From 76702bc0b807e764169207ea5cde7dde48e4d9e0 Mon Sep 17 00:00:00 2001 From: webbrain-one <295484252+webbrain-one@users.noreply.github.com> Date: Fri, 21 Aug 2026 13:25:37 +0300 Subject: [PATCH] CMake: split configuration into per-module files Issue #7: Improve CMake by splitting it into smaller files, one per module. --- cmake/algine-modules/all.cmake | 11 +++++++++++ cmake/algine-modules/android.cmake | 17 +++++++++++++++++ cmake/algine-modules/common.cmake | 17 +++++++++++++++++ cmake/algine-modules/core.cmake | 17 +++++++++++++++++ cmake/algine-modules/desktop.cmake | 17 +++++++++++++++++ cmake/algine-modules/ext.cmake | 17 +++++++++++++++++ cmake/algine-modules/glm.cmake | 17 +++++++++++++++++ cmake/algine-modules/qt.cmake | 17 +++++++++++++++++ cmake/algine-modules/std.cmake | 17 +++++++++++++++++ cmake/algine-modules/tulz.cmake | 17 +++++++++++++++++ cmake/algine-modules/widgets.cmake | 17 +++++++++++++++++ 11 files changed, 181 insertions(+) create mode 100644 cmake/algine-modules/all.cmake create mode 100644 cmake/algine-modules/android.cmake create mode 100644 cmake/algine-modules/common.cmake create mode 100644 cmake/algine-modules/core.cmake create mode 100644 cmake/algine-modules/desktop.cmake create mode 100644 cmake/algine-modules/ext.cmake create mode 100644 cmake/algine-modules/glm.cmake create mode 100644 cmake/algine-modules/qt.cmake create mode 100644 cmake/algine-modules/std.cmake create mode 100644 cmake/algine-modules/tulz.cmake create mode 100644 cmake/algine-modules/widgets.cmake diff --git a/cmake/algine-modules/all.cmake b/cmake/algine-modules/all.cmake new file mode 100644 index 0000000..75746ab --- /dev/null +++ b/cmake/algine-modules/all.cmake @@ -0,0 +1,11 @@ +# Include all Algine module CMake files. +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/core.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/std.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/widgets.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/ext.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/desktop.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/qt.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/android.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/glm.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/tulz.cmake) diff --git a/cmake/algine-modules/android.cmake b/cmake/algine-modules/android.cmake new file mode 100644 index 0000000..7196bfe --- /dev/null +++ b/cmake/algine-modules/android.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine android module. +if(NOT TARGET algine_android) + file(GLOB_RECURSE ALGINE_ANDROID_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/android/*.cpp") + if(ALGINE_ANDROID_SOURCES) + add_library(alGINE_android ${ALGINE_ANDROID_SOURCES}) + target_include_directories(alGINE_android PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/android") + else() + add_library(alGINE_android INTERFACE) + target_include_directories(alGINE_android INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/android") + endif() + set_target_properties(alGINE_android PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/common.cmake b/cmake/algine-modules/common.cmake new file mode 100644 index 0000000..19bb43c --- /dev/null +++ b/cmake/algine-modules/common.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine common module. +if(NOT TARGET algine_common) + file(GLOB_RECURSE ALGINE_COMMON_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/common/*.cpp") + if(ALGINE_COMMON_SOURCES) + add_library(alGINE_common ${ALGINE_COMMON_SOURCES}) + target_include_directories(alGINE_common PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine") + else() + add_library(alGINE_common INTERFACE) + target_include_directories(alGINE_common INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine") + endif() + set_target_properties(alGINE_common PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/core.cmake b/cmake/algine-modules/core.cmake new file mode 100644 index 0000000..f157230 --- /dev/null +++ b/cmake/algine-modules/core.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine core module. +if(NOT TARGET algine_core) + file(GLOB_RECURSE ALGINE_CORE_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/core/*.cpp") + if(ALGINE_CORE_SOURCES) + add_library(alGINE_core ${ALGINE_CORE_SOURCES}) + target_include_directories(alGINE_core PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/core") + else() + add_library(alGINE_core INTERFACE) + target_include_directories(alGINE_core INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/core") + endif() + set_target_properties(alGINE_core PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/desktop.cmake b/cmake/algine-modules/desktop.cmake new file mode 100644 index 0000000..56491ee --- /dev/null +++ b/cmake/algine-modules/desktop.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine desktop module. +if(NOT TARGET algine_desktop) + file(GLOB_RECURSE ALGINE_DESKTOP_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/desktop/*.cpp") + if(ALGINE_DESKTOP_SOURCES) + add_library(alGINE_desktop ${ALGINE_DESKTOP_SOURCES}) + target_include_directories(alGINE_desktop PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/desktop") + else() + add_library(alGINE_desktop INTERFACE) + target_include_directories(alGINE_desktop INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/desktop") + endif() + set_target_properties(alGINE_desktop PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/ext.cmake b/cmake/algine-modules/ext.cmake new file mode 100644 index 0000000..975c09d --- /dev/null +++ b/cmake/algine-modules/ext.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine ext module. +if(NOT TARGET algine_ext) + file(GLOB_RECURSE ALGINE_EXT_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/ext/*.cpp") + if(ALGINE_EXT_SOURCES) + add_library(alGINE_ext ${ALGINE_EXT_SOURCES}) + target_include_directories(alGINE_ext PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/ext") + else() + add_library(alGINE_ext INTERFACE) + target_include_directories(alGINE_ext INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/ext") + endif() + set_target_properties(alGINE_ext PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/glm.cmake b/cmake/algine-modules/glm.cmake new file mode 100644 index 0000000..075c120 --- /dev/null +++ b/cmake/algine-modules/glm.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine glm module. +if(NOT TARGET algine_glm) + file(GLOB_RECURSE ALGINE_GLM_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/glm/*.cpp") + if(ALGINE_GLM_SOURCES) + add_library(alGINE_glm ${ALGINE_GLM_SOURCES}) + target_include_directories(alGINE_glm PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/glm") + else() + add_library(alGINE_glm INTERFACE) + target_include_directories(alGINE_glm INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/glm") + endif() + set_target_properties(alGINE_glm PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/qt.cmake b/cmake/algine-modules/qt.cmake new file mode 100644 index 0000000..2af7014 --- /dev/null +++ b/cmake/algine-modules/qt.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine qt module. +if(NOT TARGET algine_qt) + file(GLOB_RECURSE ALGINE_QT_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/qt/*.cpp") + if(ALGINE_QT_SOURCES) + add_library(alGINE_qt ${ALGINE_QT_SOURCES}) + target_include_directories(alGINE_qt PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/qt") + else() + add_library(alGINE_qt INTERFACE) + target_include_directories(alGINE_qt INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/qt") + endif() + set_target_properties(alGINE_qt PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/std.cmake b/cmake/algine-modules/std.cmake new file mode 100644 index 0000000..6aa3df9 --- /dev/null +++ b/cmake/algine-modules/std.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine std module. +if(NOT TARGET algine_std) + file(GLOB_RECURSE ALGINE_STD_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/std/*.cpp") + if(ALGINE_STD_SOURCES) + add_library(alGINE_std ${ALGINE_STD_SOURCES}) + target_include_directories(alGINE_std PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/std") + else() + add_library(alGINE_std INTERFACE) + target_include_directories(alGINE_std INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/std") + endif() + set_target_properties(alGINE_std PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/tulz.cmake b/cmake/algine-modules/tulz.cmake new file mode 100644 index 0000000..402d1ce --- /dev/null +++ b/cmake/algine-modules/tulz.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine tulz module. +if(NOT TARGET algine_tulz) + file(GLOB_RECURSE ALGINE_TULZ_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/tulz/*.cpp") + if(ALGINE_TULZ_SOURCES) + add_library(alGINE_tulz ${ALGINE_TULZ_SOURCES}) + target_include_directories(alGINE_tulz PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/tulz") + else() + add_library(alGINE_tulz INTERFACE) + target_include_directories(alGINE_tulz INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/tulz") + endif() + set_target_properties(alGINE_tulz PROPERTIES CXX_STANDARD 17) +endif() diff --git a/cmake/algine-modules/widgets.cmake b/cmake/algine-modules/widgets.cmake new file mode 100644 index 0000000..dcb7c4b --- /dev/null +++ b/cmake/algine-modules/widgets.cmake @@ -0,0 +1,17 @@ +# CMake configuration for the Algine widgets module. +if(NOT TARGET algine_widgets) + file(GLOB_RECURSE ALGINE_WIDGETS_SOURCES CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/src/widgets/*.cpp") + if(ALGINE_WIDGETS_SOURCES) + add_library(alGINE_widgets ${ALGINE_WIDGETS_SOURCES}) + target_include_directories(alGINE_widgets PUBLIC + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/core/widgets") + else() + add_library(alGINE_widgets INTERFACE) + target_include_directories(alGINE_widgets INTERFACE + "${CMAKE_SOURCE_DIR}/include/common" + "${CMAKE_SOURCE_DIR}/include/common/algine/core/widgets") + endif() + set_target_properties(alGINE_widgets PROPERTIES CXX_STANDARD 17) +endif()