From b401e6b03a4f42a3cff3cfd7c68dd7718c8f7de0 Mon Sep 17 00:00:00 2001 From: Yangqing Jia Date: Wed, 6 Jun 2018 20:56:31 -0700 Subject: Allow optional build and installation of native test binaries (#8225) * test finetuning * install off by default * Turn BUILD_TEST=ON for jenkins. * Turn on install_test in jenkins as well --- .jenkins/caffe2/build.sh | 3 ++- CMakeLists.txt | 5 ++++- caffe2/CMakeLists.txt | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.jenkins/caffe2/build.sh b/.jenkins/caffe2/build.sh index f0442746f7..e0733b6e47 100755 --- a/.jenkins/caffe2/build.sh +++ b/.jenkins/caffe2/build.sh @@ -67,7 +67,6 @@ report_compile_cache_stats() { fi } - ############################################################################### # Explicitly set Python executable. ############################################################################### @@ -118,6 +117,8 @@ fi # Set cmake args ############################################################################### CMAKE_ARGS+=("-DBUILD_BINARY=ON") +CMAKE_ARGS+=("-DBUILD_TEST=ON") +CMAKE_ARGS+=("-DINSTALL_TEST=ON") CMAKE_ARGS+=("-DUSE_OBSERVERS=ON") CMAKE_ARGS+=("-DUSE_ZSTD=ON") CMAKE_ARGS+=("-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}") diff --git a/CMakeLists.txt b/CMakeLists.txt index f1488f6e50..e80f1b04fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,8 +57,11 @@ cmake_dependent_option( CAFFE2_USE_MSVC_STATIC_RUNTIME "Using MSVC static runtime libraries" ON "NOT BUILD_SHARED_LIBS" OFF) cmake_dependent_option( - BUILD_TEST "Build Caffe2 C++ test binaries (need gtest and gbenchmark)" ON + BUILD_TEST "Build Caffe2 C++ test binaries (need gtest and gbenchmark)" OFF "BUILD_CAFFE2" OFF) +cmake_dependent_option( + INSTALL_TEST "Install test binaries if BUILD_TEST is on" OFF + "BUILD_TEST" OFF) option(USE_ACL "Use ARM Compute Library" OFF) option(USE_ASAN "Use Address Sanitizer" OFF) option(USE_ATEN "Use ATen" OFF) diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index b247cad7d7..b98bace57e 100644 --- a/caffe2/CMakeLists.txt +++ b/caffe2/CMakeLists.txt @@ -289,7 +289,9 @@ if(BUILD_CAFFE2) target_compile_features(${test_name} PRIVATE cxx_range_for) endif() add_test(NAME ${test_name} COMMAND $) - install(TARGETS ${test_name} DESTINATION test) + if (INSTALL_TEST) + install(TARGETS ${test_name} DESTINATION test) + endif() endforeach() if(USE_ROCM) -- cgit v1.2.3