Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
216988b0
Commit
216988b0
authored
May 29, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14582 from alalek:android_update_debug
parents
53c77155
3c1267db
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
8 deletions
+51
-8
OpenCVDetectAndroidSDK.cmake
cmake/android/OpenCVDetectAndroidSDK.cmake
+2
-1
android_ant_projects.cmake
cmake/android/android_ant_projects.cmake
+2
-2
build.gradle
modules/java/android_sdk/android_gradle_lib/build.gradle
+5
-2
build.gradle.in
modules/java/android_sdk/build.gradle.in
+8
-0
CMakeLists.txt
modules/java/jni/CMakeLists.txt
+1
-1
build_sdk.py
platforms/android/build_sdk.py
+6
-2
build.gradle.in
samples/android/build.gradle.in
+27
-0
No files found.
cmake/android/OpenCVDetectAndroidSDK.cmake
View file @
216988b0
...
@@ -9,7 +9,8 @@ if(DEFINED ANDROID_NDK_REVISION AND ANDROID_NDK_REVISION MATCHES "(1[56])([0-9]+
...
@@ -9,7 +9,8 @@ if(DEFINED ANDROID_NDK_REVISION AND ANDROID_NDK_REVISION MATCHES "(1[56])([0-9]+
endif
()
endif
()
# fixup -g option: https://github.com/opencv/opencv/issues/8460#issuecomment-434249750
# fixup -g option: https://github.com/opencv/opencv/issues/8460#issuecomment-434249750
if
((
INSTALL_CREATE_DISTRIB OR CMAKE_BUILD_TYPE STREQUAL
"Release"
)
if
(
INSTALL_CREATE_DISTRIB
AND
(
NOT BUILD_WITH_DEBUG_INFO AND NOT CMAKE_BUILD_TYPE MATCHES
"Debug"
)
AND NOT OPENCV_SKIP_ANDROID_G_OPTION_FIX
AND NOT OPENCV_SKIP_ANDROID_G_OPTION_FIX
)
)
if
(
"
${
CMAKE_CXX_FLAGS
}
"
MATCHES
" -g "
)
if
(
"
${
CMAKE_CXX_FLAGS
}
"
MATCHES
" -g "
)
...
...
cmake/android/android_ant_projects.cmake
View file @
216988b0
...
@@ -201,8 +201,8 @@ macro(add_android_project target path)
...
@@ -201,8 +201,8 @@ macro(add_android_project target path)
LIBRARY_OUTPUT_DIRECTORY
"
${
android_proj_bin_dir
}
/libs/
${
ANDROID_NDK_ABI_NAME
}
"
LIBRARY_OUTPUT_DIRECTORY
"
${
android_proj_bin_dir
}
/libs/
${
ANDROID_NDK_ABI_NAME
}
"
)
)
if
(
NOT
(
CMAKE_BUILD_TYPE MATCHES
"debug"
)
)
if
(
NOT BUILD_WITH_DEBUG_INFO AND NOT CMAKE_BUILD_TYPE MATCHES
"Debug"
)
add_custom_command
(
TARGET
${
JNI_LIB_NAME
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded
"$<TARGET_FILE:
${
JNI_LIB_NAME
}
>"
)
add_custom_command
(
TARGET
${
JNI_LIB_NAME
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded
"$<TARGET_FILE:
${
JNI_LIB_NAME
}
>"
)
endif
()
endif
()
endif
()
endif
()
endif
()
endif
()
...
...
modules/java/android_sdk/android_gradle_lib/build.gradle
View file @
216988b0
...
@@ -11,11 +11,14 @@ android {
...
@@ -11,11 +11,14 @@ android {
buildTypes
{
buildTypes
{
debug
{
debug
{
packagingOptions
{
packagingOptions
{
doNotStrip
'*
.so'
doNotStrip
'*
*/*.so'
// controlled by OpenCV CMake scripts
}
}
}
}
release
{
release
{
packagingOptions
{
doNotStrip
'**/*.so'
// controlled by OpenCV CMake scripts
}
minifyEnabled
false
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.txt'
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.txt'
}
}
...
...
modules/java/android_sdk/build.gradle.in
View file @
216988b0
...
@@ -102,7 +102,15 @@ android {
...
@@ -102,7 +102,15 @@ android {
}
}
buildTypes {
buildTypes {
debug {
packagingOptions {
doNotStrip '**/*.so' // controlled by OpenCV CMake scripts
}
}
release {
release {
packagingOptions {
doNotStrip '**/*.so' // controlled by OpenCV CMake scripts
}
minifyEnabled false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
...
...
modules/java/jni/CMakeLists.txt
View file @
216988b0
...
@@ -77,7 +77,7 @@ if(ANDROID)
...
@@ -77,7 +77,7 @@ if(ANDROID)
# force strip library after the build command
# force strip library after the build command
# because samples and tests will make a copy of the library before install
# because samples and tests will make a copy of the library before install
if
(
NOT CMAKE_BUILD_TYPE MATCHES
"Debug"
)
if
(
NOT
BUILD_WITH_DEBUG_INFO AND NOT
CMAKE_BUILD_TYPE MATCHES
"Debug"
)
add_custom_command
(
TARGET
${
the_module
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded
"$<TARGET_FILE:
${
the_module
}
>"
)
add_custom_command
(
TARGET
${
the_module
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded
"$<TARGET_FILE:
${
the_module
}
>"
)
endif
()
endif
()
endif
()
endif
()
...
...
platforms/android/build_sdk.py
View file @
216988b0
...
@@ -143,6 +143,7 @@ class Builder:
...
@@ -143,6 +143,7 @@ class Builder:
self
.
cmake_path
=
self
.
get_cmake
()
self
.
cmake_path
=
self
.
get_cmake
()
self
.
ninja_path
=
self
.
get_ninja
()
self
.
ninja_path
=
self
.
get_ninja
()
self
.
debug
=
True
if
config
.
debug
else
False
self
.
debug
=
True
if
config
.
debug
else
False
self
.
debug_info
=
True
if
config
.
debug_info
else
False
def
get_cmake
(
self
):
def
get_cmake
(
self
):
if
not
self
.
config
.
use_android_buildtools
and
check_executable
([
'cmake'
,
'--version'
]):
if
not
self
.
config
.
use_android_buildtools
and
check_executable
([
'cmake'
,
'--version'
]):
...
@@ -217,6 +218,8 @@ class Builder:
...
@@ -217,6 +218,8 @@ class Builder:
if
self
.
debug
:
if
self
.
debug
:
cmake_vars
[
'CMAKE_BUILD_TYPE'
]
=
"Debug"
cmake_vars
[
'CMAKE_BUILD_TYPE'
]
=
"Debug"
if
self
.
debug_info
:
# Release with debug info
cmake_vars
[
'BUILD_WITH_DEBUG_INFO'
]
=
"ON"
cmake_vars
[
'BUILD_WITH_DEBUG_INFO'
]
=
"ON"
if
self
.
config
.
extra_modules_path
is
not
None
:
if
self
.
config
.
extra_modules_path
is
not
None
:
...
@@ -234,7 +237,7 @@ class Builder:
...
@@ -234,7 +237,7 @@ class Builder:
# full parallelism for C++ compilation tasks
# full parallelism for C++ compilation tasks
execute
([
self
.
ninja_path
,
"opencv_modules"
])
execute
([
self
.
ninja_path
,
"opencv_modules"
])
# limit parallelism for Gradle steps (avoid huge memory consumption)
# limit parallelism for Gradle steps (avoid huge memory consumption)
execute
([
self
.
ninja_path
,
'-j3'
,
"install"
if
self
.
debug
else
"install/strip"
])
execute
([
self
.
ninja_path
,
'-j3'
,
"install"
if
(
self
.
debug_info
or
self
.
debug
)
else
"install/strip"
])
def
build_javadoc
(
self
):
def
build_javadoc
(
self
):
classpaths
=
[]
classpaths
=
[]
...
@@ -291,7 +294,8 @@ if __name__ == "__main__":
...
@@ -291,7 +294,8 @@ if __name__ == "__main__":
parser
.
add_argument
(
'--no_ccache'
,
action
=
"store_true"
,
help
=
"Do not use ccache during library build"
)
parser
.
add_argument
(
'--no_ccache'
,
action
=
"store_true"
,
help
=
"Do not use ccache during library build"
)
parser
.
add_argument
(
'--force_copy'
,
action
=
"store_true"
,
help
=
"Do not use file move during library build (useful for debug)"
)
parser
.
add_argument
(
'--force_copy'
,
action
=
"store_true"
,
help
=
"Do not use file move during library build (useful for debug)"
)
parser
.
add_argument
(
'--force_opencv_toolchain'
,
action
=
"store_true"
,
help
=
"Do not use toolchain from Android NDK"
)
parser
.
add_argument
(
'--force_opencv_toolchain'
,
action
=
"store_true"
,
help
=
"Do not use toolchain from Android NDK"
)
parser
.
add_argument
(
'--debug'
,
action
=
"store_true"
,
help
=
"Build for debug"
)
parser
.
add_argument
(
'--debug'
,
action
=
"store_true"
,
help
=
"Build 'Debug' binaries (CMAKE_BUILD_TYPE=Debug)"
)
parser
.
add_argument
(
'--debug_info'
,
action
=
"store_true"
,
help
=
"Build with debug information (useful for Release mode: BUILD_WITH_DEBUG_INFO=ON)"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
log
.
basicConfig
(
format
=
'
%(message)
s'
,
level
=
log
.
DEBUG
)
log
.
basicConfig
(
format
=
'
%(message)
s'
,
level
=
log
.
DEBUG
)
...
...
samples/android/build.gradle.in
View file @
216988b0
...
@@ -62,5 +62,32 @@ gradle.afterProject { project ->
...
@@ -62,5 +62,32 @@ gradle.afterProject { project ->
}
}
}
}
}
}
// (you still need to re-build OpenCV with debug information to debug it)
if (true) {
gradle.println("Override doNotStrip-debug for the project ${project.name}")
project.android {
buildTypes {
debug {
packagingOptions {
doNotStrip '**/*.so' // controlled by OpenCV CMake scripts
}
}
}
}
}
if (false || project.hasProperty("doNotStrip")) {
gradle.println("Override doNotStrip-release for the project ${project.name}")
project.android {
buildTypes {
release {
packagingOptions {
doNotStrip '**/*.so' // controlled by OpenCV CMake scripts
}
}
}
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment