diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f6dff507ae..15f42b9a2d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,11 +322,22 @@ endif() add_subdirectory(ThirdParty) -enable_testing() +if (NOT (DEFINED ENABLE_TESTS)) + message("Test build not explicitly disabled. Enabling implicitly") + set(ENABLE_TESTS ON CACHE BOOL "") +endif(NOT (DEFINED ENABLE_TESTS)) + +if (ENABLE_TESTS) + message("Compiling test targets enabled") + enable_testing() + add_subdirectory(NightlyTests) +else (ENABLE_TESTS) + message("Compiling test targets disabled") +endif() + add_subdirectory(ModelOptimizations) add_subdirectory(TrainingExtensions) add_subdirectory(Examples) -add_subdirectory(NightlyTests) add_subdirectory(Docs) if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Benchmarks") add_subdirectory(Benchmarks) diff --git a/ModelOptimizations/DlCompression/CMakeLists.txt b/ModelOptimizations/DlCompression/CMakeLists.txt index eb767e2f35e..22775a1fcfc 100644 --- a/ModelOptimizations/DlCompression/CMakeLists.txt +++ b/ModelOptimizations/DlCompression/CMakeLists.txt @@ -60,5 +60,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/DlCompression DESTINATION ${AIMET_INSTALL_DIR}/lib/x86_64-linux-gnu/include) -add_subdirectory(test) +if (ENABLE_TESTS) + add_subdirectory(test) +endif() + whl_add_whl_prep_common_target(DlCompression) diff --git a/ModelOptimizations/DlEqualization/CMakeLists.txt b/ModelOptimizations/DlEqualization/CMakeLists.txt index 74437875db9..ae63d9d59eb 100644 --- a/ModelOptimizations/DlEqualization/CMakeLists.txt +++ b/ModelOptimizations/DlEqualization/CMakeLists.txt @@ -78,5 +78,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/DlEqualization DESTINATION ${AIMET_INSTALL_DIR}/lib/x86_64-linux-gnu/include) -add_subdirectory(test) +if (ENABLE_TESTS) + add_subdirectory(test) +endif() + whl_add_whl_prep_common_target(DlEqualization) diff --git a/ModelOptimizations/DlQuantization/CMakeLists.txt b/ModelOptimizations/DlQuantization/CMakeLists.txt index d84589a8319..9a1b70ef438 100644 --- a/ModelOptimizations/DlQuantization/CMakeLists.txt +++ b/ModelOptimizations/DlQuantization/CMakeLists.txt @@ -124,5 +124,8 @@ endif (ENABLE_CUDA) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/DlQuantization DESTINATION ${AIMET_INSTALL_DIR}/lib/x86_64-linux-gnu/include) -add_subdirectory(test) +if (ENABLE_TESTS) + add_subdirectory(test) +endif() + whl_add_whl_prep_common_target(DlQuantization) diff --git a/TrainingExtensions/common/CMakeLists.txt b/TrainingExtensions/common/CMakeLists.txt index 4e1d716f8d1..3c50d54c938 100644 --- a/TrainingExtensions/common/CMakeLists.txt +++ b/TrainingExtensions/common/CMakeLists.txt @@ -35,7 +35,10 @@ #============================================================================== add_subdirectory(src/python) -add_subdirectory(test) + +if (ENABLE_TESTS) + add_subdirectory(test) +endif() add_custom_target(whl_prep_cp_common DEPENDS whl_prep_cp_common_DlCompression diff --git a/TrainingExtensions/onnx/CMakeLists.txt b/TrainingExtensions/onnx/CMakeLists.txt index f5315f55202..9eb1c593b5d 100644 --- a/TrainingExtensions/onnx/CMakeLists.txt +++ b/TrainingExtensions/onnx/CMakeLists.txt @@ -40,8 +40,10 @@ find_path(ONNXRUNTIME_INC "onnxruntime_cxx_api.h" PATH_SUFFIXES onnxruntime_head find_package(Eigen3 REQUIRED) add_subdirectory(src/python) -add_subdirectory(test) +if (ENABLE_TESTS) + add_subdirectory(test) +endif() add_library(OnnxCppOps SHARED src/QcQuantizeOp.h diff --git a/TrainingExtensions/tensorflow/CMakeLists.txt b/TrainingExtensions/tensorflow/CMakeLists.txt index 0548c9ed5cb..d52cc510f78 100644 --- a/TrainingExtensions/tensorflow/CMakeLists.txt +++ b/TrainingExtensions/tensorflow/CMakeLists.txt @@ -187,4 +187,7 @@ add_dependencies(whl_prep_ln whl_prep_ln_tensorflow) whl_add_whl_action_target(tensorflow) add_subdirectory(src/python) -add_subdirectory(test) + +if (ENABLE_TESTS) + add_subdirectory(test) +endif() diff --git a/TrainingExtensions/torch/CMakeLists.txt b/TrainingExtensions/torch/CMakeLists.txt index 5910e8c517c..8ab806fde5e 100644 --- a/TrainingExtensions/torch/CMakeLists.txt +++ b/TrainingExtensions/torch/CMakeLists.txt @@ -94,10 +94,11 @@ add_subdirectory(src/python) if (ENABLE_ONNX) message(STATUS "ONNX is enabled, skipping Torch Unit test") else(ENABLE_ONNX) - add_subdirectory(test) + if (ENABLE_TESTS) + add_subdirectory(test) + endif() endif(ENABLE_ONNX) - install(DIRECTORY ${CMAKE_BINARY_DIR}/artifacts/aimet_common/ DESTINATION ${AIMET_INSTALL_DIR}/lib/python/aimet_common FILES_MATCHING PATTERN "AimetTensorQuantizer*.so"