diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dc5cdb8c24..001077a5237 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,12 +9,6 @@ set(CAFFE2_VERSION_PATCH 1) set(CAFFE2_VERSION "${CAFFE2_VERSION_MAJOR}.${CAFFE2_VERSION_MINOR}.${CAFFE2_VERSION_PATCH}") -# ---[ Do not search cmake install prefix. See the following link for details: -# https://github.com/caffe2/caffe2/commit/251d2d0c521c781276eea3748d92fc92e5dbceab -message(STATUS "Setting CMAKE_FIND_NO_INSTALL_PREFIX") -set(CMAKE_FIND_NO_INSTALL_PREFIX TRUE) - - # ---[ Options. # Note to developers: if you add an option below, make sure you also add it to # cmake/Summary.cmake so that the summary prints out the option values. diff --git a/caffe2/binaries/CMakeLists.txt b/caffe2/binaries/CMakeLists.txt index 6995ef4268e..48e4d447af6 100644 --- a/caffe2/binaries/CMakeLists.txt +++ b/caffe2/binaries/CMakeLists.txt @@ -13,6 +13,10 @@ if (USE_CUDA) caffe2_binary_target("inspect_gpus.cc") target_link_libraries(inspect_gpus ${CUDA_LIBRARIES}) caffe2_binary_target("print_core_object_sizes.cc") + + # Core overhead benchmark + caffe2_binary_target("core_overhead_benchmark.cc") + target_link_libraries(core_overhead_benchmark benchmark) endif() if (USE_ZMQ) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 29df60ec984..72dccdf0d9d 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -114,17 +114,28 @@ endif() # ---[ Googletest and benchmark if(BUILD_TEST) + set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + # We will build gtest as static libs and embed it directly into the binary. + set(BUILD_SHARED_LIBS OFF) + # For gtest, we will simply embed it into our test binaries, so we won't + # need to install it. + set(BUILD_GTEST ON) + set(INSTALL_GTEST OFF) + # We currently don't need gmock right now. + set(BUILD_GMOCK OFF) add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/googletest) caffe2_include_directories(${PROJECT_SOURCE_DIR}/third_party/googletest/googletest/include) - find_package(Benchmark) - if(Benchmark_FOUND) - list(APPEND Caffe2_DEPENDENCY_LIBS ${Benchmark_LIBRARIES}) - caffe2_include_directories(${Benchmark_INCLUDE_DIRS}) - else() - add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/benchmark) - caffe2_include_directories(${PROJECT_SOURCE_DIR}/third_party/benchmark/include) - endif() + # We will not need to test benchmark lib itself. + set(BENCHMARK_ENABLE_TESTING OFF) + # We will not need to install benchmark. This is pending + # https://github.com/google/benchmark/pull/463 + set(INSTALL_BENCHMARK OFF) + add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/benchmark) + caffe2_include_directories(${PROJECT_SOURCE_DIR}/third_party/benchmark/include) + + # Recover the build shared libs option. + set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS}) endif() # ---[ LMDB diff --git a/third_party/benchmark b/third_party/benchmark index 4bf28e611b5..6d8339dd97a 160000 --- a/third_party/benchmark +++ b/third_party/benchmark @@ -1 +1 @@ -Subproject commit 4bf28e611b55de8a2d4eece3c335e014f8b0f630 +Subproject commit 6d8339dd97afea4633e54ed4b42307aff4386040 diff --git a/third_party/googletest b/third_party/googletest index 5e7fd50e17b..bfc0ffc8a69 160000 --- a/third_party/googletest +++ b/third_party/googletest @@ -1 +1 @@ -Subproject commit 5e7fd50e17b6edf1cadff973d0ec68966cf3265e +Subproject commit bfc0ffc8a698072c794ae7299db9cb6866f4c0bc