TBOOX

xmake v2.2.8 released, New vs project generator

2019-08-22

This version provides a new vs project generation plugin (thanks to @OpportunityLiu for its contribution), which is quite different from the previous plugin processing mode for generating vs. The vs project is to open all the source files and hand them over to vs to handle the compilation.

In addition, we rewrote the entire luajit io runtime to better support the unicode character set, especially the support for Chinese characters on Windows.

Finally, the new version began to try to install the lua bitcode script directly, to reduce the size of the installation package (controlled within 2.4M), improve the efficiency of xmake boot load.

Introduction of new features

Integrating with the new vsxmake generator

The original vs build plugin does not support xmake’s rules. Because xmake’s rules use a lot of custom scripts like on_build, they can’t be expanded, so projects like qt, wdk can’t support exporting to vs. compile.

Therefore, in order to solve this problem, the new version of the vs. build plugin performs the compile operation by directly calling the xmake command under vs, and also supports intellsence and definition jumps, as well as breakpoint debugging.

The specific use is similar to the old version:

$ xmake project -k [vsxmake2010|vsxmake2013|vsxmake2015|..] -m "debug;release"

If no version is specified, xmake will automatically detect the current version of vs to generate:

$ xmake project -k vsxmake -m "debug;release"

In addition, the vsxmake plugin will additionally generate a custom configuration property page for easy and flexible modification and appending some xmake compilation configuration in the vs., and even switch to other cross toolchains in the configuration to achieve the vs. vs. Cross-compilation of other platforms such as android, linux.

By the way, the project generated by this vsxmake plugin also supports the selection of a specified batch of source files for quick compilation.

Unicode encoding support

The original version in some windows environment, and can not handle unicode encoding very well, the Chinese compilation error message displayed may also be garbled. In the new version, xamake built-in luajit/io is completely rewritten in win. Under the unicode encoding provides better support, even in the xmake.lua or source file path, there are characters such as emoji can be handled very well.

target("program")
    set_kind("binary")

    add_files("source file 🎆/*.c")
    add_includedirs("header file")

    before_build(function()
        print("start compile 😊")
    end)

    after_build(function()
        print("end Compile")
    end)

Protobuf c/c++Building support

xmake-repo The official repository has added the protobuf-c/cpp dependency package. Users can easily use protobuf in xmake.lua. With the built-in protobuf.c/protobuf.cpp build rules, We can add a *.proto file directly to the project to develop a protocol based on protobuf, for example:

Using c library

add_requires("protobuf-c")

target("console_c")
    set_kind("binary")
    add_packages("protobuf-c")

    add_files("src/*.c")
    add_files("src/*.proto", {rules = "protobuf.c"})

Using the C++ library

add_requires("protobuf-cpp")

target("console_c++")
    set_kind("binary")
    set_languages("c++11")

    add_packages("protobuf-cpp")

    add_files("src/*.cpp")
    add_files("src/*.proto", {rules = "protobuf.cpp"})

Termux/Android Support

The new version of xmake has a good support for android/termux, so that users can encode and compile on android phones anytime and anywhere, with vim effect is very good.

Changelog

New features

  • Add protobuf c/c++ rules
  • #468: Add utf-8 support for io module on windows
  • #472: Add xmake project -k vsxmake plugin to support call xmake from vs/msbuild
  • #487: Support to build the selected files for the given target
  • Add filelock for io
  • #513: Support for android/termux
  • #517: Add add_cleanfiles api for target
  • #537: Add set_runenv api to override os/envs

Changes

  • #257: Lock the whole project to avoid other process to access.
  • Attempt to enable /dev/shm for the os.tmpdir
  • #542: Improve vs unicode output for link/cl
  • Improve binary bitcode lua scripts in the program directory

Bugs fixed

  • #549: Fix error caused by the new vsDevCmd.bat of vs2019

中文

Similar Posts

Comments



Links