Skip to content

Commit

Permalink
全平台cpu编译
Browse files Browse the repository at this point in the history
  • Loading branch information
qiulinmin committed Oct 20, 2017
1 parent 17a0001 commit b2418df
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 91 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ allprojects {
2.添加依赖
```gradle
dependencies {
compile 'com.github.pqpo:SmartCropper:V1.0.1'
compile 'com.github.pqpo:SmartCropper:V1.1.0@aar'
}
```

Expand Down
2 changes: 1 addition & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Step 1. Add it in your root build.gradle at the end of repositories:
Step 2. Add the dependency
```
dependencies {
compile 'com.github.pqpo:SmartCropper:V1.0.1'
compile 'com.github.pqpo:SmartCropper:V1.1.0@aar'
}
```

Expand Down
Binary file added aar/smartcropperlib-1.1.0.aar
Binary file not shown.
Binary file removed aar/smartcropperlib.aar
Binary file not shown.
7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ android {
applicationId "me.pqpo.smartcropper"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.1"
ndk {
abiFilters 'armeabi'
abiFilters 'armeabi','armeabi-v7a','mips', 'x86'
}
}
buildTypes {
Expand All @@ -29,4 +29,5 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
// compile 'com.github.pqpo:SmartCropper:V1.0.1@aar'
}
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
}
}

allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
}

Expand Down
23 changes: 21 additions & 2 deletions smartcropperlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ include_directories(opencv/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()


# Creates and names a library, sets it as either STATIC
Expand Down Expand Up @@ -52,12 +58,25 @@ find_library(jnigraphics-lib
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

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

# Links the target library to the log library
# included in the NDK.
${log-lib}
${jnigraphics-lib})
else()
target_link_libraries( # Specifies the target library.
smart_cropper
opencv_imgproc
opencv_core

# Links the target library to the log library
# included in the NDK.
${log-lib}
${jnigraphics-lib})
${jnigraphics-lib})
endif()
86 changes: 4 additions & 82 deletions smartcropperlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0.0"
versionCode 2
versionName "1.1.0"

externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions -lz"
abiFilters 'armeabi'
abiFilters 'armeabi', 'armeabi-v7a', 'mips', 'x86'
}
}

Expand All @@ -36,82 +36,4 @@ android {

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

apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
// This is the library version used when deploying the artifact
version = "1.0.0"

def siteUrl = "https://github.com/pqpo/SmartCropper"
def gitUrl = "https://github.com/pqpo/SmartCropper.git"
group = "me.pqpo.smartcropper" // Maven Group ID for the artifact,一般填你唯一的包名
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name 'A library for cropping image in a smart way that can identify the border and correct the cropped image'
url siteUrl
// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'pqpo'
name 'pqpo'
email '[email protected]'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
name = "SmartCropper" //发布到JCenter上的项目名字
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}
javadoc { //jav doc采用utf-8编码否则会报“GBK的不可映射字符”错误
options{
encoding "UTF-8"
charSet 'UTF-8'
}
}
}
Binary file added smartcropperlib/opencv/lib/armeabi-v7a/libtbb.a
Binary file not shown.
Binary file added smartcropperlib/opencv/lib/mips/libtbb.a
Binary file not shown.
Binary file added smartcropperlib/opencv/lib/x86/libtbb.a
Binary file not shown.

0 comments on commit b2418df

Please sign in to comment.