From 615d6c22d1c09f36a8951da8d170bc3ce44afb5d Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 15 Nov 2013 19:41:53 +0400 Subject: [PATCH] Switched OpenCV to a 3-component version number. Epoch is gone; now the version component names in C++ and CMake are consistent (except REVISION corresponds to PATCH). --- cmake/OpenCVVersion.cmake | 10 +++------- cmake/templates/OpenCVConfig.cmake.in | 6 ++++-- doc/conf.py | 8 ++------ modules/androidcamera/src/camera_activity.cpp | 2 +- modules/core/include/opencv2/core/version.hpp | 15 +++++---------- modules/cudacodec/src/ffmpeg_video_source.cpp | 2 +- modules/cudacodec/src/video_writer.cpp | 2 +- modules/java/android_lib/AndroidManifest.xml | 2 +- modules/java/generator/gen_java.py | 13 +++++-------- platforms/android/libinfo/info.c | 4 ++-- platforms/android/package/AndroidManifest.xml | 6 +++--- 11 files changed, 28 insertions(+), 42 deletions(-) diff --git a/cmake/OpenCVVersion.cmake b/cmake/OpenCVVersion.cmake index c8ce40308f..60ac16420a 100644 --- a/cmake/OpenCVVersion.cmake +++ b/cmake/OpenCVVersion.cmake @@ -1,16 +1,12 @@ SET(OPENCV_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/modules/core/include/opencv2/core/version.hpp") file(STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS REGEX "#define CV_VERSION_[A-Z]+[ ]+" ) -string(REGEX REPLACE ".+CV_VERSION_EPOCH[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}") -string(REGEX REPLACE ".+CV_VERSION_MAJOR[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}") -string(REGEX REPLACE ".+CV_VERSION_MINOR[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}") -string(REGEX REPLACE ".+CV_VERSION_REVISION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_TWEAK "${OPENCV_VERSION_PARTS}") +string(REGEX REPLACE ".+CV_VERSION_MAJOR[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}") +string(REGEX REPLACE ".+CV_VERSION_MINOR[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}") +string(REGEX REPLACE ".+CV_VERSION_REVISION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}") string(REGEX REPLACE ".+CV_VERSION_STATUS[ ]+\"([^\"]*)\".*" "\\1" OPENCV_VERSION_STATUS "${OPENCV_VERSION_PARTS}") set(OPENCV_VERSION_PLAIN "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}") -if(OPENCV_VERSION_TWEAK GREATER 0) - set(OPENCV_VERSION_PLAIN "${OPENCV_VERSION_PLAIN}.${OPENCV_VERSION_TWEAK}") -endif() set(OPENCV_VERSION "${OPENCV_VERSION_PLAIN}${OPENCV_VERSION_STATUS}") diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 183c669381..80d9bcba29 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -24,7 +24,6 @@ # - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@" # - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "@OPENCV_VERSION_MINOR@" # - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION: "@OPENCV_VERSION_PATCH@" -# - OpenCV_VERSION_TWEAK : Tweak version part of OpenCV_VERSION: "@OPENCV_VERSION_TWEAK@" # - OpenCV_VERSION_STATUS : Development status of this build: "@OPENCV_VERSION_STATUS@" # # Advanced variables: @@ -35,6 +34,9 @@ # - OpenCV_USE_MANGLED_PATHS # - OpenCV_HAVE_ANDROID_CAMERA # +# Deprecated variables: +# - OpenCV_VERSION_TWEAK : Always "0" +# # =================================================================================== set(modules_file_suffix "") @@ -108,7 +110,7 @@ SET(OpenCV_VERSION @OPENCV_VERSION_PLAIN@) SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@) SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@) SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@) -SET(OpenCV_VERSION_TWEAK @OPENCV_VERSION_TWEAK@) +SET(OpenCV_VERSION_TWEAK 0) SET(OpenCV_VERSION_STATUS "@OPENCV_VERSION_STATUS@") # ==================================================================== diff --git a/doc/conf.py b/doc/conf.py index 2477a300ea..7d5908fc71 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -61,19 +61,15 @@ copyright = u'2011-2013, opencv dev team' # built documents. version_file = open("../modules/core/include/opencv2/core/version.hpp", "rt").read() -version_epoch = re.search("^W*#\W*define\W+CV_VERSION_EPOCH\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) version_major = re.search("^W*#\W*define\W+CV_VERSION_MAJOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) version_minor = re.search("^W*#\W*define\W+CV_VERSION_MINOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) version_patch = re.search("^W*#\W*define\W+CV_VERSION_REVISION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) version_status = re.search("^W*#\W*define\W+CV_VERSION_STATUS\W+\"(.*?)\"\W*$", version_file, re.MULTILINE).group(1) # The short X.Y version. -version = version_epoch + '.' + version_major +version = version_major + '.' + version_minor # The full version, including alpha/beta/rc tags. -release = version_epoch + '.' + version_major + '.' + version_minor -if version_patch: - release = release + '.' + version_patch -release += version_status +release = version_major + '.' + version_minor + '.' + version_patch + version_status # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/modules/androidcamera/src/camera_activity.cpp b/modules/androidcamera/src/camera_activity.cpp index a265d2e8d1..e4669b4107 100644 --- a/modules/androidcamera/src/camera_activity.cpp +++ b/modules/androidcamera/src/camera_activity.cpp @@ -272,7 +272,7 @@ void CameraWrapperConnector::fillListWrapperLibs(const cv::String& folderPath, s cv::String CameraWrapperConnector::getDefaultPathLibFolder() { - #define BIN_PACKAGE_NAME(x) "org.opencv.lib_v" CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) "_" x + #define BIN_PACKAGE_NAME(x) "org.opencv.lib_v" CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) "_" x const char* const packageList[] = {BIN_PACKAGE_NAME("armv7a"), OPENCV_ENGINE_PACKAGE}; for (size_t i = 0; i < sizeof(packageList)/sizeof(packageList[0]); i++) { diff --git a/modules/core/include/opencv2/core/version.hpp b/modules/core/include/opencv2/core/version.hpp index 203503ecad..f21293ad0b 100644 --- a/modules/core/include/opencv2/core/version.hpp +++ b/modules/core/include/opencv2/core/version.hpp @@ -48,8 +48,7 @@ #ifndef __OPENCV_VERSION_HPP__ #define __OPENCV_VERSION_HPP__ -#define CV_VERSION_EPOCH 3 -#define CV_VERSION_MAJOR 0 +#define CV_VERSION_MAJOR 3 #define CV_VERSION_MINOR 0 #define CV_VERSION_REVISION 0 #define CV_VERSION_STATUS "-dev" @@ -60,15 +59,11 @@ #define CVAUX_STRW_EXP(__A) L#__A #define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A) -#if CV_VERSION_REVISION -# define CV_VERSION CVAUX_STR(CV_VERSION_EPOCH) "." CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS -#else -# define CV_VERSION CVAUX_STR(CV_VERSION_EPOCH) "." CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) CV_VERSION_STATUS -#endif +#define CV_VERSION CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS /* old style version constants*/ -#define CV_MAJOR_VERSION CV_VERSION_EPOCH -#define CV_MINOR_VERSION CV_VERSION_MAJOR -#define CV_SUBMINOR_VERSION CV_VERSION_MINOR +#define CV_MAJOR_VERSION CV_VERSION_MAJOR +#define CV_MINOR_VERSION CV_VERSION_MINOR +#define CV_SUBMINOR_VERSION CV_VERSION_REVISION #endif diff --git a/modules/cudacodec/src/ffmpeg_video_source.cpp b/modules/cudacodec/src/ffmpeg_video_source.cpp index c98d2c1846..02c9fbc555 100644 --- a/modules/cudacodec/src/ffmpeg_video_source.cpp +++ b/modules/cudacodec/src/ffmpeg_video_source.cpp @@ -63,7 +63,7 @@ namespace { #if defined WIN32 || defined _WIN32 const char* module_name = "opencv_ffmpeg" - CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) + CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) CVAUX_STR(CV_VERSION_REVISION) #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__) "_64" #endif diff --git a/modules/cudacodec/src/video_writer.cpp b/modules/cudacodec/src/video_writer.cpp index 15f6732e3b..6faa9d3bf9 100644 --- a/modules/cudacodec/src/video_writer.cpp +++ b/modules/cudacodec/src/video_writer.cpp @@ -733,7 +733,7 @@ namespace { #if defined(WIN32) || defined(_WIN32) const char* module_name = "opencv_ffmpeg" - CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) + CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) CVAUX_STR(CV_VERSION_REVISION) #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__) "_64" #endif diff --git a/modules/java/android_lib/AndroidManifest.xml b/modules/java/android_lib/AndroidManifest.xml index f71b84d031..1943221e98 100644 --- a/modules/java/android_lib/AndroidManifest.xml +++ b/modules/java/android_lib/AndroidManifest.xml @@ -1,7 +1,7 @@ diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index 66ea1ea93d..c41e6336cd 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -628,12 +628,11 @@ 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) revision = re.search("^W*#\W*define\W+CV_VERSION_REVISION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) status = re.search("^W*#\W*define\W+CV_VERSION_STATUS\W+\"(.*?)\"\W*$", version_file, re.MULTILINE).group(1) - return (epoch, major, minor, revision, status) + return (major, minor, revision, status) class ConstInfo(object): def __init__(self, cname, name, val, addedManually=False): @@ -800,16 +799,15 @@ public class %(jc)s { """ % { 'm' : self.module, 'jc' : jname } ) if class_name == 'Core': - (epoch, major, minor, revision, status) = getLibVersion( + (major, minor, revision, status) = getLibVersion( (os.path.dirname(__file__) or '.') + '/../../core/include/opencv2/core/version.hpp') - version_str = '.'.join( (epoch, major, minor, revision) ) + status - version_suffix = ''.join( (epoch, major, minor) ) + version_str = '.'.join( (major, minor, revision) ) + status + version_suffix = ''.join( (major, minor, revision) ) self.classes[class_name].imports.add("java.lang.String") self.java_code[class_name]["j_code"].write(""" // these constants are wrapped inside functions to prevent inlining private static String getVersion() { return "%(v)s"; } private static String getNativeLibraryName() { return "opencv_java%(vs)s"; } - private static int getVersionEpoch() { return %(ep)s; } private static int getVersionMajor() { return %(ma)s; } private static int getVersionMinor() { return %(mi)s; } private static int getVersionRevision() { return %(re)s; } @@ -817,12 +815,11 @@ public class %(jc)s { public static final String VERSION = getVersion(); public static final String NATIVE_LIBRARY_NAME = getNativeLibraryName(); - public static final int VERSION_EPOCH = getVersionEpoch(); public static final int VERSION_MAJOR = getVersionMajor(); public static final int VERSION_MINOR = getVersionMinor(); public static final int VERSION_REVISION = getVersionRevision(); public static final String VERSION_STATUS = getVersionStatus(); -""" % { 'v' : version_str, 'vs' : version_suffix, 'ep' : epoch, 'ma' : major, 'mi' : minor, 're' : revision, 'st': status } ) +""" % { 'v' : version_str, 'vs' : version_suffix, 'ma' : major, 'mi' : minor, 're' : revision, 'st': status } ) def add_class(self, decl): diff --git a/platforms/android/libinfo/info.c b/platforms/android/libinfo/info.c index cfdc881c51..3cf470c50d 100644 --- a/platforms/android/libinfo/info.c +++ b/platforms/android/libinfo/info.c @@ -6,8 +6,8 @@ const char* GetRevision(void); const char* GetLibraryList(void); JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv *, jclass); -#define PACKAGE_NAME "org.opencv.lib_v" CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) "_" ANDROID_PACKAGE_PLATFORM -#define PACKAGE_REVISION CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE) +#define PACKAGE_NAME "org.opencv.lib_v" CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) "_" ANDROID_PACKAGE_PLATFORM +#define PACKAGE_REVISION CVAUX_STR(CV_VERSION_REVISION) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE) const char* GetPackageName(void) { diff --git a/platforms/android/package/AndroidManifest.xml b/platforms/android/package/AndroidManifest.xml index 8997b161bc..97fbd9ecc8 100644 --- a/platforms/android/package/AndroidManifest.xml +++ b/platforms/android/package/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="@OPENCV_VERSION_PATCH@0@ANDROID_PACKAGE_RELEASE@" + android:versionName="@OPENCV_VERSION_PATCH@.@ANDROID_PACKAGE_RELEASE@" > @@ -12,4 +12,4 @@ android:label="@string/app_name" > - \ No newline at end of file +