forked from libsdl-org/SDL_image
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Modify VS projects to pick up SDL in location we install - Modify VS projects to use libpng and libjpeg(turbo) - Adds libpng and libjpeg(turbo) to VisualC/external (libpng+zlib is from SDL_image 2.0.5 build, libjpeg turbo is from libjpeg-turbo 3.0.1 release gcc installers, lib/headers extracted from install) - Adds automation to construct SDL_image bundle using msbuild (VS projects)
- Loading branch information
Showing
14 changed files
with
671 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,287 +1,59 @@ | ||
name: Build | ||
name: PGCE Build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
Build: | ||
name: ${{ matrix.platform.name }} | ||
runs-on: ${{ matrix.platform.os }} | ||
|
||
defaults: | ||
run: | ||
shell: ${{ matrix.platform.shell }} | ||
build: | ||
name: Windows ${{ matrix.archplatform }} | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
fail-fast: false # if a particular matrix build fails, don't skip the rest | ||
matrix: | ||
platform: | ||
- { name: Windows (MSVC+CMake), os: windows-latest, shell: sh, cmake: '-GNinja', msvc: 1, shared: 1, static: 0, vendored: 1 } | ||
- { name: Windows (mingw32+autotools), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, shared: 1, static: 1 } | ||
- { name: Windows (mingw64+CMake), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, shared: 1, static: 0, | ||
cmake: '-DSDL2IMAGE_BACKEND_STB=OFF -DSDL2IMAGE_BACKEND_WIC=OFF -G "Ninja Multi-Config"' } | ||
- { name: Linux (autotools), os: ubuntu-latest, shell: sh, shared: 1, static: 1} | ||
- { name: Linux (CMake), os: ubuntu-latest, shell: sh, cmake: '-GNinja', shared: 1, static: 0, vendored: 1 } | ||
- { name: 'Linux (CMake, static)', os: ubuntu-latest, shell: sh, cmake: '-DBUILD_SHARED_LIBS=OFF -GNinja', shared: 0, static: 1, vendored: 1 } | ||
- { name: Macos (autotools), os: macos-latest, shell: sh, shared: 1, static: 1 } | ||
- { name: Macos (CMake), os: macos-latest, shell: sh, cmake: '-GNinja', shared: 1, static: 0, vendored: 1 } | ||
|
||
include: | ||
- { | ||
arch: x86_amd64, | ||
archplatform: x64, | ||
archlocation: x64, | ||
} | ||
- { | ||
arch: x86, | ||
archplatform: x86, | ||
archlocation: Win32, | ||
} | ||
|
||
steps: | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
if: ${{ matrix.platform.msvc }} | ||
with: | ||
arch: x64 | ||
- name: Set up MSYS2 | ||
if: ${{ contains(matrix.platform.shell, 'msys2') }} | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
msystem: ${{ matrix.platform.msystem }} | ||
path-type: inherit | ||
install: >- | ||
${{ matrix.platform.msys-env }}-autotools | ||
${{ matrix.platform.msys-env }}-cmake | ||
${{ matrix.platform.msys-env }}-gcc | ||
${{ matrix.platform.msys-env }}-ninja | ||
${{ matrix.platform.msys-env }}-pkg-config | ||
${{ matrix.platform.msys-env }}-nasm | ||
${{ matrix.platform.msys-env }}-libavif | ||
${{ matrix.platform.msys-env }}-libjpeg-turbo | ||
${{ matrix.platform.msys-env }}-libjxl | ||
${{ matrix.platform.msys-env }}-libpng | ||
${{ matrix.platform.msys-env }}-libtiff | ||
${{ matrix.platform.msys-env }}-libwebp | ||
${{ matrix.platform.msys-env }}-zlib | ||
- name: Install Ninja | ||
uses: turtlesec-no/get-ninja@main | ||
if: ${{ !contains(matrix.platform.shell, 'msys2') }} | ||
- name: Set up SDL | ||
id: sdl | ||
uses: libsdl-org/setup-sdl@main | ||
with: | ||
cmake-generator: Ninja | ||
version: 2-head | ||
sdl-test: true | ||
shell: ${{ matrix.platform.shell }} | ||
add-to-environment: true | ||
- name: Setup Macos dependencies | ||
if: ${{ runner.os == 'macOS' }} | ||
run: | | ||
brew install \ | ||
autoconf \ | ||
automake \ | ||
jpeg \ | ||
libavif \ | ||
libpng \ | ||
libtiff \ | ||
libtool \ | ||
nasm \ | ||
ninja \ | ||
pkg-config \ | ||
webp \ | ||
zlib \ | ||
${NULL+} | ||
- name: Setup Linux dependencies | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get -y install \ | ||
autoconf \ | ||
automake \ | ||
cmake \ | ||
libavif-dev \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
libtiff-dev \ | ||
libtool \ | ||
libwebp-dev \ | ||
nasm \ | ||
ninja-build \ | ||
pkg-config \ | ||
zlib1g-dev \ | ||
${NULL+} | ||
- name: Set up NASM | ||
uses: ilammy/setup-nasm@v1 | ||
if: ${{ matrix.platform.vendored && !contains(matrix.platform.shell, 'msys2') }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Check that versioning is consistent | ||
# We only need to run this once: arbitrarily use the Linux/CMake build | ||
if: ${{ runner.os == 'Linux' && matrix.platform.cmake }} | ||
run: ./build-scripts/test-versioning.sh | ||
|
||
- name: Setup (CMake) | ||
if: ${{ matrix.platform.cmake && !matrix.platform.msystem && !matrix.platform.msvc }} | ||
uses: jwlawson/actions-setup-cmake@master | ||
with: | ||
cmake-version: '3.16' | ||
- name: Configure (CMake) | ||
if: ${{ matrix.platform.cmake }} | ||
run: | | ||
export CMAKE_CONFIGURATION_TYPES=Debug | ||
cmake -B build \ | ||
-DSDL2IMAGE_VENDORED=${{ matrix.platform.vendored }} \ | ||
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$PWD/build \ | ||
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$PWD/build \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DSDL2IMAGE_SAMPLES=ON \ | ||
-DSDL2IMAGE_TESTS=ON \ | ||
-DSDL2IMAGE_TESTS_INSTALL=ON \ | ||
-DSDL2IMAGE_AVIF=ON \ | ||
-DSDL2IMAGE_JXL=ON \ | ||
-DSDL2IMAGE_TIF=ON \ | ||
-DSDL2IMAGE_WEBP=ON \ | ||
-DCMAKE_INSTALL_PREFIX=prefix_cmake \ | ||
${{ matrix.platform.cmake }} | ||
- name: Build (CMake) | ||
if: ${{ matrix.platform.cmake }} | ||
run: cmake --build build/ --config Debug --parallel --verbose | ||
- name: Run build-time tests (CMake) | ||
if: ${{ matrix.platform.cmake }} | ||
run: | | ||
set -eu | ||
if [ "x${{ runner.os }}" = xLinux ]; then | ||
export LD_LIBRARY_PATH="${{ github.workspace }}/build:$LD_LIBRARY_PATH" | ||
fi | ||
if [ "x${{ runner.os }}" = xmacos ]; then | ||
export DYLD_LIBRARY_PATH="${{ github.workspace }}/build:$DYLD_LIBRARY_PATH" | ||
fi | ||
if [ "x${{ runner.os }}" = "xWindows" ]; then | ||
sdl_binpath="$( cygpath -u "${{ steps.sdl.outputs.prefix }}" )" | ||
sdlimage_binpath="$( cygpath -u "${{ github.workspace }}/build" )" | ||
export PATH="$sdl_binpath:$sdlimage_binpath:$PATH" | ||
fi | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_AVIF=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_BMP=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_CUR=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_GIF=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_ICO=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_JPG=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_JXL=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_LBM=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_PCX=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_PNG=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_PNM=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_QOI=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_SVG=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_TGA=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_TIF=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_WEBP=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_XPM=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_XV=1 | ||
export SDL_IMAGE_TEST_REQUIRE_SAVE_JPG=1 | ||
export SDL_IMAGE_TEST_REQUIRE_SAVE_PNG=1 | ||
cd build/test | ||
ctest -VV -C Debug | ||
- name: Install (CMake) | ||
if: ${{ (matrix.platform.shell == 'sh' || contains(matrix.platform.shell, 'msys2')) && matrix.platform.cmake }} | ||
run: | | ||
set -eu | ||
rm -fr DESTDIR-cmake | ||
cmake --install build/ --config Debug | ||
echo "SDL2_image_DIR=$(pwd)/prefix_cmake" >> $GITHUB_ENV | ||
( cd prefix_cmake; find . ) | LC_ALL=C sort -u | ||
- name: Upload artifacts (CMake) | ||
if: ${{ failure() && runner.os == 'Linux' && matrix.platform.cmake }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "${{ matrix.platform.name }} artifacts" | ||
path: | | ||
build/test/*.bmp | ||
build/test/*.jpg | ||
build/test/*.png | ||
if-no-files-found: ignore | ||
|
||
- name: Configure (Autotools) | ||
if: ${{ !matrix.platform.cmake }} | ||
run: | | ||
set -eu | ||
rm -fr build | ||
mkdir build | ||
./autogen.sh | ||
if [ "x${{ runner.os }}" = "xmacOS" ]; then | ||
export LDFLAGS=-Wl,-rpath,${{ steps.sdl.outputs.prefix }}/lib | ||
fi | ||
# We do the CMake build with stb_image and the Autotools build without | ||
set -- --disable-stb-image --prefix=$(pwd)/prefix_autotools --enable-tests --enable-installed-tests | ||
( cd build && ../configure "$@" ) | ||
- name: Build (Autotools) | ||
if: ${{ !matrix.platform.cmake }} | ||
run: | | ||
set -eu | ||
parallel="$(getconf _NPROCESSORS_ONLN)" | ||
make -j"${parallel}" -C build V=1 | ||
- name: Run build-time tests (Autotools) | ||
if: ${{ !matrix.platform.cmake }} | ||
run: | | ||
set -eu | ||
if [ "x${{ runner.os }}" = "xWindows" ]; then | ||
sdl_binpath="$( cygpath -u "${{ steps.sdl.outputs.prefix }}" )" | ||
export PATH="$sdl_binpath:$PATH" | ||
fi | ||
parallel="$(getconf _NPROCESSORS_ONLN)" | ||
# Expect to support all formats except JXL in these builds. | ||
# See test/README.md for how this works. | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_AVIF=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_BMP=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_CUR=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_GIF=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_ICO=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_JPG=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_JXL=0 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_LBM=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_PCX=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_PNG=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_PNM=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_QOI=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_SVG=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_TGA=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_TIF=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_WEBP=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_XPM=1 | ||
export SDL_IMAGE_TEST_REQUIRE_LOAD_XV=1 | ||
export SDL_IMAGE_TEST_REQUIRE_SAVE_JPG=1 | ||
export SDL_IMAGE_TEST_REQUIRE_SAVE_PNG=1 | ||
make -j"${parallel}" -C build check V=1 VERBOSE=1 | ||
- name: Install (Autotools) | ||
if: ${{ !matrix.platform.cmake }} | ||
run: | | ||
set -eu | ||
curdir="$(pwd)" | ||
parallel="$(getconf _NPROCESSORS_ONLN)" | ||
make -j"${parallel}" -C build install V=1 | ||
echo "SDL2_image_DIR=$(pwd)/prefix_autotools" >> $GITHUB_ENV | ||
( cd prefix_autotools; find . ) | LC_ALL=C sort -u | ||
- name: Distcheck (Autotools) | ||
if: ${{ runner.os == 'Linux' && !matrix.platform.cmake }} | ||
run: | | ||
set -eu | ||
parallel="$(getconf _NPROCESSORS_ONLN)" | ||
make -j"${parallel}" -C build distcheck V=1 | ||
- name: Upload artifacts (Autotools) | ||
if: ${{ failure() && !matrix.platform.cmake }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.platform.name }} artifacts | ||
path: | | ||
build/test/*.bmp | ||
build/test/*.jpg | ||
build/test/*.log | ||
build/test/*.png | ||
if-no-files-found: ignore | ||
- name: Verify CMake configuration files | ||
run: | | ||
cmake -S cmake/test -B cmake_config_build \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_PREFIX_PATH="${{ env.SDL2_image_DIR }}" \ | ||
-DTEST_SHARED=${{ matrix.platform.shared }} \ | ||
-DTEST_STATIC=${{ matrix.platform.static }} | ||
cmake --build cmake_config_build --verbose | ||
- uses: actions/[email protected] | ||
|
||
- uses: TheMrMilchmann/setup-msvc-dev@v3 # this lets us use the developer command prompt on windows | ||
with: | ||
arch: ${{ matrix.arch }} | ||
|
||
- name: Get SDL | ||
run: | | ||
.github/fetch_sdl_vc.ps1 | ||
- name: Build SDL_image | ||
run: | | ||
msbuild VisualC/SDL_image.vcxproj /p:PlatformToolset=v143 /p:Configuration=Release /p:Platform=${{ matrix.archplatform }} | ||
- name: Prepare upload | ||
run: | | ||
mkdir upload_prep/lib/${{ matrix.archplatform }} | ||
cp VisualC/${{ matrix.archlocation }}/Release/SDL2_image.dll upload_prep/lib/${{ matrix.archplatform }}/SDL2_image.dll | ||
cp VisualC/${{ matrix.archlocation }}/Release/SDL2_image.lib upload_prep/lib/${{ matrix.archplatform }}/SDL2_image.lib | ||
cp -r VisualC/external/optional/${{ matrix.archplatform }} upload_prep/lib/${{ matrix.archplatform }}/optional | ||
- name: Add constant files to bundle | ||
if: matrix.archplatform == 'x64' # only run once, adds to same bundle as win32 | ||
run: | | ||
mkdir upload_prep/include | ||
cp include/SDL_image.h upload_prep/include/SDL_image.h | ||
cp CHANGES.txt upload_prep/CHANGES.txt | ||
cp README.txt upload_prep/README.txt | ||
cp LICENSE.txt upload_prep/LICENSE.txt | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: SDL-image-build | ||
path: upload_prep |
Oops, something went wrong.