-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
Add support of importing modules from packages #3228
Conversation
Does it work now? Can you provide an example project with package? and how to test it? |
this PR works on the small tests i did, but it need furthermore test to ensures it works with more complex project |
Add a test project and define a local package with modules in this project directly. then call |
0e08145
to
f797f99
Compare
it works for me xmake install -y -o /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/b/bar/latest/4e0143c97b65425b855ad5fd03038b6a -P /mnt/xmake/tests/projects/c++/modules/packages/my-repo/packages/b/bar/src --diagnosis --verbose
TEST1. <--------
TEST2
installing bar ..
installing bar to /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/b/bar/latest/4e0143c97b65425b855ad5fd03038b6a ..
> copy ../../../../../build/.packages/b/bar/latest/cache/build_4e0143c9/linux/x86_64/release/libbar.a to /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/b/bar/latest/4e0143c97b65425b855ad5fd03038b6a/lib
> copy bar.mpp to /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/b/bar/latest/4e0143c97b65425b855ad5fd03038b6a/modules/bar/bar.mpp
install ok! But it does not build project for gcc.
|
yes i spoke too fast didn't updated the local XMake files after editing the repo :D |
but any idea why the package test build when running
|
Ok it's this function that fail on msvc without -vD (when XMake is trying to build a package) function get_ifcoutputflag(target)
local ifcoutputflag = _g.ifcoutputflag
if ifcoutputflag == nil then
local compinst = target:compiler("cxx")
if compinst:has_flags("-ifcOutput", "cxxflags", {flagskey = "cl_ifc_output"}) then
ifcoutputflag = "-ifcOutput"
end
assert(ifcoutputflag, "compiler(msvc): does not support c++ module!")
_g.ifcoutputflag = ifcoutputflag or false
end
return ifcoutputflag or nil
end |
you can pass to see verbose checkflags logs |
this should allow a support of importing modules from a XMake library with other buildsys like CMake or Meson
f96640c
to
325d674
Compare
when adding -vD the test pass :/ i don't know how to debug this |
I don't know, I need some time to debug it. maybe need debug |
Because of some incorrect flags detection (missing input arguments), when calling Some other msvc flags detections have the same problem. |
It works now, I have fixed it. |
I tested for gcc/clang on my machine, it works now. |
I sent this pr (experimental support for c++ modules distribution) to sg15@lists.isocpp.org and got some feedback.
|
This is a Proof of concepts, may need a lot of optimisation / refinements
the module distribution files are based on https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2473r1.pdf