1 # Copyright (C) 2020 The Khronos Group Inc.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
12 # Redistributions in binary form must reproduce the above
13 # copyright notice, this list of conditions and the following
14 # disclaimer in the documentation and/or other materials provided
15 # with the distribution.
17 # Neither the name of The Khronos Group Inc. nor the names of its
18 # contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 # POSSIBILITY OF SUCH DAMAGE.
34 LOCAL_PATH := $(call my-dir)
36 # Generate glslang/build_info.h
37 GLSLANG_GENERATED_INCLUDEDIR:=$(TARGET_OUT)/include
38 GLSLANG_BUILD_INFO_H:=$(GLSLANG_GENERATED_INCLUDEDIR)/glslang/build_info.h
40 define gen_glslang_build_info_h
41 $(call generate-file-dir,$(GLSLANG_GENERATED_INCLUDEDIR)/dummy_filename)
42 $(GLSLANG_BUILD_INFO_H): \
43 $(LOCAL_PATH)/build_info.py \
44 $(LOCAL_PATH)/build_info.h.tmpl \
45 $(LOCAL_PATH)/CHANGES.md
46 @$(HOST_PYTHON) $(LOCAL_PATH)/build_info.py \
48 -i $(LOCAL_PATH)/build_info.h.tmpl \
49 -o $(GLSLANG_BUILD_INFO_H)
50 @echo "[$(TARGET_ARCH_ABI)] Generate : $(GLSLANG_BUILD_INFO_H) <= CHANGES.md"
52 $(eval $(call gen_glslang_build_info_h))
54 GLSLANG_OS_FLAGS := -DGLSLANG_OSINCLUDE_UNIX
55 # AMD and NV extensions are turned on by default in upstream Glslang.
56 GLSLANG_DEFINES:= -DAMD_EXTENSIONS -DNV_EXTENSIONS -DENABLE_HLSL $(GLSLANG_OS_FLAGS)
59 LOCAL_MODULE:=OSDependent
60 LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
61 LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
62 LOCAL_SRC_FILES:=glslang/OSDependent/Unix/ossource.cpp
63 LOCAL_C_INCLUDES:=$(LOCAL_PATH) $(LOCAL_PATH)/glslang/OSDependent/Unix/
64 LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/OSDependent/Unix/
65 include $(BUILD_STATIC_LIBRARY)
68 LOCAL_MODULE:=OGLCompiler
69 LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
70 LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
71 LOCAL_SRC_FILES:=OGLCompilersDLL/InitializeDll.cpp
72 LOCAL_C_INCLUDES:=$(LOCAL_PATH)/OGLCompiler
73 LOCAL_STATIC_LIBRARIES:=OSDependent
74 include $(BUILD_STATIC_LIBRARY)
76 # Build the stubbed HLSL library.
77 # The HLSL source is now directly referenced by the glslang static library
81 LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
84 LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
85 $(LOCAL_PATH)/glslang/HLSL
86 include $(BUILD_STATIC_LIBRARY)
89 GLSLANG_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT)))
91 # ShaderLang.cpp depends on the generated build_info.h
92 $(LOCAL_PATH)/glslang/MachineIndependent/ShaderLang.cpp: \
93 $(GLSLANG_BUILD_INFO_H)
96 LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
97 LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
99 glslang/GenericCodeGen/CodeGen.cpp \
100 glslang/GenericCodeGen/Link.cpp \
101 glslang/HLSL/hlslAttributes.cpp \
102 glslang/HLSL/hlslGrammar.cpp \
103 glslang/HLSL/hlslOpMap.cpp \
104 glslang/HLSL/hlslParseables.cpp \
105 glslang/HLSL/hlslParseHelper.cpp \
106 glslang/HLSL/hlslScanContext.cpp \
107 glslang/HLSL/hlslTokenStream.cpp \
108 glslang/MachineIndependent/attribute.cpp \
109 glslang/MachineIndependent/Constant.cpp \
110 glslang/MachineIndependent/glslang_tab.cpp \
111 glslang/MachineIndependent/InfoSink.cpp \
112 glslang/MachineIndependent/Initialize.cpp \
113 glslang/MachineIndependent/Intermediate.cpp \
114 glslang/MachineIndependent/intermOut.cpp \
115 glslang/MachineIndependent/IntermTraverse.cpp \
116 glslang/MachineIndependent/iomapper.cpp \
117 glslang/MachineIndependent/limits.cpp \
118 glslang/MachineIndependent/linkValidate.cpp \
119 glslang/MachineIndependent/parseConst.cpp \
120 glslang/MachineIndependent/ParseContextBase.cpp \
121 glslang/MachineIndependent/ParseHelper.cpp \
122 glslang/MachineIndependent/PoolAlloc.cpp \
123 glslang/MachineIndependent/propagateNoContraction.cpp \
124 glslang/MachineIndependent/reflection.cpp \
125 glslang/MachineIndependent/RemoveTree.cpp \
126 glslang/MachineIndependent/Scan.cpp \
127 glslang/MachineIndependent/ShaderLang.cpp \
128 glslang/MachineIndependent/SpirvIntrinsics.cpp \
129 glslang/MachineIndependent/SymbolTable.cpp \
130 glslang/MachineIndependent/Versions.cpp \
131 glslang/MachineIndependent/preprocessor/PpAtom.cpp \
132 glslang/MachineIndependent/preprocessor/PpContext.cpp \
133 glslang/MachineIndependent/preprocessor/Pp.cpp \
134 glslang/MachineIndependent/preprocessor/PpScanner.cpp \
135 glslang/MachineIndependent/preprocessor/PpTokens.cpp
136 LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
137 $(LOCAL_PATH)/glslang/MachineIndependent \
138 $(GLSLANG_GENERATED_INCLUDEDIR) \
140 LOCAL_STATIC_LIBRARIES:=OSDependent OGLCompiler HLSL
141 include $(BUILD_STATIC_LIBRARY)
143 include $(CLEAR_VARS)
145 # GlslangToSpv.cpp depends on the generated build_info.h
146 $(LOCAL_PATH)/SPIRV/GlslangToSpv.cpp: \
147 $(GLSLANG_BUILD_INFO_H)
150 LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror $(GLSLANG_DEFINES)
152 SPIRV/GlslangToSpv.cpp \
153 SPIRV/InReadableOrder.cpp \
155 SPIRV/SPVRemapper.cpp \
156 SPIRV/SpvBuilder.cpp \
157 SPIRV/SpvPostProcess.cpp \
159 SPIRV/disassemble.cpp \
161 LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
162 $(LOCAL_PATH)/glslang/SPIRV \
163 $(GLSLANG_GENERATED_INCLUDEDIR)
164 LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/SPIRV
165 LOCAL_STATIC_LIBRARIES:=glslang
166 include $(BUILD_STATIC_LIBRARY)