set(step3_depends ${step2_depends} ${step3_input_files} ${copied_files})
+if(ANDROID)
+ set(LIB_NAME_SUFIX "")
+else()
+ set(LIB_NAME_SUFIX "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
+endif()
+
# step 4: build jar
if(ANDROID)
set(JAR_FILE "${OpenCV_BINARY_DIR}/bin/classes.jar")
)
endif()
else(ANDROID)
- set(JAR_NAME opencv-${OPENCV_VERSION}.jar)
+ set(JAR_NAME opencv-${LIB_NAME_SUFIX}.jar)
set(JAR_FILE "${OpenCV_BINARY_DIR}/bin/${JAR_NAME}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build.xml.in" "${OpenCV_BINARY_DIR}/build.xml" IMMEDIATE @ONLY)
list(APPEND step3_depends "${OpenCV_BINARY_DIR}/build.xml")
# Additional target properties
set_target_properties(${the_module} PROPERTIES
- OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
- DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
+ OUTPUT_NAME "${the_module}${LIB_NAME_SUFIX}"
+ #DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
INSTALL_NAME_DIR ${OPENCV_LIB_INSTALL_PATH}
}, # '', i.e. no class
} # func_arg_fix
+
+def getLibVersion(version_hpp_path):
+ version_file = open(version_hpp_path, "rt").read()
+ epoch = re.search("^W*#\W*define\W+CV_VERSION_EPOCH\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
+ major = re.search("^W*#\W*define\W+CV_VERSION_MAJOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
+ minor = re.search("^W*#\W*define\W+CV_VERSION_MINOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
+ patch = re.search("^W*#\W*define\W+CV_VERSION_REVISION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
+ return (epoch, major, minor, patch)
+
class ConstInfo(object):
def __init__(self, cname, name, val, addedManually=False):
self.cname = cname
public class %(jc)s {
""" % { 'm' : self.module, 'jc' : jname } )
-# self.java_code[class_name]["jn_code"].write("""
-# //
-# // native stuff
-# //
-# static { System.loadLibrary("opencv_java"); }
-#""" )
-
+ if class_name == 'Core':
+ (epoch, major, minor, patch) = getLibVersion(
+ (os.path.dirname(__file__) or '.') + '/../../core/include/opencv2/core/version.hpp')
+ version_str = '.'.join( (epoch, major, minor, patch) )
+ version_suffix = ''.join( (epoch, major, minor) )
+ #if version_suffix.endswith('0'):
+ # version_suffix = version_suffix[0 : -1]
+ self.classes[class_name].imports.add("java.lang.String")
+ self.java_code[class_name]["j_code"].write("""
+ public static final String VERSION = "%(v)s", VERSION_SUFFIX = "%(vs)s";
+""" % { 'v' : version_str, 'vs' : version_suffix } )
def add_class(self, decl):