Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/android_support' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiecohen committed Jan 13, 2013
1 parent 8750fc8 commit c215522
Show file tree
Hide file tree
Showing 108 changed files with 69,371 additions and 52 deletions.
5 changes: 5 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# OpenNI Android makefile.
#

include $(call all-subdir-makefiles)

20 changes: 20 additions & 0 deletions Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Android >= v2.3
APP_PLATFORM := android-9

# Build ARMv7-A machine code.
APP_ABI := armeabi-v7a
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

36 changes: 36 additions & 0 deletions Include/Android-Arm/OniPlatformAndroid-Arm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*****************************************************************************
* *
* OpenNI 2.x Alpha *
* Copyright (C) 2012 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
*****************************************************************************/
#ifndef _ONI_PLATFORM_ANDROID_ARM_H_
#define _ONI_PLATFORM_ANDROID_ARM_H_

// Start with Linux-x86, and override what's different
#include "../Linux-x86/OniPlatformLinux-x86.h"

//---------------------------------------------------------------------------
// Platform Basic Definition
//---------------------------------------------------------------------------
#undef ONI_PLATFORM
#undef ONI_PLATFORM_STRING

#define ONI_PLATFORM ONI_PLATFORM_ANDROID_ARM
#define ONI_PLATFORM_STRING "Android-Arm"

#endif //_ONI_PLATFORM_LINUX_ARM_H_
3 changes: 2 additions & 1 deletion Include/Driver/OniDriverTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define _ONI_DRIVER_TYPES_H_

#include <OniCTypes.h>
#include <stdarg.h>

#define ONI_STREAM_PROPERTY_PRIVATE_BASE XN_MAX_UINT16

Expand All @@ -48,4 +49,4 @@ struct OniDriverServices
};


#endif // _ONI_DRIVER_TYPES_H_
#endif // _ONI_DRIVER_TYPES_H_
20 changes: 15 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ Linux
Or via apt:
sudo apt-get install graphviz

Android
-------
- Android NDK r8d
From: http://developer.android.com/tools/sdk/ndk/index.html#Downloads

Building
========
Building on Windows:
Expand All @@ -58,16 +63,21 @@ Building on Windows:
Building on Linux:
Run:
$ make

Cross-Compiling for arm on Linux:
The following environment variables should be defined:
- ARM_CXX=<path to cross-compilation g++>
- ARM_STAGING=<path to cross-compilation staging dir>
Then, run:
$ PLATFORM=Arm make

Creating the installer:
- Go into the directory 'Redist'
- Run ReleaseVersion.py [x86|x64|arm]
- Installer will be placed in the 'Final' directory
Building on Android:
- Place the OpenNI root directory under your application jni folder
- OpenNI root folder contains a sample Application.mk. You don't have to use it, but if you want to, place it
directly under your jni directory.

Creating the installer (not available for Android):
- Go into the directory 'Redist'
- Run ReleaseVersion.py [x86|x64|arm]
- Installer will be placed in the 'Final' directory

5 changes: 5 additions & 0 deletions Samples/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# OpenNI Android makefile.
#

include $(call all-subdir-makefiles)

28 changes: 28 additions & 0 deletions Samples/EventBasedRead/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# OpenNI Samples Android makefile.
# EventBasedRead
#

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

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

# 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_SHARED_LIBRARIES := OpenNI2

LOCAL_MODULE := EventBasedRead

include $(BUILD_EXECUTABLE)
28 changes: 28 additions & 0 deletions Samples/MultipleStreamRead/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# OpenNI Samples Android makefile.
# MultipleStreamRead
#

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

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

# 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_SHARED_LIBRARIES := OpenNI2

LOCAL_MODULE := MultipleStreamRead

include $(BUILD_EXECUTABLE)
28 changes: 28 additions & 0 deletions Samples/SimpleRead/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# OpenNI Samples Android makefile.
# SimpleRead
#

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

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

# 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_SHARED_LIBRARIES := OpenNI2

LOCAL_MODULE := SimpleRead

include $(BUILD_EXECUTABLE)
5 changes: 5 additions & 0 deletions Source/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# OpenNI Android makefile.
#

include $(call all-subdir-makefiles)

42 changes: 42 additions & 0 deletions Source/Core/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# OpenNI Android makefile.
# libOpenNI2.so
#

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

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

# list all source files
MY_SRC_FILES := \
$(MY_PREFIX)*.cpp \
$(MY_PREFIX)../Drivers/OniFile/Formats/XnCodec.cpp \
$(MY_PREFIX)../Drivers/OniFile/Formats/XnStreamCompression.cpp \
$(MY_PREFIX)../../ThirdParty/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)/../../ThirdParty/PSCommon/XnLib/Include \
$(LOCAL_PATH)/../Drivers/OniFile/Formats \
$(LOCAL_PATH)/../../ThirdParty/LibJPEG

LOCAL_CFLAGS := -fvisibility=hidden -DOPENNI2_EXPORT
LOCAL_CPPFLAGS := -frtti
LOCAL_LDFLAGS := -Wl,--export-dynamic -llog

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../Include

LOCAL_PREBUILT_LIBS := libc
LOCAL_STATIC_LIBRARIES := XnLib

LOCAL_MODULE:= OpenNI2

include $(BUILD_SHARED_LIBRARY)

21 changes: 16 additions & 5 deletions Source/Core/OniContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ OniStatus Context::initialize()
XnStatus Context::loadLibraries(const char* directoryName)
{
XnStatus nRetVal;

// Get a file list of Xiron devices

XnInt32 nFileCount = 0;
typedef XnChar FileName[XN_FILE_MAX_PATH];
FileName* acsFileList = NULL;

#if (ONI_PLATFORM != ONI_PLATFORM_ANDROID_ARM)
XnChar cpSearchString[XN_FILE_MAX_PATH] = "";

xnLogVerbose(XN_LOG_MASK_ALL, "Looking for drivers in drivers repository '%s'", directoryName);
Expand All @@ -155,9 +163,6 @@ XnStatus Context::loadLibraries(const char* directoryName)
XN_VALIDATE_STR_APPEND(cpSearchString, XN_FILE_ALL_WILDCARD, XN_FILE_MAX_PATH, nRetVal);
XN_VALIDATE_STR_APPEND(cpSearchString, XN_SHARED_LIBRARY_POSTFIX, XN_FILE_MAX_PATH, nRetVal);

// Get a file list of Xiron devices

XnInt32 nFileCount = 0;
nRetVal = xnOSCountFiles(cpSearchString, &nFileCount);
if (nRetVal != XN_STATUS_OK || nFileCount == 0)
{
Expand All @@ -166,9 +171,15 @@ XnStatus Context::loadLibraries(const char* directoryName)
return XN_STATUS_NO_MODULES_FOUND;
}

typedef XnChar FileName[XN_FILE_MAX_PATH];
FileName* acsFileList = XN_NEW_ARR(FileName, nFileCount);
acsFileList = XN_NEW_ARR(FileName, nFileCount);
nRetVal = xnOSGetFileList(cpSearchString, NULL, acsFileList, nFileCount, &nFileCount);
#else
// Android
nFileCount = 2;
acsFileList = XN_NEW_ARR(FileName, nFileCount);
strcpy(acsFileList[0], "libPS1080.so");
strcpy(acsFileList[1], "libOniFile.so");
#endif

// Save directory
XnChar workingDir[XN_FILE_MAX_PATH];
Expand Down
5 changes: 5 additions & 0 deletions Source/Drivers/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# OpenNI Android makefile.
#

include $(call all-subdir-makefiles)

41 changes: 41 additions & 0 deletions Source/Drivers/OniFile/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# OpenNI OniFile Android makefile.
# libOniFile.so
#

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

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

# list all source files
MY_SRC_FILES := \
$(MY_PREFIX)*.cpp \
$(MY_PREFIX)Formats/*.cpp \
$(MY_PREFIX)XnLibExtensions/*.cpp \
$(MY_PREFIX)../../../ThirdParty/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)/. \
$(LOCAL_PATH)/../../../Include \
$(LOCAL_PATH)/../../../ThirdParty/PSCommon/XnLib/Include \
$(LOCAL_PATH)/../../../ThirdParty/LibJPEG \
$(LOCAL_PATH)/Formats

LOCAL_CFLAGS := -fvisibility=hidden
LOCAL_CPPFLAGS := -frtti
LOCAL_LDFLAGS := -Wl,--export-dynamic -llog

LOCAL_PREBUILT_LIBS := libc
LOCAL_STATIC_LIBRARIES := XnLib

LOCAL_MODULE:= OniFile

include $(BUILD_SHARED_LIBRARY)

44 changes: 44 additions & 0 deletions Source/Drivers/PS1080/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# OpenNI PS1080 Android makefile.
# libPS1080.so
#

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

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

# list all source files
MY_SRC_FILES := \
$(MY_PREFIX)Core/*.cpp \
$(MY_PREFIX)DDK/*.cpp \
$(MY_PREFIX)DriverImpl/*.cpp\
$(MY_PREFIX)Formats/*.cpp \
$(MY_PREFIX)Include/*.cpp \
$(MY_PREFIX)Sensor/*.cpp \
$(MY_PREFIX)../../../ThirdParty/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)/. \
$(LOCAL_PATH)/Include \
$(LOCAL_PATH)/../../../Include \
$(LOCAL_PATH)/../../../ThirdParty/PSCommon/XnLib/Include

LOCAL_CFLAGS := -fvisibility=hidden
LOCAL_CPPFLAGS := -frtti
LOCAL_LDFLAGS := -Wl,--export-dynamic -llog

LOCAL_PREBUILT_LIBS := libc
LOCAL_SHARED_LIBRARIES := libusb
LOCAL_STATIC_LIBRARIES := XnLib

LOCAL_MODULE:= PS1080

include $(BUILD_SHARED_LIBRARY)

Loading

0 comments on commit c215522

Please sign in to comment.