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 +++++++++++----------- scripts/cmake/tensorflow.cmake | 18 +--------- scripts/cmake/util_functions.cmake | 17 +++++++++ 3 files changed, 38 insertions(+), 38 deletions(-) (limited to 'scripts') 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 diff --git a/scripts/cmake/tensorflow.cmake b/scripts/cmake/tensorflow.cmake index 9a4066d..9d72405 100644 --- a/scripts/cmake/tensorflow.cmake +++ b/scripts/cmake/tensorflow.cmake @@ -1,5 +1,5 @@ #---------------------------------------------------------------------------- -# Copyright (c) 2021 Arm Limited. All rights reserved. +# Copyright (c) 2021 - 2022 Arm Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -65,22 +65,6 @@ else() DESTINATION ${TENSORFLOW_LITE_MICRO_PATH}/tools/make/targets/) endif() -#TODO: this thing fails the TF build, when the driver is compiled, fatal error: 'ethosETHOSU_ARCH_interface.h' file not found -#if (CMAKE_SYSTEM_PROCESSOR STREQUAL cortex-m55) -# set(TENSORFLOW_LITE_MICRO_TARGET "cortex_m_generic") -# set(TENSORFLOW_LITE_MICRO_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR}${CPU_FEATURES}) -# if(ETHOS_U_NPU_ENABLED) -# # Arm Ethos-U55 NPU is the co-processor for ML workload: -# set(TENSORFLOW_LITE_MICRO_CO_PROCESSOR "ethos_u") -# endif() -# -# set(TENSORFLOW_LITE_MICRO_OPTIMIZED_KERNEL "cmsis_nn") -# -#else() -# set(TENSORFLOW_LITE_MICRO_TARGET "linux") -# set(TENSORFLOW_LITE_MICRO_TARGET_ARCH x86_64) -#endif() - if (TENSORFLOW_LITE_MICRO_CLEAN_DOWNLOADS) list(APPEND MAKE_TARGETS_LIST "clean_downloads") endif() diff --git a/scripts/cmake/util_functions.cmake b/scripts/cmake/util_functions.cmake index f9742f7..447265c 100644 --- a/scripts/cmake/util_functions.cmake +++ b/scripts/cmake/util_functions.cmake @@ -174,3 +174,20 @@ function(download_file_from_modelzoo model_zoo_version file_sub_path download_pa endif() endfunction() + +function(add_platform_build_configuration) + + set(oneValueArgs TARGET_PLATFORM) + cmake_parse_arguments(PARSED "" "${oneValueArgs}" "" ${ARGN} ) + message(STATUS "Searching for ${PARSED_TARGET_PLATFORM} build configuration") + list(APPEND PLATFORM_BUILD_CONFIG_DIRS ${CMAKE_SCRIPTS_DIR}/platforms) + + FIND_PATH(PLATFORM_BUILD_CONFIG + NAMES build_configuration.cmake + PATH_SUFFIXES ${PARSED_TARGET_PLATFORM} + PATHS ${PLATFORM_BUILD_CONFIG_DIRS} + ) + + message(STATUS "Found build configuration: ${PLATFORM_BUILD_CONFIG}") + include(${PLATFORM_BUILD_CONFIG}/build_configuration.cmake) +endfunction() \ No newline at end of file -- cgit v1.2.1