Change makefiles to select appropriate openxr_loader at build time

This commit is contained in:
Simon 2023-01-27 14:49:23 +00:00
parent 566da10ab6
commit 0d72a548ca
5 changed files with 36 additions and 19 deletions

View file

@ -1,14 +1,13 @@
# MAKEFILE_LIST specifies the current used Makefiles, of which this is the last
# one. I use that to obtain the Application.mk dir then import the root
# Application.mk.
ROOT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))../../../../..
NDK_MODULE_PATH := $(ROOT_DIR)
APP_PLATFORM := android-24
APP_CFLAGS += -Wl,--no-undefined
APPLICATIONMK_PATH = $(call my-dir)
NDK_MODULE_PATH := $(APPLICATIONMK_PATH)/../..
TOP_DIR := $(APPLICATIONMK_PATH)
SUPPORT_LIBS := $(TOP_DIR)/SupportLibs

View file

@ -2,10 +2,10 @@ LOCAL_PATH := $(call my-dir)
# Uncomment for the correct headset - slight changes required in OpenXR implementation
OPENXR_HMD = -DMETA_QUEST
#OPENXR_HMD = -DPICO_XR
OPENXR_HMD := META_QUEST
#OPENXR_HMD := PICO_XR
JK3_BASE_CFLAGS = $(OPENXR_HMD) -DHAVE_GLES -DFINAL_BUILD -fexceptions -Wall -Wno-write-strings -Wno-comment -fno-caller-saves -fno-tree-vectorize -Wno-unused-but-set-variable -fvisibility=hidden
JK3_BASE_CFLAGS = -D$(OPENXR_HMD) -DHAVE_GLES -DFINAL_BUILD -fexceptions -Wall -Wno-write-strings -Wno-comment -fno-caller-saves -fno-tree-vectorize -Wno-unused-but-set-variable -fvisibility=hidden
JK3_BASE_CPPFLAGS = -fvisibility-inlines-hidden -Wno-invalid-offsetof -fvisibility=hidden
ifeq ($(NDK_DEBUG), 0)
@ -20,6 +20,7 @@ JK3_BASE_LDLIBS =
JK3_BASE_LDLIBS += -Wl
JK3_BASE_C_INCLUDES := $(OPENJK_PATH)/lib $(JK3_CODE_PATH)/client $(JK3_CODE_PATH)/server $(JK3_CODE_PATH)/libs/freetype2/include $(JK3_CODE_PATH)/common $(JK3_CODE_PATH)/gl
JK3_BASE_C_INCLUDES += $(LOCAL_PATH)/../../../../../../OpenXR/include
JK3_BASE_C_INCLUDES += $(LOCAL_PATH)/../../../../../../3rdParty/khronos/openxr/OpenXR-SDK/include
JK3_BASE_C_INCLUDES += $(LOCAL_PATH)/../../../../../../3rdParty/khronos/openxr/OpenXR-SDK/src/common
JK3_BASE_C_INCLUDES += $(JK3_CODE_PATH)/ $(OPENJK_PATH)/code/ $(OPENJK_PATH)/shared/ $(JK3_CODE_PATH)/ui $(OPENJK_PATH)/lib/gsl-lite/include

View file

@ -137,10 +137,4 @@ LOCAL_SRC_FILES += $(JK3_SRC) $(JKVR_SRC_FILES)
include $(BUILD_SHARED_LIBRARY)
$(call import-module,OpenXR/Projects/AndroidPrebuilt/jni)
$(call import-module,AndroidPrebuilt/jni)

View file

@ -137,10 +137,4 @@ LOCAL_SRC_FILES += $(JK3_SRC) $(JKVR_SRC_FILES)
include $(BUILD_SHARED_LIBRARY)
$(call import-module,OpenXR/Projects/AndroidPrebuilt/jni)
$(call import-module,AndroidPrebuilt/jni)

View file

@ -0,0 +1,29 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := openxr_loader
ifeq ($(NDK_DEBUG),1)
BUILDTYPE := Debug
else
BUILDTYPE := Release
endif
# Meta provide Debug and Release libraries
ifeq ($(OPENXR_HMD),META_QUEST)
LOCAL_SRC_FILES := ../../../../../OpenXR/Libs/Android/$(TARGET_ARCH_ABI)/$(BUILDTYPE)/lib$(LOCAL_MODULE).so
endif
# Pico only provide the one loader
ifeq ($(OPENXR_HMD),PICO_XR)
LOCAL_SRC_FILES := ../../../../../OpenXR/libs/android.$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
endif
# NOTE: This check is added to prevent the following error when running a "make clean" where
# the prebuilt lib may have been deleted: "LOCAL_SRC_FILES points to a missing file"
ifneq (,$(wildcard $(LOCAL_PATH)/$(LOCAL_SRC_FILES)))
include $(PREBUILT_SHARED_LIBRARY)
endif