blob: 5ac775e4780d0c2a1825b61e63ad9d2a0ba6e88f [file] [log] [blame]
keunyoungb85b2752013-03-08 12:28:03 -08001# 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#
keunyoungb85b2752013-03-08 12:28:03 -080010# Top-level for all modules
Lingfeng Yang4fa970a2018-09-24 07:53:40 -070011GOLDFISH_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 :=
keunyoungb85b2752013-03-08 12:28:03 -080026
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
Lingfeng Yang4fa970a2018-09-24 07:53:40 -070030EMUGL_COMMON_INCLUDES := $(GOLDFISH_OPENGL_PATH)/host/include/libOpenglRender $(GOLDFISH_OPENGL_PATH)/system/include
keunyoungb85b2752013-03-08 12:28:03 -080031
keunyoungb85b2752013-03-08 12:28:03 -080032# This is always set to a module's LOCAL_CFLAGS
33# See the definition of emugl-begin-module in common.mk
Gurchetan Singhcb790882021-12-06 09:42:42 -080034EMUGL_COMMON_CFLAGS :=
Lingfeng Yang4fa970a2018-09-24 07:53:40 -070035
Lingfeng Yang6a283672018-11-01 13:37:56 -070036# Whether or not to build the Vulkan library.
Lingfeng Yang6f9871b2020-08-17 15:46:53 -070037GFXSTREAM := false
Lingfeng Yang6a283672018-11-01 13:37:56 -070038
Lingfeng Yang4fa970a2018-09-24 07:53:40 -070039# Host build
40ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
41
42GOLDFISH_OPENGL_SHOULD_BUILD := true
43GOLDFISH_OPENGL_LIB_SUFFIX := _host
44
Lingfeng Yang6f9871b2020-08-17 15:46:53 -070045GFXSTREAM := true
Lingfeng Yang6a283672018-11-01 13:37:56 -070046
Lingfeng Yang4fa970a2018-09-24 07:53:40 -070047# Set modern defaults for the codename, version, etc.
48PLATFORM_VERSION_CODENAME:=Q
49PLATFORM_SDK_VERSION:=29
50IS_AT_LEAST_OPD1:=true
51
52# The host-side Android framework implementation
53HOST_EMUGL_PATH := $(GOLDFISH_OPENGL_PATH)/../../../external/qemu/android/android-emugl
54EMUGL_COMMON_INCLUDES += $(HOST_EMUGL_PATH)/guest
55
56EMUGL_COMMON_CFLAGS += \
57 -DPLATFORM_SDK_VERSION=29 \
58 -DGOLDFISH_HIDL_GRALLOC \
59 -DEMULATOR_OPENGL_POST_O=1 \
60 -DHOST_BUILD \
61 -DANDROID \
62 -DGL_GLEXT_PROTOTYPES \
Lingfeng Yange38d15c2018-09-24 16:24:01 -070063 -fvisibility=default \
Lingfeng Yang2ed17d42018-09-27 08:04:08 -070064 -DPAGE_SIZE=4096 \
Lingfeng Yang6f9871b2020-08-17 15:46:53 -070065 -DGFXSTREAM \
Aurimas Liutikasacc48742018-12-20 15:06:46 -080066 -Wno-unused-parameter
Lingfeng Yang4fa970a2018-09-24 07:53:40 -070067
68endif # GOLDFISH_OPENGL_BUILD_FOR_HOST
69
70ifeq (true,$(BUILD_EMULATOR_OPENGL)) # Guest build
71
72GOLDFISH_OPENGL_SHOULD_BUILD := true
73
74EMUGL_COMMON_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
keunyoungb85b2752013-03-08 12:28:03 -080075
Lingfeng Yang5a8161c2017-05-06 01:00:03 -070076ifeq (O, $(PLATFORM_VERSION_CODENAME))
Lingfeng Yang256462a2017-06-05 11:50:17 -070077EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
78endif
79
80ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25 && echo isApi26OrHigher),isApi26OrHigher)
81EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
Lingfeng Yang5a8161c2017-05-06 01:00:03 -070082endif
83
Yifan Hong22dd0fe2017-06-08 17:17:17 -070084ifdef IS_AT_LEAST_OPD1
bohu8b0bfc72017-05-11 02:11:51 -070085 EMUGL_COMMON_CFLAGS += -DEMULATOR_OPENGL_POST_O=1
86endif
87
Yahan Zhou52dd9f02016-07-20 14:31:33 -070088ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 18 && echo PreJellyBeanMr2),PreJellyBeanMr2)
Yahan Zhouda1c76d2016-06-23 13:58:09 -070089 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
90 EMUGL_COMMON_CFLAGS += -DHAVE_ARM_TLS_REGISTER
91 endif
Yahan Zhoub795a342016-07-20 16:12:02 -070092endif
93ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 16 && echo PreJellyBean),PreJellyBean)
Yahan Zhouda1c76d2016-06-23 13:58:09 -070094 EMUGL_COMMON_CFLAGS += -DALOG_ASSERT=LOG_ASSERT
95 EMUGL_COMMON_CFLAGS += -DALOGE=LOGE
96 EMUGL_COMMON_CFLAGS += -DALOGW=LOGW
97 EMUGL_COMMON_CFLAGS += -DALOGD=LOGD
Lingfeng Yange5913372016-11-29 14:23:14 -080098 EMUGL_COMMON_CFLAGS += -DALOGV=LOGV
Yahan Zhouda1c76d2016-06-23 13:58:09 -070099endif
100
Lingfeng Yanga4085412018-11-01 20:19:46 -0700101ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27 && echo isApi28OrHigher),isApi28OrHigher)
Lingfeng Yang6f9871b2020-08-17 15:46:53 -0700102 GFXSTREAM := true
103 EMUGL_COMMON_CFLAGS += -DGFXSTREAM
Lingfeng Yang6a283672018-11-01 13:37:56 -0700104endif
105
keunyoungb85b2752013-03-08 12:28:03 -0800106# Include common definitions used by all the modules included later
107# in this build file. This contains the definition of all useful
108# emugl-xxxx functions.
109#
Lingfeng Yang4fa970a2018-09-24 07:53:40 -0700110include $(GOLDFISH_OPENGL_PATH)/common.mk
111
112endif # BUILD_EMULATOR_OPENGL (guest build)
113
114ifeq (true,$(GOLDFISH_OPENGL_SHOULD_BUILD))
115
116# Uncomment the following line if you want to enable debug traces
117# in the GLES emulation libraries.
118# EMUGL_COMMON_CFLAGS += -DEMUGL_DEBUG=1
keunyoungb85b2752013-03-08 12:28:03 -0800119
120# IMPORTANT: ORDER IS CRUCIAL HERE
121#
122# For the import/export feature to work properly, you must include
123# modules below in correct order. That is, if module B depends on
124# module A, then it must be included after module A below.
125#
126# This ensures that anything exported by module A will be correctly
127# be imported by module B when it is declared.
128#
129# Note that the build system will complain if you try to import a
130# module that hasn't been declared yet anyway.
131#
Roman Kiryanovb488e622020-05-19 18:07:23 -0700132include $(GOLDFISH_OPENGL_PATH)/shared/qemupipe/Android.mk
133include $(GOLDFISH_OPENGL_PATH)/shared/gralloc_cb/Android.mk
Roman Kiryanov1ef59e42020-05-11 15:50:11 -0700134include $(GOLDFISH_OPENGL_PATH)/shared/GoldfishAddressSpace/Android.mk
Lingfeng Yanged069c52020-09-03 19:11:02 -0700135
136ifeq (true,$(GFXSTREAM)) # android-emu
137 include $(GOLDFISH_OPENGL_PATH)/android-emu/Android.mk
138endif
139
Lingfeng Yang4fa970a2018-09-24 07:53:40 -0700140include $(GOLDFISH_OPENGL_PATH)/shared/OpenglCodecCommon/Android.mk
keunyoungb85b2752013-03-08 12:28:03 -0800141
Lingfeng Yang4fa970a2018-09-24 07:53:40 -0700142# Encoder shared libraries
143include $(GOLDFISH_OPENGL_PATH)/system/GLESv1_enc/Android.mk
144include $(GOLDFISH_OPENGL_PATH)/system/GLESv2_enc/Android.mk
145include $(GOLDFISH_OPENGL_PATH)/system/renderControl_enc/Android.mk
keunyoungb85b2752013-03-08 12:28:03 -0800146
Lingfeng Yang6f9871b2020-08-17 15:46:53 -0700147ifeq (true,$(GFXSTREAM)) # Vulkan libs
Lingfeng Yang6a283672018-11-01 13:37:56 -0700148 include $(GOLDFISH_OPENGL_PATH)/system/vulkan_enc/Android.mk
149endif
150
Lingfeng Yang4fa970a2018-09-24 07:53:40 -0700151include $(GOLDFISH_OPENGL_PATH)/system/OpenglSystemCommon/Android.mk
keunyoungb85b2752013-03-08 12:28:03 -0800152
Yahan Zhou4719ae92021-06-24 13:30:56 -0700153# Profiler library
154include $(GOLDFISH_OPENGL_PATH)/system/profiler/Android.mk
155
keunyoungb85b2752013-03-08 12:28:03 -0800156# System shared libraries
Lingfeng Yang4fa970a2018-09-24 07:53:40 -0700157include $(GOLDFISH_OPENGL_PATH)/system/GLESv1/Android.mk
158include $(GOLDFISH_OPENGL_PATH)/system/GLESv2/Android.mk
keunyoungb85b2752013-03-08 12:28:03 -0800159
Lingfeng Yang2ed17d42018-09-27 08:04:08 -0700160include $(GOLDFISH_OPENGL_PATH)/system/gralloc/Android.mk
Lingfeng Yangb65946f2020-02-04 10:49:07 -0800161
162ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
Roman Kiryanovefb10582020-01-29 16:28:15 -0800163include $(GOLDFISH_OPENGL_PATH)/system/hals/Android.mk
Lingfeng Yangb65946f2020-02-04 10:49:07 -0800164endif
165
Lingfeng Yang4fa970a2018-09-24 07:53:40 -0700166include $(GOLDFISH_OPENGL_PATH)/system/egl/Android.mk
keunyoungb85b2752013-03-08 12:28:03 -0800167
Lingfeng Yang6f9871b2020-08-17 15:46:53 -0700168ifeq (true,$(GFXSTREAM)) # Vulkan libs
Lingfeng Yangd7447042018-10-25 11:09:18 -0700169 include $(GOLDFISH_OPENGL_PATH)/system/vulkan/Android.mk
170endif
Lingfeng Yanga89af502018-10-18 13:46:20 -0700171
huansd96d5bd2018-10-15 14:32:46 -0700172ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 28 -o $(IS_AT_LEAST_QPR1) = true && echo isApi29OrHigher),isApi29OrHigher)
173 # HWC2 enabled after P
174 include $(GOLDFISH_OPENGL_PATH)/system/hwc2/Android.mk
Roman Kiryanovf0ae38e2020-05-19 17:25:11 +0000175 # hardware codecs enabled after P
176 include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/common/Android.mk
177 include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/plugin/Android.mk
178 include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/avcdec/Android.mk
179 include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/vpxdec/Android.mk
huansd96d5bd2018-10-15 14:32:46 -0700180endif
181
Lingfeng Yang4fa970a2018-09-24 07:53:40 -0700182endif