aboutsummaryrefslogtreecommitdiff
path: root/Android.mk
blob: 943da9334b16aa46e6d9eedacd08eda8265d47ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# This is the top-level build file for the Android HW OpenGL ES emulation
# in Android.
#
# You must define BUILD_EMULATOR_OPENGL to 'true' in your environment to
# build the following files.
#
# Also define BUILD_EMULATOR_OPENGL_DRIVER to 'true' to build the gralloc
# stuff as well.
#
# Top-level for all modules
GOLDFISH_OPENGL_PATH := $(call my-dir)

HARDWARE_GOOGLE_GFXSTREAM_PATH := $(GOLDFISH_OPENGL_PATH)/../../../hardware/google/gfxstream

ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
ENABLE_GOLDFISH_OPENGL_FOLDER := true
else
ifneq ($(filter $(GOLDFISH_OPENGL_PATH),$(PRODUCT_SOONG_NAMESPACES)),)
ENABLE_GOLDFISH_OPENGL_FOLDER := true
endif
endif

ifeq (true,$(ENABLE_GOLDFISH_OPENGL_FOLDER))

# There are two kinds of builds for goldfish-opengl:
# 1. The standard guest build, denoted by BUILD_EMULATOR_OPENGL
# 2. The host-side build, denoted by GOLDFISH_OPENGL_BUILD_FOR_HOST
#
# Variable controlling whether the build for goldfish-opengl
# libraries (including their Android.mk's) should be triggered.
GOLDFISH_OPENGL_SHOULD_BUILD := false

# In the host build, some libraries have name collisions with
# other libraries, so we have this variable here to control
# adding a suffix to the names of libraries. Should be blank
# for the guest build.
GOLDFISH_OPENGL_LIB_SUFFIX :=

# Directory containing common headers used by several modules
# This is always set to a module's LOCAL_C_INCLUDES
# See the definition of emugl-begin-module in common.mk
EMUGL_COMMON_INCLUDES := \
    $(HARDWARE_GOOGLE_GFXSTREAM_PATH)/guest/iostream/include/libOpenglRender \
    $(HARDWARE_GOOGLE_GFXSTREAM_PATH)/guest/include

# This is always set to a module's LOCAL_CFLAGS
# See the definition of emugl-begin-module in common.mk
EMUGL_COMMON_CFLAGS :=

# Whether or not to build the Vulkan library.
GFXSTREAM := false

# Host build
ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))

GOLDFISH_OPENGL_SHOULD_BUILD := true
GOLDFISH_OPENGL_LIB_SUFFIX := _host

GFXSTREAM := true

# Set modern defaults for the codename, version, etc.
PLATFORM_VERSION_CODENAME:=Q
PLATFORM_SDK_VERSION:=29
IS_AT_LEAST_OPD1:=true

# The host-side Android framework implementation
HOST_EMUGL_PATH := $(GOLDFISH_OPENGL_PATH)/../../../external/qemu/android/android-emugl
EMUGL_COMMON_INCLUDES += $(HOST_EMUGL_PATH)/guest

EMUGL_COMMON_CFLAGS += \
    -DPLATFORM_SDK_VERSION=29 \
    -DGOLDFISH_HIDL_GRALLOC \
    -DHOST_BUILD \
    -DANDROID \
    -DGL_GLEXT_PROTOTYPES \
    -fvisibility=default \
    -DPAGE_SIZE=4096 \
    -DGFXSTREAM \
    -DENABLE_ANDROID_HEALTH_MONITOR \
    -Wno-unused-parameter

endif # GOLDFISH_OPENGL_BUILD_FOR_HOST

ifeq (true,$(BUILD_EMULATOR_OPENGL)) # Guest build

GOLDFISH_OPENGL_SHOULD_BUILD := true

EMUGL_COMMON_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)

ifeq (O, $(PLATFORM_VERSION_CODENAME))
EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
endif

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25 && echo isApi26OrHigher),isApi26OrHigher)
EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
endif

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 18 && echo PreJellyBeanMr2),PreJellyBeanMr2)
    ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
        EMUGL_COMMON_CFLAGS += -DHAVE_ARM_TLS_REGISTER
    endif
endif
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 16 && echo PreJellyBean),PreJellyBean)
    EMUGL_COMMON_CFLAGS += -DALOG_ASSERT=LOG_ASSERT
    EMUGL_COMMON_CFLAGS += -DALOGE=LOGE
    EMUGL_COMMON_CFLAGS += -DALOGW=LOGW
    EMUGL_COMMON_CFLAGS += -DALOGD=LOGD
    EMUGL_COMMON_CFLAGS += -DALOGV=LOGV
endif

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27 && echo isApi28OrHigher),isApi28OrHigher)
    GFXSTREAM := true
    EMUGL_COMMON_CFLAGS += -DGFXSTREAM
endif

# Include common definitions used by all the modules included later
# in this build file. This contains the definition of all useful
# emugl-xxxx functions.
#
include $(GOLDFISH_OPENGL_PATH)/common.mk

endif # BUILD_EMULATOR_OPENGL (guest build)

ifeq (true,$(GOLDFISH_OPENGL_SHOULD_BUILD))

# Uncomment the following line if you want to enable debug traces
# in the GLES emulation libraries.
# EMUGL_COMMON_CFLAGS += -DEMUGL_DEBUG=1

# IMPORTANT: ORDER IS CRUCIAL HERE
#
# For the import/export feature to work properly, you must include
# modules below in correct order. That is, if module B depends on
# module A, then it must be included after module A below.
#
# This ensures that anything exported by module A will be correctly
# be imported by module B when it is declared.
#
# Note that the build system will complain if you try to import a
# module that hasn't been declared yet anyway.
#
ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
include $(GOLDFISH_OPENGL_PATH)/system/hals/Android.mk
endif

endif

endif # ENABLE_GOLDFISH_OPENGL_FOLDER