blob: 4777003527fd6125ecaab9defef9ee773cecbf06 [file] [log] [blame]
Merck Hung90c0c552018-09-28 16:08:14 +08001LOCAL_PATH := $(call my-dir)
2swiftshader_src_root := $(LOCAL_PATH)
Greg Hartman9ec919a2015-04-16 21:44:59 -07003
Greg Hartmandf01da32015-09-16 15:27:27 -07004COMMON_C_INCLUDES += \
5 bionic \
Nicolas Capensb7510aa2016-05-16 13:16:32 -04006 $(LOCAL_PATH)/../include \
Nicolas Capens9c025c02015-12-07 20:58:40 -05007 $(LOCAL_PATH)/OpenGL/ \
Nicolas Capens708c24b2017-10-26 13:07:10 -04008 $(LOCAL_PATH)
Nicolas Capens9c025c02015-12-07 20:58:40 -05009
Logan Chien6c9fb0e2019-02-26 13:39:52 +080010ifeq ($(REACTOR_USE_SUBZERO),true)
Logan Chien17b75892018-08-27 10:49:24 +080011
Nicolas Capens1ba26112017-05-02 11:57:06 -040012COMMON_C_INCLUDES += \
Nicolas Capens5aebe182017-05-03 14:23:06 -040013 $(LOCAL_PATH)/../third_party/subzero/ \
Nicolas Capens1ba26112017-05-02 11:57:06 -040014 $(LOCAL_PATH)/../third_party/llvm-subzero/include/ \
15 $(LOCAL_PATH)/../third_party/llvm-subzero/build/Android/include/ \
Nicolas Capens5aebe182017-05-03 14:23:06 -040016 $(LOCAL_PATH)/../third_party/subzero/pnacl-llvm/include/
Logan Chien17b75892018-08-27 10:49:24 +080017
Nicolas Capens1ba26112017-05-02 11:57:06 -040018else
Logan Chien17b75892018-08-27 10:49:24 +080019
Logan Chien17b75892018-08-27 10:49:24 +080020COMMON_C_INCLUDES += \
21 $(LOCAL_PATH)/../third_party/llvm-7.0/llvm/include \
22 $(LOCAL_PATH)/../third_party/llvm-7.0/configs/android/include \
23 $(LOCAL_PATH)/../third_party/llvm-7.0/configs/common/include
Logan Chien17b75892018-08-27 10:49:24 +080024
Nicolas Capens1ba26112017-05-02 11:57:06 -040025endif
26
Greg Hartman7e45f6d2018-03-16 00:02:23 -070027# Project Treble is introduced from Oreo MR1
28ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27 && echo OreoMR1),OreoMR1)
Jiyong Parka114ed52017-08-18 19:07:26 +090029COMMON_SHARED_LIBRARIES := libnativewindow liblog
30COMMON_HEADER_LIBRARIES := libhardware_headers libnativebase_headers
31COMMON_STATIC_LIBRARIES := libarect
Nicolas Capensc33b4732017-08-03 15:53:25 -040032endif
33
Nicolas Capens9c025c02015-12-07 20:58:40 -050034# Marshmallow does not have stlport, but comes with libc++ by default
35ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
36COMMON_C_INCLUDES += external/stlport/stlport
37endif
Greg Hartman9ec919a2015-04-16 21:44:59 -070038
Greg Hartmandf01da32015-09-16 15:27:27 -070039COMMON_SRC_FILES := \
Greg Hartman9ec919a2015-04-16 21:44:59 -070040 Common/CPUID.cpp \
41 Common/Configurator.cpp \
42 Common/DebugAndroid.cpp \
Greg Hartmanf66c1102015-04-17 17:29:14 -070043 Common/GrallocAndroid.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070044 Common/Half.cpp \
45 Common/Math.cpp \
46 Common/Memory.cpp \
47 Common/Resource.cpp \
48 Common/Socket.cpp \
49 Common/Thread.cpp \
50 Common/Timer.cpp
51
Greg Hartmandf01da32015-09-16 15:27:27 -070052COMMON_SRC_FILES += \
Greg Hartman9ec919a2015-04-16 21:44:59 -070053 Main/Config.cpp \
54 Main/FrameBuffer.cpp \
55 Main/FrameBufferAndroid.cpp \
Nicolas Capens518e41a2016-04-27 23:18:01 -040056 Main/SwiftConfig.cpp
Greg Hartman9ec919a2015-04-16 21:44:59 -070057
Nicolas Capensc07dc4b2018-08-06 14:20:45 -040058COMMON_SRC_FILES += \
Nicolas Capensb6d4ce32019-03-12 23:00:24 -040059 Reactor/Reactor.cpp \
Nicolas Capensc07dc4b2018-08-06 14:20:45 -040060 Reactor/Debug.cpp \
61 Reactor/DebugAndroid.cpp \
Nicolas Capens1a3ce872018-10-10 10:42:36 -040062 Reactor/ExecutableMemory.cpp
Nicolas Capensc07dc4b2018-08-06 14:20:45 -040063
Logan Chien6c9fb0e2019-02-26 13:39:52 +080064ifeq ($(REACTOR_USE_SUBZERO),true)
Nicolas Capens1ba26112017-05-02 11:57:06 -040065COMMON_SRC_FILES += \
66 Reactor/SubzeroReactor.cpp \
Nicolas Capens1ba26112017-05-02 11:57:06 -040067 Reactor/Optimizer.cpp
68else
Greg Hartmandf01da32015-09-16 15:27:27 -070069COMMON_SRC_FILES += \
Nicolas Capens5763d172016-09-26 13:44:20 -040070 Reactor/LLVMReactor.cpp \
Nicolas Capensc07dc4b2018-08-06 14:20:45 -040071 Reactor/CPUID.cpp
Nicolas Capens1ba26112017-05-02 11:57:06 -040072endif
Greg Hartman9ec919a2015-04-16 21:44:59 -070073
Greg Hartmandf01da32015-09-16 15:27:27 -070074COMMON_SRC_FILES += \
Greg Hartman9ec919a2015-04-16 21:44:59 -070075 Renderer/Blitter.cpp \
76 Renderer/Clipper.cpp \
77 Renderer/Color.cpp \
78 Renderer/Context.cpp \
Alexis Hetu0de50d42015-09-09 13:56:41 -040079 Renderer/ETC_Decoder.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070080 Renderer/Matrix.cpp \
81 Renderer/PixelProcessor.cpp \
82 Renderer/Plane.cpp \
83 Renderer/Point.cpp \
84 Renderer/QuadRasterizer.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070085 Renderer/Renderer.cpp \
86 Renderer/Sampler.cpp \
87 Renderer/SetupProcessor.cpp \
88 Renderer/Surface.cpp \
89 Renderer/TextureStage.cpp \
90 Renderer/Vector.cpp \
91 Renderer/VertexProcessor.cpp \
92
Greg Hartmandf01da32015-09-16 15:27:27 -070093COMMON_SRC_FILES += \
Greg Hartman9ec919a2015-04-16 21:44:59 -070094 Shader/Constants.cpp \
Alexis Hetuf2a8c372015-07-13 11:08:41 -040095 Shader/PixelPipeline.cpp \
96 Shader/PixelProgram.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070097 Shader/PixelRoutine.cpp \
98 Shader/PixelShader.cpp \
99 Shader/SamplerCore.cpp \
100 Shader/SetupRoutine.cpp \
101 Shader/Shader.cpp \
102 Shader/ShaderCore.cpp \
103 Shader/VertexPipeline.cpp \
104 Shader/VertexProgram.cpp \
105 Shader/VertexRoutine.cpp \
106 Shader/VertexShader.cpp \
107
Greg Hartmandf01da32015-09-16 15:27:27 -0700108COMMON_SRC_FILES += \
Nicolas Capensdeda34b2015-04-28 15:21:53 -0700109 OpenGL/common/Image.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -0700110 OpenGL/common/Object.cpp \
111 OpenGL/common/MatrixStack.cpp \
112
Greg Hartman3b876b92015-12-01 20:07:21 -0800113COMMON_CFLAGS := \
114 -DLOG_TAG=\"swiftshader\" \
Chih-Hung Hsieh4be91712017-10-11 14:23:57 -0700115 -Wall \
116 -Werror \
117 -Wno-format \
118 -Wno-switch \
119 -Wno-unused-local-typedef \
Greg Hartman3b876b92015-12-01 20:07:21 -0800120 -Wno-unused-parameter \
Chih-Hung Hsieh4be91712017-10-11 14:23:57 -0700121 -Wno-unused-value \
122 -Wno-unused-variable \
Greg Hartman3b876b92015-12-01 20:07:21 -0800123 -Wno-implicit-exception-spec-mismatch \
Nicolas Capens7cfb50c2018-12-08 12:35:32 -0800124 -Wno-implicit-fallthrough \
Greg Hartman3b876b92015-12-01 20:07:21 -0800125 -Wno-overloaded-virtual \
Nicolas Capens1ba26112017-05-02 11:57:06 -0400126 -Wno-non-virtual-dtor \
Nicolas Capensdc209332017-08-04 09:40:46 -0400127 -Wno-attributes \
128 -Wno-unknown-attributes \
129 -Wno-unknown-warning-option \
Greg Hartman3b876b92015-12-01 20:07:21 -0800130 -fno-operator-names \
131 -msse2 \
132 -D__STDC_CONSTANT_MACROS \
133 -D__STDC_LIMIT_MACROS \
134 -DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
Nicolas Capens506cc5e2017-07-24 11:30:55 -0400135 -std=c++11 \
136 -DNO_SANITIZE_FUNCTION=
Nicolas Capens135f6342015-11-11 10:49:08 -0500137
Greg Hartman3b876b92015-12-01 20:07:21 -0800138ifneq (16,${PLATFORM_SDK_VERSION})
139COMMON_CFLAGS += -Xclang -fuse-init-array
140else
141COMMON_CFLAGS += -D__STDC_INT64__
142endif
143
Jaesung Chungfccddfe2017-06-22 20:02:09 +0900144# gralloc1 is introduced from N MR1
145ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 25 && echo NMR1),NMR1)
146COMMON_CFLAGS += -DHAVE_GRALLOC1
147COMMON_C_INCLUDES += \
148 system/core/libsync/include \
149 system/core/libsync
150endif
151
Nicolas Capens1ba26112017-05-02 11:57:06 -0400152# Common Subzero defines
153COMMON_CFLAGS += -DALLOW_DUMP=0 -DALLOW_TIMERS=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_MINIMAL_BUILD=0 -DALLOW_WASM=0 -DICE_THREAD_LOCAL_HACK=1
154
155# Subzero target
156LOCAL_CFLAGS_x86 += -DSZTARGET=X8632
157LOCAL_CFLAGS_x86_64 += -DSZTARGET=X8664
158LOCAL_CFLAGS_arm += -DSZTARGET=ARM32
159
Greg Hartmandf01da32015-09-16 15:27:27 -0700160include $(CLEAR_VARS)
161LOCAL_CLANG := true
162LOCAL_MODULE := swiftshader_top_release
Jiyong Parka114ed52017-08-18 19:07:26 +0900163LOCAL_VENDOR_MODULE := true
Greg Hartmandf01da32015-09-16 15:27:27 -0700164LOCAL_MODULE_TAGS := optional
165LOCAL_SRC_FILES := $(COMMON_SRC_FILES)
166LOCAL_CFLAGS := $(COMMON_CFLAGS) -fomit-frame-pointer -ffunction-sections -fdata-sections -DANGLE_DISABLE_TRACE
167LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES)
Nicolas Capensc33b4732017-08-03 15:53:25 -0400168LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
Jiyong Parka114ed52017-08-18 19:07:26 +0900169LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES)
170LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
Greg Hartmandf01da32015-09-16 15:27:27 -0700171include $(BUILD_STATIC_LIBRARY)
Greg Hartman9ec919a2015-04-16 21:44:59 -0700172
Greg Hartmandf01da32015-09-16 15:27:27 -0700173include $(CLEAR_VARS)
174LOCAL_CLANG := true
175LOCAL_MODULE := swiftshader_top_debug
Jiyong Parka114ed52017-08-18 19:07:26 +0900176LOCAL_VENDOR_MODULE := true
Greg Hartmandf01da32015-09-16 15:27:27 -0700177LOCAL_MODULE_TAGS := optional
178LOCAL_SRC_FILES := $(COMMON_SRC_FILES)
Greg Hartman5d6c1c72015-10-02 16:29:40 -0700179LOCAL_CFLAGS := $(COMMON_CFLAGS) -UNDEBUG -g -O0 -DDEFAULT_THREAD_COUNT=1
Greg Hartmandf01da32015-09-16 15:27:27 -0700180LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES)
Nicolas Capensc33b4732017-08-03 15:53:25 -0400181LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
Jiyong Parka114ed52017-08-18 19:07:26 +0900182LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES)
183LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
Greg Hartman9ec919a2015-04-16 21:44:59 -0700184include $(BUILD_STATIC_LIBRARY)
Greg Hartman8527e472015-11-02 13:08:12 -0800185
Merck Hung90c0c552018-09-28 16:08:14 +0800186include $(swiftshader_src_root)/Reactor/Android.mk
187include $(swiftshader_src_root)/OpenGL/libGLESv2/Android.mk
188include $(swiftshader_src_root)/OpenGL/libGLES_CM/Android.mk
189include $(swiftshader_src_root)/OpenGL/libEGL/Android.mk
190include $(swiftshader_src_root)/OpenGL/compiler/Android.mk