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

Optional find dependency in installed cmake config. #7099

Merged
merged 11 commits into from
Jul 11, 2021

Conversation

trivialfis
Copy link
Member

@trivialfis trivialfis commented Jul 10, 2021

Following up #6159 . This PR removes find_dependency in CMake config and make sure dependencies are private if xgboost is built as shared library (the default).

An issue was found during writing another C demo for external memory, where I have to set the project with CXX language to get CMake working (but I'm writing a demo for C). Also FindNccl is a custom script in xgboost which is not available as part of CMake, adding it to dependency will break users' code.

After the PR we simply include gputreeshap header instead of linking it due to a CMake error saying it's not in the export set when built as a static library.

Other than these, I added a simple script using readelf to show that the C demo is not linking anything from the dependency set of xgboost.

@codecov-commenter
Copy link

codecov-commenter commented Jul 10, 2021

Codecov Report

Merging #7099 (7514021) into master (77f6cf2) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7099   +/-   ##
=======================================
  Coverage   81.59%   81.59%           
=======================================
  Files          13       13           
  Lines        3901     3901           
=======================================
  Hits         3183     3183           
  Misses        718      718           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77f6cf2...7514021. Read the comment docs.

@@ -4,7 +4,7 @@ find_package(Threads REQUIRED)

set(RABIT_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/allreduce_base.cc
${CMAKE_CURRENT_LIST_DIR}/src/c_api.cc)
${CMAKE_CURRENT_LIST_DIR}/src/rabit_c_api.cc)
Copy link
Member Author

@trivialfis trivialfis Jul 11, 2021

Choose a reason for hiding this comment

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

msvc complains that 2 files having same name might produce incorrect result. So I renamed the c api file and merged the test_io.cc into xgboost.

@trivialfis trivialfis merged commit 3457968 into dmlc:master Jul 11, 2021
@trivialfis trivialfis deleted the cmake-install-targets branch July 11, 2021 09:20
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

Successfully merging this pull request may close these issues.

3 participants