On 2/16/22 09:35, Kristian Evers via PROJ wrote:
Bas, I'm not sure how to understand this.

So you go from (8.2.1):

   /usr/lib/x86_64-linux-gnu/libproj.so -> libproj.so.22.2.1
   /usr/lib/x86_64-linux-gnu/libproj.so.22 -> libproj.so.22.2.1
   /usr/lib/x86_64-linux-gnu/libproj.so.22.2.1

To (9.0.0):

   /usr/lib/x86_64-linux-gnu/libproj.so -> libproj.so.9.0.0
   /usr/lib/x86_64-linux-gnu/libproj.so.25 -> libproj.so.9.0.0
   /usr/lib/x86_64-linux-gnu/libproj.so.9.0.0


Are you suggesting that we ONLY use the major, minor and patch version
numbers for the so-files and forget about the SOVERSION from now on?

No, SOVERSION is essential as it is part of the SONAME:

 <NAME>.so.<SOVERSION>

Where <NAME> = libproj, and <SOVERSION> = 25

If that is the case, personally I'm all for it since I've always found the
current/revision/age difficult (as is evident in several release candidates
in the past) but is that a common practice among project that base their
packages on CMake?

autotools determines the versions (both 22 and 22.2.1 in the above examples for 8.2.1 with version-info 24:1:2) based on the version-info.

SOVERSION (the 22 in libproj.so.22) is determined by CURRENT minus AGE, the filename version (22.2.1 in libproj.so.22.2.1) is determined by (CURRENT-AGE).AGE.REVISION or some other magic.

The SOVERSION cannot be decremented and must be incremented every release that breaks the ABI. This was 22 in 8.2.1, is currently 25 in 9.0.0-rc1, and could also be 23 in 9.0.0-rc2.

You configure this in CMake with:

  set_target_properties(proj
    PROPERTIES
    VERSION <X>.<Y>.<Z>
    SOVERSION <N>
  )

This creates the files:

 libproj.so             (symlink to libproj.so.<X>.<Y>.<Z>)
 libproj.so.<N>         (symlink to libproj.so.<X>.<Y>.<Z>)
 libproj.so.<X>.<Y>.<Z>

Now that autotools and libtool are no longer used, you don't have to use the complicated logic to determine the VERSION value (<X>.<Y>.<Z>).

For projects that start with CMake and only support that it's common to use the project major version for the SOVERSION value and full project version for VERSION value.

That cannot be used for PROJ as it is migrating away from autotools and cannot decrement the SOVERSION to 9.

This situation is similar to what MapServer did some time ago, that currently uses:

  set_target_properties(mapserver
    PROPERTIES
    VERSION ${MapServer_VERSION_STRING}
    SOVERSION 2
  )

This is what I also suggest for PROJ to make library versioning easier now that the libtool complications are gone.

Since code speaks louder than words, see the attached patch for an example of what I mean.

Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9bd4c1f01..47a0833bd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,11 +113,7 @@ include(ProjVersion)
 proj_version(MAJOR 9 MINOR 0 PATCH 0)
 # Use libtool convention to build the CMake's VERSION and SOVERSION
 # See https://github.com/pvanhoof/dir-examples#cmake-in-the-cmake-example
-set(PROJ_LIBTOOL_CURRENT    25)
-set(PROJ_LIBTOOL_REVISION   0)
-set(PROJ_LIBTOOL_AGE        0)
-math(EXPR PROJ_API_VERSION "${PROJ_LIBTOOL_CURRENT} - ${PROJ_LIBTOOL_AGE}")
-set(PROJ_BUILD_VERSION "${PROJ_API_VERSION}.${PROJ_LIBTOOL_AGE}.${PROJ_LIBTOOL_REVISION}")
+set(PROJ_SOVERSION    25)
 
 ################################################################################
 # Build features and variants
diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake
index 93b3f9ecf..a4c2690df 100644
--- a/src/lib_proj.cmake
+++ b/src/lib_proj.cmake
@@ -402,21 +402,21 @@ target_include_directories(proj INTERFACE
 if(WIN32)
   set_target_properties(proj
     PROPERTIES
-    VERSION "${${PROJECT_NAME}_BUILD_VERSION}"
+    VERSION "${CMAKE_PROJECT_VERSION}"
     OUTPUT_NAME "${PROJ_CORE_TARGET_OUTPUT_NAME}"
     ARCHIVE_OUTPUT_NAME proj
     CLEAN_DIRECT_OUTPUT 1)
 elseif(BUILD_FRAMEWORKS_AND_BUNDLE)
   set_target_properties(proj
     PROPERTIES
-    VERSION "${${PROJECT_NAME}_BUILD_VERSION}"
+    VERSION "${CMAKE_PROJECT_VERSION}"
     INSTALL_NAME_DIR ${PROJ_INSTALL_NAME_DIR}
     CLEAN_DIRECT_OUTPUT 1)
 else()
   set_target_properties(proj
     PROPERTIES
-    VERSION "${${PROJECT_NAME}_BUILD_VERSION}"
-    SOVERSION "${${PROJECT_NAME}_API_VERSION}"
+    VERSION "${CMAKE_PROJECT_VERSION}"
+    SOVERSION "${${PROJECT_NAME}_SOVERSION}"
     CLEAN_DIRECT_OUTPUT 1)
 endif()
 
_______________________________________________
PROJ mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/proj

Reply via email to