blob: 8559689d0a82e2a08ed2a86dd7c7fcbdc430a514 [file] [log] [blame]
Greg Hartman9ec919a2015-04-16 21:44:59 -07001LOCAL_PATH:= $(call my-dir)
Greg Hartman9ec919a2015-04-16 21:44:59 -07002
Greg Hartmandf01da32015-09-16 15:27:27 -07003COMMON_C_INCLUDES += \
4 bionic \
Nicolas Capensb7510aa2016-05-16 13:16:32 -04005 $(LOCAL_PATH)/../include \
Nicolas Capens9c025c02015-12-07 20:58:40 -05006 $(LOCAL_PATH)/OpenGL/ \
Nicolas Capens708c24b2017-10-26 13:07:10 -04007 $(LOCAL_PATH)
Nicolas Capens9c025c02015-12-07 20:58:40 -05008
Nicolas Capens1ba26112017-05-02 11:57:06 -04009ifdef use_subzero
Logan Chien17b75892018-08-27 10:49:24 +080010
Nicolas Capens1ba26112017-05-02 11:57:06 -040011COMMON_C_INCLUDES += \
Nicolas Capens5aebe182017-05-03 14:23:06 -040012 $(LOCAL_PATH)/../third_party/subzero/ \
Nicolas Capens1ba26112017-05-02 11:57:06 -040013 $(LOCAL_PATH)/../third_party/llvm-subzero/include/ \
14 $(LOCAL_PATH)/../third_party/llvm-subzero/build/Android/include/ \
Nicolas Capens5aebe182017-05-03 14:23:06 -040015 $(LOCAL_PATH)/../third_party/subzero/pnacl-llvm/include/
Logan Chien17b75892018-08-27 10:49:24 +080016
Nicolas Capens1ba26112017-05-02 11:57:06 -040017else
Logan Chien17b75892018-08-27 10:49:24 +080018
19ifeq ($(SWIFTSHADER_LLVM_VERSION),3)
Nicolas Capens1ba26112017-05-02 11:57:06 -040020COMMON_C_INCLUDES += \
21 $(LOCAL_PATH)/../third_party/LLVM/include
Logan Chien17b75892018-08-27 10:49:24 +080022else
23COMMON_C_INCLUDES += \
24 $(LOCAL_PATH)/../third_party/llvm-7.0/llvm/include \
25 $(LOCAL_PATH)/../third_party/llvm-7.0/configs/android/include \
26 $(LOCAL_PATH)/../third_party/llvm-7.0/configs/common/include
27endif
28
Nicolas Capens1ba26112017-05-02 11:57:06 -040029endif
30
Greg Hartman7e45f6d2018-03-16 00:02:23 -070031# Project Treble is introduced from Oreo MR1
32ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27 && echo OreoMR1),OreoMR1)
Jiyong Parka114ed52017-08-18 19:07:26 +090033COMMON_SHARED_LIBRARIES := libnativewindow liblog
34COMMON_HEADER_LIBRARIES := libhardware_headers libnativebase_headers
35COMMON_STATIC_LIBRARIES := libarect
Nicolas Capensc33b4732017-08-03 15:53:25 -040036endif
37
Nicolas Capens9c025c02015-12-07 20:58:40 -050038# Marshmallow does not have stlport, but comes with libc++ by default
39ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
40COMMON_C_INCLUDES += external/stlport/stlport
41endif
Greg Hartman9ec919a2015-04-16 21:44:59 -070042
Greg Hartmandf01da32015-09-16 15:27:27 -070043COMMON_SRC_FILES := \
Greg Hartman9ec919a2015-04-16 21:44:59 -070044 Common/CPUID.cpp \
45 Common/Configurator.cpp \
46 Common/DebugAndroid.cpp \
Greg Hartmanf66c1102015-04-17 17:29:14 -070047 Common/GrallocAndroid.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070048 Common/Half.cpp \
49 Common/Math.cpp \
50 Common/Memory.cpp \
51 Common/Resource.cpp \
52 Common/Socket.cpp \
53 Common/Thread.cpp \
54 Common/Timer.cpp
55
Greg Hartmandf01da32015-09-16 15:27:27 -070056COMMON_SRC_FILES += \
Greg Hartman9ec919a2015-04-16 21:44:59 -070057 Main/Config.cpp \
58 Main/FrameBuffer.cpp \
59 Main/FrameBufferAndroid.cpp \
Nicolas Capens518e41a2016-04-27 23:18:01 -040060 Main/SwiftConfig.cpp
Greg Hartman9ec919a2015-04-16 21:44:59 -070061
Nicolas Capens1ba26112017-05-02 11:57:06 -040062ifdef use_subzero
63COMMON_SRC_FILES += \
64 Reactor/SubzeroReactor.cpp \
65 Reactor/Routine.cpp \
66 Reactor/Optimizer.cpp
67else
Greg Hartmandf01da32015-09-16 15:27:27 -070068COMMON_SRC_FILES += \
Nicolas Capens5763d172016-09-26 13:44:20 -040069 Reactor/LLVMReactor.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070070 Reactor/Routine.cpp \
Nicolas Capensdaa5d912016-09-28 16:56:36 -040071 Reactor/LLVMRoutine.cpp \
72 Reactor/LLVMRoutineManager.cpp
Nicolas Capens1ba26112017-05-02 11:57:06 -040073endif
Greg Hartman9ec919a2015-04-16 21:44:59 -070074
Greg Hartmandf01da32015-09-16 15:27:27 -070075COMMON_SRC_FILES += \
Greg Hartman9ec919a2015-04-16 21:44:59 -070076 Renderer/Blitter.cpp \
77 Renderer/Clipper.cpp \
78 Renderer/Color.cpp \
79 Renderer/Context.cpp \
Alexis Hetu0de50d42015-09-09 13:56:41 -040080 Renderer/ETC_Decoder.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070081 Renderer/Matrix.cpp \
82 Renderer/PixelProcessor.cpp \
83 Renderer/Plane.cpp \
84 Renderer/Point.cpp \
85 Renderer/QuadRasterizer.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070086 Renderer/Renderer.cpp \
87 Renderer/Sampler.cpp \
88 Renderer/SetupProcessor.cpp \
89 Renderer/Surface.cpp \
90 Renderer/TextureStage.cpp \
91 Renderer/Vector.cpp \
92 Renderer/VertexProcessor.cpp \
93
Greg Hartmandf01da32015-09-16 15:27:27 -070094COMMON_SRC_FILES += \
Greg Hartman9ec919a2015-04-16 21:44:59 -070095 Shader/Constants.cpp \
Alexis Hetuf2a8c372015-07-13 11:08:41 -040096 Shader/PixelPipeline.cpp \
97 Shader/PixelProgram.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -070098 Shader/PixelRoutine.cpp \
99 Shader/PixelShader.cpp \
100 Shader/SamplerCore.cpp \
101 Shader/SetupRoutine.cpp \
102 Shader/Shader.cpp \
103 Shader/ShaderCore.cpp \
104 Shader/VertexPipeline.cpp \
105 Shader/VertexProgram.cpp \
106 Shader/VertexRoutine.cpp \
107 Shader/VertexShader.cpp \
108
Greg Hartmandf01da32015-09-16 15:27:27 -0700109COMMON_SRC_FILES += \
Nicolas Capensdeda34b2015-04-28 15:21:53 -0700110 OpenGL/common/Image.cpp \
Greg Hartman9ec919a2015-04-16 21:44:59 -0700111 OpenGL/common/Object.cpp \
112 OpenGL/common/MatrixStack.cpp \
113
Greg Hartman3b876b92015-12-01 20:07:21 -0800114COMMON_CFLAGS := \
115 -DLOG_TAG=\"swiftshader\" \
Chih-Hung Hsieh4be91712017-10-11 14:23:57 -0700116 -Wall \
117 -Werror \
118 -Wno-format \
119 -Wno-switch \
120 -Wno-unused-local-typedef \
Greg Hartman3b876b92015-12-01 20:07:21 -0800121 -Wno-unused-parameter \
Chih-Hung Hsieh4be91712017-10-11 14:23:57 -0700122 -Wno-unused-value \
123 -Wno-unused-variable \
Greg Hartman3b876b92015-12-01 20:07:21 -0800124 -Wno-implicit-exception-spec-mismatch \
125 -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
Logan Chien17b75892018-08-27 10:49:24 +0800152# Common LLVM defines
153COMMON_CFLAGS += -DSWIFTSHADER_LLVM_VERSION=$(SWIFTSHADER_LLVM_VERSION)
154
Nicolas Capens1ba26112017-05-02 11:57:06 -0400155# Common Subzero defines
156COMMON_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
157
158# Subzero target
159LOCAL_CFLAGS_x86 += -DSZTARGET=X8632
160LOCAL_CFLAGS_x86_64 += -DSZTARGET=X8664
161LOCAL_CFLAGS_arm += -DSZTARGET=ARM32
162
Greg Hartmandf01da32015-09-16 15:27:27 -0700163include $(CLEAR_VARS)
164LOCAL_CLANG := true
165LOCAL_MODULE := swiftshader_top_release
Jiyong Parka114ed52017-08-18 19:07:26 +0900166LOCAL_VENDOR_MODULE := true
Greg Hartmandf01da32015-09-16 15:27:27 -0700167LOCAL_MODULE_TAGS := optional
168LOCAL_SRC_FILES := $(COMMON_SRC_FILES)
169LOCAL_CFLAGS := $(COMMON_CFLAGS) -fomit-frame-pointer -ffunction-sections -fdata-sections -DANGLE_DISABLE_TRACE
170LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES)
Nicolas Capensc33b4732017-08-03 15:53:25 -0400171LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
Jiyong Parka114ed52017-08-18 19:07:26 +0900172LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES)
173LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
Greg Hartmandf01da32015-09-16 15:27:27 -0700174include $(BUILD_STATIC_LIBRARY)
Greg Hartman9ec919a2015-04-16 21:44:59 -0700175
Greg Hartmandf01da32015-09-16 15:27:27 -0700176include $(CLEAR_VARS)
177LOCAL_CLANG := true
178LOCAL_MODULE := swiftshader_top_debug
Jiyong Parka114ed52017-08-18 19:07:26 +0900179LOCAL_VENDOR_MODULE := true
Greg Hartmandf01da32015-09-16 15:27:27 -0700180LOCAL_MODULE_TAGS := optional
181LOCAL_SRC_FILES := $(COMMON_SRC_FILES)
Greg Hartman5d6c1c72015-10-02 16:29:40 -0700182LOCAL_CFLAGS := $(COMMON_CFLAGS) -UNDEBUG -g -O0 -DDEFAULT_THREAD_COUNT=1
Greg Hartmandf01da32015-09-16 15:27:27 -0700183LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES)
Nicolas Capensc33b4732017-08-03 15:53:25 -0400184LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
Jiyong Parka114ed52017-08-18 19:07:26 +0900185LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES)
186LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
Greg Hartman9ec919a2015-04-16 21:44:59 -0700187include $(BUILD_STATIC_LIBRARY)
Greg Hartman8527e472015-11-02 13:08:12 -0800188
Greg Hartman8527e472015-11-02 13:08:12 -0800189include $(call all-makefiles-under,$(LOCAL_PATH))