Merge pull request #505 from arris69/Build_with_Android_NDK

integration of android ndk (for travis build)
pull/508/head
Alexander Gessler 2015-03-23 00:05:20 +01:00
commit 8f577e2e77
5 changed files with 236 additions and 90 deletions

View File

@ -1,12 +1,15 @@
before_install:
- sudo apt-get install cmake python3
- echo -e "#ifndef A_R_H_INC\n#define A_R_H_INC\n#define GitVersion ${TRAVIS_JOB_ID}\n#define GitBranch \"${TRAVIS_BRANCH}\"\n#endif // A_R_H_INC" > revision.h
branches:
only:
- master
env:
matrix:
global:
- PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME}
matrix:
- LINUX=1 TRAVIS_NO_EXPORT=YES
- LINUX=1 TRAVIS_NO_EXPORT=NO
- LINUX=1 TRAVIS_STATIC_BUILD=ON
@ -15,6 +18,7 @@ env:
- WINDOWS=1 TRAVIS_NO_EXPORT=NO
- WINDOWS=1 TRAVIS_STATIC_BUILD=ON
- WINDOWS=1 TRAVIS_STATIC_BUILD=OFF
- ANDROID=1
language: cpp
@ -24,8 +28,10 @@ compiler:
install:
- if [ $WINDOWS ]; then travis_retry sudo apt-get install -q -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64; fi
- if [ $ANDROID ]; then wget -c http://dl.google.com/android/ndk/android-ndk-${PV}-${PLATF}.tar.bz2 && tar xf android-ndk-${PV}-${PLATF}.tar.bz2 ; fi
script:
- if [ $ANDROID ]; then ant -v -Dmy.dir=${TRAVIS_BUILD_DIR} -f ${TRAVIS_BUILD_DIR}/port/jassimp/build.xml ndk-jni ; fi
- cmake -G "Unix Makefiles" -DASSIMP_ENABLE_BOOST_WORKAROUND=YES -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -STATIC_BUILD=$TRAVIS_STATIC_BUILD
- make
- sudo make install
@ -38,4 +44,3 @@ script:
- echo "=========================================================="
- echo "REGRESSION TEST FAILS (results/run_regression_suite_failures.csv)"
- cat ../results/run_regression_suite_failures.csv

View File

@ -1,46 +1,46 @@
// ===============================================================================
// May be included multiple times - sets structure packing to 1
// for all supported compilers. #include <poppack1.h> reverts the changes.
//
// Currently this works on the following compilers:
// MSVC 7,8,9
// GCC
// BORLAND (complains about 'pack state changed but not reverted', but works)
// Clang
//
//
// USAGE:
//
// struct StructToBePacked {
// } PACK_STRUCT;
//
// ===============================================================================
#ifdef AI_PUSHPACK_IS_DEFINED
# error poppack1.h must be included after pushpack1.h
#endif
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack(push,1)
# define PACK_STRUCT
#elif defined( __GNUC__ )
# if defined(__clang__)
# define PACK_STRUCT __attribute__((__packed__))
# else
# define PACK_STRUCT __attribute__((gcc_struct, __packed__))
# endif
#else
# error Compiler not supported
#endif
#if defined(_MSC_VER)
// C4103: Packing was changed after the inclusion of the header, propably missing #pragma pop
# pragma warning (disable : 4103)
#endif
#define AI_PUSHPACK_IS_DEFINED
// ===============================================================================
// May be included multiple times - sets structure packing to 1
// for all supported compilers. #include <poppack1.h> reverts the changes.
//
// Currently this works on the following compilers:
// MSVC 7,8,9
// GCC
// BORLAND (complains about 'pack state changed but not reverted', but works)
// Clang
//
//
// USAGE:
//
// struct StructToBePacked {
// } PACK_STRUCT;
//
// ===============================================================================
#ifdef AI_PUSHPACK_IS_DEFINED
# error poppack1.h must be included after pushpack1.h
#endif
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack(push,1)
# define PACK_STRUCT
#elif defined( __GNUC__ )
# if !defined(HOST_MINGW)
# define PACK_STRUCT __attribute__((__packed__))
# else
# define PACK_STRUCT __attribute__((gcc_struct, __packed__))
# endif
#else
# error Compiler not supported
#endif
#if defined(_MSC_VER)
// C4103: Packing was changed after the inclusion of the header, propably missing #pragma pop
# pragma warning (disable : 4103)
#endif
#define AI_PUSHPACK_IS_DEFINED

View File

@ -1,45 +1,54 @@
<project name="jassimp" basedir="." default="all">
<property name="native-src.dir" value="jassimp-native/src" />
<property name="src.dir" value="jassimp/src" />
<property name="jassimp.lwjgl-src.dir" value="jassimp.lwjgl/src" />
<property name="build.dir" value="jassimp/bin" />
<property name="dist.dir" value="dist" />
<property name="doc.dir" value="doc" />
<path id="classpath">
</path>
<property name="native-src.dir" value="jassimp-native/src" />
<property name="src.dir" value="jassimp/src" />
<property name="jassimp.lwjgl-src.dir" value="jassimp.lwjgl/src" />
<property name="build.dir" value="jassimp/bin" />
<property name="dist.dir" value="dist" />
<property name="doc.dir" value="doc" />
<property environment="env"/>
<property name="ndk.dir" value="${env.NDK_HOME}" />
<property name="my.dir" value="${env.PWD}" />
<target name="compile">
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
<javac classpathref="classpath" destdir="${build.dir}" srcdir="${src.dir}"
source="1.6" target="1.6" includeantruntime="false">
</javac>
</target>
<path id="classpath">
</path>
<target name="jni_header">
<mkdir dir="${native-src.dir}" />
<javah outputfile="${native-src.dir}/jassimp.h" force="yes">
<classpath>
<pathelement path="${build.dir}" />
</classpath>
<class name="jassimp.Jassimp" />
</javah>
</target>
<target name="package" depends="compile">
<jar destfile="${dist.dir}/jassimp.jar" basedir="${build.dir}">
</jar>
</target>
<target name="doc">
<delete dir="${doc.dir}" />
<javadoc access="public" author="false" destdir="${doc.dir}"
sourcepath="${src.dir}">
</javadoc>
</target>
<target name="all" depends="package, doc">
</target>
</project>
<target name="compile">
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
<javac classpathref="classpath" destdir="${build.dir}" srcdir="${src.dir}"
source="1.6" target="1.6" includeantruntime="false">
</javac>
</target>
<target name="jni_header">
<mkdir dir="${native-src.dir}" />
<javah outputfile="${native-src.dir}/jassimp.h" force="yes">
<classpath>
<pathelement path="${build.dir}" />
</classpath>
<class name="jassimp.Jassimp" />
</javah>
</target>
<target name="ndk-jni" depends="package">
<exec executable="${ndk.dir}/ndk-build">
<arg line="all NDK_PROJECT_PATH=${my.dir}/workspaces/Android-NDK"/>
</exec>
</target>
<target name="package" depends="compile">
<jar destfile="${dist.dir}/jassimp.jar" basedir="${build.dir}">
</jar>
</target>
<target name="doc">
<delete dir="${doc.dir}" />
<javadoc access="public" author="false" destdir="${doc.dir}"
sourcepath="${src.dir}">
</javadoc>
</target>
<target name="all" depends="package, doc">
</target>
</project>

View File

@ -0,0 +1,124 @@
LOCAL_PATH := $(call my-dir)/../../../
include $(CLEAR_VARS)
LOCAL_MODULE := assimp_static
ASSIMP_SRC_DIR = code
FILE_LIST := $(wildcard $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/openddlparser/code/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/unzip/*.c)
FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/poly2tri/poly2tri/*/*.cc)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_SRC_FILES += contrib/clipper/clipper.cpp \
contrib/ConvertUTF/ConvertUTF.c \
contrib/irrXML/irrXML.cpp
# enables -frtti and -fexceptions
LOCAL_CPP_FEATURES := exceptions
# identifier 'nullptr' will become a keyword in C++0x [-Wc++0x-compat]
# but next breaks blender and other importer
# LOCAL_CFLAGS += -std=c++11
# cant be disabled? rudamentary function?
# -DASSIMP_BUILD_NO_FLIPWINDING_PROCESS \
#
DontBuildProcess = \
-DASSIMP_BUILD_NO_FLIPUVS_PROCESS \
-DASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS \
-DASSIMP_BUILD_NO_CALCTANGENTS_PROCESS \
-DASSIMP_BUILD_NO_DEBONE_PROCESS \
-DASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS \
-DASSIMP_BUILD_NO_FINDINSTANCES_PROCESS \
-DASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS \
-DASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS \
-DASSIMP_BUILD_NO_GENFACENORMALS_PROCESS \
-DASSIMP_BUILD_NO_GENUVCOORDS_PROCESS \
-DASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS \
-DASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS \
-DASSIMP_BUILD_NO_JOINVERTICES_PROCESS \
-DASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS \
-DASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS \
-DASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS \
-DASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS \
-DASSIMP_BUILD_NO_REMOVEVC_PROCESS \
-DASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS \
-DASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS \
-DASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS \
-DASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS \
-DASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS \
-DASSIMP_BUILD_NO_TRIANGULATE_PROCESS \
-DASSIMP_BUILD_NO_VALIDATEDS_PROCESS
DontBuildImporters = \
-DASSIMP_BUILD_NO_X_IMPORTER \
-DASSIMP_BUILD_NO_3DS_IMPORTER \
-DASSIMP_BUILD_NO_MD3_IMPORTER \
-DASSIMP_BUILD_NO_MDL_IMPORTER \
-DASSIMP_BUILD_NO_MD2_IMPORTER \
-DASSIMP_BUILD_NO_PLY_IMPORTER \
-DASSIMP_BUILD_NO_ASE_IMPORTER \
-DASSIMP_BUILD_NO_HMP_IMPORTER \
-DASSIMP_BUILD_NO_SMD_IMPORTER \
-DASSIMP_BUILD_NO_MDC_IMPORTER \
-DASSIMP_BUILD_NO_MD5_IMPORTER \
-DASSIMP_BUILD_NO_STL_IMPORTER \
-DASSIMP_BUILD_NO_LWO_IMPORTER \
-DASSIMP_BUILD_NO_DXF_IMPORTER \
-DASSIMP_BUILD_NO_NFF_IMPORTER \
-DASSIMP_BUILD_NO_RAW_IMPORTER \
-DASSIMP_BUILD_NO_OFF_IMPORTER \
-DASSIMP_BUILD_NO_AC_IMPORTER \
-DASSIMP_BUILD_NO_BVH_IMPORTER \
-DASSIMP_BUILD_NO_IRRMESH_IMPORTER \
-DASSIMP_BUILD_NO_IRR_IMPORTER \
-DASSIMP_BUILD_NO_Q3D_IMPORTER \
-DASSIMP_BUILD_NO_B3D_IMPORTER \
-DASSIMP_BUILD_NO_COLLADA_IMPORTER \
-DASSIMP_BUILD_NO_TERRAGEN_IMPORTER \
-DASSIMP_BUILD_NO_CSM_IMPORTER \
-DASSIMP_BUILD_NO_3D_IMPORTER \
-DASSIMP_BUILD_NO_LWS_IMPORTER \
-DASSIMP_BUILD_NO_OGRE_IMPORTER \
-DASSIMP_BUILD_NO_MS3D_IMPORTER \
-DASSIMP_BUILD_NO_COB_IMPORTER \
-DASSIMP_BUILD_NO_Q3BSP_IMPORTER \
-DASSIMP_BUILD_NO_NDO_IMPORTER \
-DASSIMP_BUILD_NO_IFC_IMPORTER \
-DASSIMP_BUILD_NO_XGL_IMPORTER \
-DASSIMP_BUILD_NO_FBX_IMPORTER \
-DASSIMP_BUILD_NO_C4D_IMPORTER \
-DASSIMP_BUILD_NO_OPENGEX_IMPORTER \
-DASSIMP_BUILD_NO_ASSBIN_IMPORTER
# -DASSIMP_BUILD_NO_BLEND_IMPORTER \
# -DASSIMP_BUILD_NO_GEO_IMPORTER
# -DASSIMP_BUILD_NO_OBJ_IMPORTER \
#
DontBuildImporters := -DASSIMP_BUILD_NO_IFC_IMPORTER -DASSIMP_BUILD_NO_IRRMESH_IMPORTER -DASSIMP_BUILD_NO_IRR_IMPORTER -DASSIMP_BUILD_NO_C4D_IMPORTER
ASSIMP_FLAGS_3_0 = -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_BUILD_BOOST_WORKAROUND -Dassimp_EXPORTS -fPIC -fvisibility=hidden -Wall
ASSIMP_FLAGS_3_1 = $(ASSIMP_FLAGS_3_0) # -DASSIMP_BUILD_BLENDER_DEBUG
LOCAL_CFLAGS += $(ASSIMP_FLAGS_3_1) -DASSIMP_BUILD_NO_EXPORT -DOPENDDL_NO_USE_CPP11 $(DontBuildImporters) # $(DontBuildProcess)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround $(LOCAL_PATH)/contrib/openddlparser/include ./
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := assimp
LOCAL_CFLAGS += -UASSIMP_BUILD_DLL_EXPORT
LOCAL_WHOLE_STATIC_LIBRARIES = assimp_static
LOCAL_LDLIBS := -lz
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround
include $(BUILD_SHARED_LIBRARY)
-include $(LOCAL_PATH)/assimp_cmd.mk
# let it on original place
include $(LOCAL_PATH)/port/jassimp/jassimp-native/Android.mk

View File

@ -0,0 +1,8 @@
ifeq ($(CC),clang)
NDK_TOOLCHAIN_VERSION := $(CC)
$(info "Use llvm Compiler")
endif
APP_ABI := armeabi-v7a
APP_STL := stlport_static