godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

[SCons] Improve windows toolchains.

Open Faless opened this issue 1 year ago • 3 comments

Add cygwin (MSYS2) support by extending the spawn fix (now renamed "win32_long_line_fix") to posix-on-windows (sys.platform == "cygwin").

Improve MinGW build accuracy by using target triples for compiler and tools.

Support building using MinGW-clang (use_mingw_llvm=yes).

Add arm32 and arm64 support to both MinGW and MSVC.

Faless avatar Jun 16 '23 20:06 Faless

Looks good overall. I'm surprised we need so much hacking around to make this work, is it this complex in upstream Godot too? I don't remember details but maybe it's constrained to the Windows detect.py.

akien-mga avatar Jun 17 '23 08:06 akien-mga

@akien-mga upstream godot has the spawn fix in methods.py (because it also needs to be used by other platforms compiled from windows, e.g. android) Then a lot of code to (better) detect msvc and mingw (including mingw clang) in detect.py.

In fact, we took shortcuts in godot-cpp, and we might want to take more code from upstream godot to improve detection (but I would rather do the bulk of that in a separate PR).

Tbh though I'm not sure if upstream godot supports building from cygwin, mostly because it does not seen apply the spawn fix, nor it seems to apply the other possible fix, i.e. the TEMPFILE ar command.

Faless avatar Jun 17 '23 09:06 Faless

Back to draft, as I think we should also change:

        # These options are for a release build even using target=debug
        env.Append(CCFLAGS=["-O3", "-Wwrite-strings"])

Since is should be handled by target.py, and might change the current behavior on windows MinGW-CMD/PowerShell quite a lot.

Faless avatar Jun 17 '23 11:06 Faless