From cb8a987ce714283b66db49d1bc9d5b108caaa707 Mon Sep 17 00:00:00 2001 From: alexander Date: Fri, 11 Feb 2022 13:23:22 +0000 Subject: MLECO-2752: Minor refactoring for native global steps. And further optimisations of extendability for platform build steps. Added a list for excluded use-cases. Change-Id: I5a9398bbeb595a5bf2ea39b81623e4f20238f948 Signed-off-by: alexander --- .../platforms/native/build_configuration.cmake | 41 +++++++++++----------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'scripts/cmake/platforms') diff --git a/scripts/cmake/platforms/native/build_configuration.cmake b/scripts/cmake/platforms/native/build_configuration.cmake index c87ac89..bf6f980 100644 --- a/scripts/cmake/platforms/native/build_configuration.cmake +++ b/scripts/cmake/platforms/native/build_configuration.cmake @@ -15,19 +15,6 @@ # limitations under the License. #---------------------------------------------------------------------------- -set(TEST_TPIP ${DOWNLOAD_DEP_DIR}/test) - -file(MAKE_DIRECTORY ${TEST_TPIP}) -set(TEST_TPIP_INCLUDE ${TEST_TPIP}/include) -file(MAKE_DIRECTORY ${TEST_TPIP_INCLUDE}) - -ExternalProject_Add(catch2-headers - URL https://github.com/catchorg/Catch2/releases/download/v2.11.1/catch.hpp - DOWNLOAD_NO_EXTRACT 1 - CONFIGURE_COMMAND "" - BUILD_COMMAND bash -c "cp -R /catch.hpp ${TEST_TPIP_INCLUDE}" - INSTALL_COMMAND "") - function(set_platform_global_defaults) message(STATUS "Platform: Native (Linux based x86_64/aarch64 system)") if (NOT DEFINED CMAKE_TOOLCHAIN_FILE) @@ -35,6 +22,24 @@ function(set_platform_global_defaults) CACHE FILEPATH "Toolchain file") endif() + set(TEST_TPIP ${DOWNLOAD_DEP_DIR}/test) + + file(MAKE_DIRECTORY ${TEST_TPIP}) + set(TEST_TPIP_INCLUDE ${TEST_TPIP}/include) + file(MAKE_DIRECTORY ${TEST_TPIP_INCLUDE}) + + ExternalProject_Add(catch2-headers + URL https://github.com/catchorg/Catch2/releases/download/v2.11.1/catch.hpp + DOWNLOAD_NO_EXTRACT 1 + CONFIGURE_COMMAND "" + BUILD_COMMAND ${CMAKE_COMMAND} -E copy /catch.hpp ${TEST_TPIP_INCLUDE} + INSTALL_COMMAND "") + + add_library(catch2 INTERFACE) + target_include_directories(catch2 + INTERFACE + ${TEST_TPIP_INCLUDE}) + endfunction() function(platform_custom_post_build) @@ -98,16 +103,10 @@ function(platform_custom_post_build) set(TEST_TARGET_NAME "${CMAKE_PROJECT_NAME}-${use_case}-tests") add_executable(${TEST_TARGET_NAME} ${TEST_SOURCES}) - target_include_directories(${TEST_TARGET_NAME} PUBLIC - ${TEST_TPIP_INCLUDE} ${TEST_RESOURCES_INCLUDE}) - target_link_libraries(${TEST_TARGET_NAME} PUBLIC ${UC_LIB_NAME}) + target_include_directories(${TEST_TARGET_NAME} PRIVATE ${TEST_RESOURCES_INCLUDE}) + target_link_libraries(${TEST_TARGET_NAME} PRIVATE ${UC_LIB_NAME} catch2) target_compile_definitions(${TEST_TARGET_NAME} PRIVATE "ACTIVATION_BUF_SZ=${${use_case}_ACTIVATION_BUF_SZ}" TESTS) - - add_dependencies( - "${TEST_TARGET_NAME}" - "catch2-headers" - ) endif () endfunction() \ No newline at end of file -- cgit v1.2.1