xmake v2.1.9 version released, adding visual graphics menu configuration

This version mainly increases the xmake f --menurealization of user-defined graphic menu configuration, and the interface style is similar to that of linux make menuconfig:

For more instructions, please read: Documentation Manual .

Project source code: Github , Gitee .

new features

  • Add del_files()interface to remove some files from added files list
  • Add rule(), add_rules()interface to implement custom build rules, and improveadd_files("src/*.md", {rule = "markdown"})
  • add os.filesize()interface
  • Add core.ui.xxxother cui component modules to realize the terminal visual interface for short-term interaction with users
  • Simplify the compilation and configuration of the project by xmake f --menurealizing the interactive configuration of the visual menu
  • Add set_valuesinterface to option
  • Improve options, support automatic generation of visual configuration menus according to user-defined options in the project
  • Add source file location information when calling the api to set the project configuration and in the configuration menu

Improve

  • Improve cross toolchain configuration to support unknown build tool name configuration by specifying tool alias to direct to known toolchain, for example:xmake f [email protected]
  • #151 : Improve dynamic library generation under mingw platform
  • Improve generate makefile plugin
  • Improve detection error prompts
  • Improve add_cxflagsthe settings of flags api, add force parameter to disable automatic detection and mapping, and force setting options:add_cxflags("-DTEST", {force = true})
  • Improved add_filesflags setting, adding force field for setting original flags without automatic detection and mapping:add_files("src/*.c", {force = {cxflags = "-DTEST"}})
  • Improve search project root directory strategy
  • Improve vs environment detection, support detection of vs environment under encrypted file system
  • Upgrade luajit to the latest 2.1.0-beta3
  • Add support for linux/arm, arm64, you can run xmake on arm linux
  • Improved vs201x project generation plugin, better includedrs setting support

Bug fixes

  • Fix dependency modification compilation and linking issues
  • #151 : fix os.nuldev()issue when passing in gcc on mingw
  • #150 : Fix the problem that ar.exe packs too long obj list parameters under windows, causing failure
  • Fix xmake f --crossthe problem of unable to configure
  • fix os.cdto windows root path problem

Introduction of new features

Added del_filesinterface implementation to delete the specified file from the source file list

Through this interface, you can delete the specified file from the list of files added by the previous add_files interface, for example:

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

In the above example, all files srcexcept the directory can be added . Of course, this can also be used to achieve the same purpose, but this method is more flexible.test.cadd_files("src/*.c|test.c")

For example, we can control which files are deleted by conditional judgment, and this interface also supports the matching mode of add_files , 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

From the above example, we can see that add_filessum del_filesis added and deleted sequentially according to the calling order, and by del_files("src/subdir/*.c|xxx.c")deleting a batch of files, and excluding src/subdir/xxx.c(that is, not deleting the file).

rule()Implement user-defined compilation rules through interfaces

After version 2.1.9, xmake not only built-in support for building files in multiple languages, but also allows users to build complex unknown files by themselves by customizing build rules.

We can extend the build support of other files by presetting the file suffixes supported by the rules:

-- 定义一个markdown文件的构建规则
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")
    
    -- 使test目标支持markdown文件的构建规则
    add_rules("markdown")

    -- 添加markdown文件的构建
    add_files("src/*.md")
    add_files("src/*.markdown")

We can also specify certain scattered other files to be processed as markdown rules:

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

<p class="tips"> Rules specified by `add_files("*.md", {rule = "markdown"})` have higher priority than rules set by `add_rules("markdown")`. </p>

We can also implement cascade construction of rules. For example, after building man rules, continue to call markdown rules to implement cascade construction:

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

For some files, it is necessary to support the mode of multi-file build to generate a single object, which can be achieved by on_build_all :

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"})

By xmake f --menuimplementing visual menu configuration

In the previous version, user-defined command-line menu options could be achieved by using option . When there are quite a lot of project configurations, this command-line configuration method is not very flexible.

Therefore, in version 2.1.9, we have extended option to make it natively support xmake f --menua graphical configuration interface, realize complex hierarchical configuration, and support fuzzy search and positioning of configuration, making configuration items more flexible and convenient.

We can set the class pathname of option through set_categoryset_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")

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

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

The effect diagram is as follows:

And we can also provide a list of option values ​​for users to quickly select through set_values , for example:

option("test")
    set_default("b")
    set_showmenu(true)
    set_values("a", "b", "c")

The effect diagram is as follows:

Search for user profiles

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325261348&siteId=291194637