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

Add feature to enable passing variable from command line when calling xmake build #6094

Closed
tie-pilot-qxw opened this issue Jan 18, 2025 · 2 comments

Comments

@tie-pilot-qxw
Copy link

Is your feature request related to a problem? Please describe.

I'm binding C++ code to Rust, and since templates can't be passed across languages, I need to decide which template to use when calling xmake build from the Rust code. I want the add_defines function to accept a command-line variable, allowing me to select the template at compile time. Currently, I'm using environment variables as a workaround, but this approach feels redundant and may have potential issues. I'd like to optimize this process.

Describe the solution you'd like

Maybe the build script should be able to accept optional variables from the command line, such as:

// this is the build script
local a = input() or ...

// this is the command line
xmake build --var "a=123" [target]

Describe alternatives you've considered

No response

Additional context

No response

@waruqi
Copy link
Member

waruqi commented Jan 18, 2025

use the custom option.

https://xmake.io/#/manual/configuration_option

xmake f --xxx=123
xmake build

@tie-pilot-qxw
Copy link
Author

Thanks a lot! That worked.

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

No branches or pull requests

2 participants