Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Androidx86 support #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Platform/Android-x86/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# OpenNI Android makefile.
#

include $(call all-subdir-makefiles)

$(call import-module,OpenNI)
28 changes: 28 additions & 0 deletions Platform/Android-x86/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
APP_STL := gnustl_static

# Android >= v2.3
APP_PLATFORM := android-15

# Build ARMv7-A machine code.
APP_ABI := x86
#APP_CFLAGS := -O3 -ftree-vectorize -ffast-math -funroll-loops

APP_CFLAGS += -fPIC

ifeq ($(APP_ABI),armeabi-v7a)
APP_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a9 -mfp=vfpv3-d16 -mfpu=vfp

# optionally add NEON to compilation flags.
# to activate, run: "ndk-build USE_NEON=1"
ifdef USE_NEON
$(call __ndk_info,Building everything with NEON support!)
APP_CFLAGS += -mfpu=neon -DHAVE_NEON=1 -flax-vector-conversions
endif
endif

APP_CPPFLAGS += -frtti

#$(call __ndk_info,APP_CFLAGS=$(APP_CFLAGS))
#$(call __ndk_info,APP_CPPFLAGS=$(APP_CPPFLAGS))

#-fsingle-precision-constant
35 changes: 35 additions & 0 deletions Platform/Android-x86/jni/XnCore/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# XnCore Android makefile.
# libXnCore.so
#

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# set path to source
MY_PREFIX := $(LOCAL_PATH)/../../../../Source/XnCore/

# list all source files
MY_SRC_FILES := \
$(MY_PREFIX)*.cpp

# expand the wildcards
MY_SRC_FILE_EXPANDED := $(wildcard $(MY_SRC_FILES))

# make those paths relative to here
LOCAL_SRC_FILES := $(MY_SRC_FILE_EXPANDED:$(LOCAL_PATH)/%=%)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../../Include/ \
$(LOCAL_PATH)/../../../../Source/ \

LOCAL_CFLAGS:= -fvisibility=hidden -DXN_CORE_EXPORTS

LOCAL_LDFLAGS += -Wl,--export-dynamic

LOCAL_SHARED_LIBRARIES := OpenNI libusb

LOCAL_PREBUILT_LIBS := libc

LOCAL_MODULE := XnCore

include $(BUILD_SHARED_LIBRARY)
37 changes: 37 additions & 0 deletions Platform/Android-x86/jni/XnDDK/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# XnDDK Android makefile.
# libXnDDK.so
#

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# set path to source
MY_PREFIX := $(LOCAL_PATH)/../../../../Source/XnDDK/

# list all source files
MY_SRC_FILES := \
$(MY_PREFIX)*.cpp

# expand the wildcards
MY_SRC_FILE_EXPANDED := $(wildcard $(MY_SRC_FILES))

# make those paths relative to here
LOCAL_SRC_FILES := $(MY_SRC_FILE_EXPANDED:$(LOCAL_PATH)/%=%)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../../Include/ \
$(LOCAL_PATH)/../../../../Source/ \
$(LOCAL_PATH)/../../../../Source/XnCommon \

LOCAL_CFLAGS := -fvisibility=hidden -DXN_DDK_EXPORTS

LOCAL_LDFLAGS += -Wl,--export-dynamic

LOCAL_SHARED_LIBRARIES := OpenNI libusb XnCore XnFormats

LOCAL_PREBUILT_LIBS := libc

LOCAL_MODULE := XnDDK

include $(BUILD_SHARED_LIBRARY)

37 changes: 37 additions & 0 deletions Platform/Android-x86/jni/XnDeviceFile/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# XnDeviceFile Android makefile.
# libXnDeviceFile.so
#

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# set path to source
MY_PREFIX := $(LOCAL_PATH)/../../../../Source/XnDeviceFile/

# list all source files
MY_SRC_FILES := \
$(MY_PREFIX)*.cpp

# expand the wildcards
MY_SRC_FILE_EXPANDED := $(wildcard $(MY_SRC_FILES))

# make those paths relative to here
LOCAL_SRC_FILES := $(MY_SRC_FILE_EXPANDED:$(LOCAL_PATH)/%=%)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../../Include/ \
$(LOCAL_PATH)/../../../../Source/ \
$(LOCAL_PATH)/../../../../Source/XnCommon \

LOCAL_CFLAGS := -fvisibility=hidden -DXN_DEVICE_EXPORTS

LOCAL_LDFLAGS += -Wl,--export-dynamic

LOCAL_SHARED_LIBRARIES := OpenNI libusb XnCore XnFormats XnDDK

LOCAL_PREBUILT_LIBS := libc

LOCAL_MODULE := XnDeviceFile

include $(BUILD_SHARED_LIBRARY)

37 changes: 37 additions & 0 deletions Platform/Android-x86/jni/XnDeviceSensorV2/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# XnDeviceSensorV2 Android makefile.
# libXnDeviceSensorV2.so
#

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# set path to source
MY_PREFIX := $(LOCAL_PATH)/../../../../Source/XnDeviceSensorV2/

