Skip to content

Commit

Permalink
update OpenCV to the lastest version. (v4.1.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
pqpo committed Jul 11, 2019
1 parent 8a612a2 commit 6381606
Show file tree
Hide file tree
Showing 334 changed files with 94,002 additions and 16,743 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
versionCode 1
versionName "1.0"
ndk {
abiFilters 'armeabi-v7a', 'x86'
abiFilters 'armeabi-v7a', "arm64-v8a", 'x86', 'x86_64'
}
}
buildTypes {
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -28,8 +28,8 @@ task clean(type: Delete) {
}

ext {
compileSdkVersion = 26
minSdkVersion = 14
targetSdkVersion = 26
supportLibraryVersion = '27.1.1'
compileSdkVersion = 28
minSdkVersion = 21
targetSdkVersion = 28
supportLibraryVersion = '28.0.0'
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Aug 15 20:09:21 CST 2018
#Thu Jul 11 18:57:23 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
50 changes: 16 additions & 34 deletions smartcameralib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,26 @@

cmake_minimum_required(VERSION 3.4.1)

set(TARGET smart_camera)
set(SRC_DIR src/main/cpp/)
set(OPENCV_LIB_DIR opencv/lib/${ANDROID_ABI}/)
set(OPENCV_3RD_LIB_DIR opencv/3rdparty/${ANDROID_ABI}/)

# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI})

include_directories(opencv/include
src/main/cpp/include)

add_library(opencv_imgproc STATIC IMPORTED)
add_library(opencv_core STATIC IMPORTED)
if(EXISTS ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libtbb.a)
add_library(tbb STATIC IMPORTED)
endif()

set_target_properties(opencv_imgproc PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libopencv_imgproc.a)
set_target_properties(opencv_core PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libopencv_core.a)
if(EXISTS ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libtbb.a)
set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libtbb.a)
endif()

link_directories(${OPENCV_LIB_DIR}
${OPENCV_3RD_LIB_DIR})

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

aux_source_directory(src/main/cpp/ DIR_LIB_SOURCE)
add_library (smart_camera SHARED ${DIR_LIB_SOURCE})
aux_source_directory(${SRC_DIR} DIR_LIB_SOURCE)
add_library (${TARGET} SHARED ${DIR_LIB_SOURCE})

# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
Expand All @@ -46,30 +42,16 @@ find_library( # Sets the name of the path variable.
find_library(jnigraphics-lib
jnigraphics)

find_library(z-lib
z)


# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

if(EXISTS ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libtbb.a)
target_link_libraries( # Specifies the target library.
smart_camera
opencv_imgproc
opencv_core
tbb

# Links the target library to the log library
# included in the NDK.
${log-lib}
${jnigraphics-lib})
if(${ANDROID_ABI} STREQUAL x86 OR ${ANDROID_ABI} STREQUAL x86_64)
target_link_libraries(${TARGET} opencv_imgproc opencv_core ${z-lib} ippiw ippicv ittnotify tbb cpufeatures ${log-lib} ${jnigraphics-lib})
else()
target_link_libraries( # Specifies the target library.
smart_camera
opencv_imgproc
opencv_core

# Links the target library to the log library
# included in the NDK.
${log-lib}
${jnigraphics-lib})
target_link_libraries(${TARGET} opencv_imgproc opencv_core ${z-lib} tegra_hal tbb cpufeatures ${log-lib} ${jnigraphics-lib})
endif()
11 changes: 4 additions & 7 deletions smartcameralib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 9
versionName "1.3.2"
versionCode 10
versionName "2.0.0"

externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -lz"
abiFilters 'armeabi-v7a', 'x86'
arguments '-DANDROID_STL=gnustl_shared'
// abiFilters 'armeabi', 'armeabi-v7a', 'mips', 'x86'
cppFlags "-std=c++11 -frtti"
abiFilters 'armeabi-v7a', "arm64-v8a", 'x86', 'x86_64'
}
}
}
Expand Down Expand Up @@ -50,6 +48,5 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
}
Loading

0 comments on commit 6381606

Please sign in to comment.