Skip to content

Commit

Permalink
Turn filelists to proper cmake files and include() them for proper ch…
Browse files Browse the repository at this point in the history
…ange detection
  • Loading branch information
maxmitti committed Dec 8, 2024
1 parent 8edc3ef commit fc5eff5
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 14 deletions.
28 changes: 14 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -174,7 +174,7 @@ endfunction()

# Add engine target

append_filelist(CLONK_SOURCES Engine.txt)
append_filelist(CLONK_SOURCES Engine)

set(LICENSES
"COPYING@LegacyClonk@ISC"
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -287,15 +287,15 @@ 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)
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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions cmake/filelists/C4Group.txt → cmake/filelists/C4Group.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set(FILE_LIST
src/C4Config.cpp
src/C4Group.cpp
src/C4Group.h
Expand All @@ -7,3 +8,4 @@ src/C4Update.cpp
src/C4Update.h
src/C4Version.h
src/c4group_ng.cpp
)
2 changes: 2 additions & 0 deletions cmake/filelists/Engine.txt → cmake/filelists/Engine.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set(FILE_LIST
src/Bitmap256.cpp
src/Bitmap256.h
src/C4Action.cpp
Expand Down Expand Up @@ -362,3 +363,4 @@ src/StdSurface8.h
src/StdSync.cpp
src/StdSync.h
src/StdWindow.h
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
set(FILE_LIST
src/MacAppTranslocation.h
src/MacAppTranslocation.cpp
src/MacUtility.mm
)
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
set(FILE_LIST
src/StdXWindow.cpp
)
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
set(FILE_LIST
src/StdGtkWindow.cpp
src/StdGtkWindow.h
)
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
set(FILE_LIST
src/StdSdlSubSystem.cpp
src/StdSdlSubSystem.h
)
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
set(FILE_LIST
src/StdSDLWindow.cpp
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set(FILE_LIST
src/C4Com.h
src/C4CrashHandlerWin32.cpp
src/C4FileClasses.cpp
Expand All @@ -10,3 +11,4 @@ src/StdAppWin32.cpp
src/StdStringEncodingConverter.cpp
src/StdStringEncodingConverter.h
src/StdWindow.cpp
)
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
set(FILE_LIST
src/StdXWindow.cpp
)
Original file line number Diff line number Diff line change
@@ -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
)
2 changes: 2 additions & 0 deletions cmake/filelists/Std.txt → cmake/filelists/Std.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set(FILE_LIST
src/C4Attributes.h
src/C4Breakpoint.h
src/C4Chrono.cpp
Expand All @@ -22,3 +23,4 @@ src/StdGzCompressedFile.cpp
src/StdGzCompressedFile.h
src/StdHelpers.h
src/StdSha1.h
)

0 comments on commit fc5eff5

Please sign in to comment.