2017-09-28 16:27:42 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set(PLATFORM "windows")
|
|
|
|
elseif(APPLE)
|
|
|
|
set(PLATFORM "mac")
|
2017-09-29 01:38:27 +00:00
|
|
|
elseif(UNIX)
|
2017-09-28 16:27:42 +00:00
|
|
|
set(PLATFORM "linux")
|
2023-04-28 20:02:53 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Cannot build installer for this unsupported platform")
|
2017-09-28 16:27:42 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(BUILD_DIR "${CMAKE_BINARY_DIR}/installer")
|
|
|
|
set(DIST_DIR "${BUILD_DIR}/dist")
|
|
|
|
set(TARGET_FILE "${DIST_DIR}/citra-setup-${PLATFORM}")
|
|
|
|
|
2023-09-01 22:18:47 +00:00
|
|
|
file(MAKE_DIRECTORY "${BUILD_DIR}" "${DIST_DIR}")
|
|
|
|
|
2017-09-28 16:27:42 +00:00
|
|
|
# Adds a custom target that will run the BuildInstaller.cmake file
|
|
|
|
# CMake can't just run a cmake function as a custom command, so this is a way around it.
|
|
|
|
# Calls the cmake command and runs a cmake file in "scripting" mode passing in variables with -D
|
|
|
|
add_custom_command(OUTPUT "${TARGET_FILE}"
|
2023-04-28 20:02:53 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DBASE_DIR=${CMAKE_SOURCE_DIR}
|
|
|
|
-DSRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DBUILD_DIR=${BUILD_DIR}
|
|
|
|
-DTARGET_FILE=${TARGET_FILE}
|
|
|
|
-P ${CMAKE_SOURCE_DIR}/CMakeModules/BuildInstaller.cmake
|
2017-09-28 16:27:42 +00:00
|
|
|
WORKING_DIRECTORY ${BUILD_DIR}
|
|
|
|
)
|
|
|
|
|
2017-09-29 01:38:27 +00:00
|
|
|
add_custom_target(installer DEPENDS ${TARGET_FILE})
|