xmake v2.2.9 release, the new C ++ experimental support for 20 modules of

This version lacks much new features, mainly for c ++ 20 modules were experimental support, currently supports clang / msvc compiler, in addition to improving the lot of experience, and improve some stability.

In addition, this version adds support socket.io and corresponding coroutine io scheduling support, to prepare for the next version of remote compilation, and subsequent distributed compilation.

New features introduced

c++20 modules

c ++ modules have been formally incorporated into the draft c ++ 20, msvc and clang have basically realized the modules-ts support, with c ++ 20 feet away from us getting closer, xmake began to c ++ modules well in advance of the support.

Currently xmake has fully supported the msvc / clang of modules-ts building to achieve, and for gcc, because of its cxx-modules branch is still in development, has not yet officially entered the master, I looked at the inside of the changelog, flags still relevant constantly changing, the feeling has not stabilized, so here temporarily not be supported.

About xmake relevant progress c ++ modules, see: https://github.com/xmake-io/xmake/pull/569

Hello Module

About related presentations c ++ modules, I do not say, here mainly describes how to build c ++ modules project we first look at a simple example under xmake,:

target("hello")
    set_kind("binary")
    add_files("src/*.cpp", "src/*.mpp") 

The above is a support xmake.lua building c ++ modules file description, which hello.mppis the module file:

#include <cstdio>
export module hello;
using namespace std;

export namespace hello {
    void say(const char* str) {
        printf("%s\n", str);
    }
}

The main program is the use of main.cpp hello module:

import hello;

int main() {
    hello::say("hello module!");
    return 0;
}

Next we execute this program xmake to build it:

ruki:hello ruki$ xmake 
[  0%]: ccache compiling.release src/hello.mpp
[ 50%]: ccache compiling.release src/main.cpp
[100%]: linking.release hello
build ok!

Is not very simple, internal xmake will to deal with all the details of logic, for developers, simply adding a module file *.mppas the source file only.

Module interface file

The above *.mppis xmake recommended module interface file naming, in fact, various compiler for the default file extension modules are not uniform, is under clang *.cppm, and the next is msvc *.ixx, which for the preparation of a unified cross-compiler module project is very unfriendly, so here reference build2 inside the recommended way, unified *.mppsuffix, to regulate under the command xmake interface module project.

Of course, this also supports xmake recommended naming, and for *.ixx*.cppmsuch as extension, xmake is also fully compatible with support, can also be added directly to add_filesgo.

Other examples

Under xmake project also built a lot of project examples with c ++ modules relevant, interested students can refer to the following: c ++ Module examples

set_toolchain Interface changes

set_toolchain This interface is mainly used for target setting different compiler tool chain, in fact, there are versions prior to 2.2.9 add_toolsand set_toolsdo two interfaces to handle the same, but these two interfaces and use of the name and the specification is not very consistent, so did the some adjustments change with this new interface to better set_toolchain setting tool chain.

For add_files("*.c")added source file, the default will always call the system that best matches the compiler tool to compile, or by xmake f --cc=clanggoing to manually modify the command, but these are global affect all target goals.

If some special needs, you need to specify different compilers to target a specific target under the current project alone, Linker, or a particular version of the compiler, this time this interface you can use the rafts, for example:

target("test1")
    add_files("*.c")

target("test2")
    add_files("*.c")
    set_toolchain("cc", "$(projectdir)/tools/bin/clang-5.0")

Test2 above description only certain special compiler provided, clang-5.0 using a specific compiler to compile test2, test1 while still using the default settings.

For some compilers filename irregular, resulting in the recognition process xmake not normally known under the name of the compiler cases, we can also add the name of a tool tips, such as:

set_toolchain("cc", "gcc@$(projectdir)/tools/bin/mipscc.exe")

The foregoing description is provided as mipscc.exe c compiler, and prompt treatment parameter passing as xmake gcc be compiled.

socket io

This has been achieved initial interface, supports io scheduling lua coroutine, io achieve high concurrent read and write (the latter also supports the process, pipe scheduling support), mainly for xmake own use, for follow-up remote compilation compiled and distributed to prepare, we do not open the user's own use, but after the other follow-up perfect, will open up, users can also do some service programs through its own plug-in socket io inside.

However, users may use scenarios is not a lot, after all xmake just a build tool, users will rarely do their own io communication.

update content

New features

  • # 569 : Added experimental support for c ++ modules
  • Add xmake project -k xmakefileBuilder
  • 620 : Adding a global ~/.xmakerc.luaprofile, take effect for all local projects.
  • 593 : Adding a core.base.socketmodule to prepare for remote and distributed compiler to compile the next step.

Improve

  • # 563 : reconfigurable logic constructs, the language-specific constructs detached into separate rules go
  • # 570 : Construction of improved Qt, the qt.applicationsplitting into qt.widgetappand qt.quickapptwo construction rules
  • # 576 : the use of set_toolchainalternative add_toolsand set_toolssolve the old ambiguous interface, setting provides a more understandable way
  • Improved xmake createCreate a template project
  • # 589 : Improving the default build number of tasks, make full use of cpu core to speed up the overall compilation speed
  • # 598 : Improved find_packagesupport for .tbd system libraries to find files on macOS
  • # 615 : support the installation and use of other arch and ios package of conan
  • # 629 : Improving hash.uuid and achieve uuid v4
  • # 639 : Improving argument parser supports -jNstyle mass participation

Bugs repair

  • # 567 : Fix memory leak problem when serialized objects appear
  • # 566 : Fix link order problems installing remote-dependent
  • # 565 : Fix Runtime PATH settings problem vcpkg package
  • # 597 : Repair xmake require installation package for too long problem
  • # 634 : Repair mode.coverage build rules, and improved detection flags

Guess you like

Origin www.oschina.net/news/112253/xmake-2-2-9-released