2 add_subdirectory(OSDependent/Windows)
4 add_subdirectory(OSDependent/Unix)
6 message("unknown platform")
9 if(EMSCRIPTEN OR ENABLE_GLSLANG_JS)
10 # May be enabled on non-Emscripten builds for binary-size testing.
11 add_subdirectory(OSDependent/Web)
12 endif(EMSCRIPTEN OR ENABLE_GLSLANG_JS)
14 ################################################################################
16 ################################################################################
17 add_library(GenericCodeGen STATIC
18 GenericCodeGen/CodeGen.cpp
19 GenericCodeGen/Link.cpp)
21 ################################################################################
23 ################################################################################
24 set(MACHINEINDEPENDENT_SOURCES
25 MachineIndependent/glslang.m4
26 MachineIndependent/glslang.y
27 MachineIndependent/glslang_tab.cpp
28 MachineIndependent/attribute.cpp
29 MachineIndependent/Constant.cpp
30 MachineIndependent/iomapper.cpp
31 MachineIndependent/InfoSink.cpp
32 MachineIndependent/Initialize.cpp
33 MachineIndependent/IntermTraverse.cpp
34 MachineIndependent/Intermediate.cpp
35 MachineIndependent/ParseContextBase.cpp
36 MachineIndependent/ParseHelper.cpp
37 MachineIndependent/PoolAlloc.cpp
38 MachineIndependent/RemoveTree.cpp
39 MachineIndependent/Scan.cpp
40 MachineIndependent/ShaderLang.cpp
41 MachineIndependent/SymbolTable.cpp
42 MachineIndependent/Versions.cpp
43 MachineIndependent/intermOut.cpp
44 MachineIndependent/limits.cpp
45 MachineIndependent/linkValidate.cpp
46 MachineIndependent/parseConst.cpp
47 MachineIndependent/reflection.cpp
48 MachineIndependent/preprocessor/Pp.cpp
49 MachineIndependent/preprocessor/PpAtom.cpp
50 MachineIndependent/preprocessor/PpContext.cpp
51 MachineIndependent/preprocessor/PpScanner.cpp
52 MachineIndependent/preprocessor/PpTokens.cpp
53 MachineIndependent/propagateNoContraction.cpp
56 set(MACHINEINDEPENDENT_HEADERS
57 MachineIndependent/attribute.h
58 MachineIndependent/glslang_tab.cpp.h
59 MachineIndependent/gl_types.h
60 MachineIndependent/Initialize.h
61 MachineIndependent/iomapper.h
62 MachineIndependent/LiveTraverser.h
63 MachineIndependent/localintermediate.h
64 MachineIndependent/ParseHelper.h
65 MachineIndependent/reflection.h
66 MachineIndependent/RemoveTree.h
67 MachineIndependent/Scan.h
68 MachineIndependent/ScanContext.h
69 MachineIndependent/SymbolTable.h
70 MachineIndependent/Versions.h
71 MachineIndependent/parseVersions.h
72 MachineIndependent/propagateNoContraction.h
73 MachineIndependent/preprocessor/PpContext.h
74 MachineIndependent/preprocessor/PpTokens.h
78 list(APPEND MACHINEINDEPENDENT_SOURCES
79 HLSL/hlslAttributes.cpp
80 HLSL/hlslParseHelper.cpp
81 HLSL/hlslScanContext.cpp
83 HLSL/hlslTokenStream.cpp
85 HLSL/hlslParseables.cpp)
87 list(APPEND MACHINEINDEPENDENT_HEADERS
89 HLSL/hlslParseHelper.h
91 HLSL/hlslScanContext.h
93 HLSL/hlslTokenStream.h
95 HLSL/hlslParseables.h)
98 add_library(MachineIndependent STATIC ${MACHINEINDEPENDENT_SOURCES} ${MACHINEINDEPENDENT_HEADERS})
100 glslang_pch(SOURCES MachineIndependent/pch.cpp)
102 target_link_libraries(MachineIndependent PRIVATE OGLCompiler OSDependent GenericCodeGen)
104 ################################################################################
106 ################################################################################
108 CInterface/glslang_c_interface.cpp)
115 Include/ConstantUnion.h
116 Include/glslang_c_interface.h
117 Include/glslang_c_shader_types.h
119 Include/InitializeGlobals.h
120 Include/intermediate.h
122 Include/ResourceLimits.h
127 add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS})
128 set_property(TARGET glslang PROPERTY FOLDER glslang)
129 set_property(TARGET glslang PROPERTY POSITION_INDEPENDENT_CODE ON)
130 target_link_libraries(glslang PRIVATE OGLCompiler OSDependent MachineIndependent)
131 target_include_directories(glslang PUBLIC
132 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
133 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
135 if(WIN32 AND BUILD_SHARED_LIBS)
136 set_target_properties(glslang PROPERTIES PREFIX "")
139 ################################################################################
141 ################################################################################
143 source_group("Public" REGULAR_EXPRESSION "Public/*")
144 source_group("MachineIndependent" REGULAR_EXPRESSION "MachineIndependent/[^/]*")
145 source_group("Include" REGULAR_EXPRESSION "Include/[^/]*")
146 source_group("GenericCodeGen" REGULAR_EXPRESSION "GenericCodeGen/*")
147 source_group("MachineIndependent\\Preprocessor" REGULAR_EXPRESSION "MachineIndependent/preprocessor/*")
148 source_group("HLSL" REGULAR_EXPRESSION "HLSL/*")
149 source_group("CInterface" REGULAR_EXPRESSION "CInterface/*")
152 ################################################################################
154 ################################################################################
155 if(ENABLE_GLSLANG_INSTALL)
156 if(BUILD_SHARED_LIBS)
157 install(TARGETS glslang
158 EXPORT glslangTargets
159 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
160 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
161 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
163 install(TARGETS glslang MachineIndependent GenericCodeGen
164 EXPORT glslangTargets
165 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
168 install(EXPORT glslangTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
172 ${MACHINEINDEPENDENT_HEADERS})
174 foreach(file ${ALL_HEADERS})
175 get_filename_component(dir ${file} DIRECTORY)
176 install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir})
178 endif(ENABLE_GLSLANG_INSTALL)