Added rules to build 64-bit libraries for 64-bit emulator
All ten libraries can now be built in 64-bit named "lib64*" (*)
in addition to the original 32-bit form named "lib*".
Also, dlopen "lib64*so" in 64-bit.
(*) eg. In Ubuntu, all can be built with the following command:
make out/host/linux-x86/lib/lib64OpenglRender.so \
out/host/linux-x86/lib/lib64EGL_translator.so \
out/host/linux-x86/lib/lib64GLES_CM_translator.so \
out/host/linux-x86/lib/lib64GLES_V2_translator.so
Rules to build static libraries lib64log.a, lib64cutils.a and lib64utils.a
they depend were added in other CLs.
Change-Id: I3afb64de6dda1d55dbd1b4443d2dbc78a683b19f
diff --git a/tools/emulator/opengl/host/libs/GLESv1_dec/Android.mk b/tools/emulator/opengl/host/libs/GLESv1_dec/Android.mk
index 5f134fc..57dc429 100644
--- a/tools/emulator/opengl/host/libs/GLESv1_dec/Android.mk
+++ b/tools/emulator/opengl/host/libs/GLESv1_dec/Android.mk
@@ -1,5 +1,13 @@
LOCAL_PATH := $(call my-dir)
+host_common_debug_CFLAGS :=
+
+#For gl debbuging
+#host_common_debug_CFLAGS += -DCHECK_GL_ERROR
+#host_common_debug_CFLAGS += -DDEBUG_PRINTOUT
+
+
+### host library #########################################
$(call emugl-begin-host-static-library,libGLESv1_dec)
$(call emugl-import, libOpenglCodecCommon libOpenglOsUtils)
@@ -12,8 +20,24 @@
# for gl_types.h !
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv1_enc)
-#For gl debbuging
-#$(call emugl-export,CFLAGS,-DCHECK_GL_ERROR)
-#$(call emugl-export,CFLAGS,-DDEBUG_PRINTOUT)
+$(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS))
+
+$(call emugl-end-module)
+
+
+### host library, 64-bit ####################################
+$(call emugl-begin-host-static-library,lib64GLESv1_dec)
+
+$(call emugl-import, lib64OpenglCodecCommon lib64OpenglOsUtils)
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
+
+$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv1_enc,gl)
+
+LOCAL_SRC_FILES := GLDecoder.cpp
+
+# for gl_types.h !
+$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv1_enc)
+
+$(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS) -m64)
$(call emugl-end-module)
diff --git a/tools/emulator/opengl/host/libs/GLESv2_dec/Android.mk b/tools/emulator/opengl/host/libs/GLESv2_dec/Android.mk
index a66c6ce..f9a83ae 100644
--- a/tools/emulator/opengl/host/libs/GLESv2_dec/Android.mk
+++ b/tools/emulator/opengl/host/libs/GLESv2_dec/Android.mk
@@ -1,5 +1,13 @@
LOCAL_PATH := $(call my-dir)
+host_common_debug_CFLAGS :=
+
+#For gl debbuging
+#host_common_debug_CFLAGS += -DCHECK_GL_ERROR
+#host_common_debug_CFLAGS += -DDEBUG_PRINTOUT
+
+
+### host library ##########################################
$(call emugl-begin-host-static-library,libGLESv2_dec)
$(call emugl-import, libOpenglCodecCommon libOpenglOsUtils)
$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv2_enc,gl2)
@@ -8,9 +16,22 @@
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv2_enc)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-#For gl debbuging
-#$(call emugl-export,CFLAGS,-DCHECK_GL_ERROR)
-#$(call emugl-export,CFLAGS,-DDEBUG_PRINTOUT)
+$(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS))
+
+LOCAL_SRC_FILES := GL2Decoder.cpp
+
+$(call emugl-end-module)
+
+### host library, 64-bit ####################################
+$(call emugl-begin-host-static-library,lib64GLESv2_dec)
+$(call emugl-import, lib64OpenglCodecCommon lib64OpenglOsUtils)
+$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv2_enc,gl2)
+
+# For gl2_types.h !
+$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv2_enc)
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
+
+$(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS) -m64)
LOCAL_SRC_FILES := GL2Decoder.cpp
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/Android.mk b/tools/emulator/opengl/host/libs/Translator/EGL/Android.mk
index 96e87de..f1a6d3a 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/Android.mk
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/Android.mk
@@ -1,31 +1,28 @@
LOCAL_PATH := $(call my-dir)
-### EGL host implementation ########################
-$(call emugl-begin-host-shared-library,libEGL_translator)
-$(call emugl-import,libGLcommon)
-
-OS_SRCS:=
+host_OS_SRCS :=
+host_common_LDLIBS :=
ifeq ($(HOST_OS),linux)
- OS_SRCS = EglX11Api.cpp
- LOCAL_LDLIBS += -lX11 -lGL -ldl -lpthread
+ host_OS_SRCS = EglX11Api.cpp
+ host_common_LDLIBS += -lX11 -lGL -ldl -lpthread
endif
ifeq ($(HOST_OS),darwin)
- OS_SRCS = EglMacApi.cpp \
- MacNative.m \
- MacPixelFormatsAttribs.m
+ host_OS_SRCS = EglMacApi.cpp \
+ MacNative.m \
+ MacPixelFormatsAttribs.m
- LOCAL_LDLIBS += -Wl,-framework,AppKit
+ host_common_LDLIBS += -Wl,-framework,AppKit
endif
ifeq ($(HOST_OS),windows)
- OS_SRCS = EglWindowsApi.cpp
- LOCAL_LDLIBS += -lopengl32 -lgdi32
+ host_OS_SRCS = EglWindowsApi.cpp
+ host_common_LDLIBS += -lopengl32 -lgdi32
endif
-LOCAL_SRC_FILES := \
- $(OS_SRCS) \
+host_common_SRC_FILES := \
+ $(host_OS_SRCS) \
ThreadInfo.cpp \
EglImp.cpp \
EglConfig.cpp \
@@ -40,5 +37,21 @@
EglDisplay.cpp \
ClientAPIExts.cpp
+### EGL host implementation ########################
+$(call emugl-begin-host-shared-library,libEGL_translator)
+$(call emugl-import,libGLcommon)
+
+LOCAL_LDLIBS += $(host_common_LDLIBS)
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
+
+$(call emugl-end-module)
+
+### EGL host implementation, 64-bit ########################
+$(call emugl-begin-host-shared-library,lib64EGL_translator)
+$(call emugl-import,lib64GLcommon)
+
+LOCAL_LDLIBS += $(host_common_LDLIBS) -m64
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
+
$(call emugl-end-module)
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp b/tools/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
index 85d1b28..d03c9db 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
@@ -183,16 +183,8 @@
return func;
}
-#ifdef _WIN32
-#define LIB_GLES_CM_NAME "libGLES_CM_translator"
-#define LIB_GLES_V2_NAME "libGLES_V2_translator"
-#elif __linux__
-#define LIB_GLES_CM_NAME "libGLES_CM_translator.so"
-#define LIB_GLES_V2_NAME "libGLES_V2_translator.so"
-#elif __APPLE__
-#define LIB_GLES_CM_NAME "libGLES_CM_translator.dylib"
-#define LIB_GLES_V2_NAME "libGLES_V2_translator.dylib"
-#endif
+#define LIB_GLES_CM_NAME EMUGL_LIBNAME("GLES_CM_translator")
+#define LIB_GLES_V2_NAME EMUGL_LIBNAME("GLES_V2_translator")
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay display, EGLint *major, EGLint *minor) {
diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_CM/Android.mk b/tools/emulator/opengl/host/libs/Translator/GLES_CM/Android.mk
index 21adeec..9aa74a7 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLES_CM/Android.mk
+++ b/tools/emulator/opengl/host/libs/Translator/GLES_CM/Android.mk
@@ -1,14 +1,28 @@
LOCAL_PATH := $(call my-dir)
+host_common_SRC_FILES := \
+ GLEScmImp.cpp \
+ GLEScmUtils.cpp \
+ GLEScmContext.cpp \
+ GLEScmValidate.cpp
+
+
### GLES_CM host implementation (On top of OpenGL) ########################
$(call emugl-begin-host-shared-library,libGLES_CM_translator)
$(call emugl-import,libGLcommon)
-LOCAL_SRC_FILES := \
- GLEScmImp.cpp \
- GLEScmUtils.cpp \
- GLEScmContext.cpp \
- GLEScmValidate.cpp
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
+
+$(call emugl-end-module)
+
+
+### GLES_CM host implementation, 64-bit ########################
+$(call emugl-begin-host-shared-library,lib64GLES_CM_translator)
+
+$(call emugl-import,lib64GLcommon)
+
+LOCAL_LDLIBS += -m64
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-end-module)
diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_V2/Android.mk b/tools/emulator/opengl/host/libs/Translator/GLES_V2/Android.mk
index a7c68b1..f4845f7 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLES_V2/Android.mk
+++ b/tools/emulator/opengl/host/libs/Translator/GLES_V2/Android.mk
@@ -1,14 +1,27 @@
LOCAL_PATH := $(call my-dir)
-### GLES_CM host implementation (On top of OpenGL) ########################
+host_common_SRC_FILES := \
+ GLESv2Imp.cpp \
+ GLESv2Context.cpp \
+ GLESv2Validate.cpp \
+ ShaderParser.cpp \
+ ProgramData.cpp
+
+
+### GLES_V2 host implementation (On top of OpenGL) ########################
$(call emugl-begin-host-shared-library,libGLES_V2_translator)
$(call emugl-import, libGLcommon)
-LOCAL_SRC_FILES := \
- GLESv2Imp.cpp \
- GLESv2Context.cpp \
- GLESv2Validate.cpp \
- ShaderParser.cpp \
- ProgramData.cpp
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
+
+$(call emugl-end-module)
+
+
+### GLES_V2 host implementation, 64-bit ##############################
+$(call emugl-begin-host-shared-library,lib64GLES_V2_translator)
+$(call emugl-import, lib64GLcommon)
+
+LOCAL_LDLIBS += -m64
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-end-module)
diff --git a/tools/emulator/opengl/host/libs/Translator/GLcommon/Android.mk b/tools/emulator/opengl/host/libs/Translator/GLcommon/Android.mk
index 88d8bdf..1236566 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLcommon/Android.mk
+++ b/tools/emulator/opengl/host/libs/Translator/GLcommon/Android.mk
@@ -1,13 +1,6 @@
LOCAL_PATH := $(call my-dir)
-### EGL host implementation ########################
-$(call emugl-begin-host-static-library,libGLcommon)
-
-$(call emugl-import,libOpenglOsUtils)
-
-translator_path := $(LOCAL_PATH)/..
-
-LOCAL_SRC_FILES := \
+host_common_SRC_FILES := \
GLDispatch.cpp \
GLutils.cpp \
GLEScontext.cpp \
@@ -22,20 +15,47 @@
objectNameManager.cpp \
FramebufferData.cpp
+host_GL_COMMON_LINKER_FLAGS :=
+host_common_LDLIBS :=
+host_common_LDFLAGS :=
+
ifeq ($(HOST_OS),linux)
-# $(call emugl-export,LDFLAGS,-Wl,--whole-archive)
- $(call emugl-export,LDLIBS,-lGL -ldl)
- GL_COMMON_LINKER_FLAGS := -Wl,-Bsymbolic
- $(call emugl-export,LDFLAGS,$(GL_COMMON_LINKER_FLAGS))
+# host_common_LDFLAGS += -Wl,--whole-archive
+ host_common_LDLIBS += -lGL -ldl
+ host_common_LDFLAGS += -Wl,-Bsymbolic
endif
ifeq ($(HOST_OS),windows)
- $(call emugl-export,LDLIBS,-lopengl32 -lgdi32)
- GL_COMMON_LINKER_FLAGS := -Wl,--add-stdcall-alias
- $(call emugl-export,LDFLAGS,$(GL_COMMON_LINKER_FLAGS))
+ host_common_LDLIBS += -lopengl32 -lgdi32
+ host_common_LDFLAGS += -Wl,--add-stdcall-alias
endif
+
+### EGL host implementation ########################
+
+$(call emugl-begin-host-static-library,libGLcommon)
+
+$(call emugl-import,libOpenglOsUtils)
+translator_path := $(LOCAL_PATH)/..
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
+$(call emugl-export,LDLIBS,$(host_common_LDLIBS))
+$(call emugl-export,LDFLAGS,$(host_common_LDFLAGS))
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/../include $(EMUGL_PATH)/shared)
$(call emugl-export,STATIC_LIBRARIES, libcutils libutils liblog)
$(call emugl-end-module)
+
+
+### EGL host implementation, 64-bit ################
+
+$(call emugl-begin-host-static-library,lib64GLcommon)
+
+$(call emugl-import,lib64OpenglOsUtils)
+translator_path := $(LOCAL_PATH)/..
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
+$(call emugl-export,LDLIBS,$(host_common_LDLIBS))
+$(call emugl-export,LDFLAGS,$(host_common_LDFLAGS))
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/../include $(EMUGL_PATH)/shared)
+$(call emugl-export,STATIC_LIBRARIES, lib64cutils lib64utils lib64log)
+
+$(call emugl-end-module)
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/Android.mk b/tools/emulator/opengl/host/libs/libOpenglRender/Android.mk
index 3beee95..1d923b4 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/Android.mk
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/Android.mk
@@ -1,28 +1,24 @@
LOCAL_PATH := $(call my-dir)
-### libOpenglRender #################################################
-$(call emugl-begin-host-shared-library,libOpenglRender)
-
-$(call emugl-import,libGLESv1_dec libGLESv2_dec lib_renderControl_dec libOpenglCodecCommon libOpenglOsUtils)
-
-OS_SRCS:=
+host_OS_SRCS :=
+host_common_LDLIBS :=
ifeq ($(HOST_OS),linux)
- OS_SRCS = NativeLinuxSubWindow.cpp
- LOCAL_LDLIBS += -lX11
+ host_OS_SRCS = NativeLinuxSubWindow.cpp
+ host_common_LDLIBS += -lX11
endif
ifeq ($(HOST_OS),darwin)
- OS_SRCS = NativeMacSubWindow.m
- LOCAL_LDLIBS += -Wl,-framework,AppKit
+ host_OS_SRCS = NativeMacSubWindow.m
+ host_common_LDLIBS += -Wl,-framework,AppKit
endif
ifeq ($(HOST_OS),windows)
- OS_SRCS = NativeWindowsSubWindow.cpp
+ host_OS_SRCS = NativeWindowsSubWindow.cpp
endif
-LOCAL_SRC_FILES := \
- $(OS_SRCS) \
+host_common_SRC_FILES := \
+ $(host_OS_SRCS) \
render_api.cpp \
ColorBuffer.cpp \
EGLDispatch.cpp \
@@ -38,6 +34,20 @@
ReadBuffer.cpp \
RenderServer.cpp
+host_common_CFLAGS :=
+
+#For gl debbuging
+#host_common_CFLAGS += -DCHECK_GL_ERROR
+
+
+### host libOpenglRender #################################################
+$(call emugl-begin-host-shared-library,libOpenglRender)
+
+$(call emugl-import,libGLESv1_dec libGLESv2_dec lib_renderControl_dec libOpenglCodecCommon libOpenglOsUtils)
+
+LOCAL_LDLIBS += $(host_common_LDLIBS)
+
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/host/include)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
@@ -46,7 +56,28 @@
LOCAL_STATIC_LIBRARIES += libutils liblog
-#For gl debbuging
-#$(call emugl-export,CFLAGS,-DCHECK_GL_ERROR)
+$(call emugl-export,CFLAGS,$(host_common_CFLAGS))
+
+$(call emugl-end-module)
+
+
+### host libOpenglRender, 64-bit #########################################
+$(call emugl-begin-host-shared-library,lib64OpenglRender)
+
+$(call emugl-import,lib64GLESv1_dec lib64GLESv2_dec lib64_renderControl_dec lib64OpenglCodecCommon lib64OpenglOsUtils)
+
+#LOCAL_LDFLAGS += -m64 # adding -m64 here doesn't work, because it somehow appear BEFORE -m32 in command-line.
+LOCAL_LDLIBS += $(host_common_LDLIBS) -m64 # Put -m64 it in LOCAL_LDLIBS instead.
+
+LOCAL_SRC_FILES := $(host_common_SRC_FILES)
+$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/host/include)
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
+
+# use Translator's egl/gles headers
+LOCAL_C_INCLUDES += $(EMUGL_PATH)/host/libs/Translator/include
+
+LOCAL_STATIC_LIBRARIES += lib64utils lib64log
+
+$(call emugl-export,CFLAGS,$(host_common_CFLAGS) -m64)
$(call emugl-end-module)
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
index 5f05caf..3cf5dbc 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
@@ -20,13 +20,7 @@
EGLDispatch s_egl;
-#ifdef _WIN32
-#define DEFAULT_EGL_LIB "libEGL_translator"
-#elif defined(__APPLE__)
-#define DEFAULT_EGL_LIB "libEGL_translator.dylib"
-#else
-#define DEFAULT_EGL_LIB "libEGL_translator.so"
-#endif
+#define DEFAULT_EGL_LIB EMUGL_LIBNAME("EGL_translator")
bool init_egl_dispatch()
{
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
index b461807..cda205f 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
@@ -24,13 +24,7 @@
static osUtils::dynLibrary *s_gles2_lib = NULL;
-#ifdef _WIN32
-#define DEFAULT_GLES_V2_LIB "libGLES_V2_translator"
-#elif defined(__APPLE__)
-#define DEFAULT_GLES_V2_LIB "libGLES_V2_translator.dylib"
-#else
-#define DEFAULT_GLES_V2_LIB "libGLES_V2_translator.so"
-#endif
+#define DEFAULT_GLES_V2_LIB EMUGL_LIBNAME("GLES_V2_translator")
//
// This function is called only once during initialiation before
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
index c8e53cd..089512a 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
@@ -27,13 +27,7 @@
// any thread has been created - hence it should NOT be thread safe.
//
-#ifdef _WIN32
-#define DEFAULT_GLES_CM_LIB "libGLES_CM_translator"
-#elif defined(__APPLE__)
-#define DEFAULT_GLES_CM_LIB "libGLES_CM_translator.dylib"
-#else
-#define DEFAULT_GLES_CM_LIB "libGLES_CM_translator.so"
-#endif
+#define DEFAULT_GLES_CM_LIB EMUGL_LIBNAME("GLES_CM_translator")
bool init_gl_dispatch()
{
diff --git a/tools/emulator/opengl/host/libs/renderControl_dec/Android.mk b/tools/emulator/opengl/host/libs/renderControl_dec/Android.mk
index 4d07938..3253a34 100644
--- a/tools/emulator/opengl/host/libs/renderControl_dec/Android.mk
+++ b/tools/emulator/opengl/host/libs/renderControl_dec/Android.mk
@@ -1,8 +1,19 @@
LOCAL_PATH := $(call my-dir)
+
+### host library ############################################
$(call emugl-begin-host-static-library,lib_renderControl_dec)
$(call emugl-import,libOpenglCodecCommon)
$(call emugl-gen-decoder,$(EMUGL_PATH)/system/renderControl_enc,renderControl)
# For renderControl_types.h
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/renderControl_enc)
$(call emugl-end-module)
+
+### host library, 64-bit ####################################
+$(call emugl-begin-host-static-library,lib64_renderControl_dec)
+$(call emugl-import,lib64OpenglCodecCommon)
+$(call emugl-gen-decoder,$(EMUGL_PATH)/system/renderControl_enc,renderControl)
+# For renderControl_types.h
+$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/renderControl_enc)
+$(call emugl-export,CFLAGS,-m64)
+$(call emugl-end-module)
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/Android.mk b/tools/emulator/opengl/shared/OpenglCodecCommon/Android.mk
index 2f7da79..7deb058 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/Android.mk
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/Android.mk
@@ -11,6 +11,15 @@
TcpStream.cpp \
TimeUtils.cpp
+host_commonSources := $(commonSources)
+
+ifeq ($(HOST_OS),windows)
+ host_commonSources += Win32PipeStream.cpp
+else
+ host_commonSources += UnixStream.cpp
+endif
+
+
### CodecCommon guest ##############################################
$(call emugl-begin-static-library,libOpenglCodecCommon)
@@ -22,18 +31,24 @@
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-end-module)
+
### OpenglCodecCommon host ##############################################
$(call emugl-begin-host-static-library,libOpenglCodecCommon)
-LOCAL_SRC_FILES := $(commonSources)
-
-ifeq ($(HOST_OS),windows)
- LOCAL_SRC_FILES += Win32PipeStream.cpp
-else
- LOCAL_SRC_FILES += UnixStream.cpp
-endif
+LOCAL_SRC_FILES := $(host_commonSources)
$(call emugl-export,STATIC_LIBRARIES,libcutils)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-end-module)
+
+### OpenglCodecCommon host, 64-bit #########################################
+$(call emugl-begin-host-static-library,lib64OpenglCodecCommon)
+
+LOCAL_SRC_FILES := $(host_commonSources)
+
+$(call emugl-export,STATIC_LIBRARIES,lib64cutils)
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
+$(call emugl-export,CFLAGS,-m64)
+$(call emugl-end-module)
+
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/Android.mk b/tools/emulator/opengl/shared/OpenglOsUtils/Android.mk
index 35da4cf..82391cd 100644
--- a/tools/emulator/opengl/shared/OpenglOsUtils/Android.mk
+++ b/tools/emulator/opengl/shared/OpenglOsUtils/Android.mk
@@ -21,28 +21,37 @@
### Host library ##############################################
+
+host_common_SRC_FILES := osDynLibrary.cpp
+host_common_LDLIBS :=
+
+ifeq ($(HOST_OS),windows)
+ host_common_SRC_FILES += \
+ osProcessWin.cpp \
+ osThreadWin.cpp
+ host_common_LDLIBS += -lws2_32 -lpsapi
+else
+ host_common_SRC_FILES += \
+ osProcessUnix.cpp \
+ osThreadUnix.cpp
+ host_common_LDLIBS += -ldl
+endif
+
+ifeq ($(HOST_OS),linux)
+ host_common_LDLIBS += -lpthread -lrt
+endif
+
+### 32-bit host library ####
$(call emugl-begin-host-static-library,libOpenglOsUtils)
-
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
+ LOCAL_SRC_FILES = $(host_common_SRC_FILES)
+ $(call emugl-export,LDLIBS,$(host_common_LDLIBS))
+$(call emugl-end-module)
- LOCAL_SRC_FILES := osDynLibrary.cpp
-
- ifeq ($(HOST_OS),windows)
- LOCAL_SRC_FILES += \
- osProcessWin.cpp \
- osThreadWin.cpp
-
- $(call emugl-export,LDLIBS,-lws2_32 -lpsapi)
- else
- LOCAL_SRC_FILES += \
- osProcessUnix.cpp \
- osThreadUnix.cpp
-
- $(call emugl-export,LDLIBS,-ldl)
- endif
-
- ifeq ($(HOST_OS),linux)
- $(call emugl-export,LDLIBS,-lpthread -lrt)
- endif
-
+### 64-bit host library ####
+$(call emugl-begin-host-static-library,lib64OpenglOsUtils)
+ $(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
+ LOCAL_SRC_FILES = $(host_common_SRC_FILES)
+ $(call emugl-export,LDLIBS,$(host_common_LDLIBS))
+ $(call emugl-export,CFLAGS,-m64)
$(call emugl-end-module)
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.h b/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.h
index 5861b60..c83fbf3 100644
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.h
+++ b/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.h
@@ -45,4 +45,27 @@
} // of namespace osUtils
+
+
+// Macro to compose emugl shared library name under various OS and bitness
+// eg.
+// on x86_64, EMUGL_LIBNAME("foo") --> "lib64foo.so"
+
+#ifdef _WIN32
+# define DLL_EXTENSION "" // _WIN32 LoadLibrary only accept name w/o .dll extension
+#elif defined(__APPLE__)
+# define DLL_EXTENSION ".dylib"
+#else
+# define DLL_EXTENSION ".so"
+#endif
+
+#if defined(__x86_64__)
+# define EMUGL_LIBNAME(name) "lib64" name DLL_EXTENSION
+#elif defined(__i386__)
+# define EMUGL_LIBNAME(name) "lib" name DLL_EXTENSION
+#else
+/* This header is included by target w/o using EMUGL_LIBNAME(). Don't #error, leave it undefined */
+#endif
+
+
#endif