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