Merge pull request #3021 from qingyuanzNV/fix_opline_prepending_opfunction_with_pp
[platform/upstream/glslang.git] / Android.mk
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
34 LOCAL_PATH := $(call my-dir)
35
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
39
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 \
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"
51 endef
52 $(eval $(call gen_glslang_build_info_h))
53
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)
57
58 include $(CLEAR_VARS)
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)
66
67 include $(CLEAR_VARS)
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)
75
76 # Build the stubbed HLSL library.
77 # The HLSL source is now directly referenced by the glslang static library
78 # instead.
79 include $(CLEAR_VARS)
80 LOCAL_MODULE:=HLSL
81 LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
82 LOCAL_SRC_FILES:= \
83         hlsl/stub.cpp
84 LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
85         $(LOCAL_PATH)/glslang/HLSL
86 include $(BUILD_STATIC_LIBRARY)
87
88 include $(CLEAR_VARS)
89 GLSLANG_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
95 LOCAL_MODULE:=glslang
96 LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
97 LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
98 LOCAL_SRC_FILES:= \
99                 glslang/CInterface/glslang_c_interface.cpp \
100                 glslang/GenericCodeGen/CodeGen.cpp \
101                 glslang/GenericCodeGen/Link.cpp \
102                 glslang/HLSL/hlslAttributes.cpp \
103                 glslang/HLSL/hlslGrammar.cpp \
104                 glslang/HLSL/hlslOpMap.cpp \
105                 glslang/HLSL/hlslParseables.cpp \
106                 glslang/HLSL/hlslParseHelper.cpp \
107                 glslang/HLSL/hlslScanContext.cpp \
108                 glslang/HLSL/hlslTokenStream.cpp \
109                 glslang/MachineIndependent/attribute.cpp \
110                 glslang/MachineIndependent/Constant.cpp \
111                 glslang/MachineIndependent/glslang_tab.cpp \
112                 glslang/MachineIndependent/InfoSink.cpp \
113                 glslang/MachineIndependent/Initialize.cpp \
114                 glslang/MachineIndependent/Intermediate.cpp \
115                 glslang/MachineIndependent/intermOut.cpp \
116                 glslang/MachineIndependent/IntermTraverse.cpp \
117                 glslang/MachineIndependent/iomapper.cpp \
118                 glslang/MachineIndependent/limits.cpp \
119                 glslang/MachineIndependent/linkValidate.cpp \
120                 glslang/MachineIndependent/parseConst.cpp \
121                 glslang/MachineIndependent/ParseContextBase.cpp \
122                 glslang/MachineIndependent/ParseHelper.cpp \
123                 glslang/MachineIndependent/PoolAlloc.cpp \
124                 glslang/MachineIndependent/propagateNoContraction.cpp \
125                 glslang/MachineIndependent/reflection.cpp \
126                 glslang/MachineIndependent/RemoveTree.cpp \
127                 glslang/MachineIndependent/Scan.cpp \
128                 glslang/MachineIndependent/ShaderLang.cpp \
129                 glslang/MachineIndependent/SpirvIntrinsics.cpp \
130                 glslang/MachineIndependent/SymbolTable.cpp \
131                 glslang/MachineIndependent/Versions.cpp \
132                 glslang/MachineIndependent/preprocessor/PpAtom.cpp \
133                 glslang/MachineIndependent/preprocessor/PpContext.cpp \
134                 glslang/MachineIndependent/preprocessor/Pp.cpp \
135                 glslang/MachineIndependent/preprocessor/PpScanner.cpp \
136                 glslang/MachineIndependent/preprocessor/PpTokens.cpp
137 LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
138         $(LOCAL_PATH)/glslang/MachineIndependent \
139         $(GLSLANG_GENERATED_INCLUDEDIR) \
140         $(GLSLANG_OUT_PATH)
141 LOCAL_STATIC_LIBRARIES:=OSDependent OGLCompiler HLSL
142 include $(BUILD_STATIC_LIBRARY)
143
144 include $(CLEAR_VARS)
145
146 # GlslangToSpv.cpp depends on the generated build_info.h
147 $(LOCAL_PATH)/SPIRV/GlslangToSpv.cpp: \
148         $(GLSLANG_BUILD_INFO_H)
149
150 LOCAL_MODULE:=SPIRV
151 LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror $(GLSLANG_DEFINES)
152 LOCAL_SRC_FILES:= \
153         SPIRV/CInterface/spirv_c_interface.cpp \
154         SPIRV/GlslangToSpv.cpp \
155         SPIRV/InReadableOrder.cpp \
156         SPIRV/Logger.cpp \
157         SPIRV/SPVRemapper.cpp \
158         SPIRV/SpvBuilder.cpp \
159         SPIRV/SpvPostProcess.cpp \
160         SPIRV/SpvTools.cpp \
161         SPIRV/disassemble.cpp \
162         SPIRV/doc.cpp
163 LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
164         $(LOCAL_PATH)/glslang/SPIRV \
165         $(GLSLANG_GENERATED_INCLUDEDIR)
166 LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/SPIRV
167 LOCAL_STATIC_LIBRARIES:=glslang
168 include $(BUILD_STATIC_LIBRARY)