• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This is the top-level build file for the Android HW OpenGL ES emulation
2# in Android.
3#
4# You must define BUILD_EMULATOR_OPENGL to 'true' in your environment to
5# build the following files.
6#
7# Also define BUILD_EMULATOR_OPENGL_DRIVER to 'true' to build the gralloc
8# stuff as well.
9#
10# Top-level for all modules
11GOLDFISH_OPENGL_PATH := $(call my-dir)
12
13# There are two kinds of builds for goldfish-opengl:
14# 1. The standard guest build, denoted by BUILD_EMULATOR_OPENGL
15# 2. The host-side build, denoted by GOLDFISH_OPENGL_BUILD_FOR_HOST
16#
17# Variable controlling whether the build for goldfish-opengl
18# libraries (including their Android.mk's) should be triggered.
19GOLDFISH_OPENGL_SHOULD_BUILD := false
20
21# In the host build, some libraries have name collisions with
22# other libraries, so we have this variable here to control
23# adding a suffix to the names of libraries. Should be blank
24# for the guest build.
25GOLDFISH_OPENGL_LIB_SUFFIX :=
26
27# Directory containing common headers used by several modules
28# This is always set to a module's LOCAL_C_INCLUDES
29# See the definition of emugl-begin-module in common.mk
30EMUGL_COMMON_INCLUDES := $(GOLDFISH_OPENGL_PATH)/host/include/libOpenglRender $(GOLDFISH_OPENGL_PATH)/system/include
31
32# common cflags used by several modules
33# This is always set to a module's LOCAL_CFLAGS
34# See the definition of emugl-begin-module in common.mk
35EMUGL_COMMON_CFLAGS := -DWITH_GLES2
36
37# Whether or not to build the Vulkan library.
38GFXSTREAM := false
39
40# Host build
41ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
42
43GOLDFISH_OPENGL_SHOULD_BUILD := true
44GOLDFISH_OPENGL_LIB_SUFFIX := _host
45
46GFXSTREAM := true
47
48# Set modern defaults for the codename, version, etc.
49PLATFORM_VERSION_CODENAME:=Q
50PLATFORM_SDK_VERSION:=29
51IS_AT_LEAST_OPD1:=true
52
53# The host-side Android framework implementation
54HOST_EMUGL_PATH := $(GOLDFISH_OPENGL_PATH)/../../../external/qemu/android/android-emugl
55EMUGL_COMMON_INCLUDES += $(HOST_EMUGL_PATH)/guest
56
57EMUGL_COMMON_CFLAGS += \
58    -DPLATFORM_SDK_VERSION=29 \
59    -DGOLDFISH_HIDL_GRALLOC \
60    -DEMULATOR_OPENGL_POST_O=1 \
61    -DHOST_BUILD \
62    -DANDROID \
63    -DGL_GLEXT_PROTOTYPES \
64    -fvisibility=default \
65    -DPAGE_SIZE=4096 \
66    -DGFXSTREAM \
67    -Wno-unused-parameter
68
69endif # GOLDFISH_OPENGL_BUILD_FOR_HOST
70
71ifeq (true,$(BUILD_EMULATOR_OPENGL)) # Guest build
72
73GOLDFISH_OPENGL_SHOULD_BUILD := true
74
75EMUGL_COMMON_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
76
77ifeq (O, $(PLATFORM_VERSION_CODENAME))
78EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
79endif
80
81ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25 && echo isApi26OrHigher),isApi26OrHigher)
82EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
83endif
84
85ifdef IS_AT_LEAST_OPD1
86    EMUGL_COMMON_CFLAGS += -DEMULATOR_OPENGL_POST_O=1
87endif
88
89ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 18 && echo PreJellyBeanMr2),PreJellyBeanMr2)
90    ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
91        EMUGL_COMMON_CFLAGS += -DHAVE_ARM_TLS_REGISTER
92    endif
93endif
94ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 16 && echo PreJellyBean),PreJellyBean)
95    EMUGL_COMMON_CFLAGS += -DALOG_ASSERT=LOG_ASSERT
96    EMUGL_COMMON_CFLAGS += -DALOGE=LOGE
97    EMUGL_COMMON_CFLAGS += -DALOGW=LOGW
98    EMUGL_COMMON_CFLAGS += -DALOGD=LOGD
99    EMUGL_COMMON_CFLAGS += -DALOGV=LOGV
100endif
101
102ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27 && echo isApi28OrHigher),isApi28OrHigher)
103    GFXSTREAM := true
104    EMUGL_COMMON_CFLAGS += -DGFXSTREAM
105endif
106
107# Include common definitions used by all the modules included later
108# in this build file. This contains the definition of all useful
109# emugl-xxxx functions.
110#
111include $(GOLDFISH_OPENGL_PATH)/common.mk
112
113endif # BUILD_EMULATOR_OPENGL (guest build)
114
115ifeq (true,$(GOLDFISH_OPENGL_SHOULD_BUILD))
116
117# Uncomment the following line if you want to enable debug traces
118# in the GLES emulation libraries.
119# EMUGL_COMMON_CFLAGS += -DEMUGL_DEBUG=1
120
121# IMPORTANT: ORDER IS CRUCIAL HERE
122#
123# For the import/export feature to work properly, you must include
124# modules below in correct order. That is, if module B depends on
125# module A, then it must be included after module A below.
126#
127# This ensures that anything exported by module A will be correctly
128# be imported by module B when it is declared.
129#
130# Note that the build system will complain if you try to import a
131# module that hasn't been declared yet anyway.
132#
133include $(GOLDFISH_OPENGL_PATH)/shared/qemupipe/Android.mk
134include $(GOLDFISH_OPENGL_PATH)/shared/gralloc_cb/Android.mk
135include $(GOLDFISH_OPENGL_PATH)/shared/GoldfishAddressSpace/Android.mk
136
137ifeq (true,$(GFXSTREAM)) # android-emu
138    include $(GOLDFISH_OPENGL_PATH)/android-emu/Android.mk
139endif
140
141include $(GOLDFISH_OPENGL_PATH)/shared/OpenglCodecCommon/Android.mk
142
143# Encoder shared libraries
144include $(GOLDFISH_OPENGL_PATH)/system/GLESv1_enc/Android.mk
145include $(GOLDFISH_OPENGL_PATH)/system/GLESv2_enc/Android.mk
146include $(GOLDFISH_OPENGL_PATH)/system/renderControl_enc/Android.mk
147
148ifeq (true,$(GFXSTREAM)) # Vulkan libs
149    include $(GOLDFISH_OPENGL_PATH)/system/vulkan_enc/Android.mk
150endif
151
152include $(GOLDFISH_OPENGL_PATH)/system/OpenglSystemCommon/Android.mk
153
154# Profiler library
155include $(GOLDFISH_OPENGL_PATH)/system/profiler/Android.mk
156
157# System shared libraries
158include $(GOLDFISH_OPENGL_PATH)/system/GLESv1/Android.mk
159include $(GOLDFISH_OPENGL_PATH)/system/GLESv2/Android.mk
160
161include $(GOLDFISH_OPENGL_PATH)/system/gralloc/Android.mk
162
163ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
164include $(GOLDFISH_OPENGL_PATH)/system/hals/Android.mk
165endif
166
167include $(GOLDFISH_OPENGL_PATH)/system/egl/Android.mk
168
169ifeq (true,$(GFXSTREAM)) # Vulkan libs
170    include $(GOLDFISH_OPENGL_PATH)/system/vulkan/Android.mk
171endif
172
173ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 28 -o $(IS_AT_LEAST_QPR1) = true && echo isApi29OrHigher),isApi29OrHigher)
174    # HWC2 enabled after P
175    include $(GOLDFISH_OPENGL_PATH)/system/hwc2/Android.mk
176    # hardware codecs enabled after P
177    include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/common/Android.mk
178    include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/plugin/Android.mk
179    include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/avcdec/Android.mk
180    include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/vpxdec/Android.mk
181endif
182
183endif
184