This version mainly adds xmake F –menu to achieve user – defined graphical menu configuration, interface style is similar to Linux make Menuconfig:

For more instructions, please read: Documentation Manual.

Project source: Github, Gitee.

New features

  • adddel_files()Interface to remove some files from the list of added files
  • addrule().add_rules()Interface to implement custom build rules and improveadd_files("src/*.md", {rule = "markdown"})
  • addos.filesize()interface
  • addcore.ui.xxxAnd CUI module to realize the visual interface of the terminal, which is used to realize the short-term interaction with the user
  • throughxmake f --menuRealize visual menu interactive configuration, simplify the compilation and configuration of the project
  • addset_valuesInterface to the option
  • Improved Option to support automatic generation of visual configuration menus based on user-defined options in projects
  • Add the source file location information when calling the API to set the project configuration and in the configuration menu

To improve the

  • Improved cross toolchain configuration to support unknown compilation tool name configuration by specifying tool aliases directed to known toolchains, for example:xmake f [email protected]
  • #151: Improved dynamic library generation under MINGw platform
  • Improved makefile generation plug-in
  • Improved detection error prompt
  • To improve theadd_cxflagsTo disable automatic detection and mapping, add the force parameter to the flags API setting:add_cxflags("-DTEST", {force = true})
  • To improve theadd_filesAdd the force field to set the original flags without automatic detection and mapping:add_files("src/*.c", {force = {cxflags = "-DTEST"}})
  • Improved search project root directory strategy
  • Improved VS environment detection to support VS environment detection under encrypted file systems
  • Upgrade Luajit to the latest 2.1.0-beta3
  • Added support for Linux/ARM, ARM64 and xmake on ARM Linux
  • Improved VS201x project generation plugin, better includedirs setup support

Bugs fix

  • Fixed dependency change compilation and linking issues
  • # 151Repair:os.nuldev()There was a problem passing GCC on mingW
  • #150: Fix ar.exe failed to pack too long obJ list parameters in Windows
  • repairxmake f --crossFailure to configure
  • repairos.cdThe root path to Windows is faulty

New Features

newdel_filesInterface to delete a specified file from the source file list

This interface allows you to delete specified files from the list of files added by the add_files interface earlier, for example:

target("test")
    add_files("src/*.c")
    del_files("src/test.c")
Copy the code

The example above, can add in addition to the test from the SRC directory. All files outside of c, of course, this can also be through add_files (SRC / *. C | test. “” c”) to achieve the same purpose, but this way is more flexible.

For example, we can use conditional judgment to control which files to delete, and this interface also supports add_files matching mode, filtering mode, and batch removal.

target("test")
    add_files("src/**.c")
    del_files("src/test*.c")
    del_files("src/subdir/*.c|xxx.c")
    if is_plat("iphoneos") then
        add_files("xxx.m")
    end
Copy the code

Through the example above, we can see add_files and del_files is according to the call order, in order to add and delete, and through del_files (” SRC subdir / *. C | XXX. C “) to delete a batch file, And exclude SRC /subdir/xxx.c (that is, do not delete the file).

throughrule()Interface to implement user-defined compilation rules

After version 2.1.9, Xmake not only has built-in native support for building files in multiple languages, but also allows users to build complex, unknown files themselves through custom build rules.

We can extend build support for other files by pre-setting the file suffixes supported by the rule:

Define the build rules for a Markdown file
rule("markdown")
    set_extensions(".md".".markdown")
    on_build(function (target, sourcefile)
        os.cp(sourcefile, path.join(target:targetdir(), path.basename(sourcefile) .. ".html"))
    end)

target("test")
    set_kind("binary")
    
    Make the test target support the markdown file build rules
    add_rules("markdown")

    Add markdown file build
    add_files("src/*.md")
    add_files("src/*.markdown")
Copy the code

We can also specify some scattered other files to be handled as markdown rules:

target("test")
    -...
    add_files("src/test/*.md.in", {rule = "markdown"})
Copy the code

Rules specified by ‘add_files(“*.md”, {rule = “markdown”}) have a higher priority than those set by’ add_rules(“markdown”).

We can also implement a cascading build of rules, for example, after building the MAN rule, we can continue to call the Markdown rule to implement a cascading build:

rule("man")
    add_imports("core.project.rule")
    on_build(function (target, sourcefile)
        rule.build("markdown", target, sourcefile)
    end)
Copy the code

For files that need to support multiple file builds to generate a single object, on_build_all can do this:

rule("man")
    on_build_all(function (target, sourcefiles)
        -- build some source files
        for _, sourcefile in ipairs(sourcefiles) do
            -...
        end
    end)

target("test")
    -...
    add_files("src/test/*.doc.in", {rule = "man"})
Copy the code

throughxmake f --menuRealize visual menu configuration

In previous versions, option was used to implement user customization of command line menu options, which was not very flexible when the project configuration was quite large.

Therefore, in version 2.1.9, we extended option to make it native support xmake F — Menu graphical configuration interface, realize complex hierarchical configuration, and support fuzzy search and positioning of configuration, configuration items more flexible and convenient.

We can use set_category to set the option’s hierarchical pathname set_category(“root/submenu/submenu2”), for example:

-- 'boolean' option
option("test1")
    set_default(true)
    set_showmenu(true)
    set_category("root menu/test1")

-- 'choice' option with values: "a", "b", "c"
option("test2")
    set_default("a")
    set_values("a"."b"."c")
    set_showmenu(true)
    set_category("root menu/test2")

-- 'string' option
option("test3")
    set_default("xx")
    set_showmenu(true)
    set_category("root menu/test3/test3")

-- 'number' option
option("test4")
    set_default(6)
    set_showmenu(true)
    set_category("root menu/test4")
Copy the code

The path structure of the menu interface displayed at the end of the above configuration:

  • root menu
    • test1
    • test2
    • test3
      • test3
    • test4

The renderings are as follows:

We can also use set_values to provide a list of option values for users to select quickly, for example:

option("test")
    set_default("b")
    set_showmenu(true)
    set_values("a"."b"."c")
Copy the code

The renderings are as follows:

Searching for User Profiles

tboox.org/cn/2018/02/…