1e5c31af7Sopenharmony_ci# cmake file for glslang
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/SPIRV/GlslangToSpv.cpp")
8e5c31af7Sopenharmony_ci	set(DEFAULT_GLSLANG_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)
9e5c31af7Sopenharmony_cielse ()
10e5c31af7Sopenharmony_ci	set(DEFAULT_GLSLANG_SRC_PATH "../glslang")
11e5c31af7Sopenharmony_ciendif ()
12e5c31af7Sopenharmony_ci
13e5c31af7Sopenharmony_ciset(GLSLANG_SRC_PATH ${DEFAULT_GLSLANG_SRC_PATH} CACHE STRING "Path to glslang source tree")
14e5c31af7Sopenharmony_ci
15e5c31af7Sopenharmony_ciif (IS_ABSOLUTE ${GLSLANG_SRC_PATH})
16e5c31af7Sopenharmony_ci	set(GLSLANG_ABS_PATH ${GLSLANG_SRC_PATH})
17e5c31af7Sopenharmony_cielse ()
18e5c31af7Sopenharmony_ci	set(GLSLANG_ABS_PATH "${CMAKE_SOURCE_DIR}/${GLSLANG_SRC_PATH}")
19e5c31af7Sopenharmony_ciendif ()
20e5c31af7Sopenharmony_ci
21e5c31af7Sopenharmony_ciif (EXISTS ${GLSLANG_ABS_PATH}/glslang/GenericCodeGen/CodeGen.cpp)
22e5c31af7Sopenharmony_ci	message(STATUS "glslang found")
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci	# Disable glslang install as part of cmake install.
25e5c31af7Sopenharmony_ci	set(SKIP_GLSLANG_INSTALL OFF CACHE BOOL "" FORCE)
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_ci	# Do not build glslang binaries.
28e5c31af7Sopenharmony_ci	set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "" FORCE)
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_ci	# Overwrite the CMake flags for glslang with the our 3rd party ones.
31e5c31af7Sopenharmony_ci	set(CMAKE_C_FLAGS	${DE_3RD_PARTY_C_FLAGS})
32e5c31af7Sopenharmony_ci	set(CMAKE_CXX_FLAGS	${DE_3RD_PARTY_CXX_FLAGS})
33e5c31af7Sopenharmony_ci
34e5c31af7Sopenharmony_ci	add_subdirectory(${GLSLANG_ABS_PATH})
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ci	add_definitions(-DENABLE_HLSL)
37e5c31af7Sopenharmony_ci
38e5c31af7Sopenharmony_ci	set(GLSLANG_INCLUDE_PATH	${GLSLANG_ABS_PATH}			PARENT_SCOPE)
39e5c31af7Sopenharmony_ci	set(GLSLANG_LIBRARIES		glslang SPIRV SPVRemapper	PARENT_SCOPE)
40e5c31af7Sopenharmony_cielse ()
41e5c31af7Sopenharmony_ci	message(FATAL_ERROR "glslang not found")
42e5c31af7Sopenharmony_ciendif ()
43