-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
116 lines (109 loc) · 3.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
##############Basic Project Setup##########################
cmake_minimum_required(VERSION 3.23.0)
set(CMAKE_C_STANDARD 99)
set(PROJECT_NAME zenzizenzizenzic_ncurses)
set(PROJECT_VENDOR Kestrel Gregorich-Trevor)
set(PROJECT_DESCRIPTION "A roguelike about fighting games.")
set(ZZZZZZ_DESKTOP_DIR /usr/share/applications)
set(VERSION_MAJOR 0)
set(VERSION_MINOR 1)
SET(VERSION_PATCH 0)
SET(RELEASE_STATE "alpha")
# Generate files
configure_file (
"${CMAKE_SOURCE_DIR}/include/version.h.in"
"${CMAKE_SOURCE_DIR}/include/version.h"
)
configure_file (
"${CMAKE_SOURCE_DIR}/share/zenzizenzizenzic.desktop.in"
"${CMAKE_SOURCE_DIR}/share/zenzizenzizenzic.desktop"
)
# Vcpkg setup
set(VCPKG_BOOTSTRAP_OPTIONS -disableMetrics)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
# Project definition
project(${PROJECT_NAME} VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} LANGUAGES C)
##########################Compile##########################
# Find required packages
set(CURSES_NEED_WIDE TRUE)
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)
find_package(cJSON REQUIRED)
# Source files
set (SOURCES
src/action.c
src/actor.c
src/ai.c
src/combat.c
src/fov.c
src/gameover.c
src/invent.c
src/main.c
src/map.c
src/mapgen.c
src/message.c
src/parser.c
src/pqueue.c
src/random.c
src/register.c
src/render.c
src/save.c
src/spawn.c
src/tile.c
windows/curses/windows.c
windows/curses/menu.c)
set (HEADERS
include/action.h
include/actor.h
include/ai.h
include/color.h
include/combat.h
include/fov.h
include/gameover.h
include/invent.h
include/map.h
include/mapgen.h
include/menu.h
include/message.h
include/parser.h
include/pqueue.h
include/random.h
include/register.h
include/render.h
include/save.h
include/spawn.h
include/tile.h
include/version.h
include/wfc.h
include/windows.h)
set (EXTRA data LICENSE README.md)
set (INCLUDE_DIR include)
# Create executable
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIR} ${CJSON_INCLUDE_DIR} ${CURSES_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${CJSON_LIBRARIES} -lpanelw ${CURSES_LIBRARIES})
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
# Copy data files
file(COPY ${EXTRA} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
##########################Install##########################
install(TARGETS ${PROJECT_NAME} DESTINATION .)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/data/ DESTINATION data)
install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION .)
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION .)
install(FILES share/zenzizenzizenzic.desktop DESTINATION ${ZZZZZZ_DESKTOP_DIR})
############################CPack##########################
#CPack
include(InstallRequiredSystemLibraries)
set(CPACK_VERBATIM_VARIABLES true)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_VENDOR "${PROJECT_VENDOR}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_EXECUTABLES "zenzizenzizenzic_ncurses;ZZZZZZ")
include(CPack)