diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-13 15:45:37 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-04-17 14:34:48 +0200 |
commit | aecbf876cd0a7894396a2e5034af9d93bf028aa0 (patch) | |
tree | 9b5742ee8e610cd396116eb56aa3fd764a4a8b56 /CMakeLists.txt | |
parent | 4a730fa0b08c68fc01f35b79a43fdd72411f2b83 (diff) | |
download | mana-aecbf876cd0a7894396a2e5034af9d93bf028aa0.tar.gz mana-aecbf876cd0a7894396a2e5034af9d93bf028aa0.tar.bz2 mana-aecbf876cd0a7894396a2e5034af9d93bf028aa0.tar.xz mana-aecbf876cd0a7894396a2e5034af9d93bf028aa0.zip |
macOS: Create an app bundle
Also enable using `cpack -G DragNDrop` to create a DMG to easily drag
Mana into the Applications folder.
The DMG is also available as a CI artifact.
The minimum deployment target has been set to 10.15, as required due to
usage of std::filesystem::create_directories.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f6782168..11b553e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.12...3.27) +set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15") + IF (NOT VERSION) SET(VERSION 0.6.1) ELSE() @@ -32,12 +34,16 @@ OPTION(ENABLE_MANASERV "Enable Manaserv support" ON) OPTION(USE_SYSTEM_GUICHAN "Use system Guichan" ON) IF (WIN32) - SET(PKG_DATADIR ".") - SET(PKG_BINDIR ".") -ELSE (WIN32) - SET(PKG_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/mana CACHE PATH "Mana datadir") - SET(PKG_BINDIR ${CMAKE_INSTALL_BINDIR}) -ENDIF (WIN32) + SET(CMAKE_INSTALL_DATADIR ".") + SET(CMAKE_INSTALL_LOCALEDIR "translations") + SET(CMAKE_INSTALL_BINDIR ".") +ELSEIF(APPLE) + SET(CMAKE_INSTALL_DATAROOTDIR "Mana.app/Contents") + SET(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}/Resources") + SET(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATADIR}/Translations") +ELSE() + SET(CMAKE_INSTALL_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/mana) +ENDIF () ADD_SUBDIRECTORY(data) @@ -59,25 +65,28 @@ if(APPLE OR NOT USE_SYSTEM_GUICHAN) ADD_SUBDIRECTORY(libs/guichan EXCLUDE_FROM_ALL) endif() +# Set generic CPack properties here so they may be used in subdirectories +SET(CPACK_PACKAGE_VENDOR "Mana Development Team") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") +SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}") # by default it includes the version +SET(CPACK_PACKAGE_EXECUTABLES "mana;Mana") +SET(CPACK_VERBATIM_VARIABLES TRUE) + ADD_SUBDIRECTORY(src) IF (GETTEXT_FOUND AND ENABLE_NLS) ADD_SUBDIRECTORY(po) ENDIF() -If(UNIX) +If(UNIX AND NOT APPLE) INSTALL(FILES org.manasource.Mana.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) INSTALL(FILES org.manasource.Mana.metainfo.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo) INSTALL(FILES data/icons/mana.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps RENAME org.manasource.Mana.png) INSTALL(FILES data/icons/mana.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps RENAME org.manasource.Mana.svg) ENDIF() -SET(CPACK_PACKAGE_VENDOR "Mana Development Team") -SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") -SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}") # by default it includes the version -SET(CPACK_PACKAGE_EXECUTABLES "mana;Mana") -SET(CPACK_VERBATIM_VARIABLES TRUE) +# Windows NSIS installer IF(WIN32) SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/data/icons/mana.ico") SET(CPACK_NSIS_INSTALLED_ICON_NAME "mana.exe") @@ -85,7 +94,7 @@ IF(WIN32) SET(CPACK_NSIS_URL_INFO_ABOUT ${PROJECT_HOMEPAGE_URL}) SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) SET(CPACK_NSIS_MUI_FINISHPAGE_RUN "mana.exe") - SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ${PKG_BINDIR}) + SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ${CMAKE_INSTALL_BINDIR}) SET(CPACK_NSIS_MANIFEST_DPI_AWARE ON) install(FILES @@ -141,7 +150,7 @@ IF(WIN32) $ENV{MINGW_PREFIX}/bin/libgraphite2.dll $ENV{MINGW_PREFIX}/bin/liblcms2-2.dll $ENV{MINGW_PREFIX}/bin/libpcre2-8-0.dll - DESTINATION ${PKG_BINDIR} + DESTINATION ${CMAKE_INSTALL_BINDIR} ) ENDIF() INCLUDE(CPack) |