From 9b3cdc0c131400a4f14f42c1cd07ba14b07ba1e0 Mon Sep 17 00:00:00 2001 From: kj16609 Date: Tue, 18 Mar 2025 06:12:54 -0400 Subject: [PATCH 1/3] Testing modules --- modules/compiler/gcc.cmake | 5 +++-- modules/helpers.cmake | 27 +++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/modules/compiler/gcc.cmake b/modules/compiler/gcc.cmake index 231909c..e07cba1 100644 --- a/modules/compiler/gcc.cmake +++ b/modules/compiler/gcc.cmake @@ -129,7 +129,8 @@ list(APPEND FGL_CONFIG "-ftree-vectorize") list(APPEND FGL_CONFIG "-fmax-errors=6") - + LIST(APPEND FGL_CONFIG "-fmodules-ts") + LIST(APPEND FGL_CONFIG "-std=c++23") #AppendWarningFlag("-fanalyzer") #AppendWarningFlag("-Wanalyzer-too-complex") @@ -162,7 +163,7 @@ list(APPEND FGL_FLAGS ${FGL_CONFIG}) list(APPEND FGL_FLAGS ${FGL_FINAL_FLAGS_${UPPER_BUILD_TYPE}}) - list(APPEND FGL_FLAGS ${FGL_WARNINGS}) + # list(APPEND FGL_FLAGS ${FGL_WARNINGS}) list(APPEND FGL_CHILD_FLAGS ${FGL_FINAL_FLAGS_${UPPER_BUILD_TYPE}}) diff --git a/modules/helpers.cmake b/modules/helpers.cmake index 4d2e3a4..e017e7e 100644 --- a/modules/helpers.cmake +++ b/modules/helpers.cmake @@ -1,4 +1,4 @@ - +cmake_minimum_required(VERSION 3.28) function(PreSetup) PlatformPreSetup() @@ -13,16 +13,39 @@ function(PostSetup) endfunction() function(AddFGLExecutable NAME SRC_SOURCES_LOCATION) + set(CMAKE_CXX_STANDARD 23) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + + file(GLOB_RECURSE M_SOURCES CONFIGURE_DEPENDS + ${SRC_SOURCES_LOCATION}/**.cppm) + + # add_library(${NAME}_MODULES) + # target_sources(${NAME}_MODULES PUBLIC FILE_SET CXX_MODULES FILES ${M_SOURCES}) + file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp ${SRC_SOURCES_LOCATION}/**.hpp ) - add_executable(${NAME} ${SOURCES}) + + message("Compiling ${NAME} WITH ${M_SOURCES} as modules") + + add_executable(${NAME}) + target_sources(${NAME} PUBLIC ${SOURCES}) + target_sources(${NAME} PUBLIC FILE_SET modules TYPE CXX_MODULES FILES ${M_SOURCES}) + target_include_directories(${NAME} PRIVATE ${SRC_SOURCES_LOCATION}) + target_link_libraries(${NAME} PRIVATE ${NAME}_MODULES) set_target_properties(${NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") SetFGLFlags(${NAME}) endfunction() +function(LinkLibs NAME ACCESS LIB) + # if (TARGET ${NAME}_MODULES) + # target_link_libraries(${NAME}_MODULES ${ACCESS} ${LIB}) + # endif () + target_link_libraries(${NAME} ${ACCESS} ${LIB}) +endfunction() + function(AddFGLLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION) file(GLOB_RECURSE CPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp) file(GLOB_RECURSE HPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.hpp) From 20057c3c5c0f062b6bbf573cdc32506dcb1f7cd8 Mon Sep 17 00:00:00 2001 From: kj16609 Date: Tue, 18 Mar 2025 06:58:03 -0400 Subject: [PATCH 2/3] Testing modules --- modules/helpers.cmake | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/helpers.cmake b/modules/helpers.cmake index e017e7e..081b78e 100644 --- a/modules/helpers.cmake +++ b/modules/helpers.cmake @@ -19,9 +19,6 @@ function(AddFGLExecutable NAME SRC_SOURCES_LOCATION) file(GLOB_RECURSE M_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cppm) - # add_library(${NAME}_MODULES) - # target_sources(${NAME}_MODULES PUBLIC FILE_SET CXX_MODULES FILES ${M_SOURCES}) - file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp ${SRC_SOURCES_LOCATION}/**.hpp @@ -39,13 +36,6 @@ function(AddFGLExecutable NAME SRC_SOURCES_LOCATION) SetFGLFlags(${NAME}) endfunction() -function(LinkLibs NAME ACCESS LIB) - # if (TARGET ${NAME}_MODULES) - # target_link_libraries(${NAME}_MODULES ${ACCESS} ${LIB}) - # endif () - target_link_libraries(${NAME} ${ACCESS} ${LIB}) -endfunction() - function(AddFGLLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION) file(GLOB_RECURSE CPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp) file(GLOB_RECURSE HPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.hpp) From 48e64f27a2cfff1b4211259402b49f942af53250 Mon Sep 17 00:00:00 2001 From: kj16609 Date: Sat, 22 Mar 2025 21:01:20 -0400 Subject: [PATCH 3/3] Remove old module linking method --- modules/helpers.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/helpers.cmake b/modules/helpers.cmake index 081b78e..545ebbf 100644 --- a/modules/helpers.cmake +++ b/modules/helpers.cmake @@ -31,7 +31,6 @@ function(AddFGLExecutable NAME SRC_SOURCES_LOCATION) target_sources(${NAME} PUBLIC FILE_SET modules TYPE CXX_MODULES FILES ${M_SOURCES}) target_include_directories(${NAME} PRIVATE ${SRC_SOURCES_LOCATION}) - target_link_libraries(${NAME} PRIVATE ${NAME}_MODULES) set_target_properties(${NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") SetFGLFlags(${NAME}) endfunction()