diff --git a/cmake/DaemonGame.cmake b/cmake/DaemonGame.cmake index b980660539..fd59825235 100644 --- a/cmake/DaemonGame.cmake +++ b/cmake/DaemonGame.cmake @@ -71,18 +71,7 @@ function(buildNexe) ADD_PRECOMPILED_HEADER(${GAMEMODULE_NAME}-nacl) endfunction() -function(rescanAndRebuild SUBPROJECT) - # Force the rescan and rebuild of the subproject. - ExternalProject_Add_Step(${SUBPROJECT} forcebuild - COMMAND ${CMAKE_COMMAND} -E remove - ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT}-prefix/src/${SUBPROJECT}-stamp/${SUBPROJECT}-configure - COMMENT "Forcing build step for '${SUBPROJECT}'" - DEPENDEES build - ALWAYS 1 - ) -endfunction() - -function(gameSubProject SUBPROJECT) +function(gameSubProject) ExternalProject_Add(${VMS_PROJECT} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${VMS_PROJECT} @@ -98,6 +87,15 @@ function(gameSubProject SUBPROJECT) ${inherited_option_args} INSTALL_COMMAND "" ) + + # Force the rescan and rebuild of the subproject. + ExternalProject_Add_Step(${VMS_PROJECT} forcebuild + COMMAND ${CMAKE_COMMAND} -E remove + ${CMAKE_CURRENT_BINARY_DIR}/${VMS_PROJECT}-prefix/src/${VMS_PROJECT}-stamp/${VMS_PROJECT}-configure + COMMENT "Forcing build step for '${VMS_PROJECT}'" + DEPENDEES build + ALWAYS 1 + ) endfunction() function(GAMEMODULE) @@ -148,8 +146,6 @@ function(GAMEMODULE) -DBUILD_GAME_NATIVE_DLL=ON -DBUILD_GAME_NATIVE_EXE=OFF ) - - rescanAndRebuild(${VMS_PROJECT}) endif() if (BUILD_GAME_NACL) @@ -170,31 +166,17 @@ function(GAMEMODULE) set(VMS_PROJECT nacl-vms-${NACL_TARGET}) list(APPEND VMS_PROJECTS ${VMS_PROJECT}) - add_dependencies(nacl-vms $VMS_PROJECT}) + add_dependencies(nacl-vms ${VMS_PROJECT}) - ExternalProject_Add(${VMS_PROJECT} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${VMS_PROJECT} - CMAKE_GENERATOR ${VM_GENERATOR} - CMAKE_ARGS - -DFORK=2 - -DCMAKE_TOOLCHAIN_FILE=${Daemon_SOURCE_DIR}/cmake/toolchain-saigo.cmake - -DDAEMON_DIR=${Daemon_SOURCE_DIR} - -DDEPS_DIR=${DEPS_DIR} - -DBUILD_GAME_NACL=ON - -DUSE_NACL_SAIGO=ON - -DNACL_TARGET=${NACL_TARGET} - -DSAIGO_ARCH=${SAIGO_ARCH} - -DBUILD_GAME_NATIVE_DLL=OFF - -DBUILD_GAME_NATIVE_EXE=OFF - -DBUILD_CLIENT=OFF - -DBUILD_TTY_CLIENT=OFF - -DBUILD_SERVER=OFF - ${inherited_option_args} - INSTALL_COMMAND "" + gameSubProject( + -DCMAKE_TOOLCHAIN_FILE=${Daemon_SOURCE_DIR}/cmake/toolchain-saigo.cmake + -DBUILD_GAME_NACL=ON + -DUSE_NACL_SAIGO=ON + -DNACL_TARGET=${NACL_TARGET} + -DSAIGO_ARCH=${SAIGO_ARCH} + -DBUILD_GAME_NATIVE_DLL=OFF + -DBUILD_GAME_NATIVE_EXE=OFF ) - - rescanAndRebuild(${VMS_PROJECT}) endforeach() else() set(VMS_PROJECT nacl-vms) @@ -203,27 +185,13 @@ function(GAMEMODULE) # Workaround a bug where CMake ExternalProject lists-as-args are cut on first “;” string(REPLACE ";" "," NACL_TARGETS_STRING "${NACL_TARGETS}") - ExternalProject_Add(${VMS_PROJECT} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${VMS_PROJECT} - CMAKE_GENERATOR ${VM_GENERATOR} - CMAKE_ARGS - -DFORK=2 - -DCMAKE_TOOLCHAIN_FILE=${Daemon_SOURCE_DIR}/cmake/toolchain-pnacl.cmake - -DDAEMON_DIR=${Daemon_SOURCE_DIR} - -DDEPS_DIR=${DEPS_DIR} - -DBUILD_GAME_NACL=ON - -DNACL_TARGETS_STRING=${NACL_TARGETS_STRING} - -DBUILD_GAME_NATIVE_DLL=OFF - -DBUILD_GAME_NATIVE_EXE=OFF - -DBUILD_CLIENT=OFF - -DBUILD_TTY_CLIENT=OFF - -DBUILD_SERVER=OFF - ${inherited_option_args} - INSTALL_COMMAND "" + gameSubProject( + -DCMAKE_TOOLCHAIN_FILE=${Daemon_SOURCE_DIR}/cmake/toolchain-pnacl.cmake + -DBUILD_GAME_NACL=ON + -DNACL_TARGETS_STRING=${NACL_TARGETS_STRING} + -DBUILD_GAME_NATIVE_DLL=OFF + -DBUILD_GAME_NATIVE_EXE=OFF ) - - rescanAndRebuild(${VMS_PROJECT}) endif() endif() @@ -244,13 +212,13 @@ function(GAMEMODULE) buildNexe() - # Revert a workaround for a bug where CMake ExternalProject lists-as-args are cut on first “;” - string(REPLACE "," ";" NACL_TARGETS "${NACL_TARGETS_STRING}") - if (USE_NACL_SAIGO) # Finalize NaCl executables for supported architectures. saigo_finalize(${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/.. ${GAMEMODULE_NAME} ${NACL_TARGET}) else() + # Revert a workaround for a bug where CMake ExternalProject lists-as-args are cut on first “;” + string(REPLACE "," ";" NACL_TARGETS "${NACL_TARGETS_STRING}") + # Generate NaCl executables for supported architectures. foreach(NACL_TARGET ${NACL_TARGETS}) pnacl_finalize(${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${GAMEMODULE_NAME} ${NACL_TARGET})