keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 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 | # |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 10 | # Top-level for all modules |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 11 | GOLDFISH_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. |
| 19 | GOLDFISH_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. |
| 25 | GOLDFISH_OPENGL_LIB_SUFFIX := |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 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 |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 30 | EMUGL_COMMON_INCLUDES := $(GOLDFISH_OPENGL_PATH)/host/include/libOpenglRender $(GOLDFISH_OPENGL_PATH)/system/include |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 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 |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 35 | EMUGL_COMMON_CFLAGS := -DWITH_GLES2 |
| 36 | |
| 37 | # Host build |
| 38 | ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST)) |
| 39 | |
| 40 | GOLDFISH_OPENGL_SHOULD_BUILD := true |
| 41 | GOLDFISH_OPENGL_LIB_SUFFIX := _host |
| 42 | |
| 43 | # Set modern defaults for the codename, version, etc. |
| 44 | PLATFORM_VERSION_CODENAME:=Q |
| 45 | PLATFORM_SDK_VERSION:=29 |
| 46 | IS_AT_LEAST_OPD1:=true |
| 47 | |
| 48 | # The host-side Android framework implementation |
| 49 | HOST_EMUGL_PATH := $(GOLDFISH_OPENGL_PATH)/../../../external/qemu/android/android-emugl |
| 50 | EMUGL_COMMON_INCLUDES += $(HOST_EMUGL_PATH)/guest |
| 51 | |
| 52 | EMUGL_COMMON_CFLAGS += \ |
| 53 | -DPLATFORM_SDK_VERSION=29 \ |
| 54 | -DGOLDFISH_HIDL_GRALLOC \ |
| 55 | -DEMULATOR_OPENGL_POST_O=1 \ |
| 56 | -DHOST_BUILD \ |
| 57 | -DANDROID \ |
| 58 | -DGL_GLEXT_PROTOTYPES \ |
Lingfeng Yang | e38d15c | 2018-09-24 16:24:01 -0700 | [diff] [blame] | 59 | -fvisibility=default \ |
Lingfeng Yang | 2ed17d4 | 2018-09-27 08:04:08 -0700 | [diff] [blame^] | 60 | -DPAGE_SIZE=4096 \ |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 61 | |
| 62 | endif # GOLDFISH_OPENGL_BUILD_FOR_HOST |
| 63 | |
| 64 | ifeq (true,$(BUILD_EMULATOR_OPENGL)) # Guest build |
| 65 | |
| 66 | GOLDFISH_OPENGL_SHOULD_BUILD := true |
| 67 | |
| 68 | EMUGL_COMMON_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 69 | |
Lingfeng Yang | 5a8161c | 2017-05-06 01:00:03 -0700 | [diff] [blame] | 70 | ifeq (O, $(PLATFORM_VERSION_CODENAME)) |
Lingfeng Yang | 256462a | 2017-06-05 11:50:17 -0700 | [diff] [blame] | 71 | EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC |
| 72 | endif |
| 73 | |
| 74 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25 && echo isApi26OrHigher),isApi26OrHigher) |
| 75 | EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC |
Lingfeng Yang | 5a8161c | 2017-05-06 01:00:03 -0700 | [diff] [blame] | 76 | endif |
| 77 | |
Yifan Hong | 22dd0fe | 2017-06-08 17:17:17 -0700 | [diff] [blame] | 78 | ifdef IS_AT_LEAST_OPD1 |
bohu | 8b0bfc7 | 2017-05-11 02:11:51 -0700 | [diff] [blame] | 79 | EMUGL_COMMON_CFLAGS += -DEMULATOR_OPENGL_POST_O=1 |
| 80 | endif |
| 81 | |
Yahan Zhou | 52dd9f0 | 2016-07-20 14:31:33 -0700 | [diff] [blame] | 82 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 18 && echo PreJellyBeanMr2),PreJellyBeanMr2) |
Yahan Zhou | da1c76d | 2016-06-23 13:58:09 -0700 | [diff] [blame] | 83 | ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) |
| 84 | EMUGL_COMMON_CFLAGS += -DHAVE_ARM_TLS_REGISTER |
| 85 | endif |
Yahan Zhou | b795a34 | 2016-07-20 16:12:02 -0700 | [diff] [blame] | 86 | endif |
| 87 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 16 && echo PreJellyBean),PreJellyBean) |
Yahan Zhou | da1c76d | 2016-06-23 13:58:09 -0700 | [diff] [blame] | 88 | EMUGL_COMMON_CFLAGS += -DALOG_ASSERT=LOG_ASSERT |
| 89 | EMUGL_COMMON_CFLAGS += -DALOGE=LOGE |
| 90 | EMUGL_COMMON_CFLAGS += -DALOGW=LOGW |
| 91 | EMUGL_COMMON_CFLAGS += -DALOGD=LOGD |
Lingfeng Yang | e591337 | 2016-11-29 14:23:14 -0800 | [diff] [blame] | 92 | EMUGL_COMMON_CFLAGS += -DALOGV=LOGV |
Yahan Zhou | da1c76d | 2016-06-23 13:58:09 -0700 | [diff] [blame] | 93 | endif |
| 94 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 95 | # Include common definitions used by all the modules included later |
| 96 | # in this build file. This contains the definition of all useful |
| 97 | # emugl-xxxx functions. |
| 98 | # |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 99 | include $(GOLDFISH_OPENGL_PATH)/common.mk |
| 100 | |
| 101 | endif # BUILD_EMULATOR_OPENGL (guest build) |
| 102 | |
| 103 | ifeq (true,$(GOLDFISH_OPENGL_SHOULD_BUILD)) |
| 104 | |
| 105 | # Uncomment the following line if you want to enable debug traces |
| 106 | # in the GLES emulation libraries. |
| 107 | # EMUGL_COMMON_CFLAGS += -DEMUGL_DEBUG=1 |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 108 | |
| 109 | # IMPORTANT: ORDER IS CRUCIAL HERE |
| 110 | # |
| 111 | # For the import/export feature to work properly, you must include |
| 112 | # modules below in correct order. That is, if module B depends on |
| 113 | # module A, then it must be included after module A below. |
| 114 | # |
| 115 | # This ensures that anything exported by module A will be correctly |
| 116 | # be imported by module B when it is declared. |
| 117 | # |
| 118 | # Note that the build system will complain if you try to import a |
| 119 | # module that hasn't been declared yet anyway. |
| 120 | # |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 121 | include $(GOLDFISH_OPENGL_PATH)/shared/OpenglCodecCommon/Android.mk |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 122 | |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 123 | # Encoder shared libraries |
| 124 | include $(GOLDFISH_OPENGL_PATH)/system/GLESv1_enc/Android.mk |
| 125 | include $(GOLDFISH_OPENGL_PATH)/system/GLESv2_enc/Android.mk |
| 126 | include $(GOLDFISH_OPENGL_PATH)/system/renderControl_enc/Android.mk |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 127 | |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 128 | # TODO: Get the rest of the libraries to build on host |
| 129 | # From here, we require more android framework |
| 130 | # reimplementations on host: |
| 131 | # goldfish_dma |
| 132 | # sockets |
| 133 | # etc. |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 134 | include $(GOLDFISH_OPENGL_PATH)/system/OpenglSystemCommon/Android.mk |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 135 | |
| 136 | # System shared libraries |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 137 | include $(GOLDFISH_OPENGL_PATH)/system/GLESv1/Android.mk |
| 138 | include $(GOLDFISH_OPENGL_PATH)/system/GLESv2/Android.mk |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 139 | |
Lingfeng Yang | 2ed17d4 | 2018-09-27 08:04:08 -0700 | [diff] [blame^] | 140 | include $(GOLDFISH_OPENGL_PATH)/system/gralloc/Android.mk |
| 141 | |
Lingfeng Yang | 78a8883 | 2018-09-26 20:57:52 -0700 | [diff] [blame] | 142 | ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST)) |
| 143 | |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 144 | include $(GOLDFISH_OPENGL_PATH)/system/egl/Android.mk |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 145 | |
Lingfeng Yang | 4fa970a | 2018-09-24 07:53:40 -0700 | [diff] [blame] | 146 | endif # !GOLDFISH_OPENGL_BUILD_FOR_HOST |
| 147 | |
| 148 | endif |