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

xmake 生成 cmake 脚本时 add_frameworks 功能无效 #808

Closed
TopXX opened this issue May 25, 2020 · 5 comments
Closed

xmake 生成 cmake 脚本时 add_frameworks 功能无效 #808

TopXX opened this issue May 25, 2020 · 5 comments

Comments

@TopXX
Copy link

TopXX commented May 25, 2020

描述问题

macOS环境下,xmake.lua 中的add_frameworks函数,在使用xmake project -k cmakelists命令生成cmake脚本后,该函数功能缺失。示例代码:add_frameworks("Cocoa", "CoreGraphics")

期待的结果

cmake脚本中添加对应的framework。

错误信息

无错误信息,cmake脚本生成xcode工程后,需要手动添加对应的framework。

相关环境

macOS 10.15.4 (19E287),xmake 2.3.3

其他信息

add_ldflags("-framework Cocoa") 生成的 cmake 脚本有效,但xmake.io文档推荐使用 add_frameworks函数。

@waruqi waruqi added this to the v2.3.4 milestone May 26, 2020
@waruqi
Copy link
Member

waruqi commented May 26, 2020

我加上支持了,不过还没测试过,你先试试吧。。xmake update dev

@TopXX
Copy link
Author

TopXX commented May 26, 2020

测试发现两个问题:
1、会出现链接错误,提示“No such file or directory: QuartzCore”,项目有引用QuartzCore.framework。
2、默认会添加 -framework Foundation 和 -framework CoreFoundation,这两个,有的项目不明确引用,也可以编译通过,请酌情考虑去掉。

@waruqi
Copy link
Member

waruqi commented May 27, 2020

测试发现两个问题:
1、会出现链接错误,提示“No such file or directory: QuartzCore”,项目有引用QuartzCore.framework。

我dev改进过了,应该可以了

2、默认会添加 -framework Foundation 和 -framework CoreFoundation,这两个,有的项目不明确引用,也可以编译通过,请酌情考虑去掉。

但是80%的objc项目都会用到这两基础库,可以简化xmake.lua的配置,xcode编译也是默认自带这些frameworks,另外即使有个别项目不需要这两frameworks,那么代码里面没有任何引用,即使追加了这两links,实际链接器也会自动忽略它们,并不会有任何其他影响。

因此暂时不会考虑去掉。

@TopXX
Copy link
Author

TopXX commented May 27, 2020

好的👌,多谢!我测试下看看。

@TopXX
Copy link
Author

TopXX commented May 28, 2020

经测试已经可以正常链接了!

@waruqi waruqi closed this as completed May 28, 2020
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