Skip to content

Conversation

@IvanKobzarev
Copy link
Contributor

@IvanKobzarev IvanKobzarev commented Jun 25, 2020

Stack from ghstack:

Differential Revision: D22239286

libpytorch_jni.so is dynamically linked with libfbjni.so, if to link to it - we need libfbjni.so as well - adding it to the readme with cmake setup for that linking

IvanKobzarev added a commit that referenced this pull request Jun 25, 2020
ghstack-source-id: f2c5066
Pull Request resolved: #40578
@IvanKobzarev IvanKobzarev requested review from dreiss and ljk53 June 25, 2020 18:38
@dr-ci
Copy link

dr-ci bot commented Jun 25, 2020

💊 CI failures summary and remediations

As of commit 6d3a7b3 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 1 time.

PATHS ${PYTORCH_LINK_DIRS}
NO_CMAKE_FIND_ROOT_PATH)
find_library(FBJNI_LIBRARY fbjni
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this PR: have you thought about providing a cmake file for client project to import useful library variables without manually creating/maintaining them?

I've seen this pattern for some OSS library, including PyTorch itself. Here is the public cmake file we generate: https://github.com/pytorch/pytorch/blob/master/cmake/TorchConfig.cmake.in

And in client project's cmake it can use find_package to locate the library's cmake and obtain $TORCH_INCLUDE_DIRS and $TORCH_LIBRARIES variables directly: https://github.com/pytorch/pytorch/blob/master/test/mobile/custom_build/CMakeLists.txt#L8

In this specific example, we don't need to maintain the dozen of static libraries as we do elsewhere: https://github.com/pytorch/pytorch/blob/master/android/pytorch_android/CMakeLists.txt#L96-L105

Just an idea - not sure if it's appropriate/common for native android projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This is a good idea, I will try to create cmake config files, to use just find_package on client side

@facebook-github-bot
Copy link
Contributor

@IvanKobzarev merged this pull request in a0569ad.

@facebook-github-bot facebook-github-bot deleted the gh/IvanKobzarev/49/head branch July 5, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants