Force backslashes to slashes for embedded paths #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Windows the paths are joined using backslashes, but these backslashes are not properly escaped for a C string when printed, resulting in the wrong string in the include. I ran into this when building csprite natively on Windows using Mingw-w64 (via).
More generally, to successfully build and run (in place) on Windows — which I was happy to see working! — I also had to:
subprocess.run(['clang++', ...]
to'g++'
-I
/-L
paths toCCFLAGS
/LFLAGS
(alternative: install SDL2 in the GCC sysroot like on other platforms)python3
topython
since that's what it's named on WindowsFor (1), this could be
'c++'
to invoke the system's primary C++ compiler, whether that'sclang++
org++
, just likecc
for the C compiler. (Note: You can do the same withCXX
in the Makefile.)For (2) the Makefile could use
sdl2-config
, which is part of SDL2 and exists specifically to solve this problem. (Note the double$$
.)The sources also need to be updated to include
SDL.h
rather thanSDL2/SDL.h
which is the incorrect include anyway. (Maybe also get rid of-DSDL_MAIN_HANDLED=1
since it doesn't seem to serve a purpose in this case? I suspect it's only there to simplify linking.)For (3) add a
PYTHON
variable a laCXX
. This would also work better in virtual environments, e.g.make PYTHON=venv/bin/python
.