Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBloomberg committed Dec 3, 2024
2 parents 387a4ad + 89d08fa commit a1a7253
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 29 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/autotools-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
60 changes: 40 additions & 20 deletions .github/workflows/cmake-win64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ..
Expand All @@ -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 ..
Expand All @@ -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 ..
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -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.)
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/sw.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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_$<CONFIG>.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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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$<$<BOOL:${MSVC}>:-${PROJECT_VERSION}$<$<CONFIG:DEBUG>: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)
Expand Down

0 comments on commit a1a7253

Please sign in to comment.