dfhack/plugins/CMakeLists.txt

240 lines
9.9 KiB
CMake

2019-07-16 20:19:11 -06:00
include(Plugins.cmake)
2019-07-16 20:19:11 -06:00
option(BUILD_STONESENSE "Build stonesense (needs a checkout first)." OFF)
if(BUILD_STONESENSE)
2019-07-16 20:19:11 -06:00
add_subdirectory(stonesense)
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)
2019-07-16 20:19:11 -06:00
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()
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)
2019-07-16 20:19:11 -06:00
add_subdirectory(devel)
endif()
2019-07-16 20:19:11 -06:00
option(BUILD_RUBY "Build ruby binding." ON)
if(BUILD_RUBY)
add_subdirectory(ruby)
2012-03-21 11:49:50 -06:00
endif()
install(DIRECTORY lua/
2019-07-16 20:19:11 -06:00
DESTINATION ${DFHACK_LUA_DESTINATION}/plugins
FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY raw/
2019-07-16 20:19:11 -06:00
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.txt")
install(DIRECTORY raw/
2019-07-16 20:19:11 -06:00
DESTINATION ${DFHACK_DATA_DESTINATION}/raw
FILES_MATCHING PATTERN "*.diff")
# Protobuf
2019-07-16 20:19:11 -06:00
file(GLOB PROJECT_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/*.proto)
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}
PROPERTIES GENERATED TRUE)
# Force a re-gen if any *.pb.* files are missing
# (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(
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}
)
2019-07-16 20:19:11 -06:00
add_custom_target(generate_proto DEPENDS ${PROJECT_PROTO_TMP_FILES})
2019-07-16 20:19:11 -06:00
set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
# Plugins
2019-07-16 20:19:11 -06:00
option(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if(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.
2019-07-16 20:19:11 -06:00
dfhack_plugin(3dveins 3dveins.cpp)
dfhack_plugin(add-spatter add-spatter.cpp)
2022-08-02 02:07:13 -06:00
dfhack_plugin(autobutcher autobutcher.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(autochop autochop.cpp)
dfhack_plugin(autoclothing autoclothing.cpp)
2019-07-16 20:19:11 -06:00
dfhack_plugin(autodump autodump.cpp)
dfhack_plugin(autofarm autofarm.cpp)
dfhack_plugin(autogems autogems.cpp LINK_LIBRARIES jsoncpp_static)
2019-07-16 20:19:11 -06:00
dfhack_plugin(autohauler autohauler.cpp)
dfhack_plugin(autolabor autolabor.cpp)
improve UX between automaterial and buildingplan solves the confusing behavior when both automaterial and buildingplan are enabled for constructions. the two plugins now communicate with each other over the Lua layer to negotiate consistent behavior. if neither plugin is enabled, the standard DF UI acts as normal if automaterial is enabled but buildingplan is not, then automaterial behavior is unchanged. if buildingplan is enabled and automaterial is not then behavior is the same as other buildings with buildingplan (no material selection screen, screen stays on building placement screen after placement). this commit fixes a bug, though, where buildingplan would only lay down a single tile of contruction instead of a solid block when a block is requested. if both plugins are enabled but buildingplan is not enabled for the building type then automaterial is unchanged from previous behavior, execpt for an additional header showing the separation between automaterial hotkeys and buildingplan hotkeys. finally, if both plugins are enabled and buildingplan is enabled for the building type then buildingplan behavior prevails, but the box select and hollow designations features of automaterial are still usable and useful. the 'Auto Mat-select', 'Reselect Type', and "Open Placement" automaterial hotkeys are hidden in the UI and ignored in the feed. This is because buildingplan takes over material selection, so 'Auto Mat-select' doesn't make sense. Buildingplan also already stays on the placement screen after placement, so 'Reselect Type' is not necessary. And all buildingplan-placed buildings have relaxed placement restrictions (e.g. they can be built in mid-air) so 'Open Placement' is also not necessary. The missing options are replaced with blank lines so the vertical alignment of all other options stays constant. we also remove a few extra lua_pop() calls that are made superfluous by the StackUnwinder.
2020-10-29 12:00:49 -06:00
dfhack_plugin(automaterial automaterial.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(automelt automelt.cpp)
2022-08-01 00:42:59 -06:00
dfhack_plugin(autonestbox autonestbox.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(autotrade autotrade.cpp)
dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua)
dfhack_plugin(burrows burrows.cpp LINK_LIBRARIES lua)
dfhack_plugin(building-hacks building-hacks.cpp LINK_LIBRARIES lua)
dfhack_plugin(buildingplan buildingplan.cpp buildingplan-planner.cpp buildingplan-rooms.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(changeitem changeitem.cpp)
dfhack_plugin(changelayer changelayer.cpp)
dfhack_plugin(changevein changevein.cpp)
dfhack_plugin(cleanconst cleanconst.cpp)
dfhack_plugin(cleaners cleaners.cpp)
dfhack_plugin(cleanowned cleanowned.cpp)
dfhack_plugin(command-prompt command-prompt.cpp)
dfhack_plugin(confirm confirm.cpp LINK_LIBRARIES lua)
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)
2019-07-16 20:19:11 -06:00
dfhack_plugin(dig dig.cpp)
dfhack_plugin(dig-now dig-now.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(digFlood digFlood.cpp)
add_subdirectory(diggingInvaders)
2019-07-16 20:19:11 -06:00
dfhack_plugin(dwarfvet dwarfvet.cpp)
dfhack_plugin(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua)
2017-09-01 06:13:34 -06:00
add_subdirectory(embark-assistant)
2019-07-16 20:19:11 -06:00
dfhack_plugin(embark-tools embark-tools.cpp)
dfhack_plugin(eventful eventful.cpp LINK_LIBRARIES lua)
dfhack_plugin(fastdwarf fastdwarf.cpp)
dfhack_plugin(filltraffic filltraffic.cpp)
dfhack_plugin(fix-unit-occupancy fix-unit-occupancy.cpp)
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)
2022-07-15 10:44:24 -06:00
dfhack_plugin(hotkeys hotkeys.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(infiniteSky infiniteSky.cpp)
dfhack_plugin(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
dfhack_plugin(jobutils jobutils.cpp)
2017-07-28 01:43:32 -06:00
add_subdirectory(labormanager)
2019-07-16 20:19:11 -06:00
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-tinythread)
dfhack_plugin(manipulator manipulator.cpp)
dfhack_plugin(map-render map-render.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(misery misery.cpp)
dfhack_plugin(mode mode.cpp)
dfhack_plugin(mousequery mousequery.cpp)
dfhack_plugin(nestboxes nestboxes.cpp)
dfhack_plugin(orders orders.cpp LINK_LIBRARIES jsoncpp_static)
2022-09-16 13:15:01 -06:00
dfhack_plugin(overlay overlay.cpp)
2019-07-16 20:19:11 -06:00
dfhack_plugin(pathable pathable.cpp LINK_LIBRARIES lua)
dfhack_plugin(petcapRemover petcapRemover.cpp)
dfhack_plugin(plants plants.cpp)
dfhack_plugin(probe probe.cpp)
dfhack_plugin(prospector prospector.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(power-meter power-meter.cpp LINK_LIBRARIES lua)
dfhack_plugin(regrass regrass.cpp)
add_subdirectory(remotefortressreader)
2019-07-16 20:19:11 -06:00
dfhack_plugin(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename)
2014-11-07 14:43:50 -07:00
add_subdirectory(rendermax)
dfhack_plugin(resume resume.cpp LINK_LIBRARIES lua)
dfhack_plugin(reveal reveal.cpp LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(search search.cpp)
dfhack_plugin(seedwatch seedwatch.cpp)
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)
2019-07-16 20:19:11 -06:00
dfhack_plugin(stockflow stockflow.cpp LINK_LIBRARIES lua)
add_subdirectory(stockpiles)
2019-07-16 20:19:11 -06:00
dfhack_plugin(stocks stocks.cpp)
dfhack_plugin(strangemood strangemood.cpp)
dfhack_plugin(tailor tailor.cpp)
dfhack_plugin(tiletypes tiletypes.cpp Brushes.h LINK_LIBRARIES lua)
2019-07-16 20:19:11 -06:00
dfhack_plugin(title-folder title-folder.cpp)
dfhack_plugin(title-version title-version.cpp)
dfhack_plugin(trackstop trackstop.cpp)
dfhack_plugin(tubefill tubefill.cpp)
add_subdirectory(tweak)
2019-07-16 20:19:11 -06:00
dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua)
dfhack_plugin(workNow workNow.cpp)
dfhack_plugin(xlsxreader xlsxreader.cpp LINK_LIBRARIES lua xlsxio_read_STATIC zip expat)
2022-08-02 02:07:13 -06:00
dfhack_plugin(zone zone.cpp)
# 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.
2014-03-04 10:00:12 -07:00
endif()
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)
dfhack_plugin(skeleton examples/skeleton.cpp)
2011-10-06 19:53:58 -06:00
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()