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

waruqi opened this Issue Dec 12, 2018 · 1 comment


None yet
1 participant
Copy link

waruqi commented Dec 12, 2018


  • 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



    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)

Show the configuration info

$ xmake require --info pcre2
The package info of project:
      -> 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


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.