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

在rule 的 on_install 腳本域如何取得 install dir ? #283

Closed
orzuk-lmj opened this issue Dec 11, 2018 · 4 comments
Closed

在rule 的 on_install 腳本域如何取得 install dir ? #283

orzuk-lmj opened this issue Dec 11, 2018 · 4 comments

Comments

@orzuk-lmj
Copy link
Contributor

orzuk-lmj commented Dec 11, 2018

  • 在自定義 rule 的 on_install(function (target) 中,我該如何取得類似 package:installdir 的路徑?
  • 如果可以的話,希望能取得 xmake install -o XXXX 所指定的目錄
  • 如何取得 exe 配對的 pdb 路徑?
@waruqi
Copy link
Member

waruqi commented Dec 11, 2018

target:installdir安装目录的接口还没封装,等我这两天封好后,你再试试,目前是在外层处理的,可以看下 https://github.com/tboox/xmake/blob/master/xmake/actions/install/main.lua

pdb文件路径是有的,target:symbolfile()

@waruqi
Copy link
Member

waruqi commented Dec 11, 2018

你可以更新下dev代码试试,我增加了target:installdir()并且额外添加了一个api set_installdir用于设置每个target的安装目录

target("test")
    set_installdir("/usr/local")

installdir的获取优先顺序:target.set_installdir > xmake install -o xxx > env(INSTALLDIR or DESTDIR) > platform.set_installdir

如果这些都没设置的话,这个target则忽略安装,当然也可以通过on_install对其重写安装过程

@orzuk-lmj
Copy link
Contributor Author

orzuk-lmj commented Dec 12, 2018

非常感謝,抓了最新dev 確認了 installdir 可以正常使用。
有個比較不方便的小問題回饋是,在windows或mingw的 shared 編譯後,dll 所對應的 .lib 和 .a 的路徑取得稍微麻煩了點。可以的話如果能內建API取得就更好了。

@waruqi
Copy link
Member

waruqi commented Dec 12, 2018

有個比較不方便的小問題回饋是,在windows或mingw的 shared 編譯後,dll 所對應的 .lib 和 .a 的路徑取得稍微麻煩了點。可以的話如果能內建API取得就更好了。

这个暂时只能用户来处理了,因为这个获取,是平台相关的,只有win需要这么获取,不好做内建Api,而且用户处理也不是特别繁琐:

path.basename(filepath) .. ".lib" 

就行了

@waruqi waruqi closed this as completed Dec 15, 2018
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