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

在macos上set_kind(shared)时与-bundle 不相容 #687

Closed
tangruidon opened this issue Feb 23, 2020 · 5 comments
Closed

在macos上set_kind(shared)时与-bundle 不相容 #687

tangruidon opened this issue Feb 23, 2020 · 5 comments
Milestone

Comments

@tangruidon
Copy link

tangruidon commented Feb 23, 2020

Describe the bug

在macos上编译动态库,
target("example")
set_kind(shared)
add_shflags("-bundle -undefined dynamic_lookup",{force=true})
编译时提示 -bundle not allowed "dynamiclib"

Expected behavior

在最后连接的时候 cc -o -bundle -undefined dynamic_lookup,而不是cc -o -shared

@waruqi
Copy link
Member

waruqi commented Feb 23, 2020

既然cc都明确提示了:-bundle not allowed "dynamiclib"

那就说明-bundle flag不能用于动态库生成上,那为啥还要设置到 set_kind shared的动态库target上去呢。

shared target仅用于生成动态库,不支持bundle生成。。

https://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm

To build a shared library, use cc's -dynamiclib option. Use the -bundle option to build a loadable module or bundle.

目前xmake原生没提供bundle的直接生成,你可以自己加add_ldflags -bundle到binary target上去来生成bundle,如果后缀名不对,你自己通过 set_filename 自行改下后缀名

@tangruidon
Copy link
Author

ok
thanks

@waruqi
Copy link
Member

waruqi commented Apr 5, 2020

我bundle支持上了,可以更新到dev分支试试

add_rules("mode.debug", "mode.release")

target("test")
    add_rules("xcode.bundle")
    add_files("src/test.m")
    add_files("src/Info.plist")

也可以通过模板创建空工程:

xmake create -t xcode.bundle -l objc test

@waruqi
Copy link
Member

waruqi commented Apr 5, 2020

签名支持我改进了下,只需要设置即可(而且默认会自动检测选择一个可用的,也不用每次手动配置):

xmake f --xcode_codesign_identity="Apple Development: xxx@gmail.com (T3NA4MRVPU)"

当然,set_values("xcode.codesign_identity")的设置还是支持的,这样不同target支持不同的签名设置

@waruqi waruqi added this to the v2.3.3 milestone Apr 5, 2020
@waruqi
Copy link
Member

waruqi commented Apr 8, 2020

恩,我稍微改进了下,info.plist统一放置到 add_files里面去,add_installfiles用于resources文件的安装

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

No branches or pull requests

2 participants