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
a897fc91
Commit
a897fc91
authored
Jul 18, 2019
by
Giles Payne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add no_samples_build option to Android SDK build
parent
f6ec0cd8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
18 deletions
+35
-18
CMakeLists.txt
CMakeLists.txt
+2
-2
android_gradle_projects.cmake
cmake/android/android_gradle_projects.cmake
+23
-11
build_sdk.py
platforms/android/build_sdk.py
+8
-3
gradle.properties
platforms/android/gradle-wrapper/gradle.properties
+1
-1
CMakeLists.txt
samples/CMakeLists.txt
+1
-1
No files found.
CMakeLists.txt
View file @
a897fc91
...
...
@@ -964,7 +964,7 @@ if(BUILD_opencv_apps)
endif
()
# examples
if
(
BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES OR INSTALL_C_EXAMPLES
)
if
(
BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_
ANDROID_EXAMPLES OR INSTALL_
PYTHON_EXAMPLES OR INSTALL_C_EXAMPLES
)
add_subdirectory
(
samples
)
endif
()
...
...
@@ -1199,7 +1199,7 @@ ocv_build_features_string(apps_status
IF BUILD_EXAMPLES THEN
"examples"
IF BUILD_opencv_apps THEN
"apps"
IF BUILD_ANDROID_SERVICE THEN
"android_service"
IF
BUILD_ANDROID_EXAMPLES
AND CAN_BUILD_ANDROID_PROJECTS THEN
"android_examples"
IF
(
BUILD_ANDROID_EXAMPLES OR INSTALL_ANDROID_EXAMPLES
)
AND CAN_BUILD_ANDROID_PROJECTS THEN
"android_examples"
ELSE
"-"
)
status
(
" Applications:"
"
${
apps_status
}
"
)
ocv_build_features_string
(
docs_status
...
...
cmake/android/android_gradle_projects.cmake
View file @
a897fc91
...
...
@@ -105,17 +105,29 @@ macro(add_android_project target path)
include ':
${
__dir
}
'
"
)
# build apk
set
(
APK_FILE
"
${
ANDROID_BUILD_BASE_DIR
}
/
${
__dir
}
/build/outputs/apk/release/
${
__dir
}
-
${
ANDROID_ABI
}
-release-unsigned.apk"
)
ocv_update
(
OPENCV_GRADLE_VERBOSE_OPTIONS
"-i"
)
add_custom_command
(
OUTPUT
"
${
APK_FILE
}
"
"
${
OPENCV_DEPHELPER
}
/android_sample_
${
__dir
}
"
COMMAND ./gradlew
${
OPENCV_GRADLE_VERBOSE_OPTIONS
}
"
${
__dir
}
:assemble"
COMMAND
${
CMAKE_COMMAND
}
-E touch
"
${
OPENCV_DEPHELPER
}
/android_sample_
${
__dir
}
"
WORKING_DIRECTORY
"
${
ANDROID_BUILD_BASE_DIR
}
"
DEPENDS
${
depends
}
opencv_java_android
COMMENT
"Building OpenCV Android sample project:
${
__dir
}
"
)
if
(
BUILD_ANDROID_EXAMPLES
)
# build apk
set
(
APK_FILE
"
${
ANDROID_BUILD_BASE_DIR
}
/
${
__dir
}
/build/outputs/apk/release/
${
__dir
}
-
${
ANDROID_ABI
}
-release-unsigned.apk"
)
ocv_update
(
OPENCV_GRADLE_VERBOSE_OPTIONS
"-i"
)
add_custom_command
(
OUTPUT
"
${
APK_FILE
}
"
"
${
OPENCV_DEPHELPER
}
/android_sample_
${
__dir
}
"
COMMAND ./gradlew
${
OPENCV_GRADLE_VERBOSE_OPTIONS
}
"
${
__dir
}
:assemble"
COMMAND
${
CMAKE_COMMAND
}
-E touch
"
${
OPENCV_DEPHELPER
}
/android_sample_
${
__dir
}
"
WORKING_DIRECTORY
"
${
ANDROID_BUILD_BASE_DIR
}
"
DEPENDS
${
depends
}
opencv_java_android
COMMENT
"Building OpenCV Android sample project:
${
__dir
}
"
)
else
()
# install only
# copy samples
add_custom_command
(
OUTPUT
"
${
OPENCV_DEPHELPER
}
/android_sample_
${
__dir
}
"
COMMAND
${
CMAKE_COMMAND
}
-E touch
"
${
OPENCV_DEPHELPER
}
/android_sample_
${
__dir
}
"
WORKING_DIRECTORY
"
${
ANDROID_BUILD_BASE_DIR
}
"
DEPENDS
${
depends
}
opencv_java_android
COMMENT
"Copying OpenCV Android sample project:
${
__dir
}
"
)
endif
()
file
(
REMOVE
"
${
OPENCV_DEPHELPER
}
/android_sample_
${
__dir
}
"
)
# force rebuild after CMake run
add_custom_target
(
android_sample_
${
__dir
}
ALL DEPENDS
"
${
OPENCV_DEPHELPER
}
/android_sample_
${
__dir
}
"
SOURCES
"
${
ANDROID_SAMPLE_MANIFEST_PATH
}
"
)
...
...
platforms/android/build_sdk.py
View file @
a897fc91
...
...
@@ -151,6 +151,7 @@ class Builder:
self
.
ninja_path
=
self
.
get_ninja
()
self
.
debug
=
True
if
config
.
debug
else
False
self
.
debug_info
=
True
if
config
.
debug_info
else
False
self
.
no_samples_build
=
True
if
config
.
no_samples_build
else
False
def
get_cmake
(
self
):
if
not
self
.
config
.
use_android_buildtools
and
check_executable
([
'cmake'
,
'--version'
]):
...
...
@@ -217,7 +218,7 @@ class Builder:
BUILD_TESTS
=
"OFF"
,
BUILD_PERF_TESTS
=
"OFF"
,
BUILD_DOCS
=
"OFF"
,
BUILD_ANDROID_EXAMPLES
=
"ON"
,
BUILD_ANDROID_EXAMPLES
=
(
"OFF"
if
self
.
no_samples_build
else
"ON"
)
,
INSTALL_ANDROID_EXAMPLES
=
"ON"
,
)
if
self
.
ninja_path
!=
'ninja'
:
...
...
@@ -243,8 +244,11 @@ class Builder:
execute
(
cmd
)
# full parallelism for C++ compilation tasks
execute
([
self
.
ninja_path
,
"opencv_modules"
])
# limit parallelism for Gradle steps (avoid huge memory consumption)
execute
([
self
.
ninja_path
,
'-j3'
,
"install"
if
(
self
.
debug_info
or
self
.
debug
)
else
"install/strip"
])
# limit parallelism for building samples (avoid huge memory consumption)
if
self
.
no_samples_build
:
execute
([
self
.
ninja_path
,
"install"
if
(
self
.
debug_info
or
self
.
debug
)
else
"install/strip"
])
else
:
execute
([
self
.
ninja_path
,
"-j1"
if
(
self
.
debug_info
or
self
.
debug
)
else
"-j3"
,
"install"
if
(
self
.
debug_info
or
self
.
debug
)
else
"install/strip"
])
def
build_javadoc
(
self
):
classpaths
=
[]
...
...
@@ -323,6 +327,7 @@ if __name__ == "__main__":
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 '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)"
)
parser
.
add_argument
(
'--no_samples_build'
,
action
=
"store_true"
,
help
=
"Do not build samples (speeds up build)"
)
args
=
parser
.
parse_args
()
log
.
basicConfig
(
format
=
'
%(message)
s'
,
level
=
log
.
DEBUG
)
...
...
platforms/android/gradle-wrapper/gradle.properties
View file @
a897fc91
...
...
@@ -9,7 +9,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs
=
-Xmx
1536m
org.gradle.jvmargs
=
-Xmx
2g
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
...
...
samples/CMakeLists.txt
View file @
a897fc91
...
...
@@ -38,7 +38,7 @@ endif()
if
(
UNIX AND NOT ANDROID
AND
(
HAVE_VA OR HAVE_VA_INTEL
))
add_subdirectory
(
va_intel
)
endif
()
if
(
ANDROID AND
BUILD_ANDROID_EXAMPLES
)
if
(
ANDROID
AND
(
BUILD_ANDROID_EXAMPLES OR INSTALL_ANDROID_EXAMPLES
)
)
add_subdirectory
(
android
)
endif
()
if
(
INSTALL_PYTHON_EXAMPLES
)
...
...
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