-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Clib integration (xmake-io/xmake#397) #398
Conversation
@waruqi Seems like I'm stuck. Is there a way to pass custom options to Other than that, installation using default options seems fine to me (for some reason it doesn't add includedirs to gcc flags though as I've thought before, but I'm fine with adding them manually in xmake.lua). |
You can see xmake/xmake/modules/package/manager/conan/install_package.lua Lines 85 to 96 in 85cb688
And we can get these options in xmake/xmake/modules/package/manager/conan/install_package.lua Lines 188 to 195 in 85cb688
Then we can pass custom options to install_package.lua add_requires("clib::clibs/bytes@0.0.4", {configs={out_dir="my_deps", save=true}})
We can defines some default option value and uses
build = {description = "...", default = "missing", values = {"all", "never", "missing", "outdated"}},
build_requires = {description = "...", default = "xmake_generator/0.1.0@bincrafters/testing"} |
Some examples for conan package: add_requires("CONAN::zlib/1.2.11@conan/stable", {alias = "zlib", debug = true,
configs = {build_requires = "xmake_generator/0.1.0@bincrafters/testing", build = "all"}})
add_requires("CONAN::OpenSSL/1.0.2n@conan/stable", {alias = "openssl",
configs = {build_requires = "xmake_generator/0.1.0@bincrafters/testing",
options = "OpenSSL:shared=True", build = "all"}})
target("test")
set_kind("binary")
add_files("src/*.c")
add_packages("openssl", "zlib") add_requires("CONAN::zlib/1.2.11@conan/stable", {alias = "zlib", debug = true}})
add_requires("CONAN::OpenSSL/1.0.2n@conan/stable", {alias = "openssl",
configs = {options = "OpenSSL:shared=True"}})
target("test")
set_kind("binary")
add_files("src/*.c")
add_packages("openssl", "zlib") You can refer to #327 (Integrate with Conan package manager) |
… into feature/clib-integration Conflicts: xmake/modules/package/manager/clib/find_package.lua xmake/modules/package/manager/clib/install_package.lua
Thanks for reviewing and help @waruqi 😁 I've fixed the issues and now everything works as intended (I've tested configuration flags too). Can we merge it? |
By the way, which platform tests have you passed? Can you write a simple example of xmake.lua for clib here? Thanks! |
I've tested it only on Linux (Debian 8 x64), but I have access to a Windows machine, so I can test it there if needed. Clib doesn't have any platform-related options, so I think it should also work there out of the box (I've used it as a standalone tool on Windows too). Example of xmake.lua along with sample code which uses the installed package is in the first post 😉 I have a question - does the I've not used xmake before, so I possibly got something wrong in my understanding of it, sorry 😬 |
You need add correct package name to find the given package. add_requires("clib::clibs/bytes@0.0.4", {alias = "bytes"})
-- add modes: debug and release
add_rules("mode.debug", "mode.release")
-- add target
target("xmake-test")
-- set kind
set_kind("binary")
-- add files
add_files("clib/bytes/*.c")
add_files("src/*.c")
add_packages("bytes") -- will call find_package to get includedirs and add -Ixxx
`` |
Just tested it on Windows (using your example with alias), everything works fine. Shall we merge now? |
Ok, Thanks! |
It works fine on macOS. 👍 |
Here is my implementation for #397.
Usage example
xmake.lua
src/main.c
Package detection is implemented by placing 'marker files' which have the same name as the package (but escaped, of course) and their content is a path to installation directory (defaults to 'clib' in project directory).
Looking forward to your answer 😉