From f7098dcdf24c974f804d213e8dd5b187edbb7e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= Date: Tue, 5 Nov 2024 14:24:42 +0100 Subject: [PATCH 1/5] cmake: adjust mingw output lib name based on fedora patch (https://src.fedoraproject.org/rpms/leptonica/blob/rawhide/f/leptonica_cmake.patch) --- src/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 55007ff30..48501ce0f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,6 +17,9 @@ add_library (leptonica ${src} ${hdr}) set_target_properties (leptonica PROPERTIES VERSION 6.0.0) set_target_properties (leptonica PROPERTIES SOVERSION 6) set_target_properties (leptonica PROPERTIES OUTPUT_NAME leptonica$<$:-${PROJECT_VERSION}$<$:d>>) +if(MINGW) + set_target_properties (leptonica PROPERTIES SUFFIX "-${PROJECT_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") +endif(MINGW) if (BUILD_SHARED_LIBS) target_compile_definitions (leptonica PRIVATE -DLIBLEPT_EXPORTS) From 23fef93d58ebddaceab421bb843c9f03aa0e8982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= Date: Mon, 25 Nov 2024 09:22:21 +0100 Subject: [PATCH 2/5] Github Action: ignore not relevant commits --- .github/workflows/autotools-macos.yml | 7 ++++++- .github/workflows/cmake-win64.yml | 2 ++ .github/workflows/cmake.yml | 9 ++++++++- .github/workflows/sw.yml | 15 ++++++++++++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/autotools-macos.yml b/.github/workflows/autotools-macos.yml index 9196ebd83..0c2ed7cf1 100644 --- a/.github/workflows/autotools-macos.yml +++ b/.github/workflows/autotools-macos.yml @@ -14,6 +14,11 @@ on: - 'configure.ac' push: + branches: + - master + paths-ignore: + - '**/CMakeLists.txt' + - '.github/*' # Trigger workflow in GitHub web frontend or from API. workflow_dispatch: @@ -27,7 +32,7 @@ jobs: matrix: config: - { os: macos-13, cc: clang } - - { os: macos-14, cc: clang } + - { os: macos-latest, cc: clang } steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/cmake-win64.yml b/.github/workflows/cmake-win64.yml index e01f2f509..1180bb3cc 100644 --- a/.github/workflows/cmake-win64.yml +++ b/.github/workflows/cmake-win64.yml @@ -3,6 +3,8 @@ name: cmake-win64 on: push: branches: [ "master" ] + paths-ignore: + - '.github/*' pull_request: branches: [ "master" ] workflow_dispatch: diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ec82e314f..9ab4e5de4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,6 +1,13 @@ name: CMake -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: [ "master" ] + paths-ignore: + - '.github/*' + pull_request: + branches: [ "master" ] + workflow_dispatch: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) diff --git a/.github/workflows/sw.yml b/.github/workflows/sw.yml index c84602b00..2d0ecf42a 100644 --- a/.github/workflows/sw.yml +++ b/.github/workflows/sw.yml @@ -1,6 +1,19 @@ name: sw -on: [push, pull_request] +on: + push: + branches: + - master + paths-ignore: + - '**/CMakeLists.txt' + - '.github/*' + pull_request: + branches: + - master + paths-ignore: + - '**/CMakeLists.txt' + - '.github/*' + workflow_dispatch: jobs: windows: From c48d896814900cfa550e18c412fb42af68b1dea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= Date: Mon, 25 Nov 2024 09:26:29 +0100 Subject: [PATCH 3/5] cmake: fix warnings: `Compatibility with CMake < 3.10 will be removed` and `Evaluation file to be written multiple times with different content.` on Windows --- CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72dcca3ed..ed6f223bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ # # ############################################################################## -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) cmake_policy(SET CMP0054 NEW) # In-source builds are disabled. @@ -372,10 +372,13 @@ get_target_property(leptonica_OUTPUT_NAME leptonica OUTPUT_NAME) configure_file(lept.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/lept.pc.in @ONLY) # to resolve generator expression in OUTPUT_NAME -file( - GENERATE - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lept.pc - INPUT ${CMAKE_CURRENT_BINARY_DIR}/lept.pc.in) +set(pkg_conf_name lept.pc) +if(WIN32) + set(pkg_conf_name lept_$.pc) +endif(WIN32) +file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${pkg_conf_name} + INPUT ${CMAKE_CURRENT_BINARY_DIR}/lept.pc.in) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/LeptonicaConfig-version.cmake.in @@ -384,7 +387,7 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/LeptonicaConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LeptonicaConfig.cmake @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lept.pc +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pkg_conf_name} DESTINATION lib/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LeptonicaConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/LeptonicaConfig-version.cmake From ec459633efd6ca8aa4e65cd787a416542d995cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= Date: Mon, 25 Nov 2024 09:31:58 +0100 Subject: [PATCH 4/5] Github Actions: [cmake-win64] libtiff with deflate and lerc support, new version of libpng ang xz --- .github/workflows/cmake-win64.yml | 56 ++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/.github/workflows/cmake-win64.yml b/.github/workflows/cmake-win64.yml index 1180bb3cc..15ff01a97 100644 --- a/.github/workflows/cmake-win64.yml +++ b/.github/workflows/cmake-win64.yml @@ -11,7 +11,7 @@ on: env: ILOC: d:/a/local - + jobs: build: name: cmake-win64 @@ -47,8 +47,8 @@ jobs: - name: Build and Install libpng shell: cmd run: | - curl -sSL https://download.sourceforge.net/libpng/lpng1643.zip -o lpng1643.zip - unzip.exe -qq lpng1643.zip + curl -sSL https://download.sourceforge.net/libpng/lpng1644.zip -o lpng1644.zip + unzip.exe -qq lpng1644.zip cd lpng1643 cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DPNG_TESTS=OFF -DPNG_SHARED=OFF cmake --build build --config Release --target install @@ -59,7 +59,7 @@ jobs: run: | git clone --depth 1 https://github.com/xbmc/giflib.git cd giflib - cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} + cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} cmake --build build --config Release --target install cd .. @@ -86,7 +86,7 @@ jobs: run: | git clone --depth 1 https://chromium.googlesource.com/webm/libwebp cd libwebp - cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DWEBP_BUILD_WEBP_JS=OFF -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DWEBP_BUILD_WEBP_JS=OFF + cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_SHARED_LIBS=ON -DWEBP_BUILD_WEBP_JS=OFF -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DWEBP_BUILD_WEBP_JS=OFF cmake --build build --config Release --target install cd .. @@ -106,28 +106,46 @@ jobs: cd zstd\build\cmake cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} cmake --build build --config Release --target install - cd .. + cd ../../.. - name: Build and Install lzma shell: cmd run: | - curl -sSL https://sourceforge.net/projects/lzmautils/files/xz-5.4.3.tar.zst/download -o xz-5.4.5.tar.zst - zstd -d xz-5.4.5.tar.zst - tar xf xz-5.4.5.tar - cd xz-5.4.5 - ; git clone --depth 1 https://github.com/tukaani-project/xz.git - ; cd xz - ; cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON - ; cmake --build build --config Release --target install - ; cd .. - + ; curl -sSL https://sourceforge.net/projects/lzmautils/files/xz-5.4.3.tar.zst/download -o xz-5.4.5.tar.zst + ; zstd -d xz-5.4.5.tar.zst + ; tar xf xz-5.4.5.tar + ; cd xz-5.4.5 + git clone --depth 1 https://github.com/tukaani-project/xz.git + cd xz + cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON + cmake --build build --config Release --target install + cd .. + + - name: Build and Install libdeflate + shell: cmd + run: | + git clone --depth 1 https://github.com/ebiggers/libdeflate.git + cd libdeflate + cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} + cmake --build build --config Release --target install + cd .. + + - name: Build and Install lerc + shell: cmd + run: | + git clone --depth 1 https://github.com/Esri/lerc.git + cd lerc + cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} + cmake --build build --config Release --target install + cd .. + - name: Build and Install libtiff shell: cmd run: | git clone --depth 1 https://gitlab.com/libtiff/libtiff.git cd libtiff - cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -Dtiff-tools=OFF -Dtiff-tests=OFF -Dtiff-contrib=OFF -Dtiff-docs=OFF - cmake --build build --config Release --target install + cmake -Bbuild_cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -Dtiff-tools=OFF -Dtiff-tests=OFF -Dtiff-contrib=OFF -Dtiff-docs=OFF + cmake --build build_cmake --config Release --target install cd .. - name: Build and Install leptonica @@ -140,7 +158,7 @@ jobs: shell: cmd run: | echo "Testing leptonica..." - ${{env.ILOC}}/bin/fileinfo prog/test-rgb.png + ${{env.ILOC}}/bin/fileinfo ${GITHUB_WORKSPACE}/prog/test-rgb.png - name: Remove not needed tools shell: cmd From 89d08fa42c703299cbc0f8d5dc71b648804865dc Mon Sep 17 00:00:00 2001 From: zdenop Date: Mon, 25 Nov 2024 09:48:21 +0100 Subject: [PATCH 5/5] Github Actions: Update cmake-win64.yml correct png directory --- .github/workflows/cmake-win64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-win64.yml b/.github/workflows/cmake-win64.yml index 15ff01a97..6647f61d4 100644 --- a/.github/workflows/cmake-win64.yml +++ b/.github/workflows/cmake-win64.yml @@ -49,7 +49,7 @@ jobs: run: | curl -sSL https://download.sourceforge.net/libpng/lpng1644.zip -o lpng1644.zip unzip.exe -qq lpng1644.zip - cd lpng1643 + cd lpng1644 cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DPNG_TESTS=OFF -DPNG_SHARED=OFF cmake --build build --config Release --target install cd ..