]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - jacinto-ai/caffe-jacinto.git/blobdiff - CMakeLists.txt
doc update
[jacinto-ai/caffe-jacinto.git] / CMakeLists.txt
index ff9ec4b624fd029c39995f4e309d83fae8b880ea..a7817943d5fc433ef77b2348ee1a14c36632e50f 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.7)
+cmake_minimum_required(VERSION 3.4.0)
 if(POLICY CMP0046)
   cmake_policy(SET CMP0046 NEW)
 endif()
@@ -10,8 +10,8 @@ endif()
 project(Caffe C CXX)
 
 # ---[ Caffe version
-set(CAFFE_TARGET_VERSION "0.16.1")
-set(CAFFE_TARGET_SOVERSION "0.16")
+set(CAFFE_TARGET_VERSION "0.17.0")
+set(CAFFE_TARGET_SOVERSION "0.17")
 add_definitions(-DCAFFE_VERSION=${CAFFE_TARGET_VERSION})
 
 # Skip `typedef __half half;`
@@ -29,21 +29,20 @@ include(cmake/Summary.cmake)
 include(cmake/ConfigGen.cmake)
 
 # ---[ Options
-caffe_option(CPU_ONLY  "Build Caffe without CUDA support" OFF) # TODO: rename to USE_CUDA
-caffe_option(USE_CUDNN "Build Caffe with cuDNN library support" ON IF NOT CPU_ONLY)
+caffe_option(USE_CUDNN "Build Caffe with cuDNN library support" ON)
 
 # USE_NCCL: Build Caffe with NCCL Library support
 # Regular ON/OFF option doesn't work here because we need to recognize 3 states:
 # 1. User didn't set USE_NCCL option =>
-#   1.1 If CPU_ONLY is ON we do nothing.
-#   1.2 If CPU_ONLY is OFF we *quietly* try to find it and use if found; do nothing otherwise.
+#   1.1 We *quietly* try to find it and use if found; do nothing otherwise.
 # 2. User explicitly set USE_NCCL=ON option =>
-#   1.1 If CPU_ONLY is ON we do nothing (it's higher priority).
-#   2.1 If CPU_ONLY is OFF we try to find it with *required* option, thus CMake fails if not found. 
+#   1.1 We try to find it with *required* option, thus CMake fails if not found.
 # 3. User explicitly set USE_NCCL=OFF option => we do nothing.
-SET(USE_NCCL)
-if(DEFINED USE_NCCL)
-  STRING(TOUPPER "${USE_NCCL}" USE_NCCL)
+set(USE_NCCL "NONE" CACHE STRING "Link Caffe with NCCL Library for Multi-GPU support")
+if(USE_NCCL STREQUAL "NONE")
+  set(USE_NCCL_SET OFF)
+else()
+  set(USE_NCCL_SET ON)
 endif()
 
 caffe_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
@@ -55,10 +54,14 @@ caffe_option(BUILD_python_layer "Build the Caffe Python layer" ON)
 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(TEST_FP16 "Build Caffe Tests with 16 bit mode included" OFF)
 caffe_option(NO_NVML "Build Caffe Tests without NVML (i.e. no CPU affinity)" OFF)
 
+if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^aarch")
+  # Tegra
+  set(NO_NVML ON)
+endif()
+
 # ---[ Dependencies
 include(cmake/Dependencies.cmake)
 
@@ -67,6 +70,11 @@ if(UNIX OR APPLE)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -std=c++11")
 endif()
 
+# The flag USE_OPENCV is not getting set automatically. Set it explicitly.
+if (USE_OPENCV)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_OPENCV")
+endif()
+
 caffe_set_caffe_link()
 
 if(USE_libstdcpp)