DO NOT MERGE Refresh GLES 3.1 must-pass XML am: d8e85a9be9 -s ours am: ba3d0b4eb3...
[platform/upstream/VK-GL-CTS.git] / external / glslang / CMakeLists.txt
1 # cmake file for glslang
2
3 if (NOT DE_DEFS)
4         message(FATAL_ERROR "Include Defs.cmake")
5 endif ()
6
7 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/SPIRV/GlslangToSpv.cpp")
8         set(DEFAULT_GLSLANG_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)
9 else ()
10         set(DEFAULT_GLSLANG_SRC_PATH "../glslang")
11 endif ()
12
13 set(GLSLANG_SRC_PATH ${DEFAULT_GLSLANG_SRC_PATH} CACHE STRING "Path to glslang source tree")
14
15 if (IS_ABSOLUTE ${GLSLANG_SRC_PATH})
16         set(GLSLANG_ABS_PATH ${GLSLANG_SRC_PATH})
17 else ()
18         set(GLSLANG_ABS_PATH "${CMAKE_SOURCE_DIR}/${GLSLANG_SRC_PATH}")
19 endif ()
20
21 find_package(BISON)
22
23 # \todo [2015-06-24 pyry] Full C++11 support on Android requires using CLang + libc++
24 if (NOT BISON_FOUND AND DE_OS_IS_WIN32 AND EXISTS ${GLSLANG_ABS_PATH}/tools/bison.exe)
25         message(STATUS "Using pre-built bison executable")
26         set(BISON_EXECUTABLE ${GLSLANG_ABS_PATH}/tools/bison.exe)
27         set(BISON_FOUND ON)
28 endif ()
29
30 if (BISON_FOUND AND EXISTS ${GLSLANG_ABS_PATH}/glslang/GenericCodeGen/CodeGen.cpp AND NOT DE_OS_IS_ANDROID)
31         message(STATUS "glslang found; building with DEQP_SUPPORT_GLSLANG")
32
33         include_directories(
34                 ${GLSLANG_ABS_PATH}
35                 ${GLSLANG_ABS_PATH}/glslang
36                 ${GLSLANG_ABS_PATH}/glslang/Include
37                 ${GLSLANG_ABS_PATH}/glslang/Public
38                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent
39                 ${GLSLANG_ABS_PATH}/glslang/GenericCodeGen
40                 ${GLSLANG_ABS_PATH}/glslang/OSDependent
41                 ${GLSLANG_ABS_PATH}/OGLCompilersDLL
42                 ${GLSLANG_ABS_PATH}/SPIRV
43                 ${CMAKE_CURRENT_BINARY_DIR}
44                 )
45
46         set(GLSLANG_SRCS
47                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/Constant.cpp
48                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/InfoSink.cpp
49                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/Initialize.cpp
50                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/IntermTraverse.cpp
51                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/Intermediate.cpp
52                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/ParseHelper.cpp
53                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/PoolAlloc.cpp
54                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/RemoveTree.cpp
55                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/Scan.cpp
56                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/ShaderLang.cpp
57                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/SymbolTable.cpp
58                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/Versions.cpp
59                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/intermOut.cpp
60                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/limits.cpp
61                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/linkValidate.cpp
62                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/parseConst.cpp
63                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/reflection.cpp
64                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/preprocessor/Pp.cpp
65                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/preprocessor/PpAtom.cpp
66                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/preprocessor/PpContext.cpp
67                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/preprocessor/PpMemory.cpp
68                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/preprocessor/PpScanner.cpp
69                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/preprocessor/PpSymbols.cpp
70                 ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/preprocessor/PpTokens.cpp
71                 ${GLSLANG_ABS_PATH}/glslang/GenericCodeGen/CodeGen.cpp
72                 ${GLSLANG_ABS_PATH}/glslang/GenericCodeGen/Link.cpp
73                 ${GLSLANG_ABS_PATH}/OGLCompilersDLL/InitializeDll.cpp
74
75                 ${GLSLANG_ABS_PATH}/SPIRV/GlslangToSpv.cpp
76                 ${GLSLANG_ABS_PATH}/SPIRV/SpvBuilder.cpp
77                 ${GLSLANG_ABS_PATH}/SPIRV/SPVRemapper.cpp
78                 ${GLSLANG_ABS_PATH}/SPIRV/doc.cpp
79                 ${GLSLANG_ABS_PATH}/SPIRV/disassemble.cpp
80
81                 ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp
82                 ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h
83
84                 osinclude.cpp
85                 )
86
87         set(CMAKE_C_FLAGS       ${DE_3RD_PARTY_C_FLAGS})
88         set(CMAKE_CXX_FLAGS     ${DE_3RD_PARTY_CXX_FLAGS})
89
90         if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG)
91                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
92         endif ()
93
94         add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h
95                                            COMMAND ${BISON_EXECUTABLE} --defines=${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp
96                                            MAIN_DEPENDENCY ${GLSLANG_ABS_PATH}/glslang/MachineIndependent/glslang.y
97                                            WORKING_DIRECTORY ${GLSLANG_ABS_PATH}/glslang)
98
99         add_library(glslang STATIC ${GLSLANG_SRCS})
100         target_link_libraries(glslang dethread ${ZLIB_LIBRARY})
101
102         set(GLSLANG_INCLUDE_PATH        ${GLSLANG_ABS_PATH}     PARENT_SCOPE)
103         set(GLSLANG_LIBRARY                     glslang                         PARENT_SCOPE)
104         set(DEQP_HAVE_GLSLANG           ON                                      PARENT_SCOPE)
105
106 else ()
107         message(STATUS "glslang not found; GLSL to SPIR-V compilation not available")
108
109         set(DEQP_HAVE_GLSLANG           OFF                                     PARENT_SCOPE)
110
111 endif ()