@@ -77,6 +77,9 @@ set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
7777# Plugins
7878option (BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON )
7979if (BUILD_SUPPORTED)
80+ # If you are adding a plugin that you do not intend to commit to the DFHack repo,
81+ # see instructions for adding "external" plugins at the end of this file.
82+
8083 dfhack_plugin(3dveins 3dveins.cpp)
8184 dfhack_plugin(add-spatter add-spatter.cpp)
8285 # dfhack_plugin(advtools advtools.cpp)
@@ -175,6 +178,9 @@ if(BUILD_SUPPORTED)
175178 dfhack_plugin(workNow workNow.cpp)
176179 dfhack_plugin(xlsxreader xlsxreader.cpp LINK_LIBRARIES lua xlsxio_read_STATIC zip expat)
177180 dfhack_plugin(zone zone.cpp LINK_LIBRARIES lua)
181+
182+ # If you are adding a plugin that you do not intend to commit to the DFHack repo,
183+ # see instructions for adding "external" plugins at the end of this file.
178184endif ()
179185
180186# this is the skeleton plugin. If you want to make your own, make a copy and then change it
@@ -183,12 +189,34 @@ if(BUILD_SKELETON)
183189 add_subdirectory (skeleton)
184190endif ()
185191
186- if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR} /CMakeLists.custom.txt" )
187- file (WRITE "${CMAKE_CURRENT_SOURCE_DIR} /CMakeLists.custom.txt" "# You can add custom plugins here to avoid touching plugins/CMakeLists.txt,
188- # This can be useful if you've made modifications to that file and try to
189- # switch between branches that have also made modifications to it.
190192
193+ # To add "external" plugins without committing them to the DFHack repo:
194+ #
195+ # 1. run CMake as you normally do (this is only necessary once if
196+ # `external/CMakeLists.txt` does not exist yet)
197+ # 2. add the plugin to the `external` folder (relative to this file).
198+ # - for a multi-file plugin, either clone the repository inside of the
199+ # `external` folder, or add the folder there manually.
200+ # - for a single-file plugin, simply add the file there.
201+ # 3. add an entry to `external/CMakeLists.txt`:
202+ # - add_subdirectory() for multi-file plugins in a subdirectory
203+ # - dfhack_plugin() for single-file plugins
204+ # 4. build DFHack as normal. The plugins you added will be built as well.
205+
206+ if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR} /external/CMakeLists.txt" )
207+ file (WRITE "${CMAKE_CURRENT_SOURCE_DIR} /external/CMakeLists.txt"
208+ "# Add external plugins here - this file is ignored by git
209+
210+ # Recommended: use add_subdirectory() for folders that you have created within
211+ # this folder, or dfhack_plugin() for single files that you have added here.
212+
213+ # See the end of /plugins/CMakeLists.txt for more details.
191214" )
192215endif ()
193216
194- include (CMakeLists.custom.txt)
217+ include ("${CMAKE_CURRENT_SOURCE_DIR} /external/CMakeLists.txt" )
218+
219+ # for backwards compatibility
220+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR} /CMakeLists.custom.txt" )
221+ include ("${CMAKE_CURRENT_SOURCE_DIR} /CMakeLists.custom.txt" )
222+ endif ()
0 commit comments