diff --git a/CMakeLists.txt b/CMakeLists.txt index d9c2f78a25..2fe0921574 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,6 +303,7 @@ get_timestamp(BUILD_DATE) enable_testing() add_subdirectory(externals) add_subdirectory(src) +add_subdirectory(dist/installer) # Installation instructions diff --git a/CMakeModules/BuildInstaller.cmake b/CMakeModules/BuildInstaller.cmake new file mode 100644 index 0000000000..f1d65a0fa8 --- /dev/null +++ b/CMakeModules/BuildInstaller.cmake @@ -0,0 +1,38 @@ +# To use this as a script, make sure you pass in the variables SRC_DIR BUILD_DIR and TARGET_FILE + +if(WIN32) + set(PLATFORM "windows") +elseif(APPLE) + set(PLATFORM "mac") +elseif(UNIX) + set(PLATFORM "linux") +else() + message(FATAL_ERROR "Cannot build installer for this unsupported platform") +endif() + +set(DIST_DIR "${BUILD_DIR}/dist") +set(ARCHIVE "${PLATFORM}.7z") + +file(MAKE_DIRECTORY ${BUILD_DIR}) +file(MAKE_DIRECTORY ${DIST_DIR}) +file(DOWNLOAD https://github.com/citra-emu/ext-windows-bin/raw/master/qtifw/${ARCHIVE} + "${BUILD_DIR}/${ARCHIVE}" SHOW_PROGRESS) +execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${BUILD_DIR}/${ARCHIVE}" + WORKING_DIRECTORY "${BUILD_DIR}/") + +set(TARGET_NAME "citra-setup-${PLATFORM}") +set(CONFIG_FILE "${SRC_DIR}/config/config_${PLATFORM}.xml") +set(INSTALLER_BASE "${BUILD_DIR}/installerbase_${PLATFORM}") +set(BINARY_CREATOR "${BUILD_DIR}/binarycreator_${PLATFORM}") +set(PACKAGES_DIR "${BUILD_DIR}/packages") +file(MAKE_DIRECTORY ${PACKAGES_DIR}) + +if (UNIX OR APPLE) + execute_process(COMMAND chmod 744 ${BINARY_CREATOR}) +endif() + +execute_process(COMMAND ${BINARY_CREATOR} -t ${INSTALLER_BASE} -n -c ${CONFIG_FILE} -p ${PACKAGES_DIR} ${TARGET_FILE}) + +if (APPLE) + execute_process(COMMAND chmod 744 ${TARGET_FILE}.app/Contents/MacOS/${TARGET_NAME}) +endif() diff --git a/dist/installer/CMakeLists.txt b/dist/installer/CMakeLists.txt new file mode 100644 index 0000000000..4fbebaf13e --- /dev/null +++ b/dist/installer/CMakeLists.txt @@ -0,0 +1,23 @@ + +if(WIN32) + set(PLATFORM "windows") +elseif(APPLE) + set(PLATFORM "mac") +elseif(UNIX) + set(PLATFORM "linux") +endif() + +set(BUILD_DIR "${CMAKE_BINARY_DIR}/installer") +set(DIST_DIR "${BUILD_DIR}/dist") +set(TARGET_FILE "${DIST_DIR}/citra-setup-${PLATFORM}") +file(MAKE_DIRECTORY ${BUILD_DIR}) + +# 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}" + COMMAND ${CMAKE_COMMAND} -DSRC_DIR=${CMAKE_CURRENT_SOURCE_DIR} -D BUILD_DIR=${BUILD_DIR} -D TARGET_FILE=${TARGET_FILE} -P ${CMAKE_SOURCE_DIR}/CMakeModules/BuildInstaller.cmake + WORKING_DIRECTORY ${BUILD_DIR} +) + +add_custom_target(installer DEPENDS ${TARGET_FILE}) diff --git a/dist/installer/README.md b/dist/installer/README.md new file mode 100644 index 0000000000..dc58093dd3 --- /dev/null +++ b/dist/installer/README.md @@ -0,0 +1,9 @@ +Citra Qt Installer +================== + +This contains the configuration files for building Citra's installer. + +Installers can only be built on the platform that they are targeting. + +Build the `installer` target to generate the installer, and the installer will be in +${build_dir}/installer/dist/ diff --git a/dist/installer/config/config_linux.xml b/dist/installer/config/config_linux.xml new file mode 100644 index 0000000000..12bb780b37 --- /dev/null +++ b/dist/installer/config/config_linux.xml @@ -0,0 +1,19 @@ + + + Citra + 1.0.0 + Citra Updater + Citra Team + + @HomeDir@/.citra + /opt/citra + icon + icon.png + + + https://repo.citra-emu.org + 1 + Official Citra Repository + + + diff --git a/dist/installer/config/config_mac.xml b/dist/installer/config/config_mac.xml new file mode 100644 index 0000000000..7fa6838b8f --- /dev/null +++ b/dist/installer/config/config_mac.xml @@ -0,0 +1,18 @@ + + + Citra + 1.0.0 + Citra Updater + Citra Team + + @ApplicationsDir@/Citra + icon + icon.png + + + https://repo.citra-emu.org + 1 + Official Citra Repository + + + diff --git a/dist/installer/config/config_windows.xml b/dist/installer/config/config_windows.xml new file mode 100644 index 0000000000..8281edd954 --- /dev/null +++ b/dist/installer/config/config_windows.xml @@ -0,0 +1,19 @@ + + + Citra + 1.0.0 + Citra Updater + Citra Team + Citra + + @HomeDir@/AppData/Local/Citra + icon + icon.png + + + https://repo.citra-emu.org + 1 + Official Citra Repository + + + diff --git a/dist/installer/config/icon.icns b/dist/installer/config/icon.icns new file mode 100644 index 0000000000..477e0c568e Binary files /dev/null and b/dist/installer/config/icon.icns differ diff --git a/dist/installer/config/icon.ico b/dist/installer/config/icon.ico new file mode 100644 index 0000000000..c531052884 Binary files /dev/null and b/dist/installer/config/icon.ico differ diff --git a/dist/installer/config/icon.png b/dist/installer/config/icon.png new file mode 100644 index 0000000000..fd102724c1 Binary files /dev/null and b/dist/installer/config/icon.png differ