-
-
Notifications
You must be signed in to change notification settings - Fork 56
Win32 support #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Win32 support #118
Conversation
I'm just a passer by, just want to say nice work, hope this can be completed and Win32 support added 👍
Left a few comments related to this before reading this, but seems like you're already aware. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left comments on some warning you were getting, also i think you can fix the indentation with clang-format project settings:
clang-format -i -style=file $(find ./ -name "*.c" -o -name "*.h")
First test - simplestSimple ninja file: cc = gcc
target = main.exe
rule link
command = $cc $flags -o $out $in
rule compile
command = $cc $flags -c $in -o $out
build main.o: compile main.c
build $target: link main.o
default $target Ran it on the same folder: Lewboski@DESKTOP-CK46RK4 MINGW64 /c/Users/Lewboski/Desktop/Programming/learn/mate/tests/01-basic-build/build
$ ./samu.exe
[1/2] gcc -c main.c -o main.o
C:\Users\Lewboski\Desktop\Programming\learn\mate\tests\01-basic-build\build\samu.exe: CreateProcess: No such file or directory
C:\Users\Lewboski\Desktop\Programming\learn\mate\tests\01-basic-build\build\samu.exe: job failed to start Second test - varsI tested it with some variables on a single source: cc = gcc
flags = -Wall -g
cwd = C$:\Users\Lewboski\Desktop\Programming\learn\mate\tests\01-basic-build
builddir = C$:\Users\Lewboski\Desktop\Programming\learn\mate\tests\01-basic-build\build
target = $builddir/main.exe
rule link
command = $cc $flags -o $out $in
rule compile
command = $cc $flags -c $in -o $out
build $builddir/main.o: compile $cwd/src/main.c
build $target: link $builddir/main.o
default $target Ran it with -f, and got: Lewboski@DESKTOP-CK46RK4 MINGW64 /c/Users/Lewboski/Desktop/Programming/learn/mate/tests/01-basic-build
$ ./build/samu.exe -f ./build/build.ninja
C:\Users\Lewboski\Desktop\Programming\learn\mate\tests\01-basic-build\build\samu.exe: mkdirs C:\: No error
C:\Users\Lewboski\Desktop\Programming\learn\mate\tests\01-basic-build\build\samu.exe: job failed to start
C:\Users\Lewboski\Desktop\Programming\learn\mate\tests\01-basic-build\build\samu.exe: subcommand failed you can use these as reference meanwhile testing |
Hello. I am another poor soul trying to add windows support.
I got basic stuff working: os-dependent jobs stuff is separated into os.h. I also fixed lots of memory leaks found with
-fsanitize-address
. Posix side with new abstractions seems to work OK.Things that need fixing before windows support can be declared:
deps = msvc
$variable
substitutions are escaped with quotes, which works fine with/usr/bin/sh -c
, but fails on Windows (CreateProcess does no CLI processing), when MSVC tries to compile something (cl.exe ... -c '<file'
) -> causeswarning D9027 : source file ''samurai\os-win32.c'' ignored
.ninja_deps
from ninja causes segfault indepsinit()
(node->gen is null for some reason)O(n^2)
.exe
suffix and usemt.exe
to add manifest file -> important for UTF-8 and long paths.NMake
does not supportGnu Make
'sifeq()
, it has its own syntax for conditionals. May be easier to have two Makefiles, formake
andnmake
setvbuf()
is disabled in win32, bc it causes assert with bufsize zerocanonpath()
and other path related APISCMakefile and related gitignores are for development only, it helps with IDE support.
There seem to be issues with formatting caused by said IDEs and TABS. Idk how to fix that :D