diff --git a/.gitignore b/.gitignore index 60c4a0b9a..ba3e3042f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.actual-rewrite *.process-output *.rewrite +/obj/ /bin/ /buildscons/ /libs/ diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100755 index 000000000..640491198 --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e8f96ecb..ba53b5802 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5) PROJECT(jsoncpp) ENABLE_TESTING() -OPTION(JSONCPP_WITH_TESTS "Compile and run JsonCpp test executables" ON) -OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON) +OPTION(JSONCPP_WITH_TESTS "Compile and run JsonCpp test executables" OFF) +OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" OFF) OPTION(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF) -OPTION(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON) +OPTION(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" OFF) OPTION(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF) # Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..3c4dcfddb --- /dev/null +++ b/build.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +################################################################################ + +export BUILD_MODULE=JsonCpp + +################################################################################ + +echo "========================== Update "${BUILD_MODULE}" Project ===========================" +android update project -t android-19 -p . -s + +if [ -z "$ANDROID_NDK_ROOT" ]; then + ANDROID_NDK_ROOT=~/ndk +fi + +if [ "$1" == "" ]; then + echo "========================== Build "${BUILD_MODULE}" ===========================" + $ANDROID_NDK_ROOT/ndk-build -j16 NDK_DEBUG=0 OVR_DEBUG=1 +fi + +if [ "$1" == "debug" ]; then + echo "========================== Build "${BUILD_MODULE} $1 " ===========================" + $ANDROID_NDK_ROOT/ndk-build -j16 NDK_DEBUG=0 OVR_DEBUG=1 +fi + +if [ "$1" == "release" ]; then + echo "========================== Build "${BUILD_MODULE} $1 " ===========================" + $ANDROID_NDK_ROOT/ndk-build -j16 NDK_DEBUG=0 OVR_DEBUG=0 +fi + +if [ "$1" == "clean" ]; then + echo "========================== Build "${BUILD_MODULE} $1 " ===========================" + $ANDROID_NDK_ROOT/ndk-build clean NDK_DEBUG=1 + $ANDROID_NDK_ROOT/ndk-build clean NDK_DEBUG=0 + ant clean + rm -rf obj + rm -rf libs +fi + +################################################################################ \ No newline at end of file diff --git a/build.xml b/build.xml new file mode 100755 index 000000000..d3123d426 --- /dev/null +++ b/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/import.mk b/import.mk new file mode 100755 index 000000000..338377edf --- /dev/null +++ b/import.mk @@ -0,0 +1,16 @@ +################################################################################ + +# save off the local path +LOCAL_PATH_TEMP := $(LOCAL_PATH) +LOCAL_PATH := $(call my-dir) + +################################################################################ + +LOCAL_C_INCLUDES += $(LOCAL_PATH)/include + +################################################################################ + +# Restore the local path since we overwrote it when we started +LOCAL_PATH := $(LOCAL_PATH_TEMP) + +################################################################################ \ No newline at end of file diff --git a/jni/Android.mk b/jni/Android.mk new file mode 100755 index 000000000..b15eea71e --- /dev/null +++ b/jni/Android.mk @@ -0,0 +1,13 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := jsoncpp +LOCAL_ARM_MODE := arm + +include $(LOCAL_PATH)/cflags.mk + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include +LOCAL_SRC_FILES = ../src/lib_json/json_reader.cpp ../src/lib_json/json_value.cpp ../src/lib_json/json_writer.cpp + +include $(BUILD_STATIC_LIBRARY) # start building based on everything since CLEAR_VARS diff --git a/jni/Application.mk b/jni/Application.mk new file mode 100755 index 000000000..58ff280f2 --- /dev/null +++ b/jni/Application.mk @@ -0,0 +1,18 @@ +# Common build settings for all VR apps + +# This needs to be defined to get the right header directories for egl / etc +APP_PLATFORM := android-19 + +# This needs to be defined to avoid compile errors like: +# Error: selected processor does not support ARM mode `ldrex r0,[r3]' +APP_ABI := armeabi-v7a + +# Statically link the GNU STL. This may not be safe for multi-so libraries but +# we don't know of any problems yet. +APP_STL := gnustl_static +APP_OPTIM := release + +# Explicitly use GCC 4.8 as our toolchain. This is the 32-bit default as of +# r10d but versions as far back as r9d have 4.8. The previous default, 4.6, is +# deprecated as of r10c. +NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file diff --git a/jni/cflags.mk b/jni/cflags.mk new file mode 100755 index 000000000..be103175a --- /dev/null +++ b/jni/cflags.mk @@ -0,0 +1,39 @@ +# This file is included in all .mk files to ensure their compilation flags are in sync +# across debug and release builds. + +# NOTE: this is not part of import_vrlib.mk because VRLib itself needs to have these flags +# set, but VRLib's make file cannot include import_vrlib.mk or it would be importing itself. + +LOCAL_CFLAGS := -DANDROID_NDK +#LOCAL_CFLAGS += -Werror # error on warnings +LOCAL_CFLAGS += -Wall +LOCAL_CFLAGS += -Wextra +LOCAL_CPLAGS += -Werror=ignored-qualifiers +#LOCAL_CFLAGS += -Wlogical-op # not part of -Wall or -Wextra +#LOCAL_CFLAGS += -Weffc++ # too many issues to fix for now +LOCAL_CFLAGS += -Wno-strict-aliasing # TODO: need to rewrite some code +LOCAL_CFLAGS += -Wno-unused-parameter +LOCAL_CFLAGS += -Wno-missing-field-initializers # warns on this: SwipeAction ret = {} +LOCAL_CFLAGS += -Wno-multichar # used in internal Android headers: DISPLAY_EVENT_VSYNC = 'vsyn', +LOCAL_CFLAGS += -std=gnu++11 +LOCAL_CFLAGS += -Wno-parentheses +LOCAL_CFLAGS += -Wno-sign-compare +LOCAL_CFLAGS += -Wno-unused-variable +LOCAL_CFLAGS += -Wno-switch +LOCAL_CFLAGS += -Wno-unused-but-set-variable +LOCAL_CFLAGS += -Wno-deprecated-declarations +LOCAL_CFLAGS += -Wno-unused-value +LOCAL_CFLAGS += -Wno-unused-function +LOCAL_CFLAGS += -Wno-literal-suffix +LOCAL_CFLAGS += -Wno-write-strings +LOCAL_CPPFLAGS := -Wno-type-limits +LOCAL_CPPFLAGS += -Wno-invalid-offsetof +LOCAL_CPPFLAGS += -DNIMBLE_TARGET_ANDROID=1 +LOCAL_CPPFLAGS += -frtti +LOCAL_CPPFLAGS += -fexceptions + +#ifeq ($(OVR_DEBUG),1) +# LOCAL_CFLAGS += -DOVR_BUILD_DEBUG=1 -O0 -g +#else + LOCAL_CFLAGS += -O3 +#endif diff --git a/local.properties b/local.properties new file mode 100644 index 000000000..64031726c --- /dev/null +++ b/local.properties @@ -0,0 +1,10 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. + +# location of the SDK. This is only used by Ant +# For customization when using a Version Control System, please read the +# header note. +sdk.dir=/Users/vaughamhong/Development/adt/sdk diff --git a/proguard-project.txt b/proguard-project.txt new file mode 100644 index 000000000..f2fe1559a --- /dev/null +++ b/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/project.properties b/project.properties new file mode 100755 index 000000000..91d2b0246 --- /dev/null +++ b/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-19 +android.library=true