-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
63 lines (50 loc) · 2.07 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
# SPDX-License-Identifier: GPL-3.0-only
#
# (c) 2022-2023 h67ma <[email protected]>
cmake_minimum_required(VERSION 3.15)
set(CMAKE_CXX_STANDARD 17)
set(CXX_STANDARD_REQUIRED ON)
include(CMakeGitVersion.cmake)
project(foerr
LANGUAGES CXX
)
# don't warn about DOWNLOAD_EXTRACT_TIMESTAMP in 3.24+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()
# EXCLUDE_FROM_ALL skips SFML's files from being installed.
# we don't need them, also some of them want to install to system paths and require superuser privileges to do so
add_subdirectory(deps/sfml EXCLUDE_FROM_ALL)
add_subdirectory(deps/nlohmann_json)
add_subdirectory(src)
install(DIRECTORY res DESTINATION ".")
install(DIRECTORY fonts DESTINATION ".")
install(FILES LICENSE DESTINATION ".")
install(FILES "${PROJECT_BINARY_DIR}/_deps/sfml-src/license.md" DESTINATION "licenses" RENAME "SFML-LICENSE.md")
install(FILES "${PROJECT_BINARY_DIR}/_deps/nlohmann_json-src/LICENSE.MIT" DESTINATION "licenses" RENAME "NLOHMANN-JSON-LICENSE.MIT")
if(WIN32)
# seems a bit hacky but I guess it works?
# TODO detect x86/x64 and select dll from proper path
install(FILES "${PROJECT_BINARY_DIR}/_deps/sfml-src/extlibs/bin/x64/openal32.dll" DESTINATION ".")
endif()
set(CPACK_BINARY_STGZ "OFF")
set(CPACK_BINARY_TZ "OFF")
if(WIN32)
set(CPACK_BINARY_NSIS "ON")
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/res/ico/foerr.ico")
set(CPACK_NSIS_INSTALLED_ICON_NAME "foerr.exe")
set(CPACK_NSIS_PACKAGE_NAME "FoE: Remains of Remains")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
elseif(UNIX)
set(CPACK_BINARY_TGZ "ON")
endif()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "foerr")
set(CPACK_MONOLITHIC_INSTALL "ON")
# ':' not allowed in shortcut name as it will be a file name.
# for some reason these shortcuts remain in "Start Menu" after uninstall
set(CPACK_PACKAGE_EXECUTABLES "foerr" "FoE Remains of Remains")
get_git_version(${GIT_EXECUTABLE} ${CMAKE_SOURCE_DIR})
set(CPACK_PACKAGE_VERSION ${GIT_VERSION})
include(CPack)