aboutsummaryrefslogtreecommitdiffstats
path: root/build-scripts/build-windows
blob: 76f88f3bfa664f13e940cd4e0a293682f3fec3c6 (plain) (blame)
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
#!/bin/bash
set -ex
cd $(dirname $0)/..
wordsize=$1
tool=$2

declare -a cmake_xargs
declare -a ctest_xargs
if [[ $tool == mingw ]]; then
    pacman -Sy --noconfirm make base-devel tar zip unzip
    if [ ! -x /c/msys64/mingw$wordsize/bin/g++.exe ]; then
        if [[ $wordsize == 64 ]]; then
            pacman -Sy --noconfirm mingw-w64-x86_64-toolchain
        else
            pacman -Sy --noconfirm mingw-w64-i686-toolchain
        fi
    fi
    PATH="/c/msys64/mingw$wordsize/bin:$PATH"
    config=RelWithDebInfo
    cmake_xargs=(-- -k)
    g++ -v
elif [[ $tool == msvc ]]; then
    cl
    config=Release
    cmake_xargs=(--config $config)
    ctest_xargs=(-C $config)
fi

mkdir build distribution
unzip doc.zip
unzip qpdf-external-libs-bin.zip

cd build
../cmake-win $tool ci
cmake --build . -j$(nproc) "${cmake_xargs[@]}"
ctest --verbose "${ctest_xargs[@]}"
cpack -G NSIS -C $config
cpack -G ZIP -C $config
for i in qpdf-*.exe; do
    mv $i ../distribution/$(echo $i | sed -e 's/.exe/-ci.exe/')
done
for i in qpdf-*.zip; do
    mv $i ../distribution/$(echo $i | sed -e 's/.zip/-ci.zip/')
done
cd ..
sha256sum distribution/*