From e3474878b62949d9200016d325a0b1c3e1bad4ea Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Fri, 18 Jan 2013 14:57:55 +0400 Subject: [PATCH] Consistently use 4-digit library version --- android/libinfo/info.c | 4 ++-- android/package/CMakeLists.txt | 2 +- cmake/OpenCVExtraTargets.cmake | 2 +- cmake/OpenCVModule.cmake | 2 +- cmake/OpenCVVersion.cmake | 16 +++++++++++----- cmake/templates/OpenCVConfig.cmake.in | 12 +++++++----- doc/conf.py | 15 +++++++++------ modules/androidcamera/src/camera_activity.cpp | 2 +- modules/core/include/opencv2/core/version.hpp | 19 +++++++++++++++---- modules/gpu/src/ffmpeg_video_source.cpp | 2 +- modules/gpu/src/video_writer.cpp | 2 +- modules/highgui/src/cap_ffmpeg.cpp | 2 +- modules/java/CMakeLists.txt | 2 +- modules/java/android_lib/.project | 2 +- modules/java/android_lib/AndroidManifest.xml | 4 ++-- modules/java/jar/build.xml | 2 +- 16 files changed, 56 insertions(+), 34 deletions(-) diff --git a/android/libinfo/info.c b/android/libinfo/info.c index f0c2dd6a28..225cc10c1a 100644 --- a/android/libinfo/info.c +++ b/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_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) "_" ANDROID_PACKAGE_PLATFORM -#define PACKAGE_REVISION CVAUX_STR(CV_SUBMINOR_VERSION) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE) +#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(ANDROID_PACKAGE_RELEASE) const char* GetPackageName(void) { diff --git a/android/package/CMakeLists.txt b/android/package/CMakeLists.txt index 0e7848d6e0..24ce876616 100644 --- a/android/package/CMakeLists.txt +++ b/android/package/CMakeLists.txt @@ -56,7 +56,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_MANIFEST_FILE}" "${PACKAGE configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml" "${PACKAGE_DIR}/res/values/strings.xml" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/drawable/icon.png" "${PACKAGE_DIR}/res/drawable/icon.png" COPYONLY) -set(target_name "OpenCV_${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}_binary_pack_${ANDROID_PACKAGE_PLATFORM}") +set(target_name "OpenCV_${OPENCV_VERSION}_binary_pack_${ANDROID_PACKAGE_PLATFORM}") get_target_property(opencv_java_location opencv_java LOCATION) set(android_proj_target_files ${ANDROID_PROJECT_FILES}) diff --git a/cmake/OpenCVExtraTargets.cmake b/cmake/OpenCVExtraTargets.cmake index 08d5f406a5..936e3a2635 100644 --- a/cmake/OpenCVExtraTargets.cmake +++ b/cmake/OpenCVExtraTargets.cmake @@ -16,7 +16,7 @@ endif() # Source package, for "make package_source" # ---------------------------------------------------------------------------- if(BUILD_PACKAGE) - set(TARBALL_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}") + set(TARBALL_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VERSION}") if (NOT WIN32) if(APPLE) set(TAR_CMD gnutar) diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index aba5c21e68..d479093867 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -470,7 +470,7 @@ macro(ocv_create_module) # Android SDK build scripts can include only .so files into final .apk # As result we should not set version properties for Android set_target_properties(${the_module} PROPERTIES - VERSION ${OPENCV_VERSION} + VERSION ${OPENCV_LIBVERSION} SOVERSION ${OPENCV_SOVERSION} ) endif() diff --git a/cmake/OpenCVVersion.cmake b/cmake/OpenCVVersion.cmake index 8ffcf01f6b..03de98068b 100644 --- a/cmake/OpenCVVersion.cmake +++ b/cmake/OpenCVVersion.cmake @@ -1,12 +1,18 @@ 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_.+OR_VERSION[ ]+[0-9]+" ) +FILE(STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS REGEX "#define CV_VERSION_[A-Z]+[ ]+[0-9]+" ) -string(REGEX REPLACE ".+CV_MAJOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}") -string(REGEX REPLACE ".+CV_MINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}") -string(REGEX REPLACE ".+CV_SUBMINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}") +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}") + +set(OPENCV_VERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}") +if(OPENCV_VERSION_TWEAK GREATER 0) + set(OPENCV_VERSION "${OPENCV_VERSION}.${OPENCV_VERSION_TWEAK}") +endif() -set(OPENCV_VERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}.2") set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}") +set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}") # create a dependency on version file # we never use output of the following command but cmake will rerun automatically if the version file changes diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 981bb7a44d..4cf87536d8 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -22,10 +22,11 @@ # - OpenCV_INCLUDE_DIRS : The OpenCV include directories. # - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability # - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API -# - OpenCV_VERSION : The version of this OpenCV build. Example: "@OPENCV_VERSION@" -# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MAJOR@" -# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MINOR@" -# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_PATCH@" +# - OpenCV_VERSION : The version of this OpenCV build: "@OPENCV_VERSION@" +# - 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@" # # Advanced variables: # - OpenCV_SHARED @@ -99,6 +100,7 @@ SET(OpenCV_VERSION @OPENCV_VERSION@) 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@) # ==================================================================== # Link libraries: e.g. libopencv_core.so, opencv_imgproc220d.lib, etc... @@ -183,7 +185,7 @@ set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_}) # Resolve dependencies # ============================================================== if(OpenCV_USE_MANGLED_PATHS) - set(OpenCV_LIB_SUFFIX ".${OpenCV_VERSION}") + set(OpenCV_LIB_SUFFIX ".${OpenCV_VERSION_MAJOR}.${OpenCV_VERSION_MINOR}.${OpenCV_VERSION_PATCH}") else() set(OpenCV_LIB_SUFFIX "") endif() diff --git a/doc/conf.py b/doc/conf.py index 35073e051f..7b9b02ecf4 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -44,21 +44,24 @@ master_doc = 'index' # General information about the project. project = u'OpenCV' -copyright = u'2011-2012, opencv dev team' +copyright = u'2011-2013, opencv dev team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. version_file = open("../modules/core/include/opencv2/core/version.hpp", "rt").read() -version_major = re.search("^W*#\W*define\W+CV_MAJOR_VERSION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) -version_minor = re.search("^W*#\W*define\W+CV_MINOR_VERSION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) -version_patch = re.search("^W*#\W*define\W+CV_SUBMINOR_VERSION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) +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) # The short X.Y version. -version = version_major + '.' + version_minor +version = version_epoch + '.' + version_major # The full version, including alpha/beta/rc tags. -release = version_major + '.' + version_minor + '.' + version_patch +release = version_epoch + '.' + version_major + '.' + version_minor +if version_patch: + release = release + '.' + version_patch # 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 37144ba1a2..508159b17f 100644 --- a/modules/androidcamera/src/camera_activity.cpp +++ b/modules/androidcamera/src/camera_activity.cpp @@ -269,7 +269,7 @@ void CameraWrapperConnector::fillListWrapperLibs(const string& folderPath, vecto std::string CameraWrapperConnector::getDefaultPathLibFolder() { - #define BIN_PACKAGE_NAME(x) "org.opencv.lib_v" CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) "_" x + #define BIN_PACKAGE_NAME(x) "org.opencv.lib_v" CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) "_" 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 78f8109e18..b6d1568ce4 100644 --- a/modules/core/include/opencv2/core/version.hpp +++ b/modules/core/include/opencv2/core/version.hpp @@ -47,12 +47,23 @@ #ifndef __OPENCV_VERSION_HPP__ #define __OPENCV_VERSION_HPP__ -#define CV_MAJOR_VERSION 2 -#define CV_MINOR_VERSION 4 -#define CV_SUBMINOR_VERSION 3 +#define CV_VERSION_EPOCH 2 +#define CV_VERSION_MAJOR 4 +#define CV_VERSION_MINOR 3 +#define CV_VERSION_REVISION 2 #define CVAUX_STR_EXP(__A) #__A #define CVAUX_STR(__A) CVAUX_STR_EXP(__A) -#define CV_VERSION CVAUX_STR(CV_MAJOR_VERSION) "." CVAUX_STR(CV_MINOR_VERSION) "." CVAUX_STR(CV_SUBMINOR_VERSION) ".2" + +#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) +#else +# define CV_VERSION CVAUX_STR(CV_VERSION_EPOCH) "." CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) +#endif + +/* 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 #endif diff --git a/modules/gpu/src/ffmpeg_video_source.cpp b/modules/gpu/src/ffmpeg_video_source.cpp index a0f420507e..71553d9915 100644 --- a/modules/gpu/src/ffmpeg_video_source.cpp +++ b/modules/gpu/src/ffmpeg_video_source.cpp @@ -64,7 +64,7 @@ namespace { #if defined WIN32 || defined _WIN32 const char* module_name = "opencv_ffmpeg" - CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION) + CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__) "_64" #endif diff --git a/modules/gpu/src/video_writer.cpp b/modules/gpu/src/video_writer.cpp index 617c1eabc6..036512d9af 100644 --- a/modules/gpu/src/video_writer.cpp +++ b/modules/gpu/src/video_writer.cpp @@ -767,7 +767,7 @@ namespace { #if defined WIN32 || defined _WIN32 const char* module_name = "opencv_ffmpeg" - CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION) + CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__) "_64" #endif diff --git a/modules/highgui/src/cap_ffmpeg.cpp b/modules/highgui/src/cap_ffmpeg.cpp index f9fc75cc4b..cc910a332a 100644 --- a/modules/highgui/src/cap_ffmpeg.cpp +++ b/modules/highgui/src/cap_ffmpeg.cpp @@ -86,7 +86,7 @@ private: { #if defined WIN32 || defined _WIN32 const char* module_name = "opencv_ffmpeg" - CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION) + CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR) #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__) "_64" #endif diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index 372bf84d7b..aa7db6951b 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -278,7 +278,7 @@ if(ANDROID) endif() else(ANDROID) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/jar/build.xml" "${OpenCV_BINARY_DIR}/build.xml" IMMEDIATE @ONLY) - set(JAR_NAME opencv-${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}.jar) + set(JAR_NAME opencv-${OPENCV_VERSION}.jar) add_custom_command( OUTPUT "${OpenCV_BINARY_DIR}/bin/${JAR_NAME}" "${OpenCV_BINARY_DIR}/bin/.${JAR_NAME}.dephelper" diff --git a/modules/java/android_lib/.project b/modules/java/android_lib/.project index 174e529f56..44f6529bd8 100644 --- a/modules/java/android_lib/.project +++ b/modules/java/android_lib/.project @@ -1,6 +1,6 @@ - OpenCV Library - @OPENCV_VERSION_MAJOR@.@OPENCV_VERSION_MINOR@.@OPENCV_VERSION_PATCH@ + OpenCV Library - @OPENCV_VERSION@ diff --git a/modules/java/android_lib/AndroidManifest.xml b/modules/java/android_lib/AndroidManifest.xml index e4567ae029..f71b84d031 100644 --- a/modules/java/android_lib/AndroidManifest.xml +++ b/modules/java/android_lib/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@@OPENCV_VERSION_PATCH@@OPENCV_VERSION_TWEAK@" + android:versionName="@OPENCV_VERSION@"> diff --git a/modules/java/jar/build.xml b/modules/java/jar/build.xml index 71c1b1fefd..07705b2f0d 100644 --- a/modules/java/jar/build.xml +++ b/modules/java/jar/build.xml @@ -10,6 +10,6 @@ - + \ No newline at end of file