Improvements to the build system #4609

Merged
merged 6 commits into from Feb 17, 2017

Conversation

Projects
None yet
3 participants
Contributor

intelfx commented Aug 20, 2016

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:

  • most of the dependencies are made PUBLIC (i. e. the client programs will link to them). This mimics the previous behavior, but it might be worth to revise configuration. E. g. the BLAS libraries — do we really need to make clients link to them?

Tests done:

  • building as a static and shared library for GNU/Linux and Android, linking to a sample project.

shelhamer added the build label Aug 20, 2016

intelfx added some commits Aug 14, 2016

@intelfx intelfx cmake: fix usage of INCLUDE_DIR/INCLUDE_DIRS in Dependencies.cmake b9c3c06
@intelfx intelfx cmake: add option to link with OpenMP
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).
f1b9da5
@intelfx intelfx cmake/Templates: properly spell OpenCV CMake config file name a59e647
@intelfx intelfx cmake: refactor deps detection, specify all dependencies in the expor…
…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.
ba189d9
@intelfx intelfx net.cpp: do not include test/test_caffe_main.hpp 6200b91
@intelfx intelfx cmake/Templates: remove duplicated #cmakedefines from caffe_config.h.in
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 #4625.
6ed799c

@shelhamer shelhamer merged commit 9bb1b9c into BVLC:master Feb 17, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Owner

shelhamer commented Feb 17, 2017

Thanks for the build polish.

+ PUBLIC
+ $<BUILD_INTERFACE:${Caffe_INCLUDE_DIR}>
+ $<INSTALL_INTERFACE:include>)
+target_compile_definitions(caffe ${Caffe_DEFINITIONS})
@willyd

willyd Mar 17, 2017 edited

Contributor

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})
@willyd

willyd Mar 17, 2017

Contributor

According to the CMake release notes this command was added in 2.8.12. The root CMakeLists currently requires only 2.8.7.

Contributor

willyd commented Mar 17, 2017

@intelfx Looks like we should also bump the minimum CMake version from 2.8.7 to 2.8.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment