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. |
TomasBorquez
left a comment
There was a problem hiding this comment.
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 $targetRan 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 startSecond 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 $targetRan 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 failedyou can use these as reference meanwhile testing |
michaelforney
left a comment
There was a problem hiding this comment.
This looks like a pretty good initial attempt! I'll need to take a closer look at the jobs abstraction.
It seems like there are a lot of places where pointer to bool conversion doesn't work. Is this because MSVC doesn't have bool? Or is something else going on?
Could you revert the formatting changes? As mentioned in .clang-format, the changes it suggests aren't authoritative. I have formatted everything how I want it, and I think the rules in .clang-format are as close as I can get.
There should be a way to configure your IDE to use tabs. Maybe somewhere in the settings?
| build/ | ||
| CMakeUserPresets.json | ||
| CMakePresets.json | ||
| *.user No newline at end of file |
There was a problem hiding this comment.
These are probably better to put in your .git/info/exclude instead.
There was a problem hiding this comment.
Agree, will revert later probably
| static size_t nstarted, nfinished, ntotal; | ||
| static bool consoleused; | ||
| static struct timespec starttime; | ||
| static struct ostimespec starttime; |
There was a problem hiding this comment.
I think we should just make it ostime() and have it return a double.
| @@ -0,0 +1,29 @@ | |||
| cmake_minimum_required(VERSION 3.16) | |||
There was a problem hiding this comment.
Do you think it's possible to get the Makefile to work with nmake?
There was a problem hiding this comment.
NMake is not very compatible with Make, easier to maintain both, considering project simplicity
build.c
Outdated
| int64_t old; | ||
|
|
||
| restat = edgevar(e, "restat", true); | ||
| struct string * restat = edgevar(e, "restat", true); |
There was a problem hiding this comment.
Can you show the error here? Does MSVC not allow conversion of pointer to bool?
There was a problem hiding this comment.
MSVC allows, I did this and similar patches to fix memory leaks - edgevar() allocates new string (e.g: see line 380).
|
@michaelforney Hello! you are finally active. Though I myself moved away from this PR) I kinda lost interest and there is a lot of work to be done. |
|
I read couple of your new commits, I see you are doing some work on abstracting os-specific things. Reviving this PR may not be very worth it (though looking at the implementation of some things probably is) |
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$variablesubstitutions 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_depsfrom ninja causes segfault indepsinit()(node->gen is null for some reason)O(n^2).exesuffix and usemt.exeto add manifest file -> important for UTF-8 and long paths.NMakedoes not supportGnu Make'sifeq(), it has its own syntax for conditionals. May be easier to have two Makefiles, formakeandnmakesetvbuf()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