diff options
author | David Svantesson <david.svantesson@arm.com> | 2023-04-24 16:47:04 +0000 |
---|---|---|
committer | David Svantesson <david.svantesson@arm.com> | 2023-05-03 10:49:45 +0000 |
commit | b5d6c28d41c4228c5bfaf06e451c21c387b3ce5f (patch) | |
tree | 445a1dfe8bbbbac7f3d530c373f700aa7fd49e4a /CMakeLists.txt | |
parent | 54e52a9408f874e96d7872d09121f64a001b2c47 (diff) | |
download | ComputeLibrary-b5d6c28d41c4228c5bfaf06e451c21c387b3ce5f.tar.gz |
Bazel and CMake updates
Updates to CMake and Bazel builds addressing:
* Cmake options are named too generic
* Use CMAKE_CXX_FLAGS_DEBUG instead of DEBUG option
* Option to disable tests
* Bazel: rename "arm_compute" to "arm_compute_core"
Resolves: ONCPUML-1252
Signed-off-by: David Svantesson <david.svantesson@arm.com>
Change-Id: If65b0cfcca77e2423777b0b901a5b733cfca6bfc
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9501
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 060370d33a..3c6798784a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,7 @@ endif() # --------------------------------------------------------------------- # Configuration +set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -gdwarf-2 -DARM_COMPUTE_ASSERTS_ENABLED") # Default to Release Build if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE @@ -113,26 +114,20 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") add_compile_options("-Wno-psabi") endif() -# Compile with -Werror if WERROR set -if(WERROR) +# Compile with -Werror if ARM_COMPUTE_WERROR set +if(ARM_COMPUTE_WERROR) add_compile_options("-Werror") endif() -# Compile with debug flags and define ARM_COMPUTE_ASSERTS_ENABLED if DEBUG set -if(DEBUG) - add_compile_options("-O0" "-g" "-gdwarf-2") - add_definitions(-DARM_COMPUTE_ASSERTS_ENABLED) # ARM_COMPUTE_DEBUG_ENABLED ?? -endif() - # Compile with -fno-exceptions flag and define ARM_COMPUTE_EXCEPTIONS_DISABLED -# if DEBUG set -if(NOT EXCEPTIONS) +# if ARM_COMPUTE_EXCEPTIONS not set +if(NOT ARM_COMPUTE_EXCEPTIONS) add_compile_options("-fno-exceptions") add_definitions(-DARM_COMPUTE_EXCEPTIONS_DISABLED) endif() -# Link OpenMP libraries if OPENMP flag on -if(OPENMP) +# Link OpenMP libraries if ARM_COMPUTE_OPENMP set +if(ARM_COMPUTE_OPENMP) find_package(OpenMP) if(OpenMP_CXX_FOUND) link_libraries(OpenMP::OpenMP_CXX) @@ -240,37 +235,36 @@ add_library(ArmCompute::Graph ALIAS arm_compute_graph) # Library Target Sources add_subdirectory(src) -# --------------------------------------------------------------------- -# Validation Framework Library -add_library(arm_compute_validation_framework "") -# target_compile_options(arm_compute_validation_framework PRIVATE -# "-march=armv8.2-a") -target_compile_options(arm_compute_validation_framework - PRIVATE "-march=armv8.2-a+fp16") - -add_subdirectory(tests) -target_include_directories( - arm_compute_validation_framework - PUBLIC $<INSTALL_INTERFACE:include> - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> - ${CMAKE_CURRENT_SOURCE_DIR}) -target_compile_options(arm_compute_validation_framework - PUBLIC ${COMMON_CXX_FLAGS}) - target_link_libraries( - arm_compute_validation_framework - PUBLIC arm_compute_core arm_compute_graph) - -# --------------------------------------------------------------------- -# Validation Binary +if(ARM_COMPUTE_BUILD_TESTING) + # --------------------------------------------------------------------- + # Validation Framework Library + add_library(arm_compute_validation_framework "") + # target_compile_options(arm_compute_validation_framework PRIVATE + # "-march=armv8.2-a") + target_compile_options(arm_compute_validation_framework + PRIVATE "-march=armv8.2-a+fp16") + + add_subdirectory(tests) + target_include_directories( + arm_compute_validation_framework + PUBLIC $<INSTALL_INTERFACE:include> + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> + ${CMAKE_CURRENT_SOURCE_DIR}) + target_compile_options(arm_compute_validation_framework + PUBLIC ${COMMON_CXX_FLAGS}) + target_link_libraries( + arm_compute_validation_framework + PUBLIC arm_compute_core arm_compute_graph) -if(BUILD_TESTING) + # --------------------------------------------------------------------- + # Validation Binary add_executable(arm_compute_validation "") target_compile_options(arm_compute_validation PRIVATE "-march=armv8.2-a+fp16") - if(ENABLE_BF16_VALIDATION) + if(ARM_COMPUTE_ENABLE_BF16_VALIDATION) target_compile_definitions(arm_compute_validation PRIVATE ARM_COMPUTE_ENABLE_BF16) endif() - if(ENABLE_SVE_VALIDATION) + if(ARM_COMPUTE_ENABLE_SVE_VALIDATION) target_compile_definitions(arm_compute_validation PRIVATE ENABLE_SVE) target_compile_definitions(arm_compute_validation PRIVATE ARM_COMPUTE_ENABLE_SVE) endif() @@ -300,11 +294,11 @@ if(BUILD_TESTING) arm_compute_benchmark PUBLIC arm_compute_core arm_compute_graph arm_compute_validation_framework) -endif() # BUILD_TESTING +endif() # ARM_COMPUTE_BUILD_TESTING # --------------------------------------------------------------------- # Examples Binaries -if(BUILD_EXAMPLES) +if(ARM_COMPUTE_BUILD_EXAMPLES) add_subdirectory(examples) @@ -331,4 +325,4 @@ if(BUILD_EXAMPLES) target_link_libraries(${test_name} PUBLIC arm_compute_core) endforeach() -endif() # BUILD_EXAMPLES +endif() # ARM_COMPUTE_BUILD_EXAMPLES |