File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/sh
22# This script requires `sh` instead of `bash` because the latter is not always installed on FreeBSD.
3- set -eu
3+ set -eux
44
5- case " ${1% -* } " in
5+ USAGE=" Usage: $0 <os> [additional toolset]"
6+
7+ OS=" ${1:? $USAGE } "
8+ shift
9+ TOOLSET=" ${1-} "
10+ shift 2> /dev/null || : # That argument is optional.
11+ if [ $# -ne 0 ]; then
12+ echo >&2 " $USAGE "
13+ exit 1
14+ fi
15+
16+ case " ${OS% -* } " in
617 ubuntu)
18+ pkgs=bison
19+ case " $TOOLSET " in
20+ mingw32) TOOLSET=
21+ pkgs=" $pkgs g++-mingw-w64-i686-win32 mingw-w64-tools libz-mingw-w64-dev dpkg-dev"
22+ ;;
23+ mingw64) TOOLSET=
24+ pkgs=" $pkgs g++-mingw-w64-x86-64-win32 mingw-w64-tools libz-mingw-w64-dev dpkg-dev"
25+ ;;
26+ ' ' )
27+ pkgs=" $pkgs libpng-dev"
28+ ;;
29+ esac
730 sudo apt-get -qq update
8- sudo apt-get install -yq bison libpng-dev pkg-config
31+ # shellcheck disable=SC2086 # (This word splitting is intentional.)
32+ sudo apt-get install -yq $pkgs
933 ;;
1034 macos)
1135 # macOS bundles GNU Make 3.81, which doesn't support synced output.
@@ -30,6 +54,11 @@ case "${1%-*}" in
3054 ;;
3155esac
3256
57+ if [ -n " $TOOLSET " ]; then
58+ printf >&2 ' Unknown toolset `%s` for OS `%s`\n' " $TOOLSET " " $OS "
59+ exit 1
60+ fi
61+
3362echo " PATH=($PATH )" | sed ' s/:/\n /g'
3463bison --version
3564make --version
Original file line number Diff line number Diff line change @@ -240,12 +240,12 @@ jobs:
240240 - name : Install MinGW
241241 run : | # dpkg-dev is apparently required for pkg-config for cross-building
242242 sudo apt-get install g++-mingw-w64-${{ matrix.arch }}-win32 mingw-w64-tools libz-mingw-w64-dev dpkg-dev
243- - name : Install libpng dev headers for MinGW
244- run : |
245- ./.github/scripts/mingw-w64-libpng-dev.sh ${{ matrix.triplet }}
243+ # - name: Install libpng dev headers for MinGW
244+ # run: |
245+ # ./.github/scripts/mingw-w64-libpng-dev.sh ${{ matrix.triplet }}
246246 - name : Cross-build Windows binaries
247247 run : |
248- make mingw${{ matrix.bits }} -kj Q=
248+ cmake -B build -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain- mingw${{ matrix.bits }}.cmake
249249 - name : Package binaries
250250 run : | # DLL dependencies can be figured out using e.g. Dependency Walker or objdump -p
251251 mkdir bins
Original file line number Diff line number Diff line change @@ -14,6 +14,6 @@ CMakeCache.txt
1414CMakeFiles /
1515cmake_install.cmake
1616CMakeUserPresets.json
17- build /
17+ build * /
1818* .dSYM /
1919callgrind.out. *
Original file line number Diff line number Diff line change 1+ # From https://www.mingw-w64.org/build-systems/cmake/
2+
3+ set (CMAKE_SYSTEM_NAME Windows)
4+ set (CMAKE_SYSTEM_PROCESSOR i686)
5+
6+ # specify the cross compiler
7+ set (CMAKE_C_COMPILER i686-w64-mingw32-gcc)
8+ set (CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
9+ set (CMAKE_RC_COMPILER i686-w64-mingw32-windres)
10+
11+ # where is the target environment
12+ set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
13+
14+ # search for programs in the build host directories
15+ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16+ # for libraries and headers in the target directories
17+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
18+ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Original file line number Diff line number Diff line change 1+ # From https://www.mingw-w64.org/build-systems/cmake/
2+
3+ set (CMAKE_SYSTEM_NAME Windows)
4+ set (CMAKE_SYSTEM_PROCESSOR x86_64)
5+
6+ # specify the cross compiler
7+ set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
8+ set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
9+ set (CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
10+
11+ # where is the target environment
12+ set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
13+
14+ # search for programs in the build host directories
15+ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16+ # for libraries and headers in the target directories
17+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
18+ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
You can’t perform that action at this time.
0 commit comments