<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[想请教一下大家构建C++模块架构是这样的吗？]]></title><description><![CDATA[<pre><code>cmake_minimum_required(VERSION 3.28)

project(occ_module
    LANGUAGES CXX 
    VERSION 8.0.0
)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true)

find_package(OpenCASCADE CONFIG REQUIRED)

add_library(occ_module)
target_link_libraries(occ_module PUBLIC 
    ${OpenCASCADE_LIBRARIES}
)

file(GLOB mfiles source/cppm/*/*.cppm source/cppm/*.cppm)
file(GLOB sfiles "source/src/*/*.cpp" source/src/*.cpp)
target_sources(occ_module 
PUBLIC 
    FILE_SET occ_module_m
        TYPE CXX_MODULES
            FILES ${mfiles}
PRIVATE 
    ${sfiles}
)

install(TARGETS occ_module 
    EXPORT occ_moduleTargets DESTINATION lib 
    FILE_SET occ_module_m
)
install(EXPORT occ_moduleTargets 
    NAMESPACE occ_module::
    DESTINATION lib/cmake/occ_module
)
include (CMakePackageConfigHelpers)
configure_package_config_file(
    "cmake/config.cmake.in"
    ${CMAKE_CURRENT_BINARY_DIR}/occ_moduleConfig.cmake
    INSTALL_DESTINATION lib/cmake/occ_module
)
write_basic_package_version_file(
    ${CMAKE_CURRENT_BINARY_DIR}/occ_moduleConfigVersion.cmake
    VERSION ${PROJECT_VERSION}
    COMPATIBILITY SameMajorVersion
)
install(FILES 
    ${CMAKE_CURRENT_BINARY_DIR}/occ_moduleConfig.cmake 
    ${CMAKE_CURRENT_BINARY_DIR}/occ_moduleConfigVersion.cmake 
    DESTINATION lib/occ_module
)

find_package(Boost CONFIG REQUIRED unit_test_framework)
enable_testing()
file(GLOB tfiles tests/*.cpp)
foreach (f ${tfiles})
get_filename_component(e ${f} NAME)
string(REPLACE ".cpp" "" e ${e})
add_executable(${e} ${f})
target_link_libraries(${e} PRIVATE 
    occ_module
    Boost::unit_test_framework
)

add_test(NAME ${e} COMMAND ${e})
endforeach()
</code></pre>
]]></description><link>http://forum.d2learn.org/topic/224/想请教一下大家构建c-模块架构是这样的吗</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 19:05:32 GMT</lastBuildDate><atom:link href="http://forum.d2learn.org/topic/224.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 05 Jul 2026 15:01:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 想请教一下大家构建C++模块架构是这样的吗？ on Sun, 05 Jul 2026 15:10:56 GMT]]></title><description><![CDATA[<p dir="auto">我想构建成cppm里声明导出模块和接口，定义实现内容放在.cpp文件里：</p>
<pre><code>module;

#include &lt;BinDrivers.hxx&gt;
#include &lt;BinDrivers_Marker.hxx&gt;
#include &lt;BinLDrivers_Marker.hxx&gt;

export module occ_module.application_framework.tkbin;

export namespace occ_module {
using BinDrivers = ::BinDrivers;
using BinDrivers_Marker = ::BinDrivers_Marker;
}
</code></pre>
]]></description><link>http://forum.d2learn.org/post/880</link><guid isPermaLink="true">http://forum.d2learn.org/post/880</guid><dc:creator><![CDATA[小明]]></dc:creator><pubDate>Sun, 05 Jul 2026 15:10:56 GMT</pubDate></item></channel></rss>