This repository has been archived by the owner on Jul 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
95 lines (86 loc) · 4.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
##################################################################################
# Game data
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.2 )
PROJECT( MegaGlest )
OPTION(WANT_INSTALL_DATA "Install MegaGlest's data" ON)
# Requires an install prefix for the items below to work
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "" AND WANT_INSTALL_DATA)
MESSAGE(STATUS "**Data package INSTALL triggered.")
SET(COMMON_INFO_ABOUT_PATH "(if the path is relative then is appended to the CMAKE_INSTALL_PREFIX)")
IF(NOT MEGAGLEST_DATA_INSTALL_PATH)
SET(MEGAGLEST_DATA_INSTALL_PATH "share/megaglest/" CACHE STRING "The installation path for data files ${COMMON_INFO_ABOUT_PATH}")
ENDIF()
IF(NOT MEGAGLEST_APPDATA_INSTALL_PATH AND NOT WANT_SINGLE_INSTALL_DIRECTORY)
SET(MEGAGLEST_APPDATA_INSTALL_PATH "share/appdata/" CACHE STRING "The installation path for appdata files ${COMMON_INFO_ABOUT_PATH}")
ENDIF()
IF(NOT MEGAGLEST_DESKTOP_INSTALL_PATH)
SET(MEGAGLEST_DESKTOP_INSTALL_PATH "share/applications/" CACHE STRING "The installation path for desktop files ${COMMON_INFO_ABOUT_PATH}")
ENDIF()
IF(NOT MEGAGLEST_ICON_INSTALL_PATH)
SET(MEGAGLEST_ICON_INSTALL_PATH "share/pixmaps/" CACHE STRING "The installation path for icon files ${COMMON_INFO_ABOUT_PATH}")
ENDIF()
IF(NOT MEGAGLEST_BIN_INSTALL_PATH)
SET(MEGAGLEST_BIN_INSTALL_PATH "bin/" CACHE STRING "The installation path for binaries ${COMMON_INFO_ABOUT_PATH}")
ENDIF()
IF(NOT MEGAGLEST_MENU_INSTALL_PATH AND NOT WANT_SINGLE_INSTALL_DIRECTORY)
SET(MEGAGLEST_MENU_INSTALL_PATH "share/menu/" CACHE STRING "The installation path for menu file ${COMMON_INFO_ABOUT_PATH}")
ENDIF()
FOREACH(MG_PATH BIN ICON)
IF(IS_ABSOLUTE "${MEGAGLEST_${MG_PATH}_INSTALL_PATH}")
SET(MEGAGLEST_FULL_${MG_PATH}_INSTALL_PATH "${MEGAGLEST_${MG_PATH}_INSTALL_PATH}/")
ELSE()
SET(MEGAGLEST_FULL_${MG_PATH}_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${MEGAGLEST_${MG_PATH}_INSTALL_PATH}/")
ENDIF()
STRING(REGEX REPLACE "//+" "/" MEGAGLEST_FULL_${MG_PATH}_INSTALL_PATH "${MEGAGLEST_FULL_${MG_PATH}_INSTALL_PATH}")
ENDFOREACH()
CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/others/menu/megaglest.menu.in"
"${PROJECT_BINARY_DIR}/others/menu/megaglest.menu.in" COPYONLY)
IF(BUILD_MEGAGLEST_MAP_EDITOR OR NOT DEFINED BUILD_MEGAGLEST_MAP_EDITOR)
FILE(READ "${PROJECT_SOURCE_DIR}/others/menu/megaglest_editor.menu.in" EDITOR_MENU)
FILE(APPEND "${PROJECT_BINARY_DIR}/others/menu/megaglest.menu.in" "${EDITOR_MENU}")
ENDIF()
CONFIGURE_FILE("${PROJECT_BINARY_DIR}/others/menu/megaglest.menu.in"
"${PROJECT_BINARY_DIR}/others/menu/megaglest")
# Installation of the data
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/data"
"${PROJECT_SOURCE_DIR}/docs"
"${PROJECT_SOURCE_DIR}/maps"
"${PROJECT_SOURCE_DIR}/scenarios"
"${PROJECT_SOURCE_DIR}/techs"
"${PROJECT_SOURCE_DIR}/tilesets"
"${PROJECT_SOURCE_DIR}/tutorials"
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH}
OPTIONAL REGEX "/.git" EXCLUDE)
IF(UNIX AND NOT "${MEGAGLEST_APPDATA_INSTALL_PATH}" STREQUAL "")
INSTALL(FILES "${PROJECT_SOURCE_DIR}/others/appdata/megaglest.appdata.xml"
DESTINATION ${MEGAGLEST_APPDATA_INSTALL_PATH})
IF(BUILD_MEGAGLEST_MAP_EDITOR OR NOT DEFINED BUILD_MEGAGLEST_MAP_EDITOR)
INSTALL(FILES "${PROJECT_SOURCE_DIR}/others/appdata/megaglest_editor.appdata.xml"
DESTINATION ${MEGAGLEST_APPDATA_INSTALL_PATH})
ENDIF()
ENDIF()
IF(UNIX AND NOT "${MEGAGLEST_MENU_INSTALL_PATH}" STREQUAL "")
INSTALL(FILES
"${PROJECT_BINARY_DIR}/others/menu/megaglest"
DESTINATION ${MEGAGLEST_MENU_INSTALL_PATH})
ENDIF()
IF(UNIX AND NOT APPLE)
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/others/icons/megaglest.png"
"${PROJECT_SOURCE_DIR}/others/icons/megaglest.xpm"
DESTINATION ${MEGAGLEST_ICON_INSTALL_PATH})
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/others/desktop/megaglest.desktop"
DESTINATION ${MEGAGLEST_DESKTOP_INSTALL_PATH})
IF(BUILD_MEGAGLEST_MAP_EDITOR OR NOT DEFINED BUILD_MEGAGLEST_MAP_EDITOR)
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/others/desktop/megaglest_editor.desktop"
DESTINATION ${MEGAGLEST_DESKTOP_INSTALL_PATH})
ENDIF()
IF(BUILD_MEGAGLEST_MODEL_VIEWER OR NOT DEFINED BUILD_MEGAGLEST_MODEL_VIEWER)
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/others/desktop/megaglest_g3dviewer.desktop"
DESTINATION ${MEGAGLEST_DESKTOP_INSTALL_PATH})
ENDIF()
ENDIF()
ENDIF()