Skip to content

Commit ab1f2e6

Browse files
committed
cmake: build dll game with sub cmake to use different compilation flags
1 parent 282ccc0 commit ab1f2e6

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

cmake/DaemonGame.cmake

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ function(GAMEMODULE)
9898
endif()
9999

100100
if (BUILD_GAME_NATIVE_DLL)
101-
buildGameModule("native-dll")
101+
if (USE_HARDENING)
102+
set(FORK 1 PARENT_SCOPE)
103+
else()
104+
buildGameModule("native-dll")
105+
endif()
102106
endif()
103107

104108
if (BUILD_GAME_NATIVE_EXE)
@@ -121,6 +125,17 @@ function(GAMEMODULE)
121125
"-D${inherited_option}=${${inherited_option}}")
122126
endforeach(inherited_option)
123127

128+
if (BUILD_GAME_NATIVE_DLL AND USE_HARDENING)
129+
set(VMS_PROJECT dll-vms)
130+
set(VMS_PROJECTS ${VMS_PROJECT})
131+
132+
gameSubProject(
133+
-DBUILD_GAME_NACL=OFF
134+
-DBUILD_GAME_NATIVE_DLL=ON
135+
-DBUILD_GAME_NATIVE_EXE=OFF
136+
)
137+
endif()
138+
124139
if (BUILD_GAME_NACL)
125140
if (USE_NACL_SAIGO)
126141
add_custom_target(nacl-vms ALL)
@@ -170,7 +185,12 @@ function(GAMEMODULE)
170185

171186
set(VMS_PROJECTS ${VMS_PROJECTS} PARENT_SCOPE)
172187
elseif (FORK EQUAL 2)
173-
if (BUILD_GAME_NACL)
188+
if (BUILD_GAME_NATIVE_DLL)
189+
# Put the .dll and .so files in the same directory as the engine.
190+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/..)
191+
192+
buildGameModule("native-dll")
193+
elseif (BUILD_GAME_NACL)
174194
if (USE_NACL_SAIGO)
175195
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
176196
else()

0 commit comments

Comments
 (0)