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..6647f61d4 100644 --- a/.github/workflows/cmake-win64.yml +++ b/.github/workflows/cmake-win64.yml @@ -3,13 +3,15 @@ name: cmake-win64 on: push: branches: [ "master" ] + paths-ignore: + - '.github/*' pull_request: branches: [ "master" ] workflow_dispatch: env: ILOC: d:/a/local - + jobs: build: name: cmake-win64 @@ -45,9 +47,9 @@ 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 - cd lpng1643 + curl -sSL https://download.sourceforge.net/libpng/lpng1644.zip -o lpng1644.zip + unzip.exe -qq lpng1644.zip + 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 .. @@ -57,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 .. @@ -84,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 .. @@ -104,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 @@ -138,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 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: 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 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)