xmake 用起来真是舒服

2018 年 10 月 30 日
 georgetso
@waruqi
win+vscode 用 wsl 的 clang 编译 cpp 项目, 根本不用写 makefile, 很舒服
好项目!
1893 次点击
所在节点    程序员
10 条回复
lniwn
2018 年 10 月 30 日
我也觉得 xmake 很棒,只是不知为何人气没有想象的高。
waruqi
2018 年 10 月 30 日
额,还是头一次看到关于 xmake 的主题,受宠若惊哈。。多谢支持。
waruqi
2018 年 10 月 30 日
@lniwn 太冷门了哦。。没多少人关注。。
sagaxu
2018 年 10 月 30 日
@lniwn 大家都习惯 cmake 了,轮子又多又圆
georgetso
2018 年 10 月 31 日
@waruqi 请问这个问题应该怎么配置 xmake.lua ? 我加了 add_cxflags("-std=c++11") 但是无效

error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
waruqi
2018 年 10 月 31 日
@georgetso 你设置 set_languages("c++11") 试试

https://xmake.io/#/zh/manual?id=targetset_languages

你的设置应该也是可以的,或者执行下 xmake -v 编译看下详细的编译选项,确认下 有没有设置成功
georgetso
2018 年 10 月 31 日
@waruqi
这是 -v 出现的内容:
ccache clang -c -fvisibility=hidden -O3 -m64 -I/usr/local/include -I/usr/include -Qunused-arguments -o build/.objs/redis/linux/x86_64/release/./connector.cc.o connector.cc

我指定了 -std=c++17, 但是没有在上面的内容中出现.
具体来说是编译这个项目出现的问题: https://github.com/danielshaving/redis-cpp17
waruqi
2018 年 10 月 31 日
@georgetso 我试了下,可以啊,ccache xcrun -sdk macosx clang -c -fvisibility=hidden -O3 -std=c++17 -arch x86_64 -fpascal-strings -fmessage-length=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -Qunused-arguments -o build/.objs/redis/macosx/x86_64/release/./connector.cc.o connector.cc

下面两种设置,我都试了 ok 的。。

set_languages("c++17")

或者

add_cxflags("-std=c++17")

你要么到 github 提个 issues 吧,这边讨论不方便维护。
waruqi
2018 年 10 月 31 日
或者你贴下 你的 xmake.lua 内容
georgetso
2018 年 10 月 31 日
@waruqi
just did, please see

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/502745

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX