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 dynamic generated target #222

Closed
keosu opened this issue Sep 18, 2023 · 4 comments
Closed

Support dynamic generated target #222

keosu opened this issue Sep 18, 2023 · 4 comments

Comments

@keosu
Copy link

keosu commented Sep 18, 2023

Is your feature request related to a problem? Please describe.

比如,我希望通过遍历test目录下的文件夹,为每一个文件夹生成一下target
但是这种情况下xmake vscode插件(侧边栏,状态栏)不能自动识别target

for _, folder in ipairs(os.dirs("tests/*"), path.basename) do 
    files = folder .. "/*.cpp" 
    target( folder)
        set_kind("binary")
        add_files(files) 
end

Describe the solution you'd like

不知道增加动态解析target功能是否为很麻烦?

Describe alternatives you've considered

No response

Additional context

No response

@waruqi
Copy link
Member

waruqi commented Sep 18, 2023

不是可以的么,我这 ok

image

@keosu
Copy link
Author

keosu commented Sep 18, 2023

不知道是否是操作系统有关,测试环境的的机器是win10,xmake-vscode version v2.2.2
现在我的现象是,状态栏的build能成功编译,但是xmake侧边栏target是空的,状态栏点default 切换target,提示一个“unexptected token xxxx, is not a valid JSON”
我晚些时候再试试。

@waruqi
Copy link
Member

waruqi commented Sep 18, 2023

不知道是否是操作系统有关,测试环境的的机器是win10,xmake-vscode version v2.2.2 现在我的现象是,状态栏的build能成功编译,但是xmake侧边栏target是空的,状态栏点default 切换target,提示一个“unexptected token xxxx, is not a valid JSON” 我晚些时候再试试。

检查下描述域有什么 print 输出,或者 一些 warnings 输出,去掉就行

@waruqi
Copy link
Member

waruqi commented Sep 18, 2023

刚好想请教一个问题,我对lua不熟,想问一下 lua中这里的缩进是有语义的(如python)还是只是为了好看? 假设我有两个target,每个依赖不同的第三方库,add_requires好像只能放在最前面,下面这么,就会报错

add_requires("aa")
target( a)
        set_kind("binary")
        add_files("src/a/*.cpp") 
        add_packages("aa")
     

add_requires("bb")   -- 这里会报错, 只能放到最前面
target( b)
        set_kind("binary")
        add_files("src/b/*.cpp") 
        add_package("bb")

我是想按照target 按需引入 依赖,不知道一般推荐的方法是啥?谢谢

无关问题不要混一起,单独提

@keosu keosu closed this as completed Sep 18, 2023
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