Skip to content

Commit c24d7cc

Browse files
author
Andrey Pavlenko
committed
adding more version-related variables
1 parent 29b763d commit c24d7cc

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

modules/java/generator/gen_java.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,9 @@ def add_class_code_stream(self, class_name, cls_base = ''):
739739
# version_suffix = version_suffix[0 : -1]
740740
self.classes[class_name].imports.add("java.lang.String")
741741
self.java_code[class_name]["j_code"].write("""
742-
public static final String VERSION = "%(v)s", VERSION_SUFFIX = "%(vs)s";
743-
""" % { 'v' : version_str, 'vs' : version_suffix } )
742+
public static final String VERSION = "%(v)s", NATIVE_LIBRARY_NAME = "opencv_java%(vs)s";
743+
public static final int VERSION_EPOCH = %(ep)s, VERSION_MAJOR = %(ma)s, VERSION_MINOR = %(mi)s, VERSION_PATCH = %(pa)s;
744+
""" % { 'v' : version_str, 'vs' : version_suffix, 'ep' : epoch, 'ma' : major, 'mi' : minor, 'pa' : patch } )
744745

745746

746747
def add_class(self, decl):

samples/java/ant/src/SimpleSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class SimpleSample {
77

8-
static{ System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX); }
8+
static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }
99

1010
public static void main(String[] args) {
1111
System.out.println("Welcome to OpenCV " + Core.VERSION);

samples/java/eclipse/HelloCV/src/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class Main {
66

77
public static void main(String[] args) {
88
System.out.println("Welcome to OpenCV " + Core.VERSION);
9-
System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX);
9+
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
1010
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
1111
System.out.println("m = " + m.dump());
1212
}

samples/java/sbt/src/main/scala/Main.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object Main extends App {
1515
// We must load the native library before using any OpenCV functions.
1616
// You must load this library _exactly once_ per Java invocation.
1717
// If you load it more than once, you will get a java.lang.UnsatisfiedLinkError.
18-
System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX)
18+
System.loadLibrary(Core.NATIVE_LIBRARY_NAME)
1919

2020
ScalaCorrespondenceMatchingDemo.run()
2121
ScalaDetectFaceDemo.run()

0 commit comments

Comments
 (0)