Skip to content

Commit 328e89e

Browse files
committed
cmake: move NaCl configuration do DamonGame.cmake and remove a warning about scope
1 parent 4313b20 commit 328e89e

File tree

2 files changed

+50
-52
lines changed

2 files changed

+50
-52
lines changed

CMakeLists.txt

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -93,58 +93,6 @@ endif()
9393
if(NOT DAEMON_EXTERNAL_APP)
9494
option(BUILD_CLIENT "Engine client executable, required to play" ON)
9595
option(BUILD_SERVER "Engine server executable, required to host servers" ON)
96-
97-
## About the different ways to host/play games:
98-
## Native DLL: no sandboxing, no cleaning up but debugger support. Use for dev.
99-
## NaCl exe: sandboxing, no leaks, slightly slower, hard to debug. Use for regular players.
100-
## Native exe: no sandboxing, no leaks, hard to debug. Might be used by server owners for perf.
101-
## see VirtualMachine.h for code
102-
103-
# can be loaded by daemon with vm.[sc]game.type 3
104-
option(BUILD_GAME_NATIVE_DLL "Build the shared library files, mostly useful for debugging changes locally." ON)
105-
106-
# can be loaded by daemon with vm.[sc]game.type 2
107-
option(BUILD_GAME_NATIVE_EXE "Build native executable, which might be used for better performances by server owners" OFF)
108-
109-
# The NaCl SDK only runs on amd64 or i686.
110-
if (CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME
111-
AND (ARCH STREQUAL "amd64" OR ARCH STREQUAL "i686"))
112-
# can be loaded by daemon with vm.[sc]game.type 0 or 1
113-
option(BUILD_GAME_NACL "Build the NaCl \"pexe\" and \"nexe\" gamelogic modules for enabled architecture targets, required to host mods." OFF)
114-
115-
set(NACL_ALL_TARGETS "amd64;i686;armhf")
116-
set(BUILD_GAME_NACL_TARGETS "all" CACHE STRING "Enabled NaCl \"nexe\" architecture targets, values: ${NACL_ALL_TARGETS}, all, native, none.")
117-
mark_as_advanced(BUILD_GAME_NACL_TARGETS)
118-
119-
if (BUILD_GAME_NACL_TARGETS STREQUAL "all")
120-
set(NACL_TARGETS "${NACL_ALL_TARGETS}")
121-
elseif (BUILD_GAME_NACL_TARGETS STREQUAL "native")
122-
set(NACL_TARGETS "${ARCH}")
123-
elseif (BUILD_GAME_NACL_TARGETS STREQUAL "none")
124-
set(NACL_TARGETS "")
125-
else()
126-
set(NACL_TARGETS "${BUILD_GAME_NACL_TARGETS}")
127-
endif()
128-
129-
foreach(NACL_TARGET ${NACL_TARGETS})
130-
set(IS_NACL_VALID_TARGET OFF)
131-
foreach(NACL_VALID_TARGET ${NACL_ALL_TARGETS})
132-
if(NACL_TARGET STREQUAL NACL_VALID_TARGET)
133-
set(IS_NACL_VALID_TARGET ON)
134-
endif()
135-
endforeach()
136-
137-
if (NOT IS_NACL_VALID_TARGET)
138-
message(FATAL_ERROR "Invalid NaCl target ${NACL_TARGET}, must be one of ${NACL_ALL_TARGETS}")
139-
endif()
140-
endforeach()
141-
else()
142-
set(BUILD_GAME_NACL OFF)
143-
set(NACL_TARGETS "")
144-
endif()
145-
146-
set(NACL_TARGETS "${NACL_TARGETS}" PARENT_SCOPE)
147-
14896
option(BUILD_TTY_CLIENT "Engine client with no graphical display" ON)
14997
option(BUILD_DUMMY_APP "Stripped-down engine executable, mostly used to ease incremental porting and debugging" OFF)
15098
mark_as_advanced(BUILD_DUMMY_APP)

cmake/DaemonGame.cmake

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,61 @@ endif()
3737
# Function to setup all the Sgame/Cgame libraries
3838
include(CMakeParseArguments)
3939

40+
## About the different ways to host/play games:
41+
## Native DLL: no sandboxing, no cleaning up but debugger support. Use for dev.
42+
## NaCl exe: sandboxing, no leaks, slightly slower, hard to debug. Use for regular players.
43+
## Native exe: no sandboxing, no leaks, hard to debug. Might be used by server owners for perf.
44+
## See VirtualMachine.h for code.
45+
46+
# can be loaded by daemon with vm.[sc]game.type 3
47+
option(BUILD_GAME_NATIVE_DLL "Build the shared library files, mostly useful for debugging changes locally." ON)
48+
49+
# can be loaded by daemon with vm.[sc]game.type 2
50+
option(BUILD_GAME_NATIVE_EXE "Build native executable, which might be used for better performances by server owners" OFF)
51+
52+
# The NaCl SDK only runs on amd64 or i686.
53+
if (CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME
54+
AND (ARCH STREQUAL "amd64" OR ARCH STREQUAL "i686"))
55+
# can be loaded by daemon with vm.[sc]game.type 0 or 1
56+
option(BUILD_GAME_NACL "Build the NaCl \"pexe\" and \"nexe\" gamelogic modules for enabled architecture targets, required to host mods." OFF)
57+
58+
set(NACL_ALL_TARGETS "amd64;i686;armhf")
59+
set(BUILD_GAME_NACL_TARGETS "all" CACHE STRING "Enabled NaCl \"nexe\" architecture targets, values: ${NACL_ALL_TARGETS}, all, native, none.")
60+
mark_as_advanced(BUILD_GAME_NACL_TARGETS)
61+
62+
if (BUILD_GAME_NACL_TARGETS STREQUAL "all")
63+
set(NACL_TARGETS "${NACL_ALL_TARGETS}")
64+
elseif (BUILD_GAME_NACL_TARGETS STREQUAL "native")
65+
set(NACL_TARGETS "${ARCH}")
66+
elseif (BUILD_GAME_NACL_TARGETS STREQUAL "none")
67+
set(NACL_TARGETS "")
68+
else()
69+
set(NACL_TARGETS "${BUILD_GAME_NACL_TARGETS}")
70+
endif()
71+
72+
foreach(NACL_TARGET ${NACL_TARGETS})
73+
set(IS_NACL_VALID_TARGET OFF)
74+
foreach(NACL_VALID_TARGET ${NACL_ALL_TARGETS})
75+
if(NACL_TARGET STREQUAL NACL_VALID_TARGET)
76+
set(IS_NACL_VALID_TARGET ON)
77+
endif()
78+
endforeach()
79+
80+
if (NOT IS_NACL_VALID_TARGET)
81+
message(FATAL_ERROR "Invalid NaCl target ${NACL_TARGET}, must be one of ${NACL_ALL_TARGETS}")
82+
endif()
83+
endforeach()
84+
else()
85+
set(BUILD_GAME_NACL OFF)
86+
set(NACL_TARGETS "")
87+
endif()
88+
4089
function(GAMEMODULE)
4190
# ParseArguments setup
4291
set(oneValueArgs NAME)
4392
set(multiValueArgs DEFINITIONS FLAGS FILES LIBS)
4493
cmake_parse_arguments(GAMEMODULE "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
94+
4595
if (NOT NACL)
4696
if (BUILD_GAME_NATIVE_DLL)
4797
add_library(${GAMEMODULE_NAME}-native-dll MODULE ${PCH_FILE} ${GAMEMODULE_FILES} ${SHAREDLIST_${GAMEMODULE_NAME}} ${SHAREDLIST} ${COMMONLIST})

0 commit comments

Comments
 (0)