Skip to content

meson: add tests and app options #3265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

meson: add tests and app options #3265

wants to merge 1 commit into from

Conversation

neheb
Copy link
Collaborator

@neheb neheb commented Apr 28, 2025

Fixes: #3015

ping @heitbaum

@@ -1,3 +1,8 @@
option('app', type : 'boolean',
value: true,
description : 'Build exiv2 exexutable',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description : 'Build exiv2 exexutable',
description : 'Build exiv2 executable',

@@ -45,6 +50,11 @@ option('unitTests', type : 'feature',
description : 'Build and run unit tests',
)

option('tests', type : 'boolean',
value: false,
description : 'Build and run python tests',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description : 'Build and run python tests',
description : 'Build and run Python tests',

@heitbaum
Copy link

Using the following build, the app and tests are now excluded as expected.
There are 3 .cmake files missing, testing to see if that impacts application builds.

PKG_MESON_OPTS_TARGET="-Ddefault_library=static \
                       -Dwebready=false \
                       -Dxmp=disabled \
                       -Dcurl=disabled \
                       -Dnls=disabled \
                       -Dtests=false \
                       -DunitTests=disabled \
                       -Dvideo=false \
                       -Dbmff=false \
                       -Dbrotli=disabled \
                       -Dinih=disabled \
                       -Dapp=false"

versus

PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=OFF \
                       -DEXIV2_ENABLE_WEBREADY=OFF \
                       -DEXIV2_ENABLE_XMP=OFF \
                       -DEXIV2_ENABLE_CURL=OFF \
                       -DEXIV2_ENABLE_NLS=OFF \
                       -DEXIV2_BUILD_SAMPLES=OFF \
                       -DEXIV2_BUILD_UNIT_TESTS=OFF \
                       -DEXIV2_ENABLE_VIDEO=OFF \
                       -DEXIV2_ENABLE_BMFF=OFF \
                       -DEXIV2_ENABLE_BROTLI=OFF \
                       -DEXIV2_ENABLE_INIH=OFF \
                       -DEXIV2_ENABLE_FILESYSTEM_ACCESS=OFF \
                       -DEXIV2_BUILD_EXIV2_COMMAND=OFF \
                       -DBUILD_WITH_CCACHE=ON"
diff -Nu cmake-build meson-build
--- cmake-build  2025-04-29 09:31:33.557166548 +0000
+++ meson-build 2025-04-29 09:35:38.592136776 +0000
@@ -4,9 +4,6 @@
 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib
 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/cmake
 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/cmake/exiv2
-build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/cmake/exiv2/exiv2Config.cmake
-build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/cmake/exiv2/exiv2Targets.cmake
-build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/cmake/exiv2/exiv2Targets-release.cmake
 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/cmake/exiv2/exiv2ConfigVersion.cmake
 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/pkgconfig
 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/pkgconfig/exiv2.pc

@heitbaum
Copy link

I was able to build Kodi without the “missing cmake files” but only if I used the cmake generated headers (using the meson .a file - I did not run test this). Using the meson generate headers failed to allow Kodi to build.

Further build testing has isolated the error to exiv2lib_export.h being empty in the meson build. I’m not sure what the #define EXV_ENABLE_FILESYSTEM in exv_conf.h does (in the meson build versus the cmake build.)

diff -ru e-c/usr/include/exiv2/exiv2lib_export.h e-m/usr/include/exiv2/exiv2lib_export.h
--- e-c/usr/include/exiv2/exiv2lib_export.h     2025-04-29 09:53:38.000000000 +0000
+++ e-m/usr/include/exiv2/exiv2lib_export.h     2025-04-29 09:51:03.748150418 +0000
@@ -1,43 +1,7 @@
+/*
+ * Autogenerated by the Meson build system.
+ * Do not edit, your changes will be lost.
+ */
 
-#ifndef EXIV2API_H
-#define EXIV2API_H
+#pragma once
 
-#ifdef exiv2lib_STATIC
-#  define EXIV2API
-#  define EXIV2LIB_NO_EXPORT
-#else
-#  ifndef EXIV2API
-#    ifdef exiv2lib_EXPORTS
-        /* We are building this library */
-#      define EXIV2API 
-#    else
-        /* We are using this library */
-#      define EXIV2API 
-#    endif
-#  endif
-
-#  ifndef EXIV2LIB_NO_EXPORT
-#    define EXIV2LIB_NO_EXPORT 
-#  endif
-#endif
-
-#ifndef EXIV2LIB_DEPRECATED
-#  define EXIV2LIB_DEPRECATED __attribute__ ((__deprecated__))
-#endif
-
-#ifndef EXIV2LIB_DEPRECATED_EXPORT
-#  define EXIV2LIB_DEPRECATED_EXPORT EXIV2API EXIV2LIB_DEPRECATED
-#endif
-
-#ifndef EXIV2LIB_DEPRECATED_NO_EXPORT
-#  define EXIV2LIB_DEPRECATED_NO_EXPORT EXIV2LIB_NO_EXPORT EXIV2LIB_DEPRECATED
-#endif
-
-/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
-#if 0 /* DEFINE_NO_DEPRECATED */
-#  ifndef EXIV2LIB_NO_DEPRECATED
-#    define EXIV2LIB_NO_DEPRECATED
-#  endif
-#endif
-
-#endif /* EXIV2API_H */
diff -ru e-c/usr/include/exiv2/exv_conf.h e-m/usr/include/exiv2/exv_conf.h
--- e-c/usr/include/exiv2/exv_conf.h    2025-04-29 09:53:38.000000000 +0000
+++ e-m/usr/include/exiv2/exv_conf.h    2025-04-29 09:51:04.821244132 +0000
@@ -7,7 +7,7 @@
 /* #undef EXV_USE_CURL */
 
 // Define to 1 if you want to enable filesystem access
-/* #undef EXV_ENABLE_FILESYSTEM */
+#define EXV_ENABLE_FILESYSTEM
 
 // Define if you require webready support.
 /* #undef EXV_ENABLE_WEBREADY */
@@ -61,15 +61,15 @@
 #define EXV_PACKAGE_NAME "exiv2"
 
 /* Define to the full name and version of this package. */
-#define EXV_PACKAGE_STRING "exiv2 0.28.5"
+#define EXV_PACKAGE_STRING "exiv2 1.0.0.9"
 
 /* Define to the version of this package. */
-#define EXV_PACKAGE_VERSION "0.28.5"
+#define EXV_PACKAGE_VERSION "1.0.0.9"
 
-#define EXIV2_MAJOR_VERSION (0U)
-#define EXIV2_MINOR_VERSION (28U)
-#define EXIV2_PATCH_VERSION (5U)
-#define EXIV2_TWEAK_VERSION (U)
+#define EXIV2_MAJOR_VERSION (1U)
+#define EXIV2_MINOR_VERSION (0U)
+#define EXIV2_PATCH_VERSION (0U)
+#define EXIV2_TWEAK_VERSION (9U)
 
 // Definition to enable translation of Nikon lens names.
 #define EXV_HAVE_LENSDATA
Only in e-c/usr/lib/cmake/exiv2: exiv2Config.cmake
diff -ru e-c/usr/lib/cmake/exiv2/exiv2ConfigVersion.cmake e-m/usr/lib/cmake/exiv2/exiv2ConfigVersion.cmake
--- e-c/usr/lib/cmake/exiv2/exiv2ConfigVersion.cmake    2025-04-29 09:53:38.000000000 +0000
+++ e-m/usr/lib/cmake/exiv2/exiv2ConfigVersion.cmake    2025-04-29 09:51:04.998859649 +0000
@@ -4,80 +4,29 @@
 #
 # The created file sets PACKAGE_VERSION_EXACT if the current version string and
 # the requested version string are exactly the same and it sets
-# PACKAGE_VERSION_COMPATIBLE if the current version is equal to the requested version.
-# The tweak version component is ignored.
+# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
 # The variable CVF_VERSION must be set before calling configure_file().
 
+set(PACKAGE_VERSION "1.0.0")
 
 if (PACKAGE_FIND_VERSION_RANGE)
-  message(AUTHOR_WARNING
-    "`find_package()` specify a version range but the version strategy "
-    "(ExactVersion) of the module `${PACKAGE_FIND_NAME}` is incompatible "
-    "with this request. Only the lower endpoint of the range will be used.")
-endif()
-
-set(PACKAGE_VERSION "0.28.5")
-
-if("0.28.5" MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") # strip the tweak version
-  set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
-  set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
-  set(CVF_VERSION_PATCH "${CMAKE_MATCH_3}")
-
-  if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
-    string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
-  endif()
-  if(NOT CVF_VERSION_MINOR VERSION_EQUAL 0)
-    string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
-  endif()
-  if(NOT CVF_VERSION_PATCH VERSION_EQUAL 0)
-    string(REGEX REPLACE "^0+" "" CVF_VERSION_PATCH "${CVF_VERSION_PATCH}")
+  # Package version must be in the requested version range
+  if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
+      OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
+        OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
+    set(PACKAGE_VERSION_COMPATIBLE FALSE)
+  else()
+    set(PACKAGE_VERSION_COMPATIBLE TRUE)
   endif()
-
-  set(CVF_VERSION_NO_TWEAK "${CVF_VERSION_MAJOR}.${CVF_VERSION_MINOR}.${CVF_VERSION_PATCH}")
 else()
-  set(CVF_VERSION_NO_TWEAK "0.28.5")
-endif()
-
-if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") # strip the tweak version
-  set(REQUESTED_VERSION_MAJOR "${CMAKE_MATCH_1}")
-  set(REQUESTED_VERSION_MINOR "${CMAKE_MATCH_2}")
-  set(REQUESTED_VERSION_PATCH "${CMAKE_MATCH_3}")
-
-  if(NOT REQUESTED_VERSION_MAJOR VERSION_EQUAL 0)
-    string(REGEX REPLACE "^0+" "" REQUESTED_VERSION_MAJOR "${REQUESTED_VERSION_MAJOR}")
-  endif()
-  if(NOT REQUESTED_VERSION_MINOR VERSION_EQUAL 0)
-    string(REGEX REPLACE "^0+" "" REQUESTED_VERSION_MINOR "${REQUESTED_VERSION_MINOR}")
+  if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
+    set(PACKAGE_VERSION_COMPATIBLE FALSE)
+  else()
+    set(PACKAGE_VERSION_COMPATIBLE TRUE)
+    if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
+      set(PACKAGE_VERSION_EXACT TRUE)
+    endif()
   endif()
-  if(NOT REQUESTED_VERSION_PATCH VERSION_EQUAL 0)
-    string(REGEX REPLACE "^0+" "" REQUESTED_VERSION_PATCH "${REQUESTED_VERSION_PATCH}")
-  endif()
-
-  set(REQUESTED_VERSION_NO_TWEAK
-      "${REQUESTED_VERSION_MAJOR}.${REQUESTED_VERSION_MINOR}.${REQUESTED_VERSION_PATCH}")
-else()
-  set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
 endif()
 
-if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
-  set(PACKAGE_VERSION_COMPATIBLE TRUE)
-else()
-  set(PACKAGE_VERSION_COMPATIBLE FALSE)
-endif()
 
-if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
-  set(PACKAGE_VERSION_EXACT TRUE)
-endif()
-
-
-# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
-  return()
-endif()
-
-# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
-  math(EXPR installedBits "8 * 8")
-  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
-  set(PACKAGE_VERSION_UNSUITABLE TRUE)
-endif()
Only in e-c/usr/lib/cmake/exiv2: exiv2Targets.cmake
Only in e-c/usr/lib/cmake/exiv2: exiv2Targets-release.cmake
Binary files e-c/usr/lib/libexiv2.a and e-m/usr/lib/libexiv2.a differ
diff -ru e-c/usr/lib/pkgconfig/exiv2.pc e-m/usr/lib/pkgconfig/exiv2.pc
--- e-c/usr/lib/pkgconfig/exiv2.pc      2025-04-29 09:53:38.000000000 +0000
+++ e-m/usr/lib/pkgconfig/exiv2.pc      2025-04-29 09:51:05.000720176 +0000
@@ -1,13 +1,11 @@
 prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
 includedir=${prefix}/include
+libdir=${prefix}/lib
 
 Name: exiv2
 Description: Exif/IPTC/Xmp C++ metadata library and tools plus ICC Profiles, Previews and more.
-Version: 0.28.5
 URL: https://exiv2.org
-Requires.private: zlib
+Version: 1.0.0
+Requires: zlib
 Libs: -L${libdir} -lexiv2
-Libs.private: 
 Cflags: -I${includedir}

@heitbaum
Copy link

heitbaum commented Apr 29, 2025

Testing the builds of shared libraries results in the following differences:

Cmake
lrwxrwxrwx 1 docker docker      14 Apr 29 10:34 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so -> libexiv2.so.28
-rw-r--r-- 1 docker docker 3382624 Apr 29 10:34 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so.0.28.5
lrwxrwxrwx 1 docker docker      18 Apr 29 10:34 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so.28 -> libexiv2.so.0.28.5

meson
ls build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so* -l
lrwxrwxrwx 1 docker docker      14 Apr 29 10:31 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so -> libexiv2.so.30
-rwxr-xr-x 1 docker docker 3560704 Apr 29 10:31 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so.1.0.0
lrwxrwxrwx 1 docker docker      17 Apr 29 10:31 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so.30 -> libexiv2.so.1.0.0

meson with version fix
lrwxrwxrwx 1 docker docker      14 Apr 29 10:38 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so -> libexiv2.so.28
-rwxr-xr-x 1 docker docker 3560704 Apr 29 10:38 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so.0.28.5
lrwxrwxrwx 1 docker docker      18 Apr 29 10:38 build.LibreELEC-Generic.x86_64-13.0-devel/install_pkg/exiv2-0.28.5/usr/lib/libexiv2.so.28 -> libexiv2.so.0.28.5

required fix is: (this also fixes the versioning anomalies in the pkg-config and header files.)

--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
 project(
   'exiv2',
   'cpp',
-  version: '1.0.0',
+  version: '0.28.5',
   meson_version: '>=0.54.1',
   default_options: ['warning_level=0', 'cpp_std=c++20'],
 )

@heitbaum
Copy link

Lastly - not sure this was / should be set to 9? Assume this should be 0 or blank?

cdata.set('PROJECT_VERSION_TWEAK', 9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing options in meson build
3 participants