Add SDL2_image dependency to packages and build systems

This commit is contained in:
kcgen 2022-11-09 00:05:16 -08:00 committed by kcgen
parent 4ecaef10c5
commit 083dfb93c5
31 changed files with 79 additions and 21 deletions

View file

@ -95,6 +95,7 @@ jobs:
-Duse_mt32emu=false \
-Duse_opengl=false \
-Duse_png=false \
-Duse_sdl2_image=false \
-Duse_sdl2_net=false \
-Duse_slirp=false \
-Dunit_tests=disabled \

View file

@ -40,6 +40,7 @@ jobs:
os: ubuntu-20.04
conf:
- configure_flags: -Duse_slirp=false
- configure_flags: -Duse_sdl2_image=false
- configure_flags: -Duse_sdl2_net=false
- configure_flags: -Duse_opengl=false # TODO opengl is always disabled on msys2
- configure_flags: -Duse_fluidsynth=false

View file

@ -71,6 +71,7 @@ jobs:
-Duse_mt32emu=false \
-Duse_opengl=false \
-Duse_png=false \
-Duse_sdl2_image=false \
-Duse_sdl2_net=false \
-Duse_slirp=false \
build

View file

@ -73,6 +73,7 @@ jobs:
-Duse_mt32emu=false
-Duse_opengl=false
-Duse_png=false
-Duse_sdl2_image=false
-Duse_sdl2_net=false
-Duse_slirp=false
min_dependencies: true

View file

@ -191,7 +191,7 @@ jobs:
if: matrix.runner.needs_deps
run: >-
arch -arch=${{ matrix.runner.arch }} brew install librsvg tree
ccache libpng meson opusfile sdl2 sdl2_net speexdsp
ccache libpng meson opusfile sdl2 sdl2_image sdl2_net speexdsp
# Workaround frequent HTTPS-based connectivity issues
# https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/407
@ -225,7 +225,7 @@ jobs:
run: |
set -x
eval "$(${{ matrix.runner.brew_path }}/bin/brew shellenv)"
meson setup ${{ matrix.runner.build_flags }} -Ddefault_library=static -Dwrap_mode=forcefallback -Dtry_static_libs=sdl2,sdl2_net build
meson setup ${{ matrix.runner.build_flags }} -Ddefault_library=static -Dwrap_mode=forcefallback -Dtry_static_libs=sdl2,sdl2_image,sdl2_net build
meson compile -C build
- name: Upload binary

View file

@ -115,6 +115,7 @@ jobs:
# - use a minimal build because python fetching wraps segfaults under Docker
meson setup \
-Duse_fluidsynth=false \
-Duse_sdl2_image=false \
-Duse_sdl2_net=false \
-Duse_opengl=false \
-Duse_mt32emu=false \

View file

@ -89,6 +89,7 @@ jobs:
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-opusfile
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-libslirp
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-SDL2
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-SDL2_image
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-SDL2_net
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-zlib
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-speexdsp
@ -188,6 +189,7 @@ jobs:
mingw-w64-clang-${{matrix.conf.arch}}-opusfile
mingw-w64-clang-${{matrix.conf.arch}}-libslirp
mingw-w64-clang-${{matrix.conf.arch}}-SDL2
mingw-w64-clang-${{matrix.conf.arch}}-SDL2_image
mingw-w64-clang-${{matrix.conf.arch}}-SDL2_net
mingw-w64-clang-${{matrix.conf.arch}}-zlib
mingw-w64-clang-${{matrix.conf.arch}}-speexdsp

View file

@ -10,6 +10,7 @@ extraction:
- libopusfile-dev
- libpng-dev
- libsdl2-dev
- libsdl2-image-dev
- libsdl2-net-dev
- libspeexdsp-dev
- python3-pip

View file

