2019-07-16 20:19:11 -06:00
|
|
|
include(Plugins.cmake)
|
2011-07-25 03:09:29 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
option(BUILD_STONESENSE "Build stonesense (needs a checkout first)." OFF)
|
2011-07-21 03:29:26 -06:00
|
|
|
if(BUILD_STONESENSE)
|
2023-01-09 15:59:38 -07:00
|
|
|
add_subdirectory(stonesense)
|
2011-07-21 03:29:26 -06:00
|
|
|
endif()
|
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
option(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF)
|
2013-03-30 03:57:37 -06:00
|
|
|
if(BUILD_ISOWORLD)
|
2022-12-18 18:31:54 -07:00
|
|
|
#add_subdirectory(isoworld)
|
2019-07-16 20:19:11 -06:00
|
|
|
if(UNIX)
|
|
|
|
if(APPLE)
|
|
|
|
# TODO: add an OSX runner script
|
2014-07-21 12:18:29 -06:00
|
|
|
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()
|
2019-07-16 20:19:11 -06:00
|
|
|
endif()
|
2013-03-30 03:57:37 -06:00
|
|
|
endif()
|
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
option(BUILD_DEV_PLUGINS "Build developer plugins." OFF)
|
2011-08-07 16:55:17 -06:00
|
|
|
if(BUILD_DEV_PLUGINS)
|
2022-12-18 18:31:54 -07:00
|
|
|
#add_subdirectory(devel)
|
2011-07-14 00:52:06 -06:00
|
|
|
endif()
|
2011-07-16 10:10:08 -06:00
|
|
|
|
Allow plugins to export functions to lua with safe reload support.
- To ensure reload safety functions have to be wrapped. Every call
checks the loaded state and locks a mutex in Plugin. If the plugin
is unloaded, calling its functions throws a lua error. Therefore,
plugins may not create closures or export yieldable functions.
- The set of function argument and return types supported by
LuaWrapper is severely limited when compared to being compiled
inside the main library.
Currently supported types: numbers, bool, std::string, df::foo,
df::foo*, std::vector<bool>, std::vector<df::foo*>.
- To facilitate postponing initialization until after all plugins
have been loaded, the core sends a SC_CORE_INITIALIZED event.
- As an example, the burrows plugin now exports its functions.
2012-04-14 09:44:07 -06:00
|
|
|
install(DIRECTORY lua/
|
2019-07-16 20:19:11 -06:00
|
|
|
DESTINATION ${DFHACK_LUA_DESTINATION}/plugins
|
|
|
|
FILES_MATCHING PATTERN "*.lua")
|
2012-09-06 07:10:58 -06:00
|
|
|
install(DIRECTORY raw/
|
2019-07-16 20:19:11 -06:00
|
|
|
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
|
|
|
|
FILES_MATCHING PATTERN "*.txt")
|
2012-09-17 11:15:51 -06:00
|
|
|
install(DIRECTORY raw/
|
2019-07-16 20:19:11 -06:00
|
|
|
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
|
|
|
|
FILES_MATCHING PATTERN "*.diff")
|
Allow plugins to export functions to lua with safe reload support.
- To ensure reload safety functions have to be wrapped. Every call
checks the loaded state and locks a mutex in Plugin. If the plugin
is unloaded, calling its functions throws a lua error. Therefore,
plugins may not create closures or export yieldable functions.
- The set of function argument and return types supported by
LuaWrapper is severely limited when compared to being compiled
inside the main library.
Currently supported types: numbers, bool, std::string, df::foo,
df::foo*, std::vector<bool>, std::vector<df::foo*>.
- To facilitate postponing initialization until after all plugins
have been loaded, the core sends a SC_CORE_INITIALIZED event.
- As an example, the burrows plugin now exports its functions.
2012-04-14 09:44:07 -06:00
|
|
|
|
2012-03-15 03:01:23 -06:00
|
|
|
# Protobuf
|
2019-07-16 20:19:11 -06:00
|
|
|
file(GLOB PROJECT_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/*.proto)
|
2012-03-15 03:01:23 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
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}
|
2016-10-24 20:28:51 -06:00
|
|
|
PROPERTIES GENERATED TRUE)
|
|
|
|
|
|
|
|
# Force a re-gen if any *.pb.* files are missing
|
2016-10-24 20:51:27 -06:00
|
|
|
# (only runs when cmake is run, but better than nothing)
|
2019-07-16 20:19:11 -06:00
|
|
|
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(
|
2016-10-24 20:51:27 -06:00
|
|
|
OUTPUT ${PROJECT_PROTO_TMP_FILES}
|
2022-12-07 12:59:48 -07:00
|
|
|
COMMAND protoc-bin -I=${dfhack_SOURCE_DIR}/library/proto/
|
2012-03-15 04:06:50 -06:00
|
|
|
-I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
|
2016-10-24 20:28:51 -06:00
|
|
|
--cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
|
2012-03-15 03:01:23 -06:00
|
|
|
${PROJECT_PROTOS}
|
2022-03-29 11:28:52 -06:00
|
|
|
COMMAND ${PERL_EXECUTABLE} ${dfhack_SOURCE_DIR}/depends/copy-if-different.pl
|
2016-10-24 20:28:51 -06:00
|
|
|
${PROJECT_PROTO_TMP_FILES}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/proto/
|
|
|
|
COMMENT "Generating plugin protobufs"
|
2022-12-07 12:59:48 -07:00
|
|
|
DEPENDS protoc-bin ${PROJECT_PROTOS}
|
2012-03-15 03:01:23 -06:00
|
|
|
)
|
2019-07-16 20:19:11 -06:00
|
|
|
add_custom_target(generate_proto DEPENDS ${PROJECT_PROTO_TMP_FILES})
|
2012-03-15 03:01:23 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
|
2012-03-24 06:22:43 -06:00
|
|
|
|
2012-03-15 03:01:23 -06:00
|
|
|
# Plugins
|
2022-12-18 18:25:18 -07:00
|
|
|
# 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.
|
2022-04-13 20:53:22 -06:00
|
|
|
|
2023-07-04 09:07:50 -06:00
|
|
|
dfhack_plugin(3dveins 3dveins.cpp)
|
2023-04-26 15:39:13 -06:00
|
|
|
dfhack_plugin(add-spatter add-spatter.cpp)
|
2023-01-01 17:32:56 -07:00
|
|
|
dfhack_plugin(autobutcher autobutcher.cpp LINK_LIBRARIES lua)
|
2023-01-06 11:08:50 -07:00
|
|
|
dfhack_plugin(autochop autochop.cpp LINK_LIBRARIES lua)
|
2023-05-01 12:20:53 -06:00
|
|
|
dfhack_plugin(autoclothing autoclothing.cpp LINK_LIBRARIES lua)
|
2023-03-30 13:17:08 -06:00
|
|
|
dfhack_plugin(design design.cpp LINK_LIBRARIES lua)
|
2023-01-18 14:38:23 -07:00
|
|
|
dfhack_plugin(autodump autodump.cpp)
|
2023-01-06 19:04:54 -07:00
|
|
|
dfhack_plugin(autofarm autofarm.cpp)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(autogems autogems.cpp LINK_LIBRARIES jsoncpp_static)
|
2023-01-29 21:55:11 -07:00
|
|
|
add_subdirectory(autolabor)
|
2023-02-06 13:38:59 -07:00
|
|
|
dfhack_plugin(autonestbox autonestbox.cpp LINK_LIBRARIES lua)
|
2023-04-18 09:22:52 -06:00
|
|
|
dfhack_plugin(autoslab autoslab.cpp)
|
2023-01-13 13:36:16 -07:00
|
|
|
dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(burrows burrows.cpp LINK_LIBRARIES lua)
|
|
|
|
#dfhack_plugin(building-hacks building-hacks.cpp LINK_LIBRARIES lua)
|
2023-02-13 19:45:26 -07:00
|
|
|
add_subdirectory(buildingplan)
|
2023-05-09 20:13:49 -06:00
|
|
|
dfhack_plugin(changeitem changeitem.cpp)
|
2023-01-12 14:48:58 -07:00
|
|
|
dfhack_plugin(changelayer changelayer.cpp)
|
|
|
|
dfhack_plugin(changevein changevein.cpp)
|
2023-01-24 17:25:41 -07:00
|
|
|
add_subdirectory(channel-safely)
|
2023-01-12 18:14:43 -07:00
|
|
|
dfhack_plugin(cleanconst cleanconst.cpp)
|
|
|
|
dfhack_plugin(cleaners cleaners.cpp)
|
2023-01-09 16:45:45 -07:00
|
|
|
dfhack_plugin(cleanowned cleanowned.cpp)
|
2023-01-27 11:22:52 -07:00
|
|
|
dfhack_plugin(confirm confirm.cpp LINK_LIBRARIES lua)
|
2023-05-09 20:13:49 -06:00
|
|
|
dfhack_plugin(createitem createitem.cpp)
|
2023-01-12 18:14:43 -07:00
|
|
|
dfhack_plugin(cursecheck cursecheck.cpp)
|
2023-02-02 20:42:19 -07:00
|
|
|
dfhack_plugin(cxxrandom cxxrandom.cpp LINK_LIBRARIES lua)
|
2023-05-09 20:13:49 -06:00
|
|
|
dfhack_plugin(deramp deramp.cpp)
|
2022-12-19 14:43:33 -07:00
|
|
|
dfhack_plugin(debug debug.cpp LINK_LIBRARIES jsoncpp_static)
|
2023-02-05 22:11:07 -07:00
|
|
|
dfhack_plugin(dig dig.cpp)
|
2023-01-12 14:48:58 -07:00
|
|
|
dfhack_plugin(dig-now dig-now.cpp LINK_LIBRARIES lua)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(digFlood digFlood.cpp)
|
|
|
|
#add_subdirectory(diggingInvaders)
|
|
|
|
#dfhack_plugin(dwarfvet dwarfvet.cpp)
|
|
|
|
#dfhack_plugin(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua)
|
|
|
|
#add_subdirectory(embark-assistant)
|
|
|
|
#dfhack_plugin(embark-tools embark-tools.cpp)
|
2022-12-19 14:43:33 -07:00
|
|
|
dfhack_plugin(eventful eventful.cpp LINK_LIBRARIES lua)
|
2023-01-10 01:46:52 -07:00
|
|
|
dfhack_plugin(fastdwarf fastdwarf.cpp)
|
2023-04-01 12:37:36 -06:00
|
|
|
dfhack_plugin(faststart faststart.cpp)
|
2023-01-12 18:14:43 -07:00
|
|
|
dfhack_plugin(filltraffic filltraffic.cpp)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(fix-unit-occupancy fix-unit-occupancy.cpp)
|
|
|
|
#dfhack_plugin(fixveins fixveins.cpp)
|
2023-05-09 20:13:49 -06:00
|
|
|
dfhack_plugin(flows flows.cpp)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(follow follow.cpp)
|
|
|
|
#dfhack_plugin(forceequip forceequip.cpp)
|
|
|
|
#dfhack_plugin(generated-creature-renamer generated-creature-renamer.cpp)
|
2023-03-25 09:18:06 -06:00
|
|
|
dfhack_plugin(getplants getplants.cpp)
|
2022-12-19 14:43:33 -07:00
|
|
|
dfhack_plugin(hotkeys hotkeys.cpp LINK_LIBRARIES lua)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(infiniteSky infiniteSky.cpp)
|
|
|
|
#dfhack_plugin(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
|
|
|
|
#dfhack_plugin(jobutils jobutils.cpp)
|
2023-05-09 20:13:49 -06:00
|
|
|
dfhack_plugin(lair lair.cpp)
|
2023-01-12 14:48:58 -07:00
|
|
|
dfhack_plugin(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua)
|
2023-05-09 20:13:49 -06:00
|
|
|
dfhack_plugin(luasocket luasocket.cpp LINK_LIBRARIES clsocket lua dfhack-tinythread)
|
2023-04-18 09:22:52 -06:00
|
|
|
dfhack_plugin(logistics logistics.cpp LINK_LIBRARIES lua)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(manipulator manipulator.cpp)
|
|
|
|
#dfhack_plugin(map-render map-render.cpp LINK_LIBRARIES lua)
|
2023-02-08 15:02:44 -07:00
|
|
|
dfhack_plugin(misery misery.cpp LINK_LIBRARIES lua)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(mode mode.cpp)
|
|
|
|
#dfhack_plugin(mousequery mousequery.cpp)
|
2023-01-12 18:14:43 -07:00
|
|
|
dfhack_plugin(nestboxes nestboxes.cpp)
|
2023-01-22 04:08:36 -07:00
|
|
|
dfhack_plugin(orders orders.cpp LINK_LIBRARIES jsoncpp_static lua)
|
2022-12-19 14:43:33 -07:00
|
|
|
dfhack_plugin(overlay overlay.cpp LINK_LIBRARIES lua)
|
2022-12-31 22:05:03 -07:00
|
|
|
dfhack_plugin(pathable pathable.cpp LINK_LIBRARIES lua)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(petcapRemover petcapRemover.cpp)
|
|
|
|
#dfhack_plugin(plants plants.cpp)
|
2023-01-07 22:06:47 -07:00
|
|
|
dfhack_plugin(probe probe.cpp)
|
2023-03-20 10:00:25 -06:00
|
|
|
dfhack_plugin(prospector prospector.cpp LINK_LIBRARIES lua)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(power-meter power-meter.cpp LINK_LIBRARIES lua)
|
2023-01-10 01:42:37 -07:00
|
|
|
dfhack_plugin(regrass regrass.cpp)
|
2023-01-04 16:01:46 -07:00
|
|
|
add_subdirectory(remotefortressreader)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename)
|
|
|
|
#add_subdirectory(rendermax)
|
2023-01-06 12:56:19 -07:00
|
|
|
dfhack_plugin(reveal reveal.cpp LINK_LIBRARIES lua)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(search search.cpp)
|
2023-01-09 18:31:49 -07:00
|
|
|
dfhack_plugin(seedwatch seedwatch.cpp LINK_LIBRARIES lua)
|
2023-01-12 18:14:43 -07:00
|
|
|
dfhack_plugin(showmood showmood.cpp)
|
2022-12-18 18:25:18 -07:00
|
|
|
#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)
|
2023-03-05 17:16:32 -07:00
|
|
|
add_subdirectory(stockpiles)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(stocks stocks.cpp)
|
2023-02-13 02:18:45 -07:00
|
|
|
dfhack_plugin(strangemood strangemood.cpp)
|
2023-02-06 19:38:16 -07:00
|
|
|
dfhack_plugin(tailor tailor.cpp LINK_LIBRARIES lua)
|
2023-01-12 14:48:58 -07:00
|
|
|
dfhack_plugin(tiletypes tiletypes.cpp Brushes.h LINK_LIBRARIES lua)
|
2023-05-10 21:31:00 -06:00
|
|
|
#dfhack_plugin(title-folder title-folder.cpp)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(trackstop trackstop.cpp)
|
|
|
|
#dfhack_plugin(tubefill tubefill.cpp)
|
|
|
|
#add_subdirectory(tweak)
|
|
|
|
#dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua)
|
2023-04-27 14:20:25 -06:00
|
|
|
dfhack_plugin(work-now work-now.cpp)
|
2023-01-13 10:45:33 -07:00
|
|
|
dfhack_plugin(xlsxreader xlsxreader.cpp LINK_LIBRARIES lua xlsxio_read_STATIC zip expat)
|
2022-12-18 18:25:18 -07:00
|
|
|
#dfhack_plugin(zone zone.cpp)
|
2022-04-13 20:53:22 -06:00
|
|
|
|
2022-12-18 18:25:18 -07:00
|
|
|
# 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.
|
2012-02-21 10:19:17 -07:00
|
|
|
|
2011-10-06 19:53:58 -06:00
|
|
|
# this is the skeleton plugin. If you want to make your own, make a copy and then change it
|
2019-07-16 20:19:11 -06:00
|
|
|
option(BUILD_SKELETON "Build the skeleton plugin." OFF)
|
2011-10-06 19:53:58 -06:00
|
|
|
if(BUILD_SKELETON)
|
2022-08-03 01:11:18 -06:00
|
|
|
dfhack_plugin(skeleton examples/skeleton.cpp)
|
2011-10-06 19:53:58 -06:00
|
|
|
endif()
|
2015-11-17 15:38:53 -07:00
|
|
|
|
2022-04-27 20:53:05 -06:00
|
|
|
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()
|
2018-07-18 13:00:40 -06:00
|
|
|
|
2022-04-13 20:53:22 -06:00
|
|
|
# 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")
|
2022-04-27 20:53:05 -06:00
|
|
|
set(content_str
|
2022-04-13 20:53:22 -06:00
|
|
|
"# 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.
|
2018-07-18 13:00:40 -06:00
|
|
|
")
|
2022-04-27 20:53:05 -06:00
|
|
|
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})
|
2018-07-18 13:00:40 -06:00
|
|
|
endif()
|
|
|
|
|
2022-04-27 20:53:05 -06:00
|
|
|
add_subdirectory(external)
|
2022-04-13 20:53:22 -06:00
|
|
|
|
|
|
|
# for backwards compatibility
|
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.custom.txt")
|
|
|
|
include("${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.custom.txt")
|
|
|
|
endif()
|