summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-07-05 14:39:39 +0200
committerMichael Lutz <michi@icosahedron.de>2020-07-10 19:33:00 +0200
commit00eccbe298ad7f7d656e121ce58c2a6326dabe2f (patch)
treee0ad9e862c9651c25ccacdc78cf8ff165442b696
parentdb0bf20fbbcdbe98c5c0fcac8c38c18cf9419fd1 (diff)
downloadopenttd-00eccbe298ad7f7d656e121ce58c2a6326dabe2f.tar.xz
Add: [CMake] Source group definitions to create file filters in generated project files (like the old MSVC projects).
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/MSVCFilters.cmake37
2 files changed, 39 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 364236c86..1400179ff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,6 +131,8 @@ include_directories(${CMAKE_SOURCE_DIR}/src)
# Needed by everything that uses Squirrel
include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/squirrel/include)
+include(MSVCFilters)
+
include(CompileFlags)
compile_flags()
diff --git a/cmake/MSVCFilters.cmake b/cmake/MSVCFilters.cmake
new file mode 100644
index 000000000..14c7b2c35
--- /dev/null
+++ b/cmake/MSVCFilters.cmake
@@ -0,0 +1,37 @@
+# Add source group filters for use in generated projects.
+
+source_group("AI Core" REGULAR_EXPRESSION "src/ai/")
+source_group("Blitters" REGULAR_EXPRESSION "src/blitter/")
+source_group("Core Source Code" REGULAR_EXPRESSION "src/core/")
+source_group("Game Core" REGULAR_EXPRESSION "src/game/")
+source_group("MD5" REGULAR_EXPRESSION "src/3rdparty/md5/")
+source_group("Misc" REGULAR_EXPRESSION "src/misc/")
+source_group("Music" REGULAR_EXPRESSION "src/music/")
+source_group("Network Core" REGULAR_EXPRESSION "src/network/core/")
+source_group("Pathfinder" REGULAR_EXPRESSION "src/pathfinder/")
+source_group("Save/Load handlers" REGULAR_EXPRESSION "src/saveload/")
+source_group("Sound" REGULAR_EXPRESSION "src/sound/")
+source_group("Sprite loaders" REGULAR_EXPRESSION "src/spriteloader/")
+source_group("Squirrel" REGULAR_EXPRESSION "src/3rdparty/squirrel/squirrel/")
+source_group("Tables" REGULAR_EXPRESSION "src/table/")
+source_group("Video" REGULAR_EXPRESSION "src/video/")
+source_group("Widgets" REGULAR_EXPRESSION "src/widgets/")
+source_group("Windows files" REGULAR_EXPRESSION "src/os/windows/|\.rc$")
+
+# Last directive for each file wins, so make sure NPF/YAPF are after the generic pathfinder filter.
+source_group("NPF" REGULAR_EXPRESSION "src/pathfinder/npf/")
+source_group("YAPF" REGULAR_EXPRESSION "src/pathfinder/yapf/")
+
+source_group("Script" REGULAR_EXPRESSION "src/script/")
+source_group("Script API Implementation" REGULAR_EXPRESSION "src/script/api/")
+source_group("Script API" REGULAR_EXPRESSION "src/script/api/.*\.hpp$")
+source_group("AI API" REGULAR_EXPRESSION "src/script/api/ai_")
+source_group("Game API" REGULAR_EXPRESSION "src/script/api/game_")
+
+# Placed last to ensure any of the previous directory filters are overridden.
+source_group("Command handlers" REGULAR_EXPRESSION "_cmd\.cpp$")
+source_group("Drivers" REGULAR_EXPRESSION "_driver\.hpp$")
+source_group("GUI Source Code" REGULAR_EXPRESSION "_gui\.cpp$")
+source_group("Map Accessors" REGULAR_EXPRESSION "_map\.(cpp|h)$")
+source_group("NewGRF" REGULAR_EXPRESSION "newgrf.*cpp$")
+source_group("Squirrel headers" REGULAR_EXPRESSION "src/3rdparty/squirrel/squirrel/.*\.h$")