The existing scripts for Debian and NSIS packaging were too complex and dealt unnecessarily with lower level details that should be already handled by CMake and CPack. - Packaging-related scripts have been moved to the new cpack/ directory. There, CPack variables common to all generators are defined in cpack/common.cmake, and then generator-specific variables are defined independently (e.g.: cpack/debian.cmake and cpack/nsis.cmake). - Packaging is now optionally done at a second stage, by running `cpack -G <generator>` on the build directory. This removes the requirement to branch based on the system name, and instead all CPack variables are assigned unconditionally. - Since now only one version of the game is packaged, there is no need to maintain the complex scripts in packaging/ and packaging/windows that used to deal with all variants (e.g.: "wip-cars-and-tracks", "hq-cars-and-tracks", etc.). - The use of CPACK_NSIS_EXTRA_INSTALL_COMMANDS, CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS and CPACK_NSIS_CREATE_ICONS_EXTRA should not be required, let alone modifying the HKLM registry manually, since CPack already provides everything required to set up the installer, the uninstaller and shortcuts. - $INSTDIR is not required, since NSIS would already prepend the target installation directory. - PROJECT_VERSION_METADATA is not a standard CMake variable. CMAKE_PROJECT_VERSION_TWEAK is instead meant for this purpose. [1] - OPTION_PACKAGING and OPTION_ALL_IN_ONE_PACKAGING were removed since packaging will always be available, yet optional. Packagers must then run CPack on a second stage, as described above. - Outdated comments were removed to avoid confusion. TODO: - Add shortcut to track editor on NSIS. - dmg packaging was not revamped because of lacking compatible hardware, but still it has been moved to cpack/dmg.cmake. - Windows portable packaging (OPTION_PORTABLE_PACKAGING) has been left out since it required 7z and relied on several hacks to work. Furthermore, portable versions of the game were already not released on the latest release, either. [2] [1]: https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_VERSION_TWEAK.html [2]: https://sourceforge.net/projects/speed-dreams/files/2.3.0/
70 lines
3 KiB
CMake
70 lines
3 KiB
CMake
#==============================================================================
|
|
#
|
|
# file : packagemaker-dmg.cmake
|
|
# copyright : (C) 2020 Joe Thompson
|
|
# email : beaglejoe@users.sourceforge.net
|
|
# web : www.speed-dreams.org
|
|
#
|
|
#==============================================================================
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
#==============================================================================
|
|
|
|
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
|
|
|
|
MESSAGE(STATUS "TODO - need to clean this up.")
|
|
#ADD_CUSTOM_TARGET(package_base DEPENDS install)
|
|
# can't depend on built-in target install, so we ADD_CUSTOM_COMMAND
|
|
# below to make sure install is done
|
|
ADD_CUSTOM_TARGET(packing_install)
|
|
|
|
MESSAGE(STATUS "TODO - fix up the dependencies. Try to not run the install multiple times.")
|
|
#[[
|
|
ADD_CUSTOM_TARGET(package_all DEPENDS package_base
|
|
package_full)
|
|
|
|
ADD_CUSTOM_TARGET(package_base DEPENDS install_base)
|
|
ADD_CUSTOM_TARGET(package_full DEPENDS packing_install)
|
|
ADD_CUSTOM_TARGET(install_base DEPENDS packing_install)
|
|
]]
|
|
|
|
ADD_CUSTOM_TARGET(package_full)
|
|
ADD_CUSTOM_TARGET(package_base)
|
|
ADD_CUSTOM_TARGET(install_base)
|
|
|
|
|
|
ADD_CUSTOM_COMMAND(TARGET packing_install
|
|
COMMAND "${CMAKE_COMMAND}" --build . --target install --config $<CONFIG>
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
COMMENT "Building install...")
|
|
|
|
ADD_CUSTOM_COMMAND(TARGET install_base
|
|
COMMAND "${CMAKE_COMMAND}" -P createbaseapp.cmake
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
COMMENT "Creating base app...")
|
|
|
|
|
|
ADD_CUSTOM_COMMAND(TARGET package_base
|
|
COMMAND "${CMAKE_COMMAND}" -P packagebasedmg.cmake
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
COMMENT "Building base package...")
|
|
|
|
|
|
# COMMAND ${CMAKE_CPACK_COMMAND} -G "DragNDrop" --config ../CPackDMGFullConfig.cmake
|
|
ADD_CUSTOM_COMMAND(TARGET package_full
|
|
COMMAND "${CMAKE_COMMAND}" -P packagefulldmg.cmake
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
COMMENT "Building full package...")
|
|
ENDIF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
|