Merged android-experimental branch back to trunk.
This commit is contained in:
5
android/apps/CVCamera/CMakeLists.txt
Normal file
5
android/apps/CVCamera/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(CVCamera)
|
||||
|
||||
add_subdirectory(jni)
|
||||
@@ -1,86 +0,0 @@
|
||||
# The path to the NDK, requires crystax version r-4 for now, due to support
|
||||
# for the standard library
|
||||
|
||||
# load environment from local make file
|
||||
LOCAL_ENV_MK=local.env.mk
|
||||
ifneq "$(wildcard $(LOCAL_ENV_MK))" ""
|
||||
include $(LOCAL_ENV_MK)
|
||||
else
|
||||
$(shell cp sample.$(LOCAL_ENV_MK) $(LOCAL_ENV_MK))
|
||||
$(info ERROR local environement not setup! try:)
|
||||
$(info gedit $(LOCAL_ENV_MK))
|
||||
$(error Please setup the $(LOCAL_ENV_MK) - the default was just created')
|
||||
endif
|
||||
ifndef ARM_TARGETS
|
||||
ARM_TARGETS="armeabi armeabi-v7a"
|
||||
endif
|
||||
ANDROID_NDK_BASE = $(ANDROID_NDK_ROOT)
|
||||
|
||||
$(info OPENCV_CONFIG = $(OPENCV_CONFIG))
|
||||
|
||||
ifndef PROJECT_PATH
|
||||
$(info PROJECT_PATH defaulting to this directory)
|
||||
PROJECT_PATH=.
|
||||
endif
|
||||
|
||||
|
||||
# The name of the native library
|
||||
LIBNAME = libcvcamera.so
|
||||
|
||||
|
||||
# Find all the C++ sources in the native folder
|
||||
SOURCES = $(wildcard jni/*.cpp)
|
||||
HEADERS = $(wildcard jni/*.h)
|
||||
|
||||
ANDROID_MKS = $(wildcard jni/*.mk)
|
||||
|
||||
SWIG_IS = $(wildcard jni/*.i)
|
||||
|
||||
SWIG_MAIN = jni/cvcamera.i
|
||||
|
||||
SWIG_JAVA_DIR = src/com/theveganrobot/cvcamera/jni
|
||||
SWIG_JAVA_OUT = $(wildcard $(SWIG_JAVA_DIR)/*.java)
|
||||
|
||||
|
||||
SWIG_C_DIR = jni/gen
|
||||
SWIG_C_OUT = $(SWIG_C_DIR)/cvcamera_swig.cpp
|
||||
|
||||
BUILD_DEFS=OPENCV_CONFIG=$(OPENCV_CONFIG) \
|
||||
PROJECT_PATH=$(PROJECT_PATH) \
|
||||
V=$(V) \
|
||||
$(NDK_FLAGS) \
|
||||
ARM_TARGETS=$(ARM_TARGETS)
|
||||
|
||||
# The real native library stripped of symbols
|
||||
LIB = libs/armeabi-v7a/$(LIBNAME) libs/armeabi/$(LIBNAME)
|
||||
|
||||
|
||||
all: $(LIB)
|
||||
|
||||
|
||||
#calls the ndk-build script, passing it OPENCV_ROOT and OPENCV_LIBS_DIR
|
||||
$(LIB): $(SWIG_C_OUT) $(SOURCES) $(HEADERS) $(ANDROID_MKS)
|
||||
$(ANDROID_NDK_BASE)/ndk-build $(BUILD_DEFS)
|
||||
|
||||
|
||||
#this creates the swig wrappers
|
||||
$(SWIG_C_OUT): $(SWIG_IS)
|
||||
make clean-swig &&\
|
||||
mkdir -p $(SWIG_C_DIR) &&\
|
||||
mkdir -p $(SWIG_JAVA_DIR) &&\
|
||||
swig -java -c++ -I../../android-jni/jni -package "com.theveganrobot.cvcamera.jni" \
|
||||
-outdir $(SWIG_JAVA_DIR) \
|
||||
-o $(SWIG_C_OUT) $(SWIG_MAIN)
|
||||
|
||||
|
||||
#clean targets
|
||||
.PHONY: clean clean-swig cleanall
|
||||
|
||||
#this deletes the generated swig java and the generated c wrapper
|
||||
clean-swig:
|
||||
rm -f $(SWIG_JAVA_OUT) $(SWIG_C_OUT)
|
||||
|
||||
#does clean-swig and then uses the ndk-build clean
|
||||
clean: clean-swig
|
||||
$(ANDROID_NDK_BASE)/ndk-build clean $(BUILD_DEFS)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
make V=0
|
||||
@@ -1 +0,0 @@
|
||||
make OPENCV_ROOT=../../opencv V=0 clean
|
||||
@@ -7,6 +7,6 @@
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
android.library.reference.1=../../android-jni
|
||||
android.library.reference.1=../../android-opencv
|
||||
# Project target.
|
||||
target=android-7
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# date: Summer, 2010
|
||||
# author: Ethan Rublee
|
||||
# contact: ethan.rublee@gmail.com
|
||||
#
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
#define OPENCV_INCLUDES and OPENCV_LIBS
|
||||
include $(OPENCV_CONFIG)
|
||||
|
||||
LOCAL_LDLIBS += $(OPENCV_LIBS) $(ANDROID_OPENCV_LIBS) -llog -lGLESv2
|
||||
|
||||
LOCAL_C_INCLUDES += $(OPENCV_INCLUDES) $(ANDROID_OPENCV_INCLUDES)
|
||||
|
||||
LOCAL_MODULE := cvcamera
|
||||
|
||||
LOCAL_SRC_FILES := Processor.cpp gen/cvcamera_swig.cpp
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# The ARMv7 is significanly faster due to the use of the hardware FPU
|
||||
APP_ABI := $(ARM_TARGETS)
|
||||
62
android/apps/CVCamera/jni/CMakeLists.txt
Normal file
62
android/apps/CVCamera/jni/CMakeLists.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
#########################################################
|
||||
# Find opencv and android-opencv
|
||||
#########################################################
|
||||
|
||||
set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/../../build
|
||||
CACHE PATH "The path where you built opencv for android")
|
||||
set(AndroidOpenCV_DIR ${CMAKE_SOURCE_DIR}/../../android-opencv/build
|
||||
CACHE PATH "The path where you built android-opencv")
|
||||
|
||||
find_package(OpenCV REQUIRED)
|
||||
FIND_PACKAGE(AndroidOpenCV REQUIRED )
|
||||
|
||||
#########################################################
|
||||
#c flags, included, and lib dependencies
|
||||
#########################################################
|
||||
|
||||
#notice the "recycling" of CMAKE_C_FLAGS
|
||||
#this is necessary to pick up android flags
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -fPIC" )
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set( LIBRARY_DEPS ${AndroidOpenCV_LIBS} ${OpenCV_LIBS} )
|
||||
if(ANDROID)
|
||||
set( LIBRARY_DEPS ${LIBRARY_DEPS} log dl)
|
||||
endif(ANDROID)
|
||||
|
||||
#########################################################
|
||||
#SWIG STUFF
|
||||
#########################################################
|
||||
#the java package to place swig generated java files in
|
||||
set(MY_PACKAGE com.theveganrobot.cvcamera.jni)
|
||||
|
||||
if(NOT ANDROID)
|
||||
#non android swig and jni
|
||||
#jni is available by default on android
|
||||
find_package(JNI REQUIRED)
|
||||
include_directories(${JNI_INCLUDE_DIRS})
|
||||
FIND_PACKAGE(SWIG)
|
||||
endif()
|
||||
|
||||
INCLUDE(${SWIG_USE_FILE}) #on android this is found by the cmake toolchain
|
||||
|
||||
if(ANDROID)
|
||||
#this will set the output path for the java package
|
||||
#and properly create the package declarations in generated java sources
|
||||
SET_SWIG_JAVA_PACKAGE( ${MY_PACKAGE} ) #defined in the android toolchain
|
||||
endif(ANDROID)
|
||||
|
||||
#this add's the swig path for the opencv wrappers
|
||||
SET(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} "-I${AndroidOpenCV_SWIG_DIR}" )
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(cvcamera.i PROPERTIES CPLUSPLUS ON)
|
||||
|
||||
#add the swig module, giving it the name, java, and then all of the source files
|
||||
SWIG_ADD_MODULE(cvcamera java
|
||||
cvcamera.i #swig file
|
||||
Processor.cpp #cpp files can be compiled to
|
||||
)
|
||||
|
||||
#link the module like any other
|
||||
target_link_libraries(cvcamera ${LIBRARY_DEPS} )
|
||||
@@ -1,4 +0,0 @@
|
||||
#location of android-opencv port of OpenCV to android
|
||||
OPENCV_CONFIG=../../build/android-opencv.mk
|
||||
ANDROID_NDK_ROOT=$(HOME)/android-ndk-r4-crystax
|
||||
ARM_TARGETS="armeabi armeabi-v7a"
|
||||
Reference in New Issue
Block a user