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
2360291c
Commit
2360291c
authored
Jul 19, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java: update source files processing, maven stuff
parent
02829f73
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
78 additions
and
54 deletions
+78
-54
CMakeLists.txt
modules/java/CMakeLists.txt
+45
-18
OpenCVTestRunner.java
...va/android_test/src/org/opencv/test/OpenCVTestRunner.java
+1
-1
android+OpenCVLoader.java.in
modules/java/generator/src/java/android+OpenCVLoader.java.in
+11
-0
android+sync.py
modules/java/generator/src/java/android+sync.py
+0
-7
osgi+OpenCVNativeLoader.java.in
...s/java/generator/src/java/osgi+OpenCVNativeLoader.java.in
+1
-1
pom.xml
platforms/maven/opencv-it/pom.xml
+1
-1
DeployOpenCVTest.java
...cv-it/src/test/java/org/opencv/osgi/DeployOpenCVTest.java
+3
-3
pom.xml
platforms/maven/opencv/pom.xml
+8
-17
execstack_check
platforms/maven/opencv/scripts/execstack_check
+4
-2
pom.xml
platforms/maven/pom.xml
+4
-4
No files found.
modules/java/CMakeLists.txt
View file @
2360291c
...
...
@@ -18,6 +18,12 @@ if(EXISTS ${CMAKE_BINARY_DIR}/gen)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E remove_directory
"
${
CMAKE_BINARY_DIR
}
/gen"
)
endif
()
if
(
ANDROID
)
set
(
LIB_NAME_SUFIX
"
${
OPENCV_VERSION_MAJOR
}
"
)
else
()
set
(
LIB_NAME_SUFIX
"
${
OPENCV_VERSION_MAJOR
}${
OPENCV_VERSION_MINOR
}${
OPENCV_VERSION_PATCH
}
"
)
endif
()
ocv_module_include_directories
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/generator/src/cpp"
)
ocv_module_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/include"
)
...
...
@@ -69,7 +75,7 @@ macro(glob_more_specific_sources _type _root _output)
elseif
(
${
_type
}
STREQUAL
"CPP"
)
set
(
_masks
"
${
_root
}
/src/cpp/*.cpp"
)
elseif
(
${
_type
}
STREQUAL
"JAVA"
)
set
(
_masks
"
${
_root
}
/src/java/*.java"
)
set
(
_masks
"
${
_root
}
/src/java/*.java"
"
${
_root
}
/src/java/*.java.in"
)
elseif
(
${
_type
}
STREQUAL
"AIDL"
)
set
(
_masks
"
${
_root
}
/src/java/*.aidl"
)
endif
()
...
...
@@ -257,22 +263,49 @@ endforeach()
# step 3: copy files to destination
set
(
step3_input_files
${
generated_java_sources
}
${
handwritten_java_sources
}
${
handwritten_aidl_sources
}
)
set
(
copied_files
""
)
set
(
java_src_dir
"
${
OpenCV_BINARY_DIR
}
/src"
)
foreach
(
java_file
${
step3_input_files
}
)
get_filename_component
(
java_file_name
"
${
java_file
}
"
NAME
)
set
(
__configure 0
)
if
(
java_file_name MATCHES
"
\\
.in$"
)
string
(
REGEX REPLACE
"
\\
.in$"
""
java_file_name
"
${
java_file_name
}
"
)
set
(
__configure 1
)
endif
()
string
(
REPLACE
"-jdoc.java"
".java"
java_file_name
"
${
java_file_name
}
"
)
string
(
REPLACE
"+"
"/"
java_file_name
"
${
java_file_name
}
"
)
set
(
output_name
"
${
OpenCV_BINARY_DIR
}
/src/org/opencv/
${
java_file_name
}
"
)
add_custom_command
(
OUTPUT
"
${
output_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"
${
java_file
}
"
"
${
output_name
}
"
MAIN_DEPENDENCY
"
${
java_file
}
"
DEPENDS
${
step1_depends
}
${
generated_java_sources
}
${
handwritten_java_sources
}
COMMENT
"Generating src/org/opencv/
${
java_file_name
}
"
)
list
(
APPEND copied_files
"
${
output_name
}
"
)
if
(
EXISTS
"
${
java_file
}
"
)
file
(
STRINGS
"
${
java_file
}
"
PACKAGE_STR LIMIT_COUNT 1 REGEX
"package.*;$"
)
else
()
set
(
PACKAGE_STR
""
)
endif
()
if
(
PACKAGE_STR
)
list
(
GET PACKAGE_STR 0 package_name
)
string
(
REGEX REPLACE
"^package[ ]+"
""
package_name
"
${
package_name
}
"
)
string
(
REGEX REPLACE
";$"
""
package_name
"
${
package_name
}
"
)
string
(
REGEX REPLACE
".*
\\
+"
""
java_file_name
"
${
java_file_name
}
"
)
string
(
REPLACE
"."
"/"
package_path
"
${
package_name
}
"
)
set
(
output_name
"
${
package_path
}
/
${
java_file_name
}
"
)
else
()
string
(
REPLACE
"+"
"/"
java_file_name
"
${
java_file_name
}
"
)
set
(
output_name
"org/opencv/
${
java_file_name
}
"
)
endif
()
if
(
__configure
)
configure_file
(
"
${
java_file
}
"
"
${
java_src_dir
}
/
${
output_name
}
"
@ONLY
)
elseif
(
NOT
"
${
java_file
}
"
MATCHES
"
${
OpenCV_BINARY_DIR
}
/"
)
configure_file
(
"
${
java_file
}
"
"
${
java_src_dir
}
/
${
output_name
}
"
COPYONLY
)
else
()
add_custom_command
(
OUTPUT
"
${
java_src_dir
}
/
${
output_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"
${
java_file
}
"
"
${
java_src_dir
}
/
${
output_name
}
"
MAIN_DEPENDENCY
"
${
java_file
}
"
DEPENDS
"
${
java_file
}
"
COMMENT
"Generating src/
${
output_name
}
"
)
endif
()
list
(
APPEND copied_files
"
${
java_src_dir
}
/
${
output_name
}
"
)
if
(
ANDROID
)
get_filename_component
(
install_subdir
"
${
java_file
_name
}
"
PATH
)
install
(
FILES
"
${
output_name
}
"
DESTINATION
"
${
JAVA_INSTALL_ROOT
}
/src/org/opencv
/
${
install_subdir
}
"
COMPONENT java
)
get_filename_component
(
install_subdir
"
${
output
_name
}
"
PATH
)
install
(
FILES
"
${
java_src_dir
}
/
${
output_name
}
"
DESTINATION
"
${
JAVA_INSTALL_ROOT
}
/src
/
${
install_subdir
}
"
COMPONENT java
)
endif
()
endforeach
()
...
...
@@ -334,12 +367,6 @@ endif(ANDROID AND ANDROID_EXECUTABLE)
set(step3_depends
${
step2_depends
}
${
step3_input_files
}
${
copied_files
}
)
if(ANDROID)
set(LIB_NAME_SUFIX "
${
OPENCV_VERSION_MAJOR
}
")
else()
set(LIB_NAME_SUFIX "
${
OPENCV_VERSION_MAJOR
}${
OPENCV_VERSION_MINOR
}${
OPENCV_VERSION_PATCH
}
")
endif()
file(MAKE_DIRECTORY "
${
OpenCV_BINARY_DIR
}
/bin
")
# step 4: build jar
...
...
modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java
View file @
2360291c
...
...
@@ -82,7 +82,7 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
// Using OpenCV Manager for initialization;
Log
(
"Internal OpenCV library not found. Using OpenCV Manager for initialization"
);
OpenCVLoader
.
initAsync
(
OpenCVLoader
.
OPENCV_VERSION
_3_0_0
,
getContext
(),
mLoaderCallback
);
OpenCVLoader
.
initAsync
(
OpenCVLoader
.
OPENCV_VERSION
,
getContext
(),
mLoaderCallback
);
synchronized
(
this
)
{
try
{
...
...
modules/java/generator/src/java/android+OpenCVLoader.java
→
modules/java/generator/src/java/android+OpenCVLoader.java
.in
View file @
2360291c
...
...
@@ -82,6 +82,17 @@ public class OpenCVLoader
*/
public
static
final
String
OPENCV_VERSION_3_2_0
=
"3.2.0"
;
/**
*
OpenCV
Library
version
3.3.0
.
*/
public
static
final
String
OPENCV_VERSION_3_3_0
=
"3.3.0"
;
/**
*
Current
OpenCV
Library
version
*/
public
static
final
String
OPENCV_VERSION
=
"@OPENCV_VERSION_MAJOR@.@OPENCV_VERSION_MINOR@.@OPENCV_VERSION_PATCH@"
;
/**
*
Loads
and
initializes
OpenCV
library
from
current
application
package
.
Roughly
,
it
's an analog of system.loadLibrary("opencv_java").
* @return Returns true is initialization of OpenCV was successful.
...
...
modules/java/generator/src/java/android+sync.py
deleted
100755 → 0
View file @
02829f73
#!/usr/bin/python
import
os
import
shutil
for
f
in
os
.
listdir
(
"."
):
shutil
.
copyfile
(
f
,
os
.
path
.
join
(
"../../../../../../modules/java/generator/src/java/"
,
"android+"
+
f
));
modules/java/generator/src/java/osgi+OpenCVNativeLoader.java
→
modules/java/generator/src/java/osgi+OpenCVNativeLoader.java
.in
View file @
2360291c
...
...
@@ -12,7 +12,7 @@ import java.util.logging.Logger;
public class OpenCVNativeLoader implements OpenCVInterface {
public void init() {
System
.
loadLibrary
(
"opencv_java
320
"
);
System.loadLibrary("opencv_java
@LIB_NAME_SUFIX@
");
Logger.getLogger("org.opencv.osgi").log(Level.INFO, "Successfully loaded OpenCV native library.");
}
}
platforms/maven/opencv-it/pom.xml
View file @
2360291c
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
org.opencv
</groupId>
<artifactId>
opencv-parent
</artifactId>
<version>
3.
2
.0
</version>
<version>
3.
3
.0
</version>
</parent>
<groupId>
org.opencv
</groupId>
<artifactId>
opencv-it
</artifactId>
...
...
platforms/maven/opencv-it/src/test/java/org/opencv/osgi/DeployOpenCVTest.java
View file @
2360291c
...
...
@@ -32,7 +32,7 @@ public class DeployOpenCVTest {
/*
The expected string in Karaf logs when the bundle has deployed and native library loaded.
*/
private
static
final
String
OPEN
_
CV_SUCCESSFUL_LOAD_STRING
=
"Successfully loaded OpenCV native library."
;
private
static
final
String
OPENCV_SUCCESSFUL_LOAD_STRING
=
"Successfully loaded OpenCV native library."
;
private
static
final
String
KARAF_VERSION
=
"4.0.6"
;
...
...
@@ -65,7 +65,7 @@ public class DeployOpenCVTest {
mavenBundle
()
.
groupId
(
"org.opencv"
)
.
artifactId
(
"opencv"
)
.
version
(
"3.
2
.0"
),
.
version
(
"3.
3
.0"
),
logLevel
(
LogLevelOption
.
LogLevel
.
INFO
)
};
}
...
...
@@ -78,7 +78,7 @@ public class DeployOpenCVTest {
public
void
testOpenCVNativeLibraryLoadSuccess
()
{
Iterable
<
PaxLoggingEvent
>
loggingEvents
=
logService
.
getEvents
();
boolean
loadSuccessful
=
logsContainsMessage
(
loggingEvents
,
OPEN
_
CV_SUCCESSFUL_LOAD_STRING
);
boolean
loadSuccessful
=
logsContainsMessage
(
loggingEvents
,
OPENCV_SUCCESSFUL_LOAD_STRING
);
TestCase
.
assertTrue
(
"Could not determine if OpenCV library successfully loaded from the logs."
,
loadSuccessful
);
...
...
platforms/maven/opencv/pom.xml
View file @
2360291c
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
org.opencv
</groupId>
<artifactId>
opencv-parent
</artifactId>
<version>
3.
2
.0
</version>
<version>
3.
3
.0
</version>
</parent>
<groupId>
org.opencv
</groupId>
<artifactId>
opencv
</artifactId>
...
...
@@ -89,21 +89,6 @@
</arguments>
</configuration>
</execution>
<execution>
<id>
execstack
</id>
<phase>
process-classes
</phase>
<goals>
<goal>
exec
</goal>
</goals>
<configuration>
<workingDirectory>
${build.directory}/lib
</workingDirectory>
<executable>
execstack
</executable>
<arguments>
<argument>
-c
</argument>
<argument>
libopencv_java320.so
</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>
check-execstack
</id>
<phase>
process-classes
</phase>
...
...
@@ -115,7 +100,7 @@
<executable>
bash
</executable>
<arguments>
<argument>
execstack_check
</argument>
<argument>
${build.directory}/lib/libopencv_java
320
.so
</argument>
<argument>
${build.directory}/lib/libopencv_java
${lib.version.string}
.so
</argument>
</arguments>
</configuration>
</execution>
...
...
@@ -190,10 +175,12 @@
<configuration>
<rules>
<requireEnvironmentVariable>
<level>
WARN
</level>
<variableName>
ANT_HOME
</variableName>
<message>
$ANT_HOME is not set. Build may fail.
</message>
</requireEnvironmentVariable>
<requireEnvironmentVariable>
<level>
WARN
</level>
<variableName>
JAVA_HOME
</variableName>
<message>
$JAVA_HOME is not set. Build WILL fail.
</message>
</requireEnvironmentVariable>
...
...
@@ -245,6 +232,7 @@
<version>
3.4.1-b2
</version>
<executions>
<execution>
<phase>
generate-sources
</phase>
<id>
cmake-generate
</id>
<goals>
<goal>
generate
</goal>
...
...
@@ -255,15 +243,18 @@
<generator>
Unix Makefiles
</generator>
<options>
<option>
-DBUILD_SHARED_LIBS:BOOL=OFF
</option>
<option>
-DWITH_CUDA=OFF
</option>
</options>
</configuration>
</execution>
<execution>
<phase>
generate-sources
</phase>
<id>
cmake-compile
</id>
<goals>
<goal>
compile
</goal>
</goals>
<configuration>
<target>
opencv_java
</target>
<projectDirectory>
../../../build
</projectDirectory>
</configuration>
</execution>
...
...
platforms/maven/opencv/scripts/execstack_check
View file @
2360291c
...
...
@@ -20,8 +20,10 @@ red=$'\e[1;31m'
green
=
$'
\e
[1;32m'
end
=
$'
\e
[0m'
echo
"
${
green
}
[INFO] Checking that the native library executable stack flag is NOT set.
${
end
}
"
execstack
-c
$1
execstack
-q
$1
|
grep
-o
^-
BINARY
=
execstack
$BINARY
--help
>
/dev/null
||
BINARY
=
/usr/sbin/execstack
$BINARY
-c
$1
$BINARY
-q
$1
|
grep
-o
^-
if
[
$?
-ne
0
]
;
then
echo
echo
"
${
red
}
[ERROR] The Executable Flag could not be cleared on the library
$1
.
${
end
}
"
...
...
platforms/maven/pom.xml
View file @
2360291c
...
...
@@ -3,13 +3,13 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.opencv
</groupId>
<artifactId>
opencv-parent
</artifactId>
<version>
3.
2
.0
</version>
<version>
3.
3
.0
</version>
<packaging>
pom
</packaging>
<name>
OpenCV Parent POM
</name>
<licenses>
<license>
<name>
License Agreement For Open Source Computer Vision Library (3-clause BSD License)
</name>
<url></url>
<url>
http://opencv.org/license.html
</url>
</license>
</licenses>
<url>
http://opencv.org/
</url>
...
...
@@ -29,8 +29,8 @@
<properties>
<nativelibrary.name>
libopencv_java${lib.version.string}.so
</nativelibrary.name>
<pax.exam.version>
4.8.0
</pax.exam.version>
<maven.compiler.source>
1.
8
</maven.compiler.source>
<maven.compiler.target>
1.
8
</maven.compiler.target>
<maven.compiler.source>
1.
7
</maven.compiler.source>
<maven.compiler.target>
1.
7
</maven.compiler.target>
</properties>
<distributionManagement>
<snapshotRepository>
...
...
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