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 passing user configs description for `package()` #284

Closed
waruqi opened this Issue Dec 12, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@waruqi
Copy link
Member

waruqi commented Dec 12, 2018

Roadmap

  • add_configs() for package
    • add_configs("bitwidth", {description = "Set the code unit width.", default = "8", values = {"8", "16", "32"}})
    • add_configs("bitwidth", {type = "number", values = {8, 16, 32}})
    • add_configs("bitwidth", {restrict = function(value) if tonumber(value) < 100 then return true end})
  • restrict values, function or values
  • show configuration info, xmake require --info packagename

Example

package("pcre2")

    set_homepage("https://www.pcre.org/")
    set_description("A Perl Compatible Regular Expressions Library")

    add_configs("bitwidth", {description = "Set the code unit width.", default = "8", values = {"8", "16", "32"}})

    on_load(function (package)
        local bitwidth = package:config("bitwidth") or "8"
        package:add("links", "pcre2-" .. bitwidth)
        package:add("defines", "PCRE2_CODE_UNIT_WIDTH=" .. bitwidth)
    end)

Show the configuration info

$ xmake require --info pcre2
The package info of project:
    require(pcre2): 
      -> description: A Perl Compatible Regular Expressions Library
      -> version: 10.31
      ...
      -> configs:
         -> bitwidth:
            -> description: Set the code unit width.
            -> values: {"8","16","32"}
            -> default: 8

@waruqi waruqi added the new feature label Dec 12, 2018

@waruqi waruqi added this to the v2.2.4 milestone Dec 12, 2018

@waruqi

This comment has been minimized.

Copy link
Member Author

waruqi commented Dec 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.