# list all source files
MY_SRC_FILES := \
$(MY_PREFIX)*.cpp

# expand the wildcards
MY_SRC_FILE_EXPANDED := $(wildcard $(MY_SRC_FILES))

# make those paths relative to here
LOCAL_SRC_FILES := $(MY_SRC_FILE_EXPANDED:$(LOCAL_PATH)/%=%)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../../Include/ \
$(LOCAL_PATH)/../../../../Source/ \
$(LOCAL_PATH)/../../../../Source/XnCommon \

LOCAL_CFLAGS := -fvisibility=hidden -DXN_DEVICE_EXPORTS

LOCAL_LDFLAGS += -Wl,--export-dynamic

LOCAL_SHARED_LIBRARIES := OpenNI libusb XnCore XnFormats XnDDK

LOCAL_PREBUILT_LIBS := libc

LOCAL_MODULE := XnDeviceSensorV2

include $(BUILD_SHARED_LIBRARY)

39 changes: 39 additions & 0 deletions Platform/Android-x86/jni/XnFormats/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# XnFormats Android makefile.
# libXnFormats.so
#

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# set path to source
MY_PREFIX := $(LOCAL_PATH)/../../../../Source/XnFormats/

# list all source files
MY_SRC_FILES := \
$(MY_PREFIX)*.cpp \
$(MY_PREFIX)../External/LibJPEG/*.c

# expand the wildcards
MY_SRC_FILE_EXPANDED := $(wildcard $(MY_SRC_FILES))

# make those paths relative to here
LOCAL_SRC_FILES := $(MY_SRC_FILE_EXPANDED:$(LOCAL_PATH)/%=%)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../../Include/ \
$(LOCAL_PATH)/../../../../Source/ \
$(LOCAL_PATH)/../../../../Source/XnCommon \
$(LOCAL_PATH)/../../../../Source/External/LibJPEG \

LOCAL_CFLAGS := -fvisibility=hidden -DXN_FORMATS_EXPORTS

LOCAL_LDFLAGS += -Wl,--export-dynamic

LOCAL_SHARED_LIBRARIES := OpenNI libusb XnCore

LOCAL_PREBUILT_LIBS := libc

LOCAL_MODULE := XnFormats

include $(BUILD_SHARED_LIBRARY)

2 changes: 1 addition & 1 deletion Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ XnStatus XnDeviceSensorInit(XnDevicePrivateData* pDevicePrivateData)
nRetVal = XnDeviceSensorAllocateBuffers(pDevicePrivateData);
XN_IS_STATUS_OK(nRetVal);

#if XN_PLATFORM == XN_PLATFORM_ANDROID_ARM
#if (XN_PLATFORM == XN_PLATFORM_ANDROID_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_X86)
nRetVal = xnOSCreateMutex(&pDevicePrivateData->hExecuteMutex);
XN_IS_STATUS_OK(nRetVal);
#else
Expand Down
2 changes: 1 addition & 1 deletion Source/XnDeviceSensorV2/XnDeviceSensorInit.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

#define XN_SENSOR_USB_MISC_BUFFER_SIZE 0x1000
#define XN_SENSOR_USB_MISC_BUFFERS 1
#elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_MACOSX || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM)
#elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_MACOSX || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_X86)
#define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_ISO 32
#define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_BULK 32
#define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO 16
Expand Down
4 changes: 2 additions & 2 deletions Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// Defines
//---------------------------------------------------------------------------
// On weak platforms (like Arm), the default is not to use multi-process.
#if (XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM)
#if (XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_X86)
#define XN_SENSOR_DEFAULT_MULTI_PROCESS (FALSE)
#else
#define XN_SENSOR_DEFAULT_MULTI_PROCESS (TRUE)
Expand Down Expand Up @@ -250,4 +250,4 @@ XnExportedSensorDevice::CreatedDevices::Iterator XnExportedSensorDevice::FindCre
}

return it;
}
}
3 changes: 2 additions & 1 deletion Source/XnDeviceSensorV2/XnSensor.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define XN_GLOBAL_CONFIG_FILE_NAME "GlobalDefaults.ini"

// on weak platforms (Arm), we prefer to use BULK
#if (XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM)
#if (XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_X86)
#define XN_SENSOR_DEFAULT_USB_INTERFACE XN_SENSOR_USB_INTERFACE_BULK_ENDPOINTS
#else
#define XN_SENSOR_DEFAULT_USB_INTERFACE XN_SENSOR_USB_INTERFACE_ISO_ENDPOINTS
Expand Down Expand Up @@ -964,6 +964,7 @@ XnStatus XnSensor::GetFirmwareMode(XnParamCurrentMode* pnMode)
{
*pnMode = m_Firmware.GetInfo()->nCurrMode;
}

else
{
XnUInt16 nMode;
Expand Down