Skip to content

Commit

Permalink
Fix system test build issue for Android (KhronosGroup#879)
Browse files Browse the repository at this point in the history
[Why]
System test should be static library as dependency.
Cyclic dependencies are allowed only among static libraries.

[How]
Buid system test as static libray.
  • Loading branch information
robotchaoX authored Jan 29, 2024
1 parent e4ee971 commit 2c197da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down Expand Up @@ -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()
Expand Down
19 changes: 13 additions & 6 deletions bldsys/cmake/sample_helper.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -95,18 +95,21 @@ 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}
CATEGORY "Tests"
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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2c197da

Please sign in to comment.