File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ option(DPP_MODULES "Build examples with C++20 modules support" ON)
3838set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDPP_CORO -std=c++20 -pthread -O0 -fPIC -DFMT_HEADER_ONLY -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter -Wno-deprecated-declarations" )
3939set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0" )
4040
41+ # Create gcm.cache directory and symlink to the main build's dpp.gcm
42+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
43+ file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR} /gcm.cache" )
44+ file (CREATE_LINK "${CMAKE_SOURCE_DIR} /../../build/library/CMakeFiles/dpp.dir/dpp.gcm"
45+ "${CMAKE_BINARY_DIR} /gcm.cache/dpp.gcm" SYMBOLIC )
46+ endif ()
47+
4148file (GLOB example_list ./*.cpp )
4249foreach (example ${example_list} )
4350 get_filename_component (examplename ${example} NAME )
@@ -53,6 +60,10 @@ foreach (example ${example_list})
5360 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
5461 target_compile_options (${examplename} _out PRIVATE -fmodules-ts )
5562 elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
56- target_compile_options (${examplename} _out PRIVATE -fmodules )
63+ target_compile_options (${examplename} _out PRIVATE
64+ -fmodules
65+ -mavx2
66+ -fprebuilt-module-path=${CMAKE_SOURCE_DIR}/../../build/library/CMakeFiles/dpp.dir
67+ )
5768 endif ()
5869endforeach (example )
Original file line number Diff line number Diff line change 1+ #include < string>
2+ #include < typeinfo>
3+
14import dpp;
25
36int main () {
@@ -9,7 +12,7 @@ int main() {
912 }
1013 });
1114
12- bot.on_ready ([&bot](const std ::ready_t & event) -> void {
15+ bot.on_ready ([&bot](const dpp ::ready_t & event) -> void {
1316 if (dpp::run_once<struct register_bot_commands >()) {
1417 bot.global_command_create (
1518 dpp::slashcommand (" ping" , " Ping pong!" , bot.me .id )
Original file line number Diff line number Diff line change @@ -461,7 +461,9 @@ endif()
461461
462462if (DPP_MODULES)
463463 message ("-- ${Green} Modules are enabled!${ColourReset} " )
464-
464+
465+ set_target_properties (dpp PROPERTIES CXX_EXTENSIONS OFF )
466+
465467 # Add module file set directly to the dpp target
466468 target_sources (dpp
467469 PUBLIC
@@ -500,7 +502,7 @@ if (DPP_BUILD_TEST)
500502 elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
501503 target_compile_options (${testname} PRIVATE -fmodules )
502504 endif ()
503- set_target_properties (${testname} PROPERTIES CXX_SCAN_FOR_MODULES ON )
505+ set_target_properties (${testname} PROPERTIES CXX_SCAN_FOR_MODULES ON CXX_EXTENSIONS OFF )
504506 elseif (BUILD_SHARED_LIBS )
505507 target_link_libraries (${testname} PUBLIC ${modname} )
506508 else ()
You can’t perform that action at this time.
0 commit comments