Skip to content

Commit

Permalink
Fix iOS / Android CMake builds (#5482)
Browse files Browse the repository at this point in the history
* cmake: Simplify usage of option

boolean OFF is the default value:
https://cmake.org/cmake/help/latest/command/option.html

* Fix iOS / Android CMake builds

closes #4437
  • Loading branch information
juan-lunarg authored Nov 28, 2023
1 parent 7d2a618 commit afaf8fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
22 changes: 15 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,23 @@ if(ENABLE_SPIRV_TOOLS_INSTALL)
endmacro()
endif()

# Defaults to OFF if the user didn't set it.
option(SPIRV_SKIP_EXECUTABLES
"Skip building the executable and tests along with the library"
${SPIRV_SKIP_EXECUTABLES})
option(SPIRV_SKIP_TESTS
"Skip building tests along with the library" ${SPIRV_SKIP_TESTS})
if ("${SPIRV_SKIP_EXECUTABLES}")
# Currently iOS and Android are very similar.
# They both have their own packaging (APP/APK).
# Which makes regular executables/testing problematic.
#
# Currently the only deliverables for these platforms are
# libraries (either STATIC or SHARED).
#
# Furthermore testing is equally problematic.
if (IOS OR ANDROID)
set(SPIRV_SKIP_EXECUTABLES ON)
endif()

option(SPIRV_SKIP_EXECUTABLES "Skip building the executable and tests along with the library")
if (SPIRV_SKIP_EXECUTABLES)
set(SPIRV_SKIP_TESTS ON)
endif()
option(SPIRV_SKIP_TESTS "Skip building tests along with the library")

# Defaults to ON. The checks can be time consuming.
# Turn off if they take too long.
Expand Down
6 changes: 0 additions & 6 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,6 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
endif()
endif()

if (ANDROID)
foreach(target ${SPIRV_TOOLS_TARGETS})
target_link_libraries(${target} PRIVATE android log)

This comment has been minimized.

Copy link
@juan-lunarg

juan-lunarg Nov 29, 2023

Author Contributor

I figured out why this was added now. And it shouldn't have been added to SPIRV-Tools. We should explicitly link android in the vulkan validation layers which actually uses AHardwareBuffer_describe. I'll address this when we update SPIRV-Tools in the validation layers.

This comment has been minimized.

Copy link
@juan-lunarg
endforeach()
endif()

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS ${SPIRV_TOOLS_TARGETS} EXPORT ${SPIRV_TOOLS}Targets)
export(EXPORT ${SPIRV_TOOLS}Targets FILE ${SPIRV_TOOLS}Target.cmake)
Expand Down

0 comments on commit afaf8fd

Please sign in to comment.