summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorEvan Shelhamer <shelhamer@imaginarynumber.net>2017-02-16 16:35:51 -0800
committerGitHub <noreply@github.com>2017-02-16 16:35:51 -0800
commit9bb1b9cde2f5a9b0294a64626f7154cc746e303b (patch)
treea4cf47c395aed6c83dbc496d355890b717df2bb9 /CMakeLists.txt
parent475d6195e835467e0f2642f7bec4e7ecd36f43e6 (diff)
parent6ed799cb206c6b70bdd260d62e8ff3e077f5b635 (diff)
downloadcaffe-9bb1b9cde2f5a9b0294a64626f7154cc746e303b.tar.gz
caffe-9bb1b9cde2f5a9b0294a64626f7154cc746e303b.tar.bz2
caffe-9bb1b9cde2f5a9b0294a64626f7154cc746e303b.zip
Merge pull request #4609 from intelfx/BVLC-work-buildsystem
[cmake] Improvements to the build system
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt25
1 files changed, 21 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 15a7fe46..f6e0898c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,6 +39,7 @@ caffe_option(USE_OPENCV "Build with OpenCV support" ON)
caffe_option(USE_LEVELDB "Build with levelDB" ON)
caffe_option(USE_LMDB "Build with lmdb" ON)
caffe_option(ALLOW_LMDB_NOLOCK "Allow MDB_NOLOCK when reading LMDB files (only if necessary)" OFF)
+caffe_option(USE_OPENMP "Link with OpenMP (when your BLAS wants OpenMP and you get linker errors)" OFF)
# ---[ Dependencies
include(cmake/Dependencies.cmake)
@@ -55,8 +56,6 @@ if(USE_libstdcpp)
message("-- Warning: forcing libstdc++ (controlled by USE_libstdcpp option in cmake)")
endif()
-add_definitions(-DGTEST_USE_OWN_TR1_TUPLE)
-
# ---[ Warnings
caffe_warnings_disable(CMAKE_CXX_FLAGS -Wno-sign-compare -Wno-uninitialized)
@@ -65,8 +64,26 @@ configure_file(cmake/Templates/caffe_config.h.in "${PROJECT_BINARY_DIR}/caffe_co
# ---[ Includes
set(Caffe_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
-include_directories(${Caffe_INCLUDE_DIR} ${PROJECT_BINARY_DIR})
-include_directories(BEFORE src) # This is needed for gtest.
+set(Caffe_SRC_DIR ${PROJECT_SOURCE_DIR}/src)
+include_directories(${PROJECT_BINARY_DIR})
+
+# ---[ Includes & defines for CUDA
+
+# cuda_compile() does not have per-call dependencies or include pathes
+# (cuda_compile() has per-call flags, but we set them here too for clarity)
+#
+# list(REMOVE_ITEM ...) invocations remove PRIVATE and PUBLIC keywords from collected definitions and include pathes
+if(HAVE_CUDA)
+ # pass include pathes to cuda_include_directories()
+ set(Caffe_ALL_INCLUDE_DIRS ${Caffe_INCLUDE_DIRS})
+ list(REMOVE_ITEM Caffe_ALL_INCLUDE_DIRS PRIVATE PUBLIC)
+ cuda_include_directories(${Caffe_INCLUDE_DIR} ${Caffe_SRC_DIR} ${Caffe_ALL_INCLUDE_DIRS})
+
+ # add definitions to nvcc flags directly
+ set(Caffe_ALL_DEFINITIONS ${Caffe_DEFINITIONS})
+ list(REMOVE_ITEM Caffe_ALL_DEFINITIONS PRIVATE PUBLIC)
+ list(APPEND CUDA_NVCC_FLAGS ${Caffe_ALL_DEFINITIONS})
+endif()
# ---[ Subdirectories
add_subdirectory(src/gtest)