-
Notifications
You must be signed in to change notification settings - Fork 393
208 lines (178 loc) · 8.38 KB
/
cmake-win64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: cmake-win64
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: [push, pull_request, workflow_dispatch]
defaults:
run:
shell: bash --noprofile --norc -xeo pipefail {0}
env:
ILOC: d:/a/local
# Note: retry on all errors to avoid transient SEC_E_ILLEGAL_MESSAGE issues…
CURL: curl --location --retry 5 --retry-all-errors --silent --show-error
jobs:
build:
name: cmake-win64
runs-on: windows-latest
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
submodules: recursive
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Setup environment
run: |
mkdir ${{env.ILOC}}
git_info="$(git describe --tags HEAD)"
echo "version=${git_info}" >>$GITHUB_OUTPUT
echo d:/a/gnuplot/bin >>$GITHUB_PATH
echo ${{env.ILOC}}/bin >>$GITHUB_PATH
# Nuke Strawberry Perl's installation as it contains various
# MinGW headers, libraries and binaries that can get picked up
# by configure/CMake and don't necessarily behave correctly when
# not using a MinGW environment.
- name: Nuke Strawberry Perl
run: rm -rf C:/Strawberry
- name: Install nasm
uses: ilammy/setup-nasm@v1
- name: Install gnuplot
run: |
${{env.CURL}} https://sourceforge.net/projects/gnuplot/files/gnuplot/5.4.8/gp548-win64-mingw.zip/download -o gp548-win64-mingw.zip
unzip -d d:/a -qq gp548-win64-mingw.zip
gnuplot --version
- name: Build and Install zlib-ng
run: |
git clone --depth 1 https://github.com/zlib-ng/zlib-ng.git
cd zlib-ng
cmake -B build -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_SHARED_LIBS=OFF -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF -DINSTALL_UTILS=OFF
cmake --build build --config Release --target install
- name: Build and Install libpng
run: |
${{env.CURL}} https://download.sourceforge.net/libpng/lpng1639.zip -o lpng1639.zip
unzip -qq lpng1639.zip
cd lpng1639
cmake -B build -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
- name: Build and Install giflib
run: |
${{env.CURL}} https://sourceforge.net/projects/giflib/files/giflib-5.2.1.tar.gz/download -o giflib-5.2.1.tar.gz
tar xaf giflib-5.2.1.tar.gz
cd giflib-5.2.1
patch -p1 <<\EOF
diff --git c/CMakeLists.txt i/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ i/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(giflib VERSION 5.2.1 LANGUAGES C)
+
+if(MSVC)
+ set(CMAKE_DEBUG_POSTFIX "d")
+endif()
+
+add_library(giflib
+ dgif_lib.c
+ egif_lib.c
+ gif_err.c
+ gif_font.c
+ gif_hash.c
+ gif_hash.h
+ gif_lib.h
+ gif_lib_private.h
+ gifalloc.c
+ openbsd-reallocarray.c
+ quantize.c
+)
+
+install(TARGETS giflib EXPORT giflib
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+)
+
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/gif_lib.h
+ DESTINATION include
+)
diff --git c/gif_hash.h i/gif_hash.h
--- c/gif_hash.h
+++ i/gif_hash.h
@@ -9,7 +9,9 @@ SPDX-License-Identifier: MIT
#ifndef _GIF_HASH_H_
#define _GIF_HASH_H_
+#if !defined(_MSC_VER)
#include <unistd.h>
+#endif
#include <stdint.h>
#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */
EOF
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}}
cmake --build build --config Release --target install
- name: Build and Install libjpeg
run: |
git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo.git
cd libjpeg-turbo
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DWITH_TURBOJPEG=OFF
cmake --build build --config Release --target install
- name: Build and Install openjpeg
run: |
git clone --depth 1 https://github.com/uclouvain/openjpeg.git
cd openjpeg
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}}
cmake --build build --config Release --target install
- name: Build and Install webp
run: |
git clone --depth 1 https://chromium.googlesource.com/webm/libwebp
cd libwebp
cmake -B build -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 --build build --config Release --target install
- name: Build and Install jbigkit
run: |
git clone --depth 1 https://github.com/zdenop/jbigkit.git
cd jbigkit
cmake -B build -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_PROGRAMS=OFF -DBUILD_TOOLS=OFF -DCMAKE_WARN_DEPRECATED=OFF
cmake --build build --config Release --target install
- name: Build and Install zstd
run: |
git clone --depth 1 https://github.com/facebook/zstd.git
cd zstd/build/cmake
cmake -B build -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}}
cmake --build build --config Release --target install
# FIXME: skip lzma build (libtiff lzma build failure)
- name: Build and Install lzma
if: false
run: |
${{env.CURL}} https://sourceforge.net/projects/lzmautils/files/xz-5.4.3.tar.zst/download -o xz-5.4.3.tar.zst
tar xaf xz-5.4.3.tar.zst
cd xz-5.4.3
cmake -B build -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_TESTING=OFF
cmake --build build --config Release --target install
# FIXME: disable lzma support (build failure)
- name: Build and Install libtiff
run: |
git clone --depth 1 https://gitlab.com/libtiff/libtiff.git
cd libtiff
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -Dlzma=OFF -Dtiff-tools=OFF -Dtiff-tests=OFF -Dtiff-contrib=OFF -Dtiff-docs=OFF
cmake --build build --config Release --target install
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DSW_BUILD=OFF -DBUILD_PROG=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=ON
- name: Build
run: cmake --build build --config Release
# FIXME: skip `string_reg` test (libtiff lzma build failure)
- name: Test
run: ctest --test-dir build --build-config Release --output-on-failure --parallel 3 --exclude-regex '^string_reg$'
- name: Install
run: cmake --build build --config Release --target install
- name: Test install
run: fileinfo prog/test-rgb.png
- name: Remove not needed tools
run: rm -f ${{env.ILOC}}/bin/*.exe
- name: Upload Build Results
uses: actions/[email protected]
with:
name: leptonica-${{ steps.get_version.outputs.version }}-VS2019_win64
path: ${{env.ILOC}}
retention-days: 5