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

clean操作不会删除dll产生的 .exp和.lib文件 #517

Closed
Domain opened this issue Aug 3, 2019 · 7 comments
Closed

clean操作不会删除dll产生的 .exp和.lib文件 #517

Domain opened this issue Aug 3, 2019 · 7 comments

Comments

@Domain
Copy link
Contributor

Domain commented Aug 3, 2019

在windows下编译dll会产生.exp和.lib文件,clean操作应该把这两个文件也一起删除

@waruqi
Copy link
Member

waruqi commented Aug 3, 2019

你可以执行 xmake clean --all 试试

@Domain
Copy link
Contributor Author

Domain commented Aug 3, 2019

试过了,还在

@waruqi
Copy link
Member

waruqi commented Aug 3, 2019

那就是目前没删,如果不删,你clean完dll,下次重新编译也会覆写.exp/.lib。并不会有什么影响,为什么必须要去删掉呢?而且dll对应的.lib文件 对与依赖这个dll的静态link,是必须的。。除非你动态加载

所以通常.lib是不会去删了。跟dll一样属于最终生成的target文件,除非用户想把dll也删了,才会去删.lib

@Domain
Copy link
Contributor Author

Domain commented Aug 3, 2019

我理想中的clean all操作应该是把所有生成的文件都删除,只保留手动增加的文件,方便打包

@OpportunityLiu
Copy link
Member

那你应该用git clean啊

@waruqi
Copy link
Member

waruqi commented Aug 3, 2019

xmake只会清理由xmake直接生成的文件,而*.exp 以及 dll的这个 .lib文件,属于msvc的编译链接dll的附带产物,xmake是无法确认是否真的是msvc生成的,也有可能是用户手动放置进去的,所以不能随便清理,哪怕是clean --all

如果你非要删,可以自己定义下after_clean 在里面定制化清理其他文件

target("xxx")
    after_clean(function (target) 
        os.rm(path.join(target:targetdir(), "*.exp"))
        -- remove other files
    end)

我之后可以提供个add_cleanfiles的接口,提供更加方便的定制清理文件,来简化after_clean

@waruqi
Copy link
Member

waruqi commented Aug 3, 2019

我加上add_cleanfiles了,你可以试试,更新下dev分支,当然也可以使用after_clean在脚本中做更灵活的清理。具体用哪个 你自己选择。

target("xxx")
    add_cleanfiles("$(buildir)/$(plat)/$(arch)/$(mode)/xxx/*.exp")

@waruqi waruqi closed this as completed Aug 3, 2019
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

3 participants