The xmake v2.1.9 version is released, and the configuration of visual graphics menu is added

2018/02/05 09:43
Reading number 408

This version mainly adds xmake f --menu Realize user-defined graphical 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 to del_files() Interface to remove some files from the list of added files
  • add to rule() , add_rules() The interface implements custom construction rules and improves add_files("src/*.md", {rule = "markdown"})
  • add to os.filesize() Interface
  • add to core.ui.xxx And other cui component modules to realize the visual interface of the terminal for short interaction with users
  • adopt xmake f --menu Realize visual menu interactive configuration and simplify project compilation and configuration
  • add to set_values Interface to option
  • Improved option to automatically generate visual configuration menu according to user-defined options in the project
  • Add source file location information when calling api to set project configuration and in the configuration menu

improvement

  • Improve cross tool chain configuration, and support unknown compilation tool name configuration by specifying tool aliases to direct to known tool chains, such as: xmake f --cc= gcc@ccmips.exe
  • #151 : improve the generation of dynamic libraries under mingw platform
  • Improve the generation of makefile plug-ins
  • Improved detection error prompt
  • improvement add_cxflags Add the force parameter to disable automatic detection and mapping and force the setting of options such as flags api settings: add_cxflags("-DTEST", {force = true})
  • improvement add_files To set the flags of, add the force field, which is used to set the original flags without automatic detection and mapping: add_files("src/*.c", {force = {cxflags = "-DTEST"}})
  • Improve the search project root directory strategy
  • Improve vs environment detection and support detection of vs environment under encrypted file system
  • Upgrade luajit to the latest 2.1.0-beta3
  • Add support for linux/arm and arm64. You can run xmake on arm linux
  • Improved vs201x project generation plug-in and better includedirs setting support

Bugs repair

  • Fix dependent modification compilation and linking issues
  • #151 : Repair os.nuldev() There was a problem passing in gcc on mingw
  • #150 : Repair the failure problem caused by the long obj list parameter of ar.exe package under Windows
  • repair xmake f --cross Unable to configure the problem
  • repair os.cd Root path to windows

Introduction to new features

newly added del_files The interface implementation deletes the specified file from the source file list

Through this interface, you can add_files In the list of files added by the interface, delete the specified files, such as:

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

The above example can be accessed from src Add to the directory test.c All documents other than add_files("src/*.c|test.c") To achieve the same goal, but this way is more flexible.

For example, we can judge conditionally to control which files are deleted, and this interface also supports add_files The matching mode and filtering mode of are used for 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_files and del_files It is added and deleted sequentially according to the calling order, and del_files("src/subdir/*.c|xxx.c") Delete a batch of files and exclude them src/subdir/xxx.c (That is, do not delete the file).

adopt rule() The interface implements user-defined compilation rules

After version 2.1.9, xmake not only natively built-in supports the construction of files in multiple languages, but also allows users to build complex unknown files themselves through user-defined construction rules.

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

 --Define the construction rules of 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 construction rules of markdown files add_rules("markdown") --Add the construction of markdown file add_files("src/*.md") add_files("src/*.markdown")

We can also specify some miscellaneous files to be processed as markdown rules:

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

<p class="tips">Rules specified through the method of 'add_files ("*. md", {rule="markdown"})' have higher priority than those set by 'add_rules ("markdown")'</ p>

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

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

For some files, you need to support the mode of generating a single object by building multiple files on_build_all To achieve:

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

adopt xmake f --menu Realize visual menu configuration

Previous versions, using option User customization of command line menu options can be realized. 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 extended option to support native support xmake f --menu The graphical configuration interface of, realizes the complex hierarchical configuration, and supports the fuzzy search and positioning of configuration, configuration items are more flexible and convenient.

We can set_category Set the hierarchical pathname of option 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")

The last menu interface path structure shown in the above configuration:

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

The renderings are as follows:

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

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

The renderings are as follows:

Search User Configuration

Expand to read the full text
Loading
Click to lead the topic 📣 Post and join the discussion 🔥
Reward
zero comment
zero Collection
zero fabulous
 Back to top
Top