-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Improvements to the build system #4609
Conversation
bc20bb9
to
d5e5f8e
Compare
303e91c
to
c6d36b6
Compare
c6d36b6
to
b469777
Compare
…ted caffe target This is the first step towards "modern" IMPORTED-targets-only CMake setup. The find_package modules still need to be rewritten and upstreamed in form of config exports where possible.
Despite Caffe itself does not use OpenMP, explicitly linking to OpenMP should be done when one statically links to a BLAS library which uses OpenMP internally and does not provide proper CMake imported targets with proper dependencies (nobody this so far).
Rationale: these are duplicated in CMakeLists code, and they cannot be removed from there because many definitions need to be exported to the library clients. See issue BVLC#4625.
b469777
to
6ed799c
Compare
Thanks for the build polish. |
PUBLIC | ||
$<BUILD_INTERFACE:${Caffe_INCLUDE_DIR}> | ||
$<INSTALL_INTERFACE:include>) | ||
target_compile_definitions(caffe ${Caffe_DEFINITIONS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the CMake release notes this command was added in 2.8.11. The root CMakeLists currently requires only 2.8.7.
$<INSTALL_INTERFACE:include>) | ||
target_compile_definitions(caffe ${Caffe_DEFINITIONS}) | ||
if(Caffe_COMPILE_OPTIONS) | ||
target_compile_options(caffe ${Caffe_COMPILE_OPTIONS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the CMake release notes this command was added in 2.8.12. The root CMakeLists currently requires only 2.8.7.
@intelfx Looks like we should also bump the minimum CMake version from 2.8.7 to 2.8.12. |
@intelfx While moving toward 'modern' CMake is certainly laudable, IMPORTED targets are not yet very common and I'm sorely missing documentation/example on how to use them. Even the official CMake documentation does not help me much in that regard. Could you provide examples (possibly in the documentation of Right now I'm here: # [...]
find_package(Caffe)
add_library(Caffe SHARED IMPORTED)
# [...]
add_executable(myapp src/myapp.cpp)
target_link_libraries(myapp Caffe) This fails because the Caffe includes are not found (I should make clear that Caffe is not installed in Adding |
These are various improvements to the CMake buildsystem directed towards "modern" packaging with CMake IMPORTED targets and config-mode
find_package()
.There are several bugfixes and a slight refactoring of the buildsystem which makes Caffe properly export its transitive dependencies ("usage requirements") to the library users.
Open questions:
Tests done: