phoboslab / wipeout-rewrite

2.64k stars 212 forks source link

cmake on linux produces an executable named wipeout #70

Closed mickski56 closed 1 year ago

mickski56 commented 1 year ago

which conflicts with the assets directory name, also wipeout. It would be enough to compile an executable named Wipeout if this is the way you want to go.

Plus the makefile still produces an executable named wipegame

samo790 commented 1 year ago

Or maybe changing the assets directory name to "data" or anything similar

The-King-of-Toasters commented 1 year ago

I changed the logic so that you must do out-of-tree builds for CMake. If you just want to test the game, use the DEV_BUILD option.

mickski56 commented 1 year ago

Thanks, closing.

mickski56 commented 1 year ago

Just tried this. I get : error: macro names must be identifiers

/usr/bin/cc -D-DPATH_ASSETS=/media/sdf/1/sdc/src/games/wipeout-rewrite/ -D-DPATH_USERDATA=/media/sdf/1/sdc/src/games/wipeout-rewrite/ -DRENDERER_GL -I/media/sdf/1/sdc/src/games/wipeout-rewrite/src -isystem /media/sdf/1/sdc/src/games/wipeout-rewrite/src/libs -isystem /usr/include/SDL2 -fstack-protector -O2 -fPIC -march=znver2 -O3 -DNDEBUG -Wall -Wextra -std=gnu11 -MD -MT CMakeFiles/wipeout.dir/src/wipeout/object.c.o -MF CMakeFiles/wipeout.dir/src/wipeout/object.c.o.d -o CMakeFiles/wipeout.dir/src/wipeout/object.c.o -c /media/sdf/1/sdc/src/games/wipeout-rewrite/src/wipeout/object.c and CMakeFiles/wipeout.dir/flags.make contains the line C_DEFINES = -D-DPATH_ASSETS=/media/sdf/1/sdc/src/games/wipeout-rewrite/ -D-DPATH_USERDATA=/media/sdf/1/sdc/src/games/wipeout-rewrite/ -DRENDERER_GL

looks like an extra -D is getting included somehow. Also using ccmake and setting PATH_ASSETS and or PATH_USERDATA on a non dev build produces the same error. This is all on a linux system.

mickski56 commented 1 year ago

Changing

target_compile_definitions(wipeout PRIVATE $<$<BOOL:${PATH_ASSETS}>:-DPATH_ASSETS=${PATH_ASSETS}> $<$<BOOL:${PATH_USERDATA}>:-DPATH_USERDATA=${PATH_USERDATA}>

to

target_compile_definitions(wipeout PRIVATE $<$<BOOL:${PATH_ASSETS}>:PATH_ASSETS=${PATH_ASSETS}> $<$<BOOL:${PATH_USERDATA}>:PATH_USERDATA=${PATH_USERDATA}>

in CMakeLists.txt works here.

The-King-of-Toasters commented 1 year ago

That's weird, it works fine for me on macOS/Linux. The CMake docs say that they strip the -D from compile definitions.

mickski56 commented 1 year ago

Hmm, what version of cmake do you have ?

mickski56 commented 1 year ago

Works fine with cmake-3.27.4 but not with cmake-3.24.3 not a wipeout-rewrite issue as such should probably close.