• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1LOCAL_PATH:= $(call my-dir)
2
3COMMON_SWIFTSHADER_RELATIVE_PATH := $(if $(BOARD_SWIFTSHADER_RELATIVE_PATH),$(BOARD_SWIFTSHADER_RELATIVE_PATH),egl)
4
5COMMON_CFLAGS := \
6	-DLOG_TAG=\"libGLESv2_swiftshader\" \
7	-fno-operator-names \
8	-msse2 \
9	-D__STDC_CONSTANT_MACROS \
10	-D__STDC_LIMIT_MACROS \
11	-std=c++11 \
12	-DGL_API= \
13	-DGL_APICALL= \
14	-DGL_GLEXT_PROTOTYPES \
15	-Wall \
16	-Werror \
17	-Wno-format \
18	-Wno-sign-compare \
19	-Wno-unused-parameter \
20	-Wno-unused-private-field \
21	-Wno-unused-variable \
22	-Wno-implicit-exception-spec-mismatch \
23	-Wno-implicit-fallthrough \
24	-Wno-overloaded-virtual \
25	-Wno-attributes \
26	-Wno-unknown-attributes \
27	-Wno-unknown-warning-option \
28	-DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
29	-DNO_SANITIZE_FUNCTION=
30
31ifneq (16,${PLATFORM_SDK_VERSION})
32COMMON_CFLAGS += -Xclang -fuse-init-array
33else
34COMMON_CFLAGS += -D__STDC_INT64__
35endif
36
37COMMON_SRC_FILES := \
38	Buffer.cpp \
39	Context.cpp \
40	Device.cpp \
41	Fence.cpp \
42	Framebuffer.cpp \
43	IndexDataManager.cpp \
44	libGLESv2.cpp \
45	libGLESv3.cpp \
46	main.cpp \
47	entry_points.cpp \
48	Program.cpp \
49	Query.cpp \
50	Renderbuffer.cpp \
51	ResourceManager.cpp \
52	Shader.cpp \
53	Texture.cpp \
54	TransformFeedback.cpp \
55	utilities.cpp \
56	VertexArray.cpp \
57	VertexDataManager.cpp \
58	../../Common/SharedLibrary.cpp
59
60COMMON_C_INCLUDES := \
61	bionic \
62	$(LOCAL_PATH)/../../../include \
63	$(LOCAL_PATH)/../ \
64	$(LOCAL_PATH)/../../ \
65	$(LOCAL_PATH)/../../Renderer/ \
66	$(LOCAL_PATH)/../../Common/ \
67	$(LOCAL_PATH)/../../Shader/ \
68	$(LOCAL_PATH)/../../Main/
69
70COMMON_STATIC_LIBRARIES := libLLVM_swiftshader
71
72COMMON_SHARED_LIBRARIES := \
73	libdl \
74	liblog \
75	libcutils \
76	libhardware
77
78# Project Treble is introduced from Oreo MR1
79ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27 && echo OreoMR1),OreoMR1)
80COMMON_SHARED_LIBRARIES += libnativewindow
81COMMON_STATIC_LIBRARIES += libarect
82COMMON_HEADER_LIBRARIES := libnativebase_headers
83endif
84
85# gralloc1 is introduced from N MR1
86ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 25 && echo NMR1),NMR1)
87COMMON_CFLAGS += -DHAVE_GRALLOC1
88COMMON_SHARED_LIBRARIES += libsync
89endif
90
91# Marshmallow does not have stlport, but comes with libc++ by default
92ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
93COMMON_SHARED_LIBRARIES += libstlport
94COMMON_C_INCLUDES += external/stlport/stlport
95endif
96
97COMMON_LDFLAGS := \
98	-Wl,--version-script=$(LOCAL_PATH)/libGLESv2.lds \
99	-Wl,--gc-sections \
100	-Wl,--hash-style=sysv
101
102include $(CLEAR_VARS)
103LOCAL_MODULE := libGLESv2_swiftshader_debug
104
105ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
106LOCAL_MULTILIB := first
107endif
108
109ifeq (HasRelativePath,$(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo HasRelativePath))
110LOCAL_MODULE_RELATIVE_PATH := $(COMMON_SWIFTSHADER_RELATIVE_PATH)
111else
112LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(COMMON_SWIFTSHADER_RELATIVE_PATH)
113endif
114
115LOCAL_VENDOR_MODULE := true
116LOCAL_MODULE_TAGS := optional
117LOCAL_CLANG := true
118LOCAL_SRC_FILES += $(COMMON_SRC_FILES)
119LOCAL_C_INCLUDES += $(COMMON_C_INCLUDES)
120LOCAL_STATIC_LIBRARIES += swiftshader_compiler_debug swiftshader_top_debug $(COMMON_STATIC_LIBRARIES)
121LOCAL_SHARED_LIBRARIES += $(COMMON_SHARED_LIBRARIES)
122LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES)
123LOCAL_LDFLAGS += $(COMMON_LDFLAGS)
124LOCAL_CFLAGS += $(COMMON_CFLAGS) -UNDEBUG -g -O0
125include $(BUILD_SHARED_LIBRARY)
126
127include $(CLEAR_VARS)
128LOCAL_MODULE := libGLESv2_swiftshader
129
130ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
131LOCAL_MULTILIB := first
132endif
133
134ifeq (HasRelativePath,$(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo HasRelativePath))
135LOCAL_MODULE_RELATIVE_PATH := $(COMMON_SWIFTSHADER_RELATIVE_PATH)
136else
137LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(COMMON_SWIFTSHADER_RELATIVE_PATH)
138endif
139
140LOCAL_VENDOR_MODULE := true
141LOCAL_MODULE_TAGS := optional
142LOCAL_CLANG := true
143LOCAL_SRC_FILES += $(COMMON_SRC_FILES)
144LOCAL_C_INCLUDES += $(COMMON_C_INCLUDES)
145LOCAL_STATIC_LIBRARIES += swiftshader_compiler_release swiftshader_top_release $(COMMON_STATIC_LIBRARIES)
146LOCAL_SHARED_LIBRARIES += $(COMMON_SHARED_LIBRARIES)
147LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES)
148LOCAL_LDFLAGS += $(COMMON_LDFLAGS)
149LOCAL_CFLAGS += \
150	$(COMMON_CFLAGS) \
151	-fomit-frame-pointer \
152	-ffunction-sections \
153	-fdata-sections \
154	-DANGLE_DISABLE_TRACE
155include $(BUILD_SHARED_LIBRARY)
156