• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2020 The Khronos Group Inc.
2#
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
9#    Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11#
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.
16#
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.
20#
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.
33
34LOCAL_PATH := $(call my-dir)
35
36# Generate glslang/build_info.h
37GLSLANG_GENERATED_INCLUDEDIR:=$(TARGET_OUT)/include
38GLSLANG_BUILD_INFO_H:=$(GLSLANG_GENERATED_INCLUDEDIR)/glslang/build_info.h
39
40define 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 \
47						$(LOCAL_PATH) \
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"
51endef
52$(eval $(call gen_glslang_build_info_h))
53
54GLSLANG_OS_FLAGS := -DGLSLANG_OSINCLUDE_UNIX
55# AMD and NV extensions are turned on by default in upstream Glslang.
56GLSLANG_DEFINES:= -DAMD_EXTENSIONS -DNV_EXTENSIONS -DENABLE_HLSL $(GLSLANG_OS_FLAGS)
57
58include $(CLEAR_VARS)
59LOCAL_MODULE:=OSDependent
60LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
61LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
62LOCAL_SRC_FILES:=glslang/OSDependent/Unix/ossource.cpp
63LOCAL_C_INCLUDES:=$(LOCAL_PATH) $(LOCAL_PATH)/glslang/OSDependent/Unix/
64LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/OSDependent/Unix/
65include $(BUILD_STATIC_LIBRARY)
66
67include $(CLEAR_VARS)
68LOCAL_MODULE:=OGLCompiler
69LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
70LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
71LOCAL_SRC_FILES:=OGLCompilersDLL/InitializeDll.cpp
72LOCAL_C_INCLUDES:=$(LOCAL_PATH)/OGLCompiler
73LOCAL_STATIC_LIBRARIES:=OSDependent
74include $(BUILD_STATIC_LIBRARY)
75
76# Build the stubbed HLSL library.
77# The HLSL source is now directly referenced by the glslang static library
78# instead.
79include $(CLEAR_VARS)
80LOCAL_MODULE:=HLSL
81LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
82LOCAL_SRC_FILES:= \
83	hlsl/stub.cpp
84LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
85	$(LOCAL_PATH)/glslang/HLSL
86include $(BUILD_STATIC_LIBRARY)
87
88include $(CLEAR_VARS)
89GLSLANG_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT)))
90
91# ShaderLang.cpp depends on the generated build_info.h
92$(LOCAL_PATH)/glslang/MachineIndependent/ShaderLang.cpp: \
93	$(GLSLANG_BUILD_INFO_H)
94
95LOCAL_MODULE:=glslang
96LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
97LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
98LOCAL_SRC_FILES:= \
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/SymbolTable.cpp \
129		glslang/MachineIndependent/Versions.cpp \
130		glslang/MachineIndependent/preprocessor/PpAtom.cpp \
131		glslang/MachineIndependent/preprocessor/PpContext.cpp \
132		glslang/MachineIndependent/preprocessor/Pp.cpp \
133		glslang/MachineIndependent/preprocessor/PpScanner.cpp \
134		glslang/MachineIndependent/preprocessor/PpTokens.cpp
135LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
136	$(LOCAL_PATH)/glslang/MachineIndependent \
137	$(GLSLANG_GENERATED_INCLUDEDIR) \
138	$(GLSLANG_OUT_PATH)
139LOCAL_STATIC_LIBRARIES:=OSDependent OGLCompiler HLSL
140include $(BUILD_STATIC_LIBRARY)
141
142include $(CLEAR_VARS)
143
144# GlslangToSpv.cpp depends on the generated build_info.h
145$(LOCAL_PATH)/SPIRV/GlslangToSpv.cpp: \
146	$(GLSLANG_BUILD_INFO_H)
147
148LOCAL_MODULE:=SPIRV
149LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror $(GLSLANG_DEFINES)
150LOCAL_SRC_FILES:= \
151	SPIRV/GlslangToSpv.cpp \
152	SPIRV/InReadableOrder.cpp \
153	SPIRV/Logger.cpp \
154	SPIRV/SPVRemapper.cpp \
155	SPIRV/SpvBuilder.cpp \
156	SPIRV/SpvPostProcess.cpp \
157	SPIRV/SpvTools.cpp \
158	SPIRV/disassemble.cpp \
159	SPIRV/doc.cpp
160LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
161	$(LOCAL_PATH)/glslang/SPIRV \
162	$(GLSLANG_GENERATED_INCLUDEDIR)
163LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/SPIRV
164LOCAL_STATIC_LIBRARIES:=glslang
165include $(BUILD_STATIC_LIBRARY)
166