@ -126,6 +126,7 @@ DOSBox Staging has the following library dependencies:
| [libpng](http://www.libpng.org/pub/png/libpng.html) (libpng) | n/a | PNG-encoding of screen captures | Optional | yes | yes | very common |
| [Opus File](https://opus-codec.org/) (opusfile) | n/a | CDDA playback for Opus-encoded track files | Mandatory | yes | yes | common |
| [SDL 2.0](https://github.com/libsdl-org/SDL) (sdl2) | 2.0.5 | OS-agnostic API for video, audio, and eventing | Mandatory | yes | yes | common |
| [SDL_image 2.0](https://github.com/libsdl-org/SDL_image) (sdl2-image) | 2.0.x | Screenshot of rendered output to file | Optional | yes | yes | common |
| [SDL_net 2.0](https://github.com/libsdl-org/SDL_net) (sdl2-net) | 2.0.0 | Network API for emulated serial and IPX | Optional | yes | yes | common |
| [slirp](https://gitlab.freedesktop.org/slirp) (libslirp) | 4.6.1 | Unprivileged virtual TCP/IP stack for Ethernet | Optional | yes | yes | less-common |
| [SpeexDSP](https://github.com/xiph/speexdsp) (speexdsp) | n/a | Audio resampling | Mandatory | yes | yes | common |
@ -139,14 +140,14 @@ Install build dependencies appropriate for your OS:
``` shell
# Fedora
sudo dnf install ccache gcc-c++ meson alsa-lib-devel libatomic libpng-devel \
SDL2-devel SDL2_net-devel opusfile-devel fluidsynth-devel \
mt32emu-devel libslirp-devel speexdsp-devel
SDL2-devel SDL2_image-devel SDL2_net-devel opusfile-devel \
fluidsynth-devel mt32emu-devel libslirp-devel speexdsp-devel
```
``` shell
# Debian, Ubuntu
sudo apt install ccache build-essential libasound2-dev libatomic1 libpng-dev \
libsdl2-dev libsdl2-net-dev libopusfile-dev \
libsdl2-dev libsdl2-image-dev libsdl2-net-dev libopusfile-dev \
libfluidsynth-dev libslirp-dev libspeexdsp-dev
# Install Meson on Debian-10 "Buster" or Ubuntu-20.04 and older
@ -159,21 +160,21 @@ sudo apt install meson
``` shell
# Arch, Manjaro
sudo pacman -S ccache gcc meson alsa-lib libpng sdl2 sdl2_net opusfile \
fluidsynth libslirp speexdsp
sudo pacman -S ccache gcc meson alsa-lib libpng sdl2 sdl2_image sdl2_net \
opusfile fluidsynth libslirp speexdsp
```
``` shell
# openSUSE
sudo zypper install ccache gcc gcc-c++ meson alsa-devel libatomic1 libpng-devel \
libSDL2-devel libSDL2_net-devel opusfile-devel \
fluidsynth-devel libmt32emu-devel libslirp-devel \
libSDL2-devel libSDL2_image-devel libSDL2_net-devel \
opusfile-devel fluidsynth-devel libmt32emu-devel libslirp-devel \
speexdsp
```
``` shell
# Void Linux
sudo xbps-install -S SDL2-devel SDL2_net-devel alsa-lib-devel \
sudo xbps-install -S SDL2-devel SDL2_image-devel SDL2_net-devel alsa-lib-devel \
fluidsynth-devel libiir1-devel libmt32emu-devel \
libpng-devel libslirp-devel opusfile-devel \
speexdsp-devel libatomic-devel
@ -182,7 +183,7 @@ sudo xbps-install -S SDL2-devel SDL2_net-devel alsa-lib-devel \
``` shell
# macOS
xcode-select --install
brew install ccache meson libpng sdl2 sdl2_net opusfile fluid-synth libslirp speexdsp
brew install ccache meson libpng sdl2 sdl2_image sdl2_net opusfile fluid-synth libslirp speexdsp
```
### Build and stay up-to-date with the latest sources

View file

@ -34,6 +34,7 @@ BuildRequires: make
BuildRequires: meson >= 0.54.2
BuildRequires: opusfile-devel
BuildRequires: SDL2-devel >= 2.0.5
BuildRequires: SDL2_image-devel
BuildRequires: SDL2_net-devel
BuildRequires: speexdsp-devel > 1.1.9
# mt32emu dependencies:

View file

@ -24,6 +24,7 @@ install "src/dosbox" "$dst/MacOS/"
# install "$opt/libpng/lib/libpng16.16.dylib" "$dst/MacOS/"
# install "$opt/opusfile/lib/libopusfile.0.dylib" "$dst/MacOS/"
# install "$opt/sdl2/lib/libSDL2-2.0.0.dylib" "$dst/MacOS/"
# install "$opt/sdl2_image/lib/libSDL2_image-2.0.0.dylib" "$dst/MacOS/"
# install "$opt/sdl2_net/lib/libSDL2_net-2.0.0.dylib" "$dst/MacOS/"
install -m 644 "contrib/macos/Info.plist.template" "$dst/Info.plist"
install -m 644 "contrib/macos/PkgInfo" "$dst/PkgInfo"

View file

@ -22,6 +22,7 @@
#include "dosbox.h"
#include <stdio.h>
#include <string>
class Section;
@ -45,7 +46,9 @@ bool SB_Get_Address(uint16_t &sbaddr, uint8_t &sbirq, uint8_t &sbdma);
bool TS_Get_Address(Bitu& tsaddr, Bitu& tsirq, Bitu& tsdma);
extern uint8_t adlib_commandreg;
FILE * OpenCaptureFile(const char * type,const char * ext);
std::string GetScreenshotFilename(const char *type, const char *ext);
FILE *OpenCaptureFile(const char *type, const char *ext);
void CAPTURE_AddWave(uint32_t freq, uint32_t len, int16_t * data);

View file

@ -166,6 +166,7 @@ conf_data.set10('C_NE2000', get_option('use_slirp'))
conf_data.set10('C_FLUIDSYNTH', get_option('use_fluidsynth'))
conf_data.set10('C_MT32EMU', get_option('use_mt32emu'))
conf_data.set10('C_SSHOT', get_option('use_png'))
conf_data.set10('C_SDL_IMAGE', get_option('use_sdl2_image'))
conf_data.set10('C_TRACY', get_option('tracy'))
conf_data.set10('C_FPU', true)
conf_data.set10('C_FPU_X86', host_machine.cpu_family() in ['x86', 'x86_64'])
@ -425,6 +426,17 @@ if get_option('use_sdl2_net')
)
endif
# SDL Image
sdl2_image_dep = optional_dep
if get_option('use_sdl2_image')
sdl2_image_dep = dependency(
'SDL2_image',
version: '>= 2.0.0',
static: ('sdl2_image' in static_libs_list),
not_found_message: msg.format('use_sdl2_image'),
)
endif
# OpenGL
opengl_dep = optional_dep
opengl_summary_msg = 'Disabled'
@ -713,6 +725,7 @@ third_party_deps = [
atomic_dep,
stdcppfs_dep,
sdl2_dep,
sdl2_image_dep,
threads_dep,
ghc_dep,
libiir_dep,

View file

@ -5,6 +5,13 @@ option(
description: 'Enable networking features via SDL2_net (modem, ipx)',
)
option(
'use_sdl2_image',
type: 'boolean',
value: true,
description: 'Enable screenshots of rendered output',
)
option(
'use_opengl',
type: 'combo',
@ -97,6 +104,7 @@ option(
'opusfile',
'png',
'sdl2',
'sdl2_image',
'sdl2_net',
'slirp',
'speexdsp',
@ -118,6 +126,7 @@ option(
'opusfile',
'png',
'sdl2',
'sdl2_image',
'sdl2_net',
'slirp',
'speexdsp',

View file

@ -1 +1 @@
alsa-lib-devel cmake desktop-file-utils fluidsynth-devel gcc gcc-c++ git gmock-devel gtest-devel libappstream-glib libatomic libpng-devel libslirp make meson ninja opusfile-devel SDL2-devel SDL2_net-devel speexdsp-devel
alsa-lib-devel cmake desktop-file-utils fluidsynth-devel gcc gcc-c++ git gmock-devel gtest-devel libappstream-glib libatomic libpng-devel libslirp make meson ninja opusfile-devel SDL2-devel SDL2_net-devel SDL2_image-devel speexdsp-devel

View file

@ -13,6 +13,7 @@ pcre
pkg-config
readline
sdl2
sdl2_image
sdl2_net
speexdsp
wget

View file

@ -13,6 +13,7 @@ pcre
pkg-config
readline
sdl2
sdl2_image
sdl2_net
speexdsp
wget

View file

@ -5,6 +5,7 @@ libatomic1
libopusfile-dev
libpng-dev
libsdl2-dev
libsdl2-image-dev
libsdl2-net-dev
libspeexdsp-dev
python3-setuptools

View file

@ -6,6 +6,7 @@ libatomic1
libopusfile-dev
libpng-dev
libsdl2-dev
libsdl2-image-dev
libsdl2-net-dev
libspeexdsp-dev
python3-setuptools

View file

@ -9,6 +9,7 @@ libgtest-dev
libopusfile-dev
libpng-dev
libsdl2-dev
libsdl2-image-dev
libsdl2-net-dev
libslirp-dev
libspeexdsp-dev

View file

@ -9,6 +9,7 @@ libgtest-dev
libopusfile-dev
libpng-dev
libsdl2-dev
libsdl2-image-dev
libsdl2-net-dev
libslirp-dev
libspeexdsp-dev

View file

@ -8,6 +8,7 @@ mingw-w64-x86_64-ncurses
mingw-w64-x86_64-opusfile
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-SDL2_image
mingw-w64-x86_64-SDL2_net
mingw-w64-x86_64-zlib
mingw-w64-x86_64-speexdsp

View file

@ -11,6 +11,7 @@ mingw-w64-clang-i686-libpng
mingw-w64-clang-i686-libslirp
mingw-w64-clang-i686-opusfile
mingw-w64-clang-i686-SDL2
mingw-w64-clang-i686-SDL2_image
mingw-w64-clang-i686-SDL2_net
mingw-w64-clang-i686-zlib
mingw-w64-clang-i686-speexdsp

View file

@ -11,6 +11,7 @@ mingw-w64-clang-x86_64-libpng
mingw-w64-clang-x86_64-libslirp
mingw-w64-clang-x86_64-opusfile
mingw-w64-clang-x86_64-SDL2
mingw-w64-clang-x86_64-SDL2_image
mingw-w64-clang-x86_64-SDL2_net
mingw-w64-clang-x86_64-zlib
mingw-w64-clang-x86_64-speexdsp

View file

@ -11,6 +11,7 @@ mingw-w64-i686-libpng
mingw-w64-i686-libslirp
mingw-w64-i686-opusfile
mingw-w64-i686-SDL2
mingw-w64-i686-SDL2_image
mingw-w64-i686-SDL2_net
mingw-w64-i686-zlib
mingw-w64-i686-speexdsp

View file

@ -11,6 +11,7 @@ mingw-w64-x86_64-libpng
mingw-w64-x86_64-libslirp
mingw-w64-x86_64-opusfile
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-SDL2_image
mingw-w64-x86_64-SDL2_net
mingw-w64-x86_64-zlib
mingw-w64-x86_64-speexdsp

View file

@ -109,7 +109,10 @@
// Define to 1 to enable Novell NE 2000 NIC emulation
#mesondefine C_NE2000
// Define to 1 to enable screenshots in .png format
// Define to 1 to enable rendered screenshots in .png format (using SDL2_image)
#mesondefine C_SDL_IMAGE
// Define to 1 to enable surface screenshots in .png format
#mesondefine C_SSHOT
// Define to 1 to enable the Tracy profiling server

View file

@ -16,7 +16,10 @@
/* Define to 1 to enable internal debugger, requires libcurses */
#define C_DEBUG 0
/* Define to 1 to enable screenshots, requires libpng */
/* Define to 1 to enable rendered screenshots, requires SDL_image */
#define C_SDL_IMAGE 1
/* Define to 1 to enable surface screenshots, requires libpng */
#define C_SSHOT 1
/* Define to 1 to use opengl display output support */

View file

@ -0,0 +1,4 @@
// This file exists only for MSVC builds.
// It's needed because vcpkg does not set SDL subdirectory in includes list
// for projects that do not use cmake.
#include <SDL2/SDL_image.h>

View file

@ -11,6 +11,7 @@
"libpng",
"opusfile",
"sdl2",
"sdl2-image",
"sdl2-net",
"speexdsp",
"tracy",

View file

@ -169,7 +169,7 @@
<ObjectFileName>$(IntDir)\$(ProjectName)\$(ConfigurationName)\%(RelativeDir)</ObjectFileName>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;SDL2_net.lib;winmm.lib;libpng16.lib;SDL2main.lib;SDL2.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;fluidsynth.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;SDL2_image.lib;SDL2_net.lib;winmm.lib;libpng16.lib;SDL2main.lib;SDL2.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;fluidsynth.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)\dosbox.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
@ -213,7 +213,7 @@ IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0</Command>
<ObjectFileName>$(IntDir)\$(ProjectName)\$(ConfigurationName)\%(RelativeDir)</ObjectFileName>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;SDL2_net.lib;winmm.lib;libpng16.lib;SDL2main.lib;SDL2.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;SDL2_image.lib;SDL2_net.lib;winmm.lib;libpng16.lib;SDL2main.lib;SDL2.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)\dosbox.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
@ -260,7 +260,7 @@ IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0</Command>
<ObjectFileName>$(IntDir)\$(ProjectName)\$(ConfigurationName)\%(RelativeDir)</ObjectFileName>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;winmm.lib;libpng16.lib;SDL2_net.lib;SDL2.lib;SDL2main.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;fluidsynth.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;winmm.lib;libpng16.lib;SDL2_image.lib;SDL2_net.lib;SDL2.lib;SDL2main.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;fluidsynth.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)\dosbox.exe</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile />
@ -315,7 +315,7 @@ IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0</Command>
<ObjectFileName>$(IntDir)\$(ProjectName)\$(ConfigurationName)\%(RelativeDir)</ObjectFileName>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;winmm.lib;libpng16.lib;SDL2_net.lib;SDL2.lib;SDL2main.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;fluidsynth.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;winmm.lib;libpng16.lib;SDL2_image.lib;SDL2_net.lib;SDL2.lib;SDL2main.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;fluidsynth.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)\dosbox.exe</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>
@ -372,7 +372,7 @@ IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0</Command>
<ObjectFileName>$(IntDir)\$(ProjectName)\$(ConfigurationName)\%(RelativeDir)</ObjectFileName>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;winmm.lib;libpng16.lib;SDL2_net.lib;SDL2.lib;SDL2main.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;winmm.lib;libpng16.lib;SDL2_image.lib;SDL2_net.lib;SDL2.lib;SDL2main.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)\dosbox.exe</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>
@ -428,7 +428,7 @@ IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0</Command>
<ObjectFileName>$(IntDir)\$(ProjectName)\$(ConfigurationName)\%(RelativeDir)</ObjectFileName>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;winmm.lib;libpng16.lib;SDL2_net.lib;SDL2.lib;SDL2main.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;winmm.lib;libpng16.lib;SDL2_image.lib;SDL2_net.lib;SDL2.lib;SDL2main.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;mt32emu.lib;opusfile.lib;opus.lib;ogg.lib;speexdsp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)\dosbox.exe</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>