From fc5eff52b85f4ba591b205f29a37e1d61d807cd2 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Sun, 8 Dec 2024 13:00:30 +0100 Subject: [PATCH] Turn filelists to proper cmake files and include() them for proper change detection --- CMakeLists.txt | 28 +++++++++---------- .../filelists/{C4Group.txt => C4Group.cmake} | 2 ++ cmake/filelists/{Engine.txt => Engine.cmake} | 2 ++ .../{EngineApple.txt => EngineApple.cmake} | 2 ++ ...ngineX.txt => EngineConsoleNonWin32.cmake} | 2 ++ .../{EngineGtk.txt => EngineGtk.cmake} | 2 ++ .../{EngineSdl.txt => EngineSdl.cmake} | 2 ++ ...dlMainloop.txt => EngineSdlMainloop.cmake} | 2 ++ .../{EngineWin32.txt => EngineWin32.cmake} | 2 ++ ...ngineConsoleNonWin32.txt => EngineX.cmake} | 2 ++ .../{PchExclude.txt => PchExclude.cmake} | 2 ++ cmake/filelists/{Std.txt => Std.cmake} | 2 ++ 12 files changed, 36 insertions(+), 14 deletions(-) rename cmake/filelists/{C4Group.txt => C4Group.cmake} (91%) rename cmake/filelists/{Engine.txt => Engine.cmake} (99%) rename cmake/filelists/{EngineApple.txt => EngineApple.cmake} (81%) rename cmake/filelists/{EngineX.txt => EngineConsoleNonWin32.cmake} (54%) rename cmake/filelists/{EngineGtk.txt => EngineGtk.cmake} (71%) rename cmake/filelists/{EngineSdl.txt => EngineSdl.cmake} (74%) rename cmake/filelists/{EngineSdlMainloop.txt => EngineSdlMainloop.cmake} (56%) rename cmake/filelists/{EngineWin32.txt => EngineWin32.cmake} (93%) rename cmake/filelists/{EngineConsoleNonWin32.txt => EngineX.cmake} (54%) rename cmake/filelists/{PchExclude.txt => PchExclude.cmake} (89%) rename cmake/filelists/{Std.txt => Std.cmake} (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92dca18e7..2b235d9ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,8 +147,8 @@ endif () # Adds the lines of file LIST_FILE to variable TARGET_LIST function(append_filelist TARGET_LIST LIST_FILE) - file(STRINGS "cmake/filelists/${LIST_FILE}" FILE_CONTENTS) - list(APPEND ${TARGET_LIST} ${FILE_CONTENTS}) + include("cmake/filelists/${LIST_FILE}.cmake") + list(APPEND ${TARGET_LIST} ${FILE_LIST}) set(${TARGET_LIST} "${${TARGET_LIST}}" PARENT_SCOPE) endfunction() @@ -174,7 +174,7 @@ endfunction() # Add engine target -append_filelist(CLONK_SOURCES Engine.txt) +append_filelist(CLONK_SOURCES Engine) set(LICENSES "COPYING@LegacyClonk@ISC" @@ -206,25 +206,25 @@ if (ENABLE_SOUND) endif () if (WIN32) - append_filelist(CLONK_SOURCES EngineWin32.txt) + append_filelist(CLONK_SOURCES EngineWin32) else () if (APPLE) - append_filelist(CLONK_SOURCES EngineApple.txt) + append_filelist(CLONK_SOURCES EngineApple) endif () list(APPEND CLONK_SOURCES src/StdAppUnix.cpp) endif () if (USE_SDL_MAINLOOP OR USE_SDL_MIXER) - append_filelist(CLONK_SOURCES EngineSdl.txt) + append_filelist(CLONK_SOURCES EngineSdl) endif () if (USE_SDL_MAINLOOP) - append_filelist(CLONK_SOURCES EngineSdlMainloop.txt) + append_filelist(CLONK_SOURCES EngineSdlMainloop) endif () if (USE_X11) - append_filelist(CLONK_SOURCES EngineX.txt) + append_filelist(CLONK_SOURCES EngineX) endif () if (USE_WIC) @@ -236,11 +236,11 @@ else () endif () if (WITH_DEVELOPER_MODE) - append_filelist(CLONK_SOURCES EngineGtk.txt) + append_filelist(CLONK_SOURCES EngineGtk) endif () if (USE_CONSOLE AND NOT WIN32) - append_filelist(CLONK_SOURCES EngineConsoleNonWin32.txt) + append_filelist(CLONK_SOURCES EngineConsoleNonWin32) endif () if (USE_LIBNOTIFY) @@ -287,7 +287,7 @@ target_sources(clonk PUBLIC ${RES_STR_TABLE_OUTPUT_CPP} ${RES_STR_TABLE_OUTPUT_H # Add c4group target -append_filelist(C4GROUP_SOURCES C4Group.txt) +append_filelist(C4GROUP_SOURCES C4Group) add_executable(c4group ${C4GROUP_SOURCES}) target_link_libraries(c4group standard) @@ -295,7 +295,7 @@ target_compile_definitions(c4group PRIVATE USE_CONSOLE) # Add libstandard target -append_filelist(LIBSTANDARD_SOURCES Std.txt) +append_filelist(LIBSTANDARD_SOURCES Std) if (WIN32) list(APPEND LIBSTANDARD_SOURCES src/StdRegistry.cpp src/StdRegistry.h) @@ -624,8 +624,8 @@ function(set_up_pch TARGET) endforeach() endforeach() # Don't precompile certain headers - file(STRINGS "cmake/filelists/PchExclude.txt" PCH_EXCLUDE) - list(REMOVE_ITEM PCH_LIST ${PCH_EXCLUDE}) + include("cmake/filelists/PchExclude.cmake") + list(REMOVE_ITEM PCH_LIST ${FILE_LIST}) # Include headers of external libraries list(APPEND PCH_LIST ${PCH_EXTRA}) # Clean up PCH list diff --git a/cmake/filelists/C4Group.txt b/cmake/filelists/C4Group.cmake similarity index 91% rename from cmake/filelists/C4Group.txt rename to cmake/filelists/C4Group.cmake index 7837b5419..01724074c 100644 --- a/cmake/filelists/C4Group.txt +++ b/cmake/filelists/C4Group.cmake @@ -1,3 +1,4 @@ +set(FILE_LIST src/C4Config.cpp src/C4Group.cpp src/C4Group.h @@ -7,3 +8,4 @@ src/C4Update.cpp src/C4Update.h src/C4Version.h src/c4group_ng.cpp +) diff --git a/cmake/filelists/Engine.txt b/cmake/filelists/Engine.cmake similarity index 99% rename from cmake/filelists/Engine.txt rename to cmake/filelists/Engine.cmake index 7e8612447..60bf6ca5a 100644 --- a/cmake/filelists/Engine.txt +++ b/cmake/filelists/Engine.cmake @@ -1,3 +1,4 @@ +set(FILE_LIST src/Bitmap256.cpp src/Bitmap256.h src/C4Action.cpp @@ -362,3 +363,4 @@ src/StdSurface8.h src/StdSync.cpp src/StdSync.h src/StdWindow.h +) diff --git a/cmake/filelists/EngineApple.txt b/cmake/filelists/EngineApple.cmake similarity index 81% rename from cmake/filelists/EngineApple.txt rename to cmake/filelists/EngineApple.cmake index 55062bc91..7c4bf77b7 100644 --- a/cmake/filelists/EngineApple.txt +++ b/cmake/filelists/EngineApple.cmake @@ -1,3 +1,5 @@ +set(FILE_LIST src/MacAppTranslocation.h src/MacAppTranslocation.cpp src/MacUtility.mm +) diff --git a/cmake/filelists/EngineX.txt b/cmake/filelists/EngineConsoleNonWin32.cmake similarity index 54% rename from cmake/filelists/EngineX.txt rename to cmake/filelists/EngineConsoleNonWin32.cmake index b87e2b40f..f7e7046e6 100644 --- a/cmake/filelists/EngineX.txt +++ b/cmake/filelists/EngineConsoleNonWin32.cmake @@ -1 +1,3 @@ +set(FILE_LIST src/StdXWindow.cpp +) diff --git a/cmake/filelists/EngineGtk.txt b/cmake/filelists/EngineGtk.cmake similarity index 71% rename from cmake/filelists/EngineGtk.txt rename to cmake/filelists/EngineGtk.cmake index aa6a91663..b38b0900e 100644 --- a/cmake/filelists/EngineGtk.txt +++ b/cmake/filelists/EngineGtk.cmake @@ -1,2 +1,4 @@ +set(FILE_LIST src/StdGtkWindow.cpp src/StdGtkWindow.h +) diff --git a/cmake/filelists/EngineSdl.txt b/cmake/filelists/EngineSdl.cmake similarity index 74% rename from cmake/filelists/EngineSdl.txt rename to cmake/filelists/EngineSdl.cmake index 6fbe5908f..551251310 100644 --- a/cmake/filelists/EngineSdl.txt +++ b/cmake/filelists/EngineSdl.cmake @@ -1,2 +1,4 @@ +set(FILE_LIST src/StdSdlSubSystem.cpp src/StdSdlSubSystem.h +) diff --git a/cmake/filelists/EngineSdlMainloop.txt b/cmake/filelists/EngineSdlMainloop.cmake similarity index 56% rename from cmake/filelists/EngineSdlMainloop.txt rename to cmake/filelists/EngineSdlMainloop.cmake index c8dbe56f2..0d4a4ca36 100644 --- a/cmake/filelists/EngineSdlMainloop.txt +++ b/cmake/filelists/EngineSdlMainloop.cmake @@ -1 +1,3 @@ +set(FILE_LIST src/StdSDLWindow.cpp +) diff --git a/cmake/filelists/EngineWin32.txt b/cmake/filelists/EngineWin32.cmake similarity index 93% rename from cmake/filelists/EngineWin32.txt rename to cmake/filelists/EngineWin32.cmake index 744df11dc..2d1a2eb51 100644 --- a/cmake/filelists/EngineWin32.txt +++ b/cmake/filelists/EngineWin32.cmake @@ -1,3 +1,4 @@ +set(FILE_LIST src/C4Com.h src/C4CrashHandlerWin32.cpp src/C4FileClasses.cpp @@ -10,3 +11,4 @@ src/StdAppWin32.cpp src/StdStringEncodingConverter.cpp src/StdStringEncodingConverter.h src/StdWindow.cpp +) diff --git a/cmake/filelists/EngineConsoleNonWin32.txt b/cmake/filelists/EngineX.cmake similarity index 54% rename from cmake/filelists/EngineConsoleNonWin32.txt rename to cmake/filelists/EngineX.cmake index b87e2b40f..f7e7046e6 100644 --- a/cmake/filelists/EngineConsoleNonWin32.txt +++ b/cmake/filelists/EngineX.cmake @@ -1 +1,3 @@ +set(FILE_LIST src/StdXWindow.cpp +) diff --git a/cmake/filelists/PchExclude.txt b/cmake/filelists/PchExclude.cmake similarity index 89% rename from cmake/filelists/PchExclude.txt rename to cmake/filelists/PchExclude.cmake index eb6d387eb..d8a306edc 100644 --- a/cmake/filelists/PchExclude.txt +++ b/cmake/filelists/PchExclude.cmake @@ -1,6 +1,8 @@ +set(FILE_LIST src/C4AudioSystemFmodRuntime.h src/C4AudioSystemNone.h src/C4AudioSystemSdl.h src/C4ToastLibNotify.h src/C4ToastWinToastLib.h src/StdWic.h +) diff --git a/cmake/filelists/Std.txt b/cmake/filelists/Std.cmake similarity index 96% rename from cmake/filelists/Std.txt rename to cmake/filelists/Std.cmake index c4b0a0ccc..311e5caac 100644 --- a/cmake/filelists/Std.txt +++ b/cmake/filelists/Std.cmake @@ -1,3 +1,4 @@ +set(FILE_LIST src/C4Attributes.h src/C4Breakpoint.h src/C4Chrono.cpp @@ -22,3 +23,4 @@ src/StdGzCompressedFile.cpp src/StdGzCompressedFile.h src/StdHelpers.h src/StdSha1.h +)