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

如果taget名是动态的就无法解析 #281

Open
Dozingfiretruck opened this issue Nov 15, 2024 · 3 comments
Open

如果taget名是动态的就无法解析 #281

Dozingfiretruck opened this issue Nov 15, 2024 · 3 comments
Labels

Comments

@Dozingfiretruck
Copy link

Xmake 版本

2.8.9

操作系统版本和架构

win10

描述问题

project_dir = os.scriptdir()
project_name = project_dir:match(".+[/\\]([%w_]+)")

target(project_name,function()
end)

例如这样就无法解析了

期待的结果

正常解析

工程配置

project_dir = os.scriptdir()
project_name = project_dir:match(".+[/\\]([%w_]+)")

target(project_name,function()
end)

附加信息和错误日志

@waruqi
Copy link
Member

waruqi commented Nov 15, 2024

这不是好好的么,自己确认下 project_name 是否正常解析到有效值

project_dir = os.scriptdir()
project_name = project_dir:match(".+[/\\]([%w_]+)")

print("project_name", project_name)

target(project_name,function()
    set_kind("binary")
    add_files("src/*.cpp")
end)
ruki-2:test ruki$ xmake
project_name    test
project_name    test
checking for platform ... macosx
checking for architecture ... x86_64
checking for Xcode directory ... /Applications/Xcode.app
checking for SDK version of Xcode for macosx (x86_64) ... 14.0
checking for Minimal target version of Xcode for macosx (x86_64) ... 14.0
project_name    test
project_name    test
project_name    test
project_name    test
[ 50%]: cache compiling.release src/main.cpp
[ 75%]: linking.release test
[100%]: build ok, spent 1.695s

@Dozingfiretruck
Copy link
Author

编译没问题,是vscode的xmake插件里解析不出来
image

@waruqi
Copy link
Member

waruqi commented Nov 15, 2024

插件问题,你直接拉下插件源码调下,暂时没空看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants