From 2c197daecffc4caf26076c76f28e8b1e9925ef3a Mon Sep 17 00:00:00 2001 From: robotchaoX <43107451+robotchaoX@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:52:09 +0800 Subject: [PATCH] Fix system test build issue for Android (#879) [Why] System test should be static library as dependency. Cyclic dependencies are allowed only among static libraries. [How] Buid system test as static libray. --- app/apps/CMakeLists.txt | 4 ++-- bldsys/cmake/sample_helper.cmake | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/apps/CMakeLists.txt b/app/apps/CMakeLists.txt index b90bdba44..689131494 100644 --- a/app/apps/CMakeLists.txt +++ b/app/apps/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023, Arm Limited and Contributors +# Copyright (c) 2020-2024, Arm Limited and Contributors # # SPDX-License-Identifier: Apache-2.0 # @@ -89,7 +89,7 @@ foreach(ID ${PROJECT_ID_LIST}) if(TARGET ${ID}) get_target_property(TARGET_TYPE ${ID} TYPE) - if(TARGET_TYPE STREQUAL "OBJECT_LIBRARY") + if(TARGET_TYPE STREQUAL "OBJECT_LIBRARY" OR TARGET_TYPE STREQUAL "STATIC_LIBRARY") target_link_libraries(${PROJECT_NAME} PUBLIC ${ID}) endif() endif() diff --git a/bldsys/cmake/sample_helper.cmake b/bldsys/cmake/sample_helper.cmake index acfa9b2d7..e0e012c00 100644 --- a/bldsys/cmake/sample_helper.cmake +++ b/bldsys/cmake/sample_helper.cmake @@ -1,5 +1,5 @@ #[[ - Copyright (c) 2019-2023, Arm Limited and Contributors + Copyright (c) 2019-2024, Arm Limited and Contributors SPDX-License-Identifier: Apache-2.0 @@ -95,6 +95,11 @@ function(vkb_add_test) cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(SRC_FILES + ${TARGET_ID}.h + ${TARGET_ID}.cpp + ) + add_project( TYPE "Test" ID ${TARGET_ID} @@ -102,11 +107,9 @@ function(vkb_add_test) AUTHOR " " NAME ${TARGET_ID} DESCRIPTION " " - VENDOR_TAG " " - LIBS test_framework - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_ID}.h - ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_ID}.cpp) + TAGS " " + FILES ${SRC_FILES} + LIBS test_framework) endfunction() function(add_project) @@ -137,7 +140,11 @@ function(add_project) source_group("\\Shaders" FILES ${SHADERS_GLSL}) endif() +if(${TARGET_TYPE} STREQUAL "Sample") add_library(${PROJECT_NAME} OBJECT ${TARGET_FILES} ${SHADERS_GLSL}) +elseif(${TARGET_TYPE} STREQUAL "Test") + add_library(${PROJECT_NAME} STATIC ${TARGET_FILES} ${SHADERS_GLSL}) +endif() set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) # # inherit include directories from framework target