Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve C++20 modules support #2641

Merged
merged 159 commits into from
Aug 16, 2022
Merged

Improve C++20 modules support #2641

merged 159 commits into from
Aug 16, 2022

Conversation

waruqi
Copy link
Member

@waruqi waruqi commented Aug 3, 2022

@waruqi waruqi marked this pull request as ready for review August 4, 2022 03:25
@waruqi
Copy link
Member Author

waruqi commented Aug 4, 2022

@Arthapz I have improved some codes. e.g. toolchain includedirs, fix bmi flags for msvc, format code and optimize performance...

I still need to understand the code in depth, maybe it will take some time.

@waruqi waruqi added this to the v2.7.1 milestone Aug 4, 2022
@waruqi waruqi mentioned this pull request Aug 14, 2022
7 tasks
@waruqi
Copy link
Member Author

waruqi commented Aug 15, 2022

mmmmh, when building a shared lib with header units, we may have link error because the library consummer don't have access to the header units .obj, i think i need some more reading about header units to handle that we may handle them wrong

well, you can add a shared test example in tests directory first.

@waruqi
Copy link
Member Author

waruqi commented Aug 15, 2022

cmake generator work fine for gcc/clang now.

$ xmake project -k cmake; cd build/; cmake ..; make 
[  0%]: generating.cxx.module.deps src/hello_impl.cpp
[  0%]: generating.cxx.module.deps src/main.cpp
[  0%]: generating.cxx.module.deps src/mod_impl.cpp
[  0%]: generating.cxx.module.deps src/hello.mpp
[  0%]: generating.cxx.module.deps src/mod.mpp
create ok!
-- The CXX compiler identification is GNU 11.3.0
-- The C compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/xmake/tests/projects/c++/modules/dependence/build
[ 20%] Generating output_dependence_ADE56AE0
[ 0%]: generating.cxx.module.bmi mod
[ 0%]: generating.cxx.module.bmi hello
[ 20%] Built target target_dependence_ADE56AE0
[ 40%] Building CXX object CMakeFiles/dependence.dir/src/hello_impl.cpp.o
[ 60%] Building CXX object CMakeFiles/dependence.dir/src/main.cpp.o
[ 80%] Building CXX object CMakeFiles/dependence.dir/src/mod_impl.cpp.o
[100%] Linking CXX executable linux/x86_64/release/dependence
[100%] Built target dependence

@waruqi
Copy link
Member Author

waruqi commented Aug 16, 2022

The vs generator is not currently supported because it requires all cxxflags to be fetched in advance of the config phase, but some of the module's cxxflags are dynamically added in before_build_files, so they cannot be fetched.

This patch is a bit large and works mostly fine for now, so I've merged it for now, other improvements to vs generator and shared libs can be improved in a new patch separately.

@waruqi waruqi merged commit 81aca6f into dev Aug 16, 2022
@waruqi waruqi deleted the cxxmodules branch August 16, 2022 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants