-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathCMakeLists.txt
146 lines (130 loc) · 3.82 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
137
138
139
140
141
142
143
144
145
146
cmake_minimum_required(VERSION 3.11.0)
PROJECT (df-ai)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=8 --long
WORKING_DIRECTORY "${df-ai_SOURCE_DIR}"
OUTPUT_VARIABLE DF_AI_GIT_DESCRIPTION)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY "${df-ai_SOURCE_DIR}"
OUTPUT_VARIABLE DF_AI_GIT_COMMIT)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=8 --exact-match
WORKING_DIRECTORY "${df-ai_SOURCE_DIR}"
RESULT_VARIABLE DF_AI_GIT_TAGGED_RESULT
OUTPUT_QUIET ERROR_QUIET)
set(git_describe_tmp_h ${df-ai_SOURCE_DIR}/df-ai-git-describe.tmp.h)
set(git_describe_h ${df-ai_SOURCE_DIR}/df-ai-git-describe.h)
file(WRITE ${git_describe_tmp_h} "")
macro(git_describe_definition var)
string(STRIP "${${var}}" GIT_DEF_VALUE)
file(APPEND ${git_describe_tmp_h} "#define ${var} \"${GIT_DEF_VALUE}\"\n")
endmacro()
git_describe_definition(DF_AI_GIT_DESCRIPTION)
git_describe_definition(DF_AI_GIT_COMMIT)
if(${DF_AI_GIT_TAGGED_RESULT} EQUAL 0)
file(APPEND ${git_describe_tmp_h} "#define DF_AI_GIT_TAGGED\n")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${git_describe_tmp_h} ${git_describe_h})
SET(PROJECT_SRCS
df-ai.cpp
ai.cpp
config.cpp
hooks.cpp
population.cpp
population_death.cpp
population_justice.cpp
population_military.cpp
population_nobles.cpp
population_occupations.cpp
population_pets.cpp
plan.cpp
plan_assign.cpp
plan_cistern.cpp
plan_construct.cpp
plan_find.cpp
plan_persist.cpp
plan_priorities.cpp
plan_setup.cpp
plan_setup_blueprint.cpp
plan_setup_screen.cpp
plan_smooth.cpp
plan_task.cpp
blueprint.cpp
blueprint_furniture.cpp
blueprint_room.cpp
blueprint_merge.cpp
blueprint_template.cpp
stocks.cpp
stocks_detect.cpp
stocks_equipment.cpp
stocks_farm.cpp
stocks_find.cpp
stocks_forge.cpp
stocks_manager.cpp
stocks_queue.cpp
stocks_trade.cpp
stocks_update.cpp
camera.cpp
embark.cpp
room.cpp
room_describe.cpp
trade_helpers.cpp
trade_manager.cpp
event_manager.cpp
exclusive_callback.cpp
weblegends.cpp
military.cpp
pause.cpp
log.cpp
variable_string.cpp
)
SET(PROJECT_HDRS
ai.h
config.h
debug.h
hooks.h
population.h
plan.h
plan_priorities.h
plan_setup.h
blueprint.h
stocks.h
camera.h
embark.h
room.h
trade.h
event_manager.h
exclusive_callback.h
dfhack_shared.h
df-ai-git-describe.h
apply.h
variable_string.h
)
IF("${DFHACK_BUILD_ARCH}" STREQUAL "32")
set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID X86)
set(CMAKE_SIZEOF_VOID_P 4)
else()
set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID x64)
set(CMAKE_SIZEOF_VOID_P 8)
endif()
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_DEBUG_LIBS OFF)
set(Boost_USE_RELEASE_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_USE_DEBUG_RUNTIME OFF)
find_package(Boost 1.67.0 REQUIRED COMPONENTS context)
include_directories(${Boost_INCLUDE_DIRS})
LIST(APPEND PROJECT_LIBS jsoncpp_static lua ${ZLIB_LIBRARIES} ${Boost_LIBRARIES})
IF(UNIX)
IF(APPLE)
LIST(APPEND PROJECT_LIBS ${CMAKE_BINARY_DIR}/SDL)
ELSE()
LIST(APPEND PROJECT_LIBS SDL)
ENDIF()
ENDIF()
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDFAI_RELEASE")
DFHACK_PLUGIN(df-ai ${PROJECT_SRCS} LINK_LIBRARIES ${PROJECT_LIBS} COMPILE_FLAGS_GCC "-Wall -Wextra -Werror -Wno-unused-parameter" COMPILE_FLAGS_MSVC "/W3 /WX")
INSTALL(DIRECTORY rooms/ DESTINATION df-ai-blueprints/rooms FILES_MATCHING PATTERN "*.json")
INSTALL(DIRECTORY plans/ DESTINATION df-ai-blueprints/plans FILES_MATCHING PATTERN "*.json")