-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
231 lines (211 loc) · 9.89 KB
/
CMakeLists.txt
File metadata and controls
231 lines (211 loc) · 9.89 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
include(Plugins.cmake)
option(BUILD_STONESENSE "Build stonesense (needs a checkout first)." OFF)
if(BUILD_STONESENSE)
add_subdirectory(stonesense)
endif()
option(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF)
if(BUILD_ISOWORLD)
#add_subdirectory(isoworld)
if(UNIX)
if(APPLE)
# TODO: add an OSX runner script
else()
# On linux, copy our version of the df launch script which sets LD_PRELOAD
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/runisoworld
DESTINATION .)
endif()
endif()
endif()
option(BUILD_DEV_PLUGINS "Build developer plugins." OFF)
if(BUILD_DEV_PLUGINS)
add_subdirectory(devel)
endif()
if(INSTALL_DATA_FILES)
install(DIRECTORY lua/
DESTINATION ${DFHACK_LUA_DESTINATION}/plugins
FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY raw/
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.txt")
install(DIRECTORY raw/
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.diff")
endif()
# Protobuf
file(GLOB PROJECT_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/*.proto)
string(REPLACE ".proto" ".pb.cc" PROJECT_PROTO_SRCS "${PROJECT_PROTOS}")
string(REPLACE ".proto" ".pb.h" PROJECT_PROTO_HDRS "${PROJECT_PROTOS}")
string(REPLACE "/proto/" "/proto/tmp/" PROJECT_PROTO_TMP_FILES "${PROJECT_PROTO_SRCS};${PROJECT_PROTO_HDRS}")
set_source_files_properties(${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS}
PROPERTIES GENERATED TRUE)
# Force a re-gen if any *.pb.* files are missing
# (only runs when cmake is run, but better than nothing)
foreach(file IN LISTS PROJECT_PROTO_SRCS PROJECT_PROTO_HDRS)
if(NOT EXISTS ${file})
# message("Resetting generate_proto because '${file}' is missing")
file(REMOVE ${PROJECT_PROTO_TMP_FILES})
break()
endif()
endforeach()
add_custom_command(
OUTPUT ${PROJECT_PROTO_TMP_FILES}
COMMAND protoc-bin -I=${dfhack_SOURCE_DIR}/library/proto/
-I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
--cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
${PROJECT_PROTOS}
COMMAND ${PERL_EXECUTABLE} ${dfhack_SOURCE_DIR}/depends/copy-if-different.pl
${PROJECT_PROTO_TMP_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/proto/
COMMENT "Generating plugin protobufs"
DEPENDS protoc-bin ${PROJECT_PROTOS}
)
add_custom_target(generate_proto DEPENDS ${PROJECT_PROTO_TMP_FILES})
set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
# Plugins
# If you are adding a plugin that you do not intend to commit to the DFHack repo,
# see instructions for adding "external" plugins at the end of this file.
option(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if(BUILD_SUPPORTED)
dfhack_plugin(3dveins 3dveins.cpp)
dfhack_plugin(add-spatter add-spatter.cpp)
dfhack_plugin(aquifer aquifer.cpp LINK_LIBRARIES lua)
dfhack_plugin(autobutcher autobutcher.cpp LINK_LIBRARIES lua)
dfhack_plugin(autochop autochop.cpp LINK_LIBRARIES lua)
dfhack_plugin(autoclothing autoclothing.cpp LINK_LIBRARIES lua)
dfhack_plugin(design design.cpp LINK_LIBRARIES lua)
dfhack_plugin(autodump autodump.cpp)
dfhack_plugin(autofarm autofarm.cpp)
#dfhack_plugin(autogems autogems.cpp LINK_LIBRARIES jsoncpp_static)
add_subdirectory(autolabor)
dfhack_plugin(autonestbox autonestbox.cpp LINK_LIBRARIES lua)
dfhack_plugin(autoslab autoslab.cpp)
dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua)
dfhack_plugin(burrow burrow.cpp LINK_LIBRARIES lua)
#dfhack_plugin(building-hacks building-hacks.cpp LINK_LIBRARIES lua)
add_subdirectory(buildingplan)
dfhack_plugin(changeitem changeitem.cpp)
dfhack_plugin(changelayer changelayer.cpp)
dfhack_plugin(changevein changevein.cpp)
#add_subdirectory(channel-safely)
dfhack_plugin(cleanconst cleanconst.cpp)
dfhack_plugin(cleaners cleaners.cpp)
dfhack_plugin(cleanowned cleanowned.cpp)
dfhack_plugin(createitem createitem.cpp)
dfhack_plugin(cursecheck cursecheck.cpp)
dfhack_plugin(cxxrandom cxxrandom.cpp LINK_LIBRARIES lua)
dfhack_plugin(deramp deramp.cpp)
dfhack_plugin(debug debug.cpp LINK_LIBRARIES jsoncpp_static)
dfhack_plugin(dig dig.cpp LINK_LIBRARIES lua)
dfhack_plugin(dig-now dig-now.cpp LINK_LIBRARIES lua)
#dfhack_plugin(digFlood digFlood.cpp)
#add_subdirectory(diggingInvaders)
dfhack_plugin(dwarfvet dwarfvet.cpp LINK_LIBRARIES lua)
#dfhack_plugin(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua)
#add_subdirectory(embark-assistant)
dfhack_plugin(eventful eventful.cpp LINK_LIBRARIES lua)
dfhack_plugin(fastdwarf fastdwarf.cpp)
dfhack_plugin(faststart faststart.cpp)
dfhack_plugin(filltraffic filltraffic.cpp)
dfhack_plugin(fix-occupancy fix-occupancy.cpp LINK_LIBRARIES lua)
#dfhack_plugin(fixveins fixveins.cpp)
dfhack_plugin(flows flows.cpp)
#dfhack_plugin(follow follow.cpp)
#dfhack_plugin(forceequip forceequip.cpp)
#dfhack_plugin(generated-creature-renamer generated-creature-renamer.cpp)
dfhack_plugin(getplants getplants.cpp)
dfhack_plugin(hotkeys hotkeys.cpp LINK_LIBRARIES lua)
#dfhack_plugin(infiniteSky infiniteSky.cpp)
#dfhack_plugin(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
#dfhack_plugin(jobutils jobutils.cpp)
dfhack_plugin(lair lair.cpp)
dfhack_plugin(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua)
dfhack_plugin(luasocket luasocket.cpp LINK_LIBRARIES clsocket lua)
dfhack_plugin(logistics logistics.cpp LINK_LIBRARIES lua)
#dfhack_plugin(manipulator manipulator.cpp)
#dfhack_plugin(map-render map-render.cpp LINK_LIBRARIES lua)
dfhack_plugin(misery misery.cpp LINK_LIBRARIES lua)
#dfhack_plugin(mode mode.cpp)
dfhack_plugin(orders orders.cpp LINK_LIBRARIES jsoncpp_static lua)
dfhack_plugin(overlay overlay.cpp LINK_LIBRARIES lua)
dfhack_plugin(pathable pathable.cpp LINK_LIBRARIES lua)
dfhack_plugin(pet-uncapper pet-uncapper.cpp)
dfhack_plugin(plant plant.cpp LINK_LIBRARIES lua)
dfhack_plugin(preserve-rooms preserve-rooms.cpp LINK_LIBRARIES lua)
dfhack_plugin(preserve-tombs preserve-tombs.cpp)
dfhack_plugin(probe probe.cpp LINK_LIBRARIES lua)
dfhack_plugin(prospector prospector.cpp LINK_LIBRARIES lua)
#dfhack_plugin(power-meter power-meter.cpp LINK_LIBRARIES lua)
dfhack_plugin(regrass regrass.cpp LINK_LIBRARIES lua)
add_subdirectory(remotefortressreader)
#dfhack_plugin(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename)
#add_subdirectory(rendermax)
dfhack_plugin(reveal reveal.cpp LINK_LIBRARIES lua)
dfhack_plugin(seedwatch seedwatch.cpp LINK_LIBRARIES lua)
dfhack_plugin(showmood showmood.cpp)
#dfhack_plugin(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
dfhack_plugin(sort sort.cpp LINK_LIBRARIES lua)
#dfhack_plugin(steam-engine steam-engine.cpp)
add_subdirectory(spectate)
#dfhack_plugin(stockflow stockflow.cpp LINK_LIBRARIES lua)
add_subdirectory(stockpiles)
dfhack_plugin(stocks stocks.cpp LINK_LIBRARIES lua)
dfhack_plugin(strangemood strangemood.cpp)
dfhack_plugin(suspendmanager suspendmanager.cpp COMPILE_FLAGS_GCC -fno-gnu-unique LINK_LIBRARIES lua)
dfhack_plugin(tailor tailor.cpp LINK_LIBRARIES lua)
dfhack_plugin(tiletypes tiletypes.cpp Brushes.h LINK_LIBRARIES lua)
#dfhack_plugin(title-folder title-folder.cpp)
dfhack_plugin(tubefill tubefill.cpp)
add_subdirectory(tweak)
#dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua)
dfhack_plugin(work-now work-now.cpp)
dfhack_plugin(xlsxreader xlsxreader.cpp LINK_LIBRARIES lua xlsxio_read_STATIC zip expat)
dfhack_plugin(zone zone.cpp LINK_LIBRARIES lua)
endif(BUILD_SUPPORTED)
# If you are adding a plugin that you do not intend to commit to the DFHack repo,
# see instructions for adding "external" plugins at the end of this file.
# this is the skeleton plugin. If you want to make your own, make a copy and then change it
option(BUILD_SKELETON "Build the skeleton plugin." OFF)
if(BUILD_SKELETON)
dfhack_plugin(skeleton examples/skeleton.cpp)
endif()
macro(subdirlist result subdir)
file(GLOB children ABSOLUTE ${subdir}/ ${subdir}/*/)
set(dirlist "")
foreach(child ${children})
if(IS_DIRECTORY ${child})
file(RELATIVE_PATH child ${CMAKE_CURRENT_SOURCE_DIR}/${subdir} ${child})
list(APPEND dirlist ${child})
endif()
endforeach()
set(${result} ${dirlist})
endmacro()
# To add "external" plugins without committing them to the DFHack repo:
#
# 1. run CMake as you normally do (this is only necessary once if
# `external/CMakeLists.txt` does not exist yet)
# 2. add the plugin to the `external` folder (relative to this file).
# - for a multi-file plugin, either clone the repository inside of the
# `external` folder, or add the folder there manually.
# - for a single-file plugin, simply add the file there.
# 3. add an entry to `external/CMakeLists.txt`:
# - add_subdirectory() for multi-file plugins in a subdirectory
# - dfhack_plugin() for single-file plugins
# 4. build DFHack as normal. The plugins you added will be built as well.
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/CMakeLists.txt")
set(content_str
"# Add external plugins here - this file is ignored by git
# Recommended: use add_subdirectory() for folders that you have created within
# this folder, or dfhack_plugin() for single files that you have added here.
# See the end of /plugins/CMakeLists.txt for more details.
")
subdirlist(SUBDIRS external)
foreach(subdir ${SUBDIRS})
set(content_str "${content_str}add_subdirectory(${subdir})\n")
endforeach()
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/external/CMakeLists.txt" ${content_str})
endif()
add_subdirectory(external)
# for backwards compatibility
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.custom.txt")
include("${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.custom.txt")
endif()