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

Support moduleonly libraries #4707

Merged
merged 40 commits into from
Feb 11, 2024

Conversation

Arthapz
Copy link
Member

@Arthapz Arthapz commented Feb 5, 2024

Implement #4673 (comment)
need #4692 so i'll rebase on modules it when merge

add_rules("mode.release", "mode.debug")
set_languages("c++20")

target("bar2")
    set_kind("moduleonly")
    add_files("*.mpp") -- implicitly public

@Arthapz
Copy link
Member Author

Arthapz commented Feb 5, 2024

i merged these this pull requests with this #4692 (comment)
because they can't work without each other (windows don't allow empty .lib files)

@Arthapz Arthapz marked this pull request as ready for review February 5, 2024 17:38
@Arthapz
Copy link
Member Author

Arthapz commented Feb 5, 2024

i don't know how to make package kind headeronly work with this, because headeronly package doesn't forward --runtimes so the wrong compiler is used for dependency scanning

@Arthapz
Copy link
Member Author

Arthapz commented Feb 8, 2024

i think VS / VSXmake / CMake generators are OK, i'm doing xmake install/uninstall/package now

@Arthapz Arthapz marked this pull request as ready for review February 8, 2024 15:25
@Arthapz
Copy link
Member Author

Arthapz commented Feb 8, 2024

ok i think it's okay now

@waruqi
Copy link
Member

waruqi commented Feb 9, 2024

ok i think it's okay now

Thanks, but this week I don't have vs environment and time to test them in detail, I just can only do some simple syntax style review, if there is not too much problem, I will merge it. If anyone else has the time, welcome to help review and test it.

@Arthapz
Copy link
Member Author

Arthapz commented Feb 9, 2024

ok i think it's okay now

Thanks, but this week I don't have vs environment and time to test them in detail, I just can only do some simple syntax style review, if there is not too much problem, I will merge it. If anyone else has the time, welcome to help review and test it.

no problem, i've already done the next PR (reusage of modules), i'll create the PR after this one is merged
so the refactor is pretty much complete now we can concentrate on stability / bugfixes / cleanup

@waruqi
Copy link
Member

waruqi commented Feb 9, 2024

ruki@0d35ffa77272:/mnt/xmake/tests/projects/c++/modules/link_order$ xmake -r
[  0%]: <link_order_2> generating.module.deps src/main.cpp
[  0%]: <link_order_2> generating.module.deps src/foo.mpp
[  0%]: <link_order_2> generating.module.deps src/bar.mpp
[  0%]: <bar> generating.module.deps src/bar.mpp
[  0%]: <foo> generating.module.deps src/foo.mpp
[  0%]: <link_order_1> generating.module.deps src/main.cpp
[  0%]: <link_order_1> generating.module.deps src/bar.mpp
[  0%]: <link_order_1> generating.module.deps src/foo.mpp
[ 37%]: <link_order_2> compiling.module.release duplicate <--------
[ 37%]: <link_order_1> compiling.module.release duplicate
[ 62%]: compiling.release src/main.cpp
[ 62%]: compiling.release src/main.cpp
[ 75%]: linking.release link_order_2
[ 75%]: linking.release link_order_1
[100%]: build ok, spent 0.944s

what's the duplicate?

@waruqi
Copy link
Member

waruqi commented Feb 9, 2024

duplicate

well, it's module name, It looks a bit unclear without the filename information.

@waruqi
Copy link
Member

waruqi commented Feb 9, 2024

There are some problems with incremental compilation

gcc

ruki@0d35ffa77272:/mnt/xmake/tests/projects/c++/modules/dependence$ xmake
[ 54%]: compiling.release src/hello_impl.cpp
[ 54%]: compiling.release src/main.cpp
[ 54%]: compiling.release src/mod_impl.cpp
[ 81%]: linking.release dependence
[100%]: build ok, spent 1.426s
ruki@0d35ffa77272:/mnt/xmake/tests/projects/c++/modules/dependence$ xmake
[ 54%]: compiling.release src/hello_impl.cpp
[ 54%]: compiling.release src/main.cpp
[ 54%]: compiling.release src/mod_impl.cpp
[ 81%]: linking.release dependence
[100%]: build ok, spent 1.238s

clang

ruki@0d35ffa77272:/mnt/xmake/tests/projects/c++/modules/dependence$ xmake
[ 81%]: linking.release dependence
[100%]: build ok, spent 0.568s
ruki@0d35ffa77272:/mnt/xmake/tests/projects/c++/modules/dependence$ xmake
[100%]: build ok, spent 0.372s

@waruqi
Copy link
Member

waruqi commented Feb 9, 2024

gcc

ruki@0d35ffa77272:/mnt/xmake/tests/projects/c++/modules/staticlib$ xmake 
[ 25%]: compiling.release src/mod.cpp
[ 33%]: archiving.release libmod.a
[ 75%]: compiling.release src/main.cpp
[ 83%]: linking.release hello
[100%]: build ok, spent 1.774s
ruki@0d35ffa77272:/mnt/xmake/tests/projects/c++/modules/staticlib$ xmake
[ 25%]: compiling.release src/mod.cpp
[ 33%]: archiving.release libmod.a
[ 75%]: compiling.release src/main.cpp
[ 83%]: linking.release hello
[100%]: build ok, spent 0.92s

@waruqi
Copy link
Member

waruqi commented Feb 9, 2024

Maybe we need to add a test for incremental compilation to the test_base of modules. For example, test the output of os.iorunv xmake for the presence of compiling/linking text.

@waruqi waruqi merged commit a739684 into xmake-io:modules Feb 11, 2024
5 of 19 checks passed
@waruqi
Copy link
Member

waruqi commented Mar 9, 2024

It does not work in this case #4812

@Arthapz
Copy link
Member Author

Arthapz commented Mar 9, 2024

should be fixed by #4814

@waruqi
Copy link
Member

waruqi commented Mar 10, 2024

Thanks. 👍

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Thanks. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants