summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt279
1 files changed, 145 insertions, 134 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11b553e7..d8e9f865 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,156 +1,167 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.12...3.27)
+cmake_minimum_required(VERSION 3.12...3.27)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
-IF (NOT VERSION)
- SET(VERSION 0.6.1)
-ELSE()
- STRING(REPLACE "." " " _VERSION ${VERSION})
- SEPARATE_ARGUMENTS(_VERSION)
- LIST(LENGTH _VERSION _LEN)
- IF(NOT _LEN EQUAL 4 AND NOT _LEN EQUAL 3)
- MESSAGE(FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE[.BUILD]")
- ENDIF()
-ENDIF()
-
-PROJECT(Mana
- VERSION ${VERSION}
- DESCRIPTION "Mana MMORPG Client"
- HOMEPAGE_URL "https://www.manasource.org")
+if(NOT VERSION)
+ set(VERSION 0.6.1)
+else()
+ string(REPLACE "." " " _VERSION ${VERSION})
+ separate_arguments(_VERSION)
+ list(LENGTH _VERSION _LEN)
+ if(NOT _LEN EQUAL 4 AND NOT _LEN EQUAL 3)
+ message(
+ FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE[.BUILD]")
+ endif()
+endif()
+
+project(
+ Mana
+ VERSION ${VERSION}
+ DESCRIPTION "Mana MMORPG Client"
+ HOMEPAGE_URL "https://www.manasource.org")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# where to look for cmake modules
-SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
include(GNUInstallDirs)
-FIND_PACKAGE(Gettext)
-
-OPTION(WITH_OPENGL "Enable OpenGL support" ON)
-OPTION(ENABLE_NLS "Enable building of translations" ON)
-OPTION(ENABLE_MANASERV "Enable Manaserv support" ON)
-OPTION(USE_SYSTEM_GUICHAN "Use system Guichan" ON)
-
-IF (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 ()
+find_package(Gettext)
+
+option(WITH_OPENGL "Enable OpenGL support" ON)
+option(ENABLE_NLS "Enable building of translations" ON)
+option(ENABLE_MANASERV "Enable Manaserv support" ON)
+option(USE_SYSTEM_GUICHAN "Use system Guichan" ON)
+
+if(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)
+add_subdirectory(data)
-IF (ENABLE_MANASERV)
- ADD_SUBDIRECTORY(libs/enet)
-ENDIF()
+if(ENABLE_MANASERV)
+ add_subdirectory(libs/enet)
+endif()
# On macOS we need to build Guichan ourselves since it is disabled in Homebrew
# This might also be a good idea for the Windows build
if(APPLE OR NOT USE_SYSTEM_GUICHAN)
- # This policy makes sure that the below options are not ignored by the
- # added Guichan CMakeLists.txt
- SET(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
- SET(ENABLE_ALLEGRO OFF)
- SET(ENABLE_IRRLICHT OFF)
- SET(ENABLE_SDL OFF)
- SET(ENABLE_OPENGL OFF)
- SET(BUILD_GUICHAN_SHARED OFF)
- ADD_SUBDIRECTORY(libs/guichan EXCLUDE_FROM_ALL)
+ # This policy makes sure that the below options are not ignored by the added
+ # Guichan CMakeLists.txt
+ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
+ set(ENABLE_ALLEGRO OFF)
+ set(ENABLE_IRRLICHT OFF)
+ set(ENABLE_SDL OFF)
+ set(ENABLE_OPENGL OFF)
+ set(BUILD_GUICHAN_SHARED OFF)
+ 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 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")
+# By default the install directory includes the version
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
+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 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()
# 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")
- SET(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP "${CMAKE_SOURCE_DIR}\\packaging\\windows\\setup_welcome.bmp")
- 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 ${CMAKE_INSTALL_BINDIR})
- SET(CPACK_NSIS_MANIFEST_DPI_AWARE ON)
-
- install(FILES
- $ENV{MINGW_PREFIX}/bin/libgcc_s_seh-1.dll
- $ENV{MINGW_PREFIX}/bin/libwinpthread-1.dll
- $ENV{MINGW_PREFIX}/bin/libstdc++-6.dll
- $ENV{MINGW_PREFIX}/bin/libcurl-4.dll
- $ENV{MINGW_PREFIX}/bin/libintl-8.dll
- $ENV{MINGW_PREFIX}/bin/libphysfs.dll
- $ENV{MINGW_PREFIX}/bin/libpng16-16.dll
- $ENV{MINGW_PREFIX}/bin/SDL2.dll
- $ENV{MINGW_PREFIX}/bin/SDL2_image.dll
- $ENV{MINGW_PREFIX}/bin/SDL2_mixer.dll
- $ENV{MINGW_PREFIX}/bin/SDL2_net.dll
- $ENV{MINGW_PREFIX}/bin/SDL2_ttf.dll
- $ENV{MINGW_PREFIX}/bin/libxml2-2.dll
- $ENV{MINGW_PREFIX}/bin/zlib1.dll
- $ENV{MINGW_PREFIX}/bin/libiconv-2.dll
- $ENV{MINGW_PREFIX}/bin/libbrotlidec.dll
- $ENV{MINGW_PREFIX}/bin/libidn2-0.dll
- $ENV{MINGW_PREFIX}/bin/libpsl-5.dll
- $ENV{MINGW_PREFIX}/bin/libssh2-1.dll
- $ENV{MINGW_PREFIX}/bin/libzstd.dll
- $ENV{MINGW_PREFIX}/bin/libavif-16.dll
- $ENV{MINGW_PREFIX}/bin/libjxl.dll
- $ENV{MINGW_PREFIX}/bin/libjpeg-8.dll
- $ENV{MINGW_PREFIX}/bin/libtiff-6.dll
- $ENV{MINGW_PREFIX}/bin/libwebp-7.dll
- $ENV{MINGW_PREFIX}/bin/libwebpdemux-2.dll
- $ENV{MINGW_PREFIX}/bin/libmpg123-0.dll
- $ENV{MINGW_PREFIX}/bin/libopusfile-0.dll
- $ENV{MINGW_PREFIX}/bin/libfreetype-6.dll
- $ENV{MINGW_PREFIX}/bin/libharfbuzz-0.dll
- $ENV{MINGW_PREFIX}/bin/liblzma-5.dll
- $ENV{MINGW_PREFIX}/bin/libbrotlicommon.dll
- $ENV{MINGW_PREFIX}/bin/libunistring-5.dll
- $ENV{MINGW_PREFIX}/bin/libaom.dll
- $ENV{MINGW_PREFIX}/bin/libdav1d-7.dll
- $ENV{MINGW_PREFIX}/bin/libsharpyuv-0.dll
- $ENV{MINGW_PREFIX}/bin/libSvtAv1Enc-2.dll
- $ENV{MINGW_PREFIX}/bin/libyuv.dll
- $ENV{MINGW_PREFIX}/bin/libbrotlienc.dll
- $ENV{MINGW_PREFIX}/bin/libhwy.dll
- $ENV{MINGW_PREFIX}/bin/libjxl_cms.dll
- $ENV{MINGW_PREFIX}/bin/libdeflate.dll
- $ENV{MINGW_PREFIX}/bin/libjbig-0.dll
- $ENV{MINGW_PREFIX}/bin/libLerc.dll
- $ENV{MINGW_PREFIX}/bin/libopus-0.dll
- $ENV{MINGW_PREFIX}/bin/rav1e.dll
- $ENV{MINGW_PREFIX}/bin/libbz2-1.dll
- $ENV{MINGW_PREFIX}/bin/libglib-2.0-0.dll
- $ENV{MINGW_PREFIX}/bin/libogg-0.dll
- $ENV{MINGW_PREFIX}/bin/libgraphite2.dll
- $ENV{MINGW_PREFIX}/bin/liblcms2-2.dll
- $ENV{MINGW_PREFIX}/bin/libpcre2-8-0.dll
- DESTINATION ${CMAKE_INSTALL_BINDIR}
- )
-ENDIF()
-INCLUDE(CPack)
+if(WIN32)
+ set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/data/icons/mana.ico")
+ set(CPACK_NSIS_INSTALLED_ICON_NAME "mana.exe")
+ set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP
+ "${CMAKE_SOURCE_DIR}\\packaging\\windows\\setup_welcome.bmp")
+ 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 ${CMAKE_INSTALL_BINDIR})
+ set(CPACK_NSIS_MANIFEST_DPI_AWARE ON)
+
+ install(
+ FILES $ENV{MINGW_PREFIX}/bin/libgcc_s_seh-1.dll
+ $ENV{MINGW_PREFIX}/bin/libwinpthread-1.dll
+ $ENV{MINGW_PREFIX}/bin/libstdc++-6.dll
+ $ENV{MINGW_PREFIX}/bin/libcurl-4.dll
+ $ENV{MINGW_PREFIX}/bin/libintl-8.dll
+ $ENV{MINGW_PREFIX}/bin/libphysfs.dll
+ $ENV{MINGW_PREFIX}/bin/libpng16-16.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2_image.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2_mixer.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2_net.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2_ttf.dll
+ $ENV{MINGW_PREFIX}/bin/libxml2-2.dll
+ $ENV{MINGW_PREFIX}/bin/zlib1.dll
+ $ENV{MINGW_PREFIX}/bin/libiconv-2.dll
+ $ENV{MINGW_PREFIX}/bin/libbrotlidec.dll
+ $ENV{MINGW_PREFIX}/bin/libidn2-0.dll
+ $ENV{MINGW_PREFIX}/bin/libpsl-5.dll
+ $ENV{MINGW_PREFIX}/bin/libssh2-1.dll
+ $ENV{MINGW_PREFIX}/bin/libzstd.dll
+ $ENV{MINGW_PREFIX}/bin/libavif-16.dll
+ $ENV{MINGW_PREFIX}/bin/libjxl.dll
+ $ENV{MINGW_PREFIX}/bin/libjpeg-8.dll
+ $ENV{MINGW_PREFIX}/bin/libtiff-6.dll
+ $ENV{MINGW_PREFIX}/bin/libwebp-7.dll
+ $ENV{MINGW_PREFIX}/bin/libwebpdemux-2.dll
+ $ENV{MINGW_PREFIX}/bin/libmpg123-0.dll
+ $ENV{MINGW_PREFIX}/bin/libopusfile-0.dll
+ $ENV{MINGW_PREFIX}/bin/libfreetype-6.dll
+ $ENV{MINGW_PREFIX}/bin/libharfbuzz-0.dll
+ $ENV{MINGW_PREFIX}/bin/liblzma-5.dll
+ $ENV{MINGW_PREFIX}/bin/libbrotlicommon.dll
+ $ENV{MINGW_PREFIX}/bin/libunistring-5.dll
+ $ENV{MINGW_PREFIX}/bin/libaom.dll
+ $ENV{MINGW_PREFIX}/bin/libdav1d-7.dll
+ $ENV{MINGW_PREFIX}/bin/libsharpyuv-0.dll
+ $ENV{MINGW_PREFIX}/bin/libSvtAv1Enc-2.dll
+ $ENV{MINGW_PREFIX}/bin/libyuv.dll
+ $ENV{MINGW_PREFIX}/bin/libbrotlienc.dll
+ $ENV{MINGW_PREFIX}/bin/libhwy.dll
+ $ENV{MINGW_PREFIX}/bin/libjxl_cms.dll
+ $ENV{MINGW_PREFIX}/bin/libdeflate.dll
+ $ENV{MINGW_PREFIX}/bin/libjbig-0.dll
+ $ENV{MINGW_PREFIX}/bin/libLerc.dll
+ $ENV{MINGW_PREFIX}/bin/libopus-0.dll
+ $ENV{MINGW_PREFIX}/bin/rav1e.dll
+ $ENV{MINGW_PREFIX}/bin/libbz2-1.dll
+ $ENV{MINGW_PREFIX}/bin/libglib-2.0-0.dll
+ $ENV{MINGW_PREFIX}/bin/libogg-0.dll
+ $ENV{MINGW_PREFIX}/bin/libgraphite2.dll
+ $ENV{MINGW_PREFIX}/bin/liblcms2-2.dll
+ $ENV{MINGW_PREFIX}/bin/libpcre2-8-0.dll
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
+endif()
+include(CPack)