2017-08-16 ruki
This release fixed some bugs and improve some compilation problem. If you want to known more usage, please see online documents。 Source code: Github, Gitee. Changes Improve add_files to configure the compile option of the given files Inherit links and linkdirs from the dependent targets and options Improve target.a 继续阅读 »
2017-08-10 ruki
之前的版本对编译控制粒度,只能到target这一级: ```lua -- 全局根配置,所有target都会被影响 add_defines("ROOT") target("test") -- target目标配置,只对test目标下的所有源文件编译生效 add_defines("TEST") add_files("src/*.c") ``` 最近给2.1.6开发版本中的add_files进行了改进,支持基于files更细粒度的编译选项控制,例如: lua target("test") add_defines("TEST1") add_files("src/*.c") add_files("test/* 继续阅读 »
2017-08-08 ruki
如果我们要写跨平台的c/c++代码,很多时候需要处理由于不同编译器对c/c++各个标准支持力度不同导致的兼容性问题,一般通常的解决办法是:自己在代码中通过宏去判断各个编译器的版本、内置宏、标准库宏、__has_feature等来检测处理。 自己如果在代码中按上述的方式检测,会很繁琐,尤其是像c++这种存在大量语法特性,如果一一检测过来,工作量是非常大的。 通过构建工具预先检测编译特性 另外比较省事的方式,就是依赖构建工具提前做好检测,然后把检测结果作为宏添加到编译中去,这样代码只需要判断对应的特性宏是否存在,就可以进行处理了。 在cmake中就有类似的检测机制,非常强大,因此xmake也对其进行了支持,提供更加灵活强大的编译 继续阅读 »
2017-08-05 ruki
This release introduces a number of new feature updates, as detailed in Some new features of xmake v2.1.5. If you want to known more usage, please see online documents。 Source code: Github, Gitee. New features #83: Add add_csnippet and add_cxxsnippet into option for detecting some compiler features. #83: Add user e 继续阅读 »
2017-08-05 ruki
此版本带来了大量新特性更新,具体详见:xmake v2.1.5版本新特性介绍。 更多使用说明,请阅读:文档手册。 项目源码:Github, Gitee. 新特性 #83: 添加 add_csnippet,add_cxxsnippet到option来检测一些编译器特性 #83: 添加用户扩展模块去探测程序,库文件以及其他主机环境 添加find_program, find_file, find_library, find_tool和find_package 等模块接口 添加net.*和devel.*扩展模块 添加val()接口去获取内置变量,例如:val("host"), val("env PATH"), val("shell 继续阅读 »
2017-07-31 ruki
最近为了给xmake实现预编译头文件的支持,研究了下各大主流编译器处理预编译头的机制以及之间的一些差异。 现在的大部分c/c++编译器都是支持预编译头的,例如:gcc,clang,msvc等,用于优化c++代码的编译速度,毕竟c++的头文件如果包含了模板定义的话,编译速度是很慢的, 如果能够吧大部分通用的头文件放置在一个header.h中,在其他源码编译之前预先对其进行编译,之后的代码都能重用这部分预编译头,就可以极大程度上减少频繁的头文件冗余编译。 但是不同编译器对它的支持力度和处理方式,还是有很大差异的,并不是非常通用,在xmake中封装成统一的接口和使用方式,还是费了很大的功夫才搞定。 msvc的预编译头处理 预编译头 继续阅读 »
2017-07-29 ruki
2.1.5版本现已进入收尾阶段,此版本加入了一大波新特性,目前正在进行稳定性测试和修复,在这里,先来介绍下新版本中引入了哪些些新特性和改进。 1. 提供类似cmake的find_*系列接口,实现各种查找,例如:find_package, find_library, find_file, ... 2. 提供模块接口,实现编译器的各种检测,例如:has_features, has_flags, has_cincludes, has_cfuncs, ... 3. 实现大量扩展模块,提供文件下载、解压缩、git操作等接口 4. 支持预编译头文件支持,改进c++编译效率 5. 支持在工程中自定义模块进行扩展 6. 提供代码片段检测接口,实 继续阅读 »
2017-07-29 ruki
find_package This interface refers to the design of CMake for the find_* interfaces, which finds and adds package dependencies in the project target. lua target("test") set_kind("binary") add_files("*.c") on_load(function (target) import("lib.detect.find_package") target:add(find_package(" 继续阅读 »
2017-05-10 ruki
Introduction xmake lua has supported REPL(read-eval-print), we can write and test script more easily now. Enter interactive mode: ```bash $ xmake lua 1 + 2 3 a = 1 a 1 for _, v in pairs({1, 2, 3}) do print(v) end 1 2 3 ``` 继续阅读 »
2017-05-10 ruki
概述 此次更新,主要增强xmake lua插件,支持交互式命令执行(read-eval-print, REPL)以及一些稳定性问题修复。 有时候在交互模式下,运行命令更加的方便测试和验证一些模块和api,也更加的灵活,不需要再去额外写一个脚本文件来加载。 我们先看下,如何进入交互模式: ```bash 不带任何参数执行,就可以进入 $ xmake lua 进行表达式计算 1 + 2 3 赋值和打印变量值 a = 1 a 1 多行输入和执行 for _, v in pairs({1, 2, 3}) do print(v) end 1 2 3 ``` 继续阅读 »