Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support to define a variable without quotes for configuration files #1694

Closed
xq114 opened this issue Sep 22, 2021 · 7 comments
Closed

support to define a variable without quotes for configuration files #1694

xq114 opened this issue Sep 22, 2021 · 7 comments

Comments

@xq114
Copy link
Contributor

xq114 commented Sep 22, 2021

你在什么场景下需要该功能?

#1693

例如在configuration file中定义

${define MY_EXPORT}

想在target中控制

set_configvar("MY_EXPORT", is_kind("shared") and "__declspec(dllexport)" or "")

生成的文件会带有引号:

#define MY_EXPORT "__declspec(dllexport)"

或者

#define MY_EXPORT ""

描述可能的解决方案

去除configfile的引号,需要时手动用flag控制

set_configvar("MY_EXPORT", "val", {quote = true})

描述你认为的候选方案

由用户手动加引号

set_configvar("MY_EXPORT", "\"val\"")
@waruqi
Copy link
Member

waruqi commented Sep 22, 2021

目前只能禁用 默认去除会破坏向下兼容性

set_configvar("MY_EXPORT", "val", {quote = false})

@waruqi waruqi added this to the v2.5.8 milestone Sep 22, 2021
@xq114
Copy link
Contributor Author

xq114 commented Sep 22, 2021

或者用set_policy控制也成

@waruqi
Copy link
Member

waruqi commented Sep 22, 2021

或者用set_policy控制也成

可以搞成policy,但目前的默认行为不能改了走policy也是跟 quote=false一样只能禁用

@waruqi
Copy link
Member

waruqi commented Sep 23, 2021

set_configvar("MY_EXPORT", "val", {quote = true})

目前还是加了这种支持,可以再试试

@xq114
Copy link
Contributor Author

xq114 commented Sep 23, 2021

error: @programdir\core\base\bit.lua:21: module 'base/compat/bit' not found:
        no field package.preload['base/compat/bit']
        failed to load C:\Users\xq114\xmake/core/base/compat/bit.lua : @programdir\core\base\compat\bit.lua:26: 'end' expected (to close 'function' at line 25) near '&'
        no file '.\base/compat/bit.lua'
        no file 'C:\Users\xq114\xmake\lua\base/compat/bit.lua'
        no file 'C:\Users\xq114\xmake\lua\base/compat/bit\init.lua'
        no file '.\base/compat/bit.dll'
        no file 'C:\Users\xq114\xmake\base/compat/bit.dll'
        no file 'C:\Users\xq114\xmake\loadall.dll'

发现xmake update -s挂了,应该和runtime改动有关,正在卸载重装;感觉runtime的改动还是挺重要的,是不是等2.6版本再切换默认runtime比较好?这样两者之间不兼容的部分通过minor version就能区分,用到lua5.3特性的也可以直接写set_xmakever("2.6")而不用精确到小版本

@waruqi
Copy link
Member

waruqi commented Sep 23, 2021

发现xmake update -s挂了,应该和runtime改动有关,正在卸载重装

这个主要是 core 里面加个 xmake._LUAJIT,但是如果从低版本 engine 更新的话,默认就是 nil 走到 lua 上去了,我刚改了下,如果是 nil ,默认就是 luajit = true,兼容下就好了。。

感觉runtime的改动还是挺重要的,是不是等2.6版本再切换默认runtime比较好?这样两者之间不兼容的部分通过minor version就能区分,用到lua5.3特性的也可以直接写set_xmakever("2.6")而不用精确到小版本

最近几个版本是不会切的,现在仅仅 dev 阶段 win 上切了下,主要是为了做部分灰度测试,多跑出点问题 好提早修复。。等正式发版前,我会切回来的。。否则永远都测试不出来 lua5.3 上有哪些坑。。

用到lua5.3特性的也可以直接写set_xmakever("2.6")而不用精确到小版本

有专门的接口可以判断的。。if not xmake.luajit() then

@xq114
Copy link
Contributor Author

xq114 commented Sep 23, 2021

quote=false接口可以了

@xq114 xq114 closed this as completed Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants