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

Updating up Android Build Scripts #2

Open
wants to merge 1 commit 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
11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*.iml
.idea
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
local.properties
build
.externalNativeBuild
.DS_Store

22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

19 changes: 0 additions & 19 deletions .idea/gradle.xml

This file was deleted.

87 changes: 0 additions & 87 deletions .idea/misc.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

1 change: 0 additions & 1 deletion app/.gitignore

This file was deleted.

30 changes: 8 additions & 22 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.

#Added 2 path definitions to support 20160825 additions
set(pathToProject C:/Users/Owner/AndroidStudioProjects/HelloCv)
set(pathToOpenCv C:/Users/Owner/OpenCV-3.1.0-android-sdk)

#Added by the IDE on project create
cmake_minimum_required(VERSION 3.4.1)

#Two sets suggested by Bruno Alexandre Krinski 20160825
set(CMAKE_VERBOSE_MAKEFILE on)
# point to local openCV installation, relative to the directory of CMakeLists.txt
set(pathToOpenCv ${CMAKE_SOURCE_DIR}/../../OpenCV-3.1.0-android-sdk)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")

#Addition suggested by Bruno Alexandre Krinski 20160825
include_directories(${pathToOpenCv}/sdk/native/jni/include)
add_library(native-lib SHARED
src/main/cpp/native-lib.cpp )

#Added by IDE on project create
add_library( native-lib SHARED src/main/cpp/native-lib.cpp )

#Addition suggested by Bruno Alexandre Krinski 20160825
add_library( lib_opencv SHARED IMPORTED )
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libopencv_java3.so)

#Addition suggested by Bruno Alexandre Krinski 20160825
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${pathToProject}/app/src/main/jniLibs/${ANDROID_ABI}/libopencv_java3.so)

#Added by IDE on project create
find_library( log-lib log )

#Added by IDE on project create, Removed and replace with additional parameter suggested by Bruno Alexandre Krinski 20160825
#target_link_libraries( native-lib $\{log-lib} )
target_link_libraries( native-lib $\{log-lib} lib_opencv)
target_link_libraries(native-lib log lib_opencv)



Expand Down
17 changes: 5 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,18 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
// this is default, you could list specific ones here
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips', 'mips64'
}
externalNativeBuild {
cmake {
//DRS 20160825 - Commented 1, Added 1 - - Suggestion by Bruno Alexandre Krinski
//cppFlags "-frtti -fexceptions"
cppFlags "-std=c++11 -frtti -fexceptions"

//DRS 20160822h - Added 1. Later replaced by 20160825
//abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a'
//DRS 20160825 - Suggestion by Bruno Alexandre Krinski
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips', 'mips64'
cppFlags "-frtti -fexceptions"
}
}
}
//DRS 20160822h - Added sourceSets
sourceSets {
main {
jniLibs.srcDirs = ['C:\\Users\\Owner\\AndroidStudioProjects\\HelloCv\\app\\src\\main\\jniLibs']
}
}
buildTypes {
release {
minifyEnabled false
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/cpp/native-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <opencv2/core.hpp>

extern "C" {
jstring
JNIEXPORT jstring JNICALL
Java_com_company_cpp_hellocv_MainActivity_stringFromJNI(
JNIEnv *env,
jobject /* this */) {
Expand All @@ -12,7 +12,7 @@ extern "C" {
}

//DRS 20160822c - Added native method
jstring
JNIEXPORT jstring JNICALL
Java_com_company_cpp_hellocv_MainActivity_validate(JNIEnv *env, jobject, jlong addrGray, jlong addrRgba) {
cv::Rect();
cv::Mat();
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
classpath 'com.android.tools.build:gradle:2.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
Loading