Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions cmake/DaemonGame.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ option(BUILD_GAME_NATIVE_DLL "Build the shared library files, mostly useful for
# can be loaded by daemon with vm.[sc]game.type 2
option(BUILD_GAME_NATIVE_EXE "Build native executable, which might be used for better performances by server owners" OFF)

include(ExternalProject)
include(DaemonBuildInfo)
include(DaemonPlatform)

Expand Down Expand Up @@ -171,28 +172,23 @@ function(GAMEMODULE)
set(multiValueArgs DEFINITIONS FLAGS FILES LIBS)
cmake_parse_arguments(GAMEMODULE "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if (NOT FORK)
if (BUILD_GAME_NACL)
set(FORK 1 PARENT_SCOPE)
endif()

if (BUILD_GAME_NATIVE_DLL)
buildGameModule("native-dll")
endif()
if (BUILD_GAME_NATIVE_DLL)
buildGameModule("native-dll")
endif()

if (BUILD_GAME_NATIVE_EXE)
buildGameModule("native-exe")
endif()
if (BUILD_GAME_NATIVE_EXE)
buildGameModule("native-exe")
endif()

if (FORK EQUAL 1)
if (NOT FORK) # create the nacl-vms target only the first time that GAMEMODULE is called
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to set the PARENT_SCOPE if you do:

if (FORK EQUAL 1 AND NOT TARGET nacl-vms)

Copy link
Copy Markdown
Member

@illwieckz illwieckz Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact that would activate the following else() so it's wrong if exactly done this way.

set(FORK 1 PARENT_SCOPE)

if (CMAKE_GENERATOR MATCHES "Visual Studio")
set(VM_GENERATOR "NMake Makefiles")
else()
set(VM_GENERATOR ${CMAKE_GENERATOR})
endif()

include(ExternalProject)
set(INHERITED_OPTION_ARGS)

foreach(inherited_option ${NACL_VM_INHERITED_OPTIONS})
Expand Down Expand Up @@ -248,7 +244,7 @@ function(GAMEMODULE)
endif()

set(NACL_VMS_PROJECTS ${NACL_VMS_PROJECTS} PARENT_SCOPE)
elseif (FORK EQUAL 2)
elseif (FORK EQUAL 2) # we are in the CMake sub-invocation for NaCl
if (BUILD_GAME_NACL)
if (USE_NACL_SAIGO)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
Expand Down