-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
136 lines (114 loc) · 4.58 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
cmake_minimum_required( VERSION 3.16 )
list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
project( CroftEngine VERSION 2.5.0 )
cmake_policy( SET CMP0069 NEW )
cmake_policy( SET CMP0083 NEW )
cmake_policy( SET CMP0094 NEW )
if( WIN32 )
set( CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo CACHE STRING INTERNAL FORCE )
if( CMAKE_BUILD_TYPE STREQUAL "Release" )
message( FATAL_ERROR "Use RelWithDebInfo instead of Release on Windows to allow debugging minidumps." )
endif()
endif()
file( STRINGS deprecations.txt _deprecations )
foreach( _deprecation IN LISTS _deprecations )
if( _deprecation STREQUAL "" )
continue()
elseif( NOT _deprecation MATCHES "(CE-[0-9]+) ([0-9]+(\\.[0-9]+)+) (.+)" )
message( FATAL_ERROR "Invalid format. Use: <issue-id> <version> <message>" )
endif()
set( _issue_id ${CMAKE_MATCH_1} )
set( _version ${CMAKE_MATCH_2} )
set( _message ${CMAKE_MATCH_4} )
if( ${_version} VERSION_LESS_EQUAL ${CMAKE_PROJECT_VERSION} )
message( FATAL_ERROR "Deprecation message found in deprecations.txt (deprecated since ${_version}, current engine version is ${CMAKE_PROJECT_VERSION}), see https://croftengine.youtrack.cloud/issue/${_issue_id}: ${_message}" )
else()
message( WARNING "Deprecation message found in deprecations.txt (planned for removal in ${_version}), see https://croftengine.youtrack.cloud/issue/${_issue_id}: ${_message}" )
endif()
endforeach()
include( toolchain_config )
function( group_files )
foreach( fn ${ARGV} )
get_filename_component( parentDir "${fn}" PATH )
# change /'s to \\'s, and reduce redundant // or \\.
string( REGEX REPLACE "[\\/]+" "\\\\" grp "${parentDir}" )
source_group( "${grp}" FILES "${fn}" )
endforeach()
endfunction()
include( GNUInstallDirs )
if( WIN32 )
set( CMAKE_INSTALL_BINDIR "." )
endif()
include( get_opengl )
include( get_glm )
include( get_boost )
include( get_ffmpeg )
include( get_cimg )
include( dl_unpack )
include( get_python3 )
include( get_pybind11 )
include( get_gsllite )
include( get_openal )
include( get_utf8cpp )
include( get_gettext )
set( _tidy_tmp ${CMAKE_CXX_CLANG_TIDY} )
set( CMAKE_CXX_CLANG_TIDY "" )
set( ${_c4_uprefix}LINT_CLANG_TIDY OFF )
add_subdirectory( 3rdparty/rapidyaml EXCLUDE_FROM_ALL )
add_subdirectory( 3rdparty/type_safe EXCLUDE_FROM_ALL )
add_subdirectory( 3rdparty/chillout EXCLUDE_FROM_ALL )
add_subdirectory( 3rdparty/cpu_features EXCLUDE_FROM_ALL )
add_subdirectory( 3rdparty/ValveFileVDF EXCLUDE_FROM_ALL )
set( CMAKE_CXX_CLANG_TIDY ${_tidy_tmp} )
add_subdirectory( src )
if( UNIX )
install(
FILES share/logo_256.png
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pixmaps
RENAME croftengine.png
)
install(
FILES share/croftengine.desktop
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications
)
endif()
file( STRINGS src/languages.txt _languages ENCODING UTF-8 )
foreach( _language IN LISTS _languages )
if( NOT _language MATCHES ".+ .+" )
continue()
endif()
string( REGEX REPLACE " .+\$" "" _lang_id "${_language}" )
if( _lang_id STREQUAL "en_GB" )
continue()
endif()
install(
FILES share/i18n/croftengine_${_lang_id}.qm
DESTINATION ${CMAKE_INSTALL_DATADIR}/croftengine/i18n
)
endforeach()
if( WIN32 )
add_custom_target(
prepare-release
COMMENT Building release dependencies...
DEPENDS croftengine croftengine-python3-deps croftengine-runtime-deps
)
set( CPACK_GENERATOR NSIS 7Z )
set( CPACK_BINARY_7Z ON )
set( CPACK_BINARY_NSIS ON )
set( CPACK_NSIS_COMPRESSOR "/SOLID lzma" )
set( CPACK_PACKAGE_NAME CroftEngine )
set( CPACK_PACKAGE_INSTALL_DIRECTORY CroftEngine )
set( CPACK_PACKAGE_VENDOR stohrendorf )
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "An open-source Tomb Raider 1 engine remake" )
set( CPACK_PACKAGE_HOMEPAGE_URL https://github.com/stohrendorf/CroftEngine/ )
set( CPACK_NSIS_URL_INFO_ABOUT ${CPACK_PACKAGE_HOMEPAGE_URL} )
set( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/share/LICENSE )
set( CPACK_MONOLITHIC_INSTALL ON )
set( CPACK_PACKAGE_EXECUTABLES "croftengine;CroftEngine" )
string( REPLACE ";" "\n" CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" )
string( REPLACE ";" "\n" CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}" )
set( CPACK_SOURCE_GENERATOR "7Z" )
set( CPACK_NSIS_EXECUTABLES_DIRECTORY . )
set( CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON )
include( CPack )
endif()