1e5c31af7Sopenharmony_ci# cmake file for spirv-tools 2e5c31af7Sopenharmony_ci 3e5c31af7Sopenharmony_ciif (NOT DE_DEFS) 4e5c31af7Sopenharmony_ci message(FATAL_ERROR "Include Defs.cmake") 5e5c31af7Sopenharmony_ciendif () 6e5c31af7Sopenharmony_ci 7e5c31af7Sopenharmony_ciif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/include/spirv-tools/libspirv.h") 8e5c31af7Sopenharmony_ci set(DEFAULT_SPIRV_TOOLS_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src) 9e5c31af7Sopenharmony_cielse () 10e5c31af7Sopenharmony_ci set(DEFAULT_SPIRV_TOOLS_SRC_PATH "../spirv-tools") 11e5c31af7Sopenharmony_ciendif () 12e5c31af7Sopenharmony_ci 13e5c31af7Sopenharmony_ciset(SPIRV_TOOLS_SRC_PATH ${DEFAULT_SPIRV_TOOLS_SRC_PATH} CACHE STRING "Path to spirv-tools source tree") 14e5c31af7Sopenharmony_ciif (IS_ABSOLUTE ${SPIRV_TOOLS_SRC_PATH}) 15e5c31af7Sopenharmony_ci set(SPIRV_TOOLS_ABS_PATH ${SPIRV_TOOLS_SRC_PATH}) 16e5c31af7Sopenharmony_cielse () 17e5c31af7Sopenharmony_ci set(SPIRV_TOOLS_ABS_PATH "${CMAKE_SOURCE_DIR}/${SPIRV_TOOLS_SRC_PATH}") 18e5c31af7Sopenharmony_ciendif () 19e5c31af7Sopenharmony_ci 20e5c31af7Sopenharmony_ciset(SPIRV_HEADERS_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../spirv-headers/src CACHE STRING "Path to spirv-headers source tree") 21e5c31af7Sopenharmony_ciif (IS_ABSOLUTE ${SPIRV_HEADERS_SRC_PATH}) 22e5c31af7Sopenharmony_ci set(SPIRV_HEADERS_ABS_PATH ${SPIRV_HEADERS_SRC_PATH}) 23e5c31af7Sopenharmony_cielse () 24e5c31af7Sopenharmony_ci set(SPIRV_HEADERS_ABS_PATH "${CMAKE_SOURCE_DIR}/${SPIRV_HEADERS_SRC_PATH}") 25e5c31af7Sopenharmony_ciendif () 26e5c31af7Sopenharmony_ci 27e5c31af7Sopenharmony_ciif (EXISTS ${SPIRV_TOOLS_ABS_PATH}/source/opcode.cpp AND 28e5c31af7Sopenharmony_ci EXISTS ${SPIRV_HEADERS_ABS_PATH}/include/spirv/1.0/spirv.h) 29e5c31af7Sopenharmony_ci message(STATUS "spirv-tools found") 30e5c31af7Sopenharmony_ci set(CMAKE_C_FLAGS ${DE_3RD_PARTY_C_FLAGS}) 31e5c31af7Sopenharmony_ci set(CMAKE_CXX_FLAGS ${DE_3RD_PARTY_CXX_FLAGS}) 32e5c31af7Sopenharmony_ci 33e5c31af7Sopenharmony_ci # SPIR-V tools requires SPIRV-Headers 34e5c31af7Sopenharmony_ci set(SPIRV-Headers_SOURCE_DIR ${SPIRV_HEADERS_ABS_PATH}) 35e5c31af7Sopenharmony_ci 36e5c31af7Sopenharmony_ci set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE) 37e5c31af7Sopenharmony_ci add_subdirectory(${SPIRV_TOOLS_ABS_PATH} spirv-tools) 38e5c31af7Sopenharmony_cielse () 39e5c31af7Sopenharmony_ci message(FATAL_ERROR "spirv-tools not found") 40e5c31af7Sopenharmony_ciendif () 41