cmake/DaemonGame: set FORK value 1 in current scope, as it is used and only used in current scope#1623
cmake/DaemonGame: set FORK value 1 in current scope, as it is used and only used in current scope#1623illwieckz wants to merge 1 commit into
Conversation
…d only used in current scope
|
It possible that what woke the bug up was 328e89e from #1468: As said by @slipher:
Probably the right thing to move the code seting NACL_TARGETS inside DaemonGame.cmake so we don't run this code for building gamelogic when only the engine is built. Before #1468, some code that belongs to Anyway, this PR #1468 or another one like that (or a combination of this one and some others) is likely what woke up that bug, as the code was using very convoluted ways to do things. Turning this tortured and shady labyrinth into an highway had left some road signs lost in some forgotten corners, now we should be fine. |
|
The |
|
Unvanquished CMakeLists.txt uses FORK |
bc8c137 to
29cb872
Compare
|
Good catch! Though the Unvanquished The We may rename that |
|
I renamed the commit accordingly: this is |
|
I tried and and get this: |
|
OK, I know what to do. |
|
See #1625 |
dfdd061 to
86360f0
Compare
|
This should be enough: - if (FORK EQUAL 1)
+ if (FORK EQUAL 1 AND NOT TARGET nacl-vms)I don't get why you set the variable in the parent scope. |
Using TARGET would be a pain because it's different with Saigo.
The point is that FORK needs to survive until the second time GAMEMODULE is called, to see whether it has been called already or not. |
The Saigo CMake code creates an
On my end FORK=1 is set on every GAMEMODULE call, we only need to know that FORK isn't 2 as far as I know. |
178a78e to
03639d1
Compare
|
We better do that instead, so the if (NACL_VMS)
if (TARGET nacl-vms)
return()
endif()Here I renamed |
|
For information, this: if (NACL_VMS)
if (TARGET nacl-vms)
return()
endif()
# …
if (BUILD_GAME_NACL)
if (USE_NACL_SAIGO)
# …
else()
# …
endif()
endif()
elseif (FORK EQUAL 2)
# …
endif()means we are already ready to do that: if (NACL_VMS)
if (TARGET nacl-vms)
return()
endif()
# …
if (BUILD_GAME_NACL)
if (USE_NACL_SAIGO)
# …
else()
# …
endif()
elseif (BUILD_GAME_WASM)
# …
endif()
elseif (FORK EQUAL 2)
# …
if (BUILD_GAME_NACL)
if (USE_NACL_SAIGO)
#…
else()
# …
endif()
elseif (BUILD_GAME_WASM)
# …
endif()
endif()I remind that I initially made possible to also build native dll as subproject with this design (it is removed, but it would be as easy to add). Here |
|
Obsoleted by: |
Fix Unvanquished/Unvanquished#3355:
This is a dormant bug that was already there for a long time (before #1621) , the
set(FORK 1 PARENT_SCOPE)can already be found in commit de443dc from Unvanquished/Unvanquished#771 ten years ago.But because of some luck, the bug wasn't active. Some refactor woke up that bug. I don't know exactly what woken it up and when.
The bug is that the Unvanquished
CMakeLists.txtcalls theGAMEMODULE()function, which doesset(FORK 1 PARENT_SCOPE), meaningFORKis set to1inCMakeLists.txt, not inGAMEMODULE(), andGAMEMODULE()test forFORKbeing1to add thenacl-vmstarget.The reason why it worked when both cgame and sgame is built is because it had this side effect:
CMakeLists.txtcallsGAMEMODULE("sgame")that setsFORKto1inCMakeListst.txtscope (not inGAMEMODULE()scope), thenGAMEMODULE()doesn't add thenacl-vmstarget becauseFORKisn't set inGAMEMODULE()scope.CMakeLists.txtcallsGAMEMODULE("cgame")andGAMEMODULE()inherit theFORKbeing previously set to1from theCMakeListst.txtscope, thenGAMEMODULE()setsFORKto1inCMakeListst.txtscope again, thenGAMEMODULE()adds thenacl-vmstarget becauseFORKbeing1was inherited fromCMakeLists.txtas set by the previousGAMEMODULE()call.