From ed14823d7a23da610c077b162957583bcb7240dd Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Wed, 22 Apr 2026 21:18:25 +0200 Subject: [PATCH] add backward compatibility bookworm --- builder/Containerfile.template | 1 + builder/build-in-container | 2 +- src/CMakeLists.txt | 5 ++++ src/kds_s2000w_image_converter_magick.c | 6 ++++- tests/CMakeLists.txt | 34 ++++++++++++++++++------- 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/builder/Containerfile.template b/builder/Containerfile.template index 9026fac..9698807 100644 --- a/builder/Containerfile.template +++ b/builder/Containerfile.template @@ -14,6 +14,7 @@ RUN apt-get install -y \ libcmocka-dev \ cppcheck \ lcov \ + imagemagick \ libmagickcore-dev \ && apt-get clean COPY run /app/run diff --git a/builder/build-in-container b/builder/build-in-container index 7a5d52e..f226774 100755 --- a/builder/build-in-container +++ b/builder/build-in-container @@ -3,7 +3,7 @@ main() { local scriptpath=$(echo $0 | xargs dirname | xargs realpath) - local distros="debian:trixie debian:forky" + local distros="debian:bookworm debian:trixie debian:forky" mkdir -p build cp builder/run build/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4c357d6..0c4a638 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,6 +40,7 @@ if(IMAGEMAGICK) find_package(ImageMagick COMPONENTS MagickCore REQUIRED) message(STATUS "find ImageMagick: ${ImageMagick_LIBRARIES}") message(STATUS "ImageMagick_INCLUDE_DIRS: ${ImageMagick_INCLUDE_DIRS}") + message(STATUS "ImageMagick_VERSION_STRING: ${ImageMagick_VERSION_STRING}") else() find_library(netpbm NAMES netpbm REQUIRED) message(STATUS "find netpbm: ${netpbm}") @@ -49,6 +50,10 @@ else() message(STATUS "find tiff: ${TIFF_LIBRARIES}") endif() +if(ImageMagick_VERSION_STRING VERSION_LESS 7) + add_compile_definitions(IMAGEMAGICK6) +endif() + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX / CACHE PATH "install prefix" FORCE) endif() diff --git a/src/kds_s2000w_image_converter_magick.c b/src/kds_s2000w_image_converter_magick.c index f3f74cb..8a6c70c 100644 --- a/src/kds_s2000w_image_converter_magick.c +++ b/src/kds_s2000w_image_converter_magick.c @@ -1,7 +1,11 @@ #define MAGICKCORE_QUANTUM_DEPTH 16 #define MAGICKCORE_HDRI_ENABLE 0 -#include +#ifdef IMAGEMAGICK6 + #include +#else + #include +#endif #include #include "kds_s2000w_image_converter.h" #include "kds_s2000w_image_type_check.h" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ecfa301..498929d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,6 +8,11 @@ message(STATUS "find ${CMOCKA_LIBRARY}") message(STATUS "find ${CPPCHECK}") message(STATUS "find ${LCOV}") +execute_process(COMMAND bash -c "${CPPCHECK} --version | sed 's/Cppcheck //'" + OUTPUT_VARIABLE CPPCHECK_VERSION) + +message(STATUS "CPPCHECK_VERSION: ${CPPCHECK_VERSION}") + add_executable(kds_s2000w_net_get_opt_tests kds_s2000w_net_get_opt_tests.c kds_s2000w_client_mock.c) @@ -127,12 +132,23 @@ add_custom_command(TARGET runningtests --output-directory ${CMAKE_BINARY_DIR}/coverage ${CMAKE_BINARY_DIR}/coverage.info) -add_custom_command(TARGET runningtests - POST_BUILD - COMMAND ${CPPCHECK} - --check-level=exhaustive - --enable=warning,style - --inline-suppr - --error-exitcode=1 - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_SOURCE_DIR}/tests) \ No newline at end of file +if(CPPCHECK_VERSION VERSION_GREATER 2.10) + add_custom_command(TARGET runningtests + POST_BUILD + COMMAND ${CPPCHECK} + --check-level=exhaustive + --enable=warning,style + --inline-suppr + --error-exitcode=1 + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/tests) +else() + add_custom_command(TARGET runningtests + POST_BUILD + COMMAND ${CPPCHECK} + --enable=warning,style + --inline-suppr + --error-exitcode=1 + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/tests) +endif() \ No newline at end of file -- 2.47.3