Skip to content

Commit 1742f8d

Browse files
committed
cmake: move NaCl configuration do DamonGame.cmake and remove a warning about scope
1 parent 80821bf commit 1742f8d

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

CMakeLists.txt

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

cmake/DaemonGame.cmake

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

0 commit comments

Comments
 (0)