mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-07-11 09:34:00 +02:00
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cd89473f7e | |||
| b89fed20e8 | |||
| 28af6a436e | |||
| 9c53a846b8 | |||
| 816bb4c426 | |||
| c119e5f128 | |||
| d64b23bdfe | |||
| b03f118b04 | |||
| d18ac4076f | |||
| 4620c1beb8 | |||
| 55431be957 | |||
| 18946b1d92 | |||
| c517862b3c | |||
| e8d4d6341b | |||
| 2246b6f25b | |||
| cd754fafa9 | |||
| 8660ced35f | |||
| 1c7276b4f8 | |||
| 4b793c4ad4 | |||
| e9dc24d947 | |||
| 51b712a8c9 | |||
| 1ce70fba22 | |||
| 0c06aebf72 | |||
| 12cd56e5f1 | |||
| e9cef9b76b | |||
| 7395e1ed6a | |||
| c22a7560f0 | |||
| 40c8e117c1 | |||
| fb7744625c | |||
| f11eebae9a | |||
| 762e24a110 | |||
| f0a1c1f377 | |||
| 543dde0de2 | |||
| ff5190ac66 | |||
| 410e54f0b2 | |||
| c0c5e0dc8e | |||
| 56fd26ae4f | |||
| 11550cc71a | |||
| 53e0c157f1 | |||
| e57e52c6c8 | |||
| 089160278c | |||
| a3deb185a4 | |||
| 80e813baee | |||
| ff49835b22 | |||
| 1af3e28d83 | |||
| 0dce7ddaf4 | |||
| 0d1fc16a53 | |||
| 9032008a63 | |||
| 4788d643da | |||
| e1db6c24b0 | |||
| 81f98505ca | |||
| 7270e0dfbe | |||
| bc3e3b3f9c | |||
| d7b17cd494 | |||
| e5cd034b4f | |||
| 1c6210f964 | |||
| 9ce1e45d64 | |||
| be738f0cb7 | |||
| e882e0f22c | |||
| f7a1d0f952 | |||
| 6b8990fa1a | |||
| a74cff50f8 | |||
| d4ac45a9c5 | |||
| 32aebfec1a | |||
| aee7da8068 | |||
| 078361e2e6 | |||
| e0cae9c1a9 | |||
| c8d46ee919 | |||
| c5965b3940 | |||
| affb0ee0ee | |||
| dd6ea4f22a | |||
| 006a7c8eff | |||
| 5f10f39ac0 | |||
| 6e1df7fc79 | |||
| 5cab9282e7 | |||
| 1c6d8a6f59 | |||
| c43f43e634 | |||
| 409aac2caa | |||
| 21b187dacc | |||
| a110f48fad | |||
| 1f24d20054 | |||
| 8e61b79ecf | |||
| f459c456de |
@@ -19,12 +19,36 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y upgrade
|
||||
sudo apt-get -y install cmake libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libsdl2-net-dev libfreetype6-dev \
|
||||
sudo apt-get -y install cmake libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libfreetype6-dev \
|
||||
libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev libqt6websockets6-dev libvulkan-dev \
|
||||
build-essential nasm git zip appstream xvfb qt6ct mesa-vulkan-drivers
|
||||
|
||||
# sdl3 dependencies
|
||||
sudo apt-get -y install build-essential git make \
|
||||
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
|
||||
libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev \
|
||||
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \
|
||||
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
|
||||
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev
|
||||
- name: Prepare Environment
|
||||
run: |
|
||||
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
|
||||
- name: Build SDL3
|
||||
run: |
|
||||
export sdl_dir="$(pwd)/../SDL3"
|
||||
|
||||
git clone https://github.com/libsdl-org/SDL.git "$sdl_dir" -b release-3.2.22 --depth=1
|
||||
|
||||
mkdir -p "$sdl_dir/build"
|
||||
cmake -S "$sdl_dir" -B "$sdl_dir/build" \
|
||||
-DCMAKE_BUILD_TYPE="Release" \
|
||||
-DCMAKE_INSTALL_LIBDIR="lib/x86_64-linux-gnu" \
|
||||
-DCMAKE_INSTALL_FULL_LIBDIR="/usr/lib/x86_64-linux-gnu" \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
cmake --build "$sdl_dir/build" --parallel "$(nproc)"
|
||||
sudo cmake --install "$sdl_dir/build" --prefix /usr/
|
||||
- name: Build RMG (AppImage)
|
||||
run: |
|
||||
export src_dir="$(pwd)"
|
||||
@@ -61,7 +85,7 @@ jobs:
|
||||
path: Bin/*.AppImage
|
||||
|
||||
build-windows:
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2022
|
||||
strategy:
|
||||
matrix:
|
||||
features: [ ON, OFF ]
|
||||
@@ -84,8 +108,7 @@ jobs:
|
||||
mingw-w64-ucrt-x86_64-hidapi
|
||||
mingw-w64-ucrt-x86_64-freetype
|
||||
mingw-w64-ucrt-x86_64-libpng
|
||||
mingw-w64-ucrt-x86_64-SDL2
|
||||
mingw-w64-ucrt-x86_64-SDL2_net
|
||||
mingw-w64-ucrt-x86_64-sdl3
|
||||
mingw-w64-ucrt-x86_64-qt6
|
||||
mingw-w64-ucrt-x86_64-hidapi
|
||||
mingw-w64-ucrt-x86_64-speexdsp
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# Maintainer: Rosalie Wanders <rosalie@mailbox.org>
|
||||
pkgname=rmg
|
||||
pkgver=0.7.8
|
||||
pkgver=0.8.3
|
||||
pkgrel=1
|
||||
pkgdesc="Rosalie's Mupen GUI"
|
||||
arch=('x86_64' 'aarch64')
|
||||
url="https://github.com/Rosalie241/$pkgname"
|
||||
license=('GPL3')
|
||||
|
||||
depends=("hidapi" "libsamplerate" "speexdsp" "minizip" "sdl2" "sdl2_net" "zlib" "freetype2" "qt6-base" "qt6-svg" "qt6-websockets")
|
||||
makedepends=("git" "nasm" "cmake")
|
||||
depends=("hidapi" "libsamplerate" "speexdsp" "minizip" "sdl3" "zlib" "freetype2" "qt6-base" "qt6-svg" "qt6-websockets")
|
||||
makedepends=("git" "nasm" "cmake" "vulkan-headers")
|
||||
|
||||
source=("git+https://github.com/Rosalie241/$pkgname.git#tag=v$pkgver")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Name: RMG
|
||||
Version: 0.7.8
|
||||
Version: 0.8.3
|
||||
Release: %autorelease
|
||||
Summary: Rosalie's Mupen GUI
|
||||
|
||||
@@ -14,8 +14,7 @@ BuildRequires: cmake
|
||||
BuildRequires: hidapi-devel
|
||||
BuildRequires: libsamplerate-devel
|
||||
BuildRequires: minizip-compat-devel
|
||||
BuildRequires: SDL2-devel
|
||||
BuildRequires: SDL2_net-devel
|
||||
BuildRequires: SDL3-devel
|
||||
BuildRequires: freetype-devel
|
||||
BuildRequires: mesa-libGL-devel
|
||||
BuildRequires: mesa-libGLU-devel
|
||||
@@ -28,8 +27,7 @@ BuildRequires: qt6-qtwebsockets-devel
|
||||
BuildRequires: libxkbcommon-devel
|
||||
|
||||
Requires: hidapi
|
||||
Requires: SDL2
|
||||
Requires: SDL2_net
|
||||
Requires: SDL3
|
||||
Requires: zlib-ng
|
||||
Requires: libsamplerate
|
||||
Requires: speexdsp
|
||||
|
||||
@@ -29,6 +29,71 @@
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<releases>
|
||||
<release version="v0.8.3" date="2025-09-28" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix supported 64DD games not having the transfer pak functionality enabled</li>
|
||||
<li>Fix crash in Mario Artist Talent Studio when using mupen64plus-rsp-hle since v0.8.2</li>
|
||||
<li>Fix frame count not increasing from 0 since v0.8.2</li>
|
||||
<li>Fix loading save states freezing since v0.8.2</li>
|
||||
<li>Add clear buttons to 64DD IPL settings in the settings dialog</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.8.2" date="2025-09-26" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix screenshot filename being incorrect when playing 64DD games</li>
|
||||
<li>Fix GameBoy tower functionality not working in Pokemon Stadium 1 and 2</li>
|
||||
<li>Add clear buttons to transfer pak settings in RMG-Input</li>
|
||||
<li>Add support for the GameBoy camera by implementing a SDL3 backend in mupen64plus-core</li>
|
||||
<li>Improve accuracy of RSP</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.8.1" date="2025-09-23" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix incorrect usage of 'i.e' and replace it with 'e.g.' in the settings dialog</li>
|
||||
<li>Fix 7zip archives not supporting the PPMd compression method</li>
|
||||
<li>Fix being able to open another game while emulation is being started</li>
|
||||
<li>Fix allowing drag and drop events while emulation is being started</li>
|
||||
<li>Add 'Ask for confirmation on exit while in-game' setting</li>
|
||||
<li>Migrate RMG-Audio to SDL3 (thank you loganmc10 for the help)</li>
|
||||
<li>Migrate RMG-Input to SDL3</li>
|
||||
<li>Migrate RMG to SDL3</li>
|
||||
<li>Migrate mupen64plus-core to SDL3 and SDL3_net</li>
|
||||
<li>Update GLideN64 and LZMA SDK</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.8.0" date="2025-09-10" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix 64DD games crashing in some cases since v0.7.8</li>
|
||||
<li>Add Windows Vista theme to settings on Windows (thank you RibShark)</li>
|
||||
<li>Add support for the netplay dispatch server</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.7.9" date="2025-05-19" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix netplay allocating UDP packets during emulation</li>
|
||||
<li>Fix 'Game List' and 'Game Grid' UI elements not being disabled during emulation</li>
|
||||
<li>Fix compilation error with newer minizip-ng versions</li>
|
||||
<li>Add search feature to the ROM browser</li>
|
||||
<li>Add crop settings for each side in mupen64plus-video-parallel</li>
|
||||
<li>Change default ROM search limit to 2048</li>
|
||||
<li>Update mupen64plus-video-GLideN64 and mupen64plus-rsp-hle</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.7.8" date="2025-03-23" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
|
||||
@@ -38,25 +38,25 @@ Rosalie's Mupen GUI is licensed under the [GNU General Public License v3.0](http
|
||||
* Portable Debian/Ubuntu
|
||||
|
||||
```bash
|
||||
sudo apt-get -y install cmake libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev libvulkan-dev build-essential nasm git zip ninja-build
|
||||
sudo apt-get -y install cmake libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl3-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev libvulkan-dev build-essential nasm git zip ninja-build
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
* Portable Fedora
|
||||
```bash
|
||||
sudo dnf install hidapi-devel libsamplerate-devel minizip-compat-devel SDL2-devel freetype-devel mesa-libGL-devel mesa-libGLU-devel pkgconfig zlib-ng-devel binutils-devel speexdsp-devel qt6-qtbase-devel qt6-qtsvg-devel vulkan-devel gcc-c++ nasm git ninja-build
|
||||
sudo dnf install hidapi-devel libsamplerate-devel minizip-compat-devel SDL3-devel freetype-devel mesa-libGL-devel mesa-libGLU-devel pkgconfig zlib-ng-devel binutils-devel speexdsp-devel qt6-qtbase-devel qt6-qtsvg-devel vulkan-devel gcc-c++ nasm git ninja-build
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
* Portable Arch Linux
|
||||
```bash
|
||||
sudo pacman -S --needed make cmake gcc hidapi freetype2 libpng qt6 sdl2 libsamplerate nasm minizip pkgconf vulkan-headers git
|
||||
sudo pacman -S --needed make cmake gcc hidapi freetype2 libpng qt6 sdl3 libsamplerate nasm minizip pkgconf vulkan-headers git
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
* Portable OpenSUSE Tumbleweed
|
||||
```bash
|
||||
sudo zypper install SDL2-devel cmake freetype2-devel gcc gcc-c++ libhidapi-devel libhidapi-hidraw0 libpng16-devel libsamplerate-devel make nasm ninja pkgconf-pkg-config speex-devel vulkan-devel zlib-devel qt6-tools-devel qt6-opengl-devel qt6-widgets-devel qt6-svg-devel minizip-devel git
|
||||
sudo zypper install SDL3-devel cmake freetype2-devel gcc gcc-c++ libhidapi-devel libhidapi-hidraw0 libpng16-devel libsamplerate-devel make nasm ninja pkgconf-pkg-config speex-devel vulkan-devel zlib-devel qt6-tools-devel qt6-opengl-devel qt6-widgets-devel qt6-svg-devel minizip-devel git
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
@@ -73,9 +73,9 @@ cmake --install "$build_dir" --prefix="/usr"
|
||||
```
|
||||
|
||||
#### Windows
|
||||
* Download & Install [MSYS2](https://www.msys2.org/)
|
||||
* Download & Install [MSYS2](https://www.msys2.org/) (UCRT64)
|
||||
```bash
|
||||
pacman -S --needed make mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-hidapi mingw-w64-ucrt-x86_64-freetype mingw-w64-ucrt-x86_64-libpng mingw-w64-ucrt-x86_64-qt6 mingw-w64-ucrt-x86_64-SDL2 mingw-w64-ucrt-x86_64-SDL2_net mingw-w64-ucrt-x86_64-speexdsp mingw-w64-ucrt-x86_64-libsamplerate mingw-w64-ucrt-x86_64-nasm mingw-w64-ucrt-x86_64-minizip mingw-w64-ucrt-x86_64-vulkan-headers git
|
||||
pacman -S --needed make mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-hidapi mingw-w64-ucrt-x86_64-freetype mingw-w64-ucrt-x86_64-libpng mingw-w64-ucrt-x86_64-qt6 mingw-w64-ucrt-x86_64-sdl3 mingw-w64-ucrt-x86_64-speexdsp mingw-w64-ucrt-x86_64-libsamplerate mingw-w64-ucrt-x86_64-libusb mingw-w64-ucrt-x86_64-nasm mingw-w64-ucrt-x86_64-minizip mingw-w64-ucrt-x86_64-vulkan-headers git
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
|
||||
Vendored
+20
@@ -3,6 +3,8 @@
|
||||
#
|
||||
include(ExternalProject)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
find_program(RUST_CARGO cargo)
|
||||
if(NO_RUST)
|
||||
set(BUILD_INPUT_GCA OFF)
|
||||
@@ -62,6 +64,20 @@ else()
|
||||
set(MAKE_DEBUG "0")
|
||||
endif()
|
||||
|
||||
# TODO: when SDL3_net has made a release,
|
||||
# remove the vendored SDL3_net
|
||||
set(SDL3NET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDL_net)
|
||||
set(SDL3NET_SOURCES
|
||||
${SDL3NET_DIR}/src/SDL_net.c
|
||||
)
|
||||
add_library(SDL3_net STATIC ${SDL3NET_SOURCES})
|
||||
target_include_directories(SDL3_net PRIVATE ${SDL3NET_DIR}/include)
|
||||
set(SDL3NET_CFLAGS "-DUSE_SDL3NET -I${SDL3NET_DIR}/include")
|
||||
set(SDL3NET_LDLIBS "$<TARGET_FILE:SDL3_net>")
|
||||
if (WIN32)
|
||||
set(SDL3NET_LDLIBS "${SDL3NET_LDLIBS} -liphlpapi -lws2_32")
|
||||
endif (WIN32)
|
||||
|
||||
ExternalProject_Add(mupen64plus-core
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-core/
|
||||
|
||||
@@ -76,11 +92,15 @@ ExternalProject_Add(mupen64plus-core
|
||||
TARGET=${CORE_FILE} DEBUG=${MAKE_DEBUG}
|
||||
CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
OPTFLAGS=${MAKE_OPTFLAGS}
|
||||
# TODO: when SDL3_net has made a release,
|
||||
# remove the vendored SDL3_net
|
||||
SDLNET_CFLAGS=${SDL3NET_CFLAGS} SDLNET_LDLIBS=${SDL3NET_LDLIBS}
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-core
|
||||
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-core/${CORE_FILE}
|
||||
DEPENDS SDL3_net
|
||||
)
|
||||
|
||||
set(APIDIR "${CMAKE_SOURCE_DIR}/Source/3rdParty/mupen64plus-core/src/api")
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
name: 'Setup ninja'
|
||||
description: 'Download ninja and add it to the PATH environment variable'
|
||||
inputs:
|
||||
version:
|
||||
description: 'Ninja version'
|
||||
default: '1.12.1'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: 'Calculate variables'
|
||||
id: calc
|
||||
shell: sh
|
||||
run: |
|
||||
case "${{ runner.os }}-${{ runner.arch }}" in
|
||||
"Linux-X86" | "Linux-X64")
|
||||
archive="ninja-linux.zip"
|
||||
;;
|
||||
"Linux-ARM64")
|
||||
archive="ninja-linux-aarch64.zip"
|
||||
;;
|
||||
"macOS-X86" | "macOS-X64" | "macOS-ARM64")
|
||||
archive="ninja-mac.zip"
|
||||
;;
|
||||
"Windows-X86" | "Windows-X64")
|
||||
archive="ninja-win.zip"
|
||||
;;
|
||||
"Windows-ARM64")
|
||||
archive="ninja-winarm64.zip"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
echo "archive=${archive}" >> ${GITHUB_OUTPUT}
|
||||
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
|
||||
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
|
||||
id: cache-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
|
||||
key: ${{ steps.calc.outputs.cache-key }}
|
||||
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
|
||||
if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
|
||||
- name: 'Cache ${{ steps.calc.outputs.archive }}'
|
||||
if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
|
||||
key: ${{ steps.calc.outputs.cache-key }}
|
||||
- name: 'Extract ninja'
|
||||
shell: pwsh
|
||||
run: |
|
||||
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
|
||||
- name: 'Set output variables'
|
||||
id: final
|
||||
shell: pwsh
|
||||
run: |
|
||||
echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH
|
||||
@@ -0,0 +1,90 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
name: '${{ matrix.platform.name }}'
|
||||
runs-on: '${{ matrix.platform.os }}'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: 'Linux', os: ubuntu-latest, shell: sh }
|
||||
- { name: 'MacOS', os: macos-latest, shell: sh }
|
||||
# - { name: 'Windows msys2 (mingw32)', os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
|
||||
- { name: 'Windows msys2 (mingw64)', os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
|
||||
# - { name: 'Windows msys2 (clang32)', os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
|
||||
- { name: 'Windows msys2 (clang64)', os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
|
||||
# - { name: 'Windows MSVC (x86)', os: windows-latest, shell: sh, msvc: true, msvc-arch: x86, cmake: '-DPerl_ROOT=C:/Strawberry/perl/bin/' }
|
||||
- { name: 'Windows MSVC (x64)', os: windows-latest, shell: sh, msvc: true, msvc-arch: x64, cmake: '-DPerl_ROOT=C:/Strawberry/perl/bin/' }
|
||||
# - { name: 'Windows MSVC (arm32)', os: windows-latest, shell: sh, msvc: true, msvc-arch: amd64_arm, cross: true }
|
||||
# - { name: 'Windows MSVC (arm64)', os: windows-latest, shell: sh, msvc: true, msvc-arch: amd64_arm64, cross: true }
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ matrix.platform.shell }}
|
||||
steps:
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
if: ${{ matrix.platform.msvc }}
|
||||
with:
|
||||
arch: ${{ matrix.platform.msvc-arch }}
|
||||
- name: Set up MSYS2
|
||||
if: ${{ contains(matrix.platform.shell, 'msys2') }}
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{ matrix.platform.msystem }}
|
||||
install: >-
|
||||
${{ matrix.platform.msys-env }}-cc
|
||||
${{ matrix.platform.msys-env }}-cmake
|
||||
${{ matrix.platform.msys-env }}-crt
|
||||
${{ matrix.platform.msys-env }}-ninja
|
||||
${{ matrix.platform.msys-env }}-perl
|
||||
- name: Get SDL3_net sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Ninja
|
||||
if: ${{ !contains(matrix.platform.shell, 'msys2') }}
|
||||
uses: aseprite/get-ninja@main
|
||||
- name: Set up SDL3
|
||||
uses: libsdl-org/setup-sdl@main
|
||||
id: sdl
|
||||
with:
|
||||
cmake-generator: Ninja
|
||||
version: 3-head
|
||||
sdl-test: true
|
||||
shell: ${{ matrix.platform.shell }}
|
||||
add-to-environment: true
|
||||
- name: Configure (CMake)
|
||||
run: |
|
||||
cmake -B build -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=prefix \
|
||||
-DSDLNET_WERROR=ON \
|
||||
-DSDLNET_INSTALL_MAN=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=prefix \
|
||||
${{ matrix.platform.cmake }}
|
||||
|
||||
- name: Build (CMake)
|
||||
run: |
|
||||
cmake --build build/ --verbose
|
||||
- name: Install (CMake)
|
||||
if: ${{ matrix.platform.shell == 'sh' || contains(matrix.platform.shell, 'msys2') }}
|
||||
run: |
|
||||
set -eu
|
||||
rm -fr DESTDIR-cmake
|
||||
cmake --install build/ --config Release
|
||||
echo "SDL3_net_ROOT=$(pwd)/prefix" >> $GITHUB_ENV
|
||||
( cd prefix; find . ) | LC_ALL=C sort -u
|
||||
- name: Verify CMake configuration files
|
||||
run: |
|
||||
cmake -S cmake/test -B cmake_config_build \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE
|
||||
cmake --build cmake_config_build --verbose
|
||||
|
||||
- name: Check that versioning is consistent
|
||||
# We only need to run this once: arbitrarily use the Linux build
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: ./build-scripts/test-versioning.sh
|
||||
@@ -0,0 +1,737 @@
|
||||
name: 'release'
|
||||
run-name: 'Create SDL_net release artifacts for ${{ inputs.commit }}'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
commit:
|
||||
description: 'Commit of SDL_net'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
|
||||
src:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
project: ${{ steps.releaser.outputs.project }}
|
||||
version: ${{ steps.releaser.outputs.version }}
|
||||
src-tar-gz: ${{ steps.releaser.outputs.src-tar-gz }}
|
||||
src-tar-xz: ${{ steps.releaser.outputs.src-tar-xz }}
|
||||
src-zip: ${{ steps.releaser.outputs.src-zip }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Set up SDL sources'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
path: 'SDL'
|
||||
fetch-depth: 0
|
||||
- name: 'Build Source archive'
|
||||
id: releaser
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions source \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ github.workspace }}/SDL" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store source archives'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace}}/dist'
|
||||
- name: 'Generate summary'
|
||||
run: |
|
||||
echo "Run the following commands to download all artifacts:" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
echo "mkdir -p /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "cd /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "gh run -R ${{ github.repository }} download ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
linux-verify:
|
||||
needs: [src]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sources
|
||||
path: '/tmp'
|
||||
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
|
||||
id: zip
|
||||
run: |
|
||||
set -e
|
||||
mkdir /tmp/zipdir
|
||||
cd /tmp/zipdir
|
||||
unzip "/tmp/${{ needs.src.outputs.src-zip }}"
|
||||
echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: tar
|
||||
run: |
|
||||
set -e
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "/tmp/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}'
|
||||
run: |
|
||||
set -e
|
||||
diff "${{ steps.zip.outputs.path }}" "${{ steps.tar.outputs.path }}"
|
||||
- name: 'Test versioning'
|
||||
shell: bash
|
||||
run: |
|
||||
${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Install Linux dependencies'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev \
|
||||
libusb-1.0-0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \
|
||||
libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
|
||||
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
|
||||
- name: 'Extract dependencies, build and install them'
|
||||
id: deps-build
|
||||
run: |
|
||||
tar -C /tmp -v -x -f "${{ steps.deps.outputs.dep-path }}/SDL3-${{ steps.deps.outputs.dep-sdl-version }}.tar.gz"
|
||||
cmake -S /tmp/SDL3-${{ steps.deps.outputs.dep-sdl-version }} -B /tmp/SDL-build -DCMAKE_INSTALL_PREFIX=/tmp/deps-prefix
|
||||
cmake --build /tmp/SDL-build
|
||||
cmake --install /tmp/SDL-build
|
||||
echo "path=/tmp/deps-prefix" >>$GITHUB_OUTPUT
|
||||
- name: 'CMake (configure + build)'
|
||||
run: |
|
||||
cmake \
|
||||
-S ${{ steps.tar.outputs.path }} \
|
||||
-B /tmp/build \
|
||||
-DSDL3net_SAMPLES=ON \
|
||||
-DSDL3net_TESTS=ON \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.deps-build.outputs.path }}"
|
||||
cmake --build /tmp/build --verbose
|
||||
# ctest --test-dir /tmp/build --no-tests=error --output-on-failure
|
||||
|
||||
# dmg:
|
||||
# needs: [src]
|
||||
# runs-on: macos-latest
|
||||
# outputs:
|
||||
# dmg: ${{ steps.releaser.outputs.dmg }}
|
||||
# steps:
|
||||
# - name: 'Set up Python'
|
||||
# uses: actions/setup-python@v5
|
||||
# with:
|
||||
# python-version: '3.11'
|
||||
# - name: 'Fetch build-release.py'
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# ref: ${{ inputs.commit }}
|
||||
# sparse-checkout: 'build-scripts/build-release.py'
|
||||
# - name: 'Download source archives'
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: sources
|
||||
# path: '${{ github.workspace }}'
|
||||
# - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
# id: tar
|
||||
# run: |
|
||||
# mkdir -p "${{ github.workspace }}/tardir"
|
||||
# tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
# echo "path=${{ github.workspace }}/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
## - name: 'Download external dependencies'
|
||||
## run: |
|
||||
## sh "${{ steps.tar.outputs.path }}/external/download.sh" --depth 1
|
||||
# - name: 'Build SDL3_net.dmg'
|
||||
# id: releaser
|
||||
# shell: bash
|
||||
# env:
|
||||
# GH_TOKEN: ${{ github.token }}
|
||||
# run: |
|
||||
# python build-scripts/build-release.py \
|
||||
# --actions dmg \
|
||||
# --commit ${{ inputs.commit }} \
|
||||
# --root "${{ steps.tar.outputs.path }}" \
|
||||
# --github \
|
||||
# --debug
|
||||
# - name: 'Store DMG image file'
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: dmg
|
||||
# path: '${{ github.workspace }}/dist'
|
||||
#
|
||||
# dmg-verify:
|
||||
# needs: [dmg, src]
|
||||
# runs-on: macos-latest
|
||||
# steps:
|
||||
# - name: 'Set up Python'
|
||||
# uses: actions/setup-python@v5
|
||||
# with:
|
||||
# python-version: '3.11'
|
||||
# - name: 'Fetch build-release.py'
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# ref: ${{ inputs.commit }}
|
||||
# sparse-checkout: 'build-scripts/build-release.py'
|
||||
# - name: 'Download source archives'
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: sources
|
||||
# path: '${{ github.workspace }}'
|
||||
# - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
# id: src
|
||||
# run: |
|
||||
# mkdir -p /tmp/tardir
|
||||
# tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
# echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
# - name: 'Download dependencies'
|
||||
# id: deps
|
||||
# env:
|
||||
# GH_TOKEN: ${{ github.token }}
|
||||
# run: |
|
||||
# python build-scripts/build-release.py \
|
||||
# --actions download \
|
||||
# --commit ${{ inputs.commit }} \
|
||||
# --root "${{ steps.src.outputs.path }}" \
|
||||
# --github \
|
||||
# --debug
|
||||
# - name: 'Mount dependencies'
|
||||
# id: deps-mount
|
||||
# run: |
|
||||
# hdiutil attach "${{ steps.deps.outputs.dep-path }}/SDL3-${{ steps.deps.outputs.dep-sdl-version }}.dmg"
|
||||
# sdl_mount_pount="/Volumes/SDL3"
|
||||
# if [ ! -d "$sdl_mount_pount/SDL3.xcframework" ]; then
|
||||
# echo "Cannot find SDL3.xcframework!"
|
||||
# exit 1
|
||||
# fi
|
||||
# echo "path=${sdl_mount_pount}" >>$GITHUB_OUTPUT
|
||||
# - name: 'Download ${{ needs.dmg.outputs.dmg }}'
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: dmg
|
||||
# path: '${{ github.workspace }}'
|
||||
# - name: 'Mount ${{ needs.dmg.outputs.dmg }}'
|
||||
# id: mount
|
||||
# run: |
|
||||
# hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}'
|
||||
# mount_point="/Volumes/${{ needs.src.outputs.project }}"
|
||||
# if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.xcframework" ]; then
|
||||
# echo "Cannot find ${{ needs.src.outputs.project }}.xcframework!"
|
||||
# exit 1
|
||||
# fi
|
||||
# echo "mount-point=${mount_point}">>$GITHUB_OUTPUT
|
||||
# - name: 'CMake (configure + build) Darwin'
|
||||
# run: |
|
||||
# set -e
|
||||
# cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
# -DTEST_SHARED=TRUE \
|
||||
# -DTEST_SHARED=TRUE \
|
||||
# -DTEST_STATIC=FALSE \
|
||||
# -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
# -DCMAKE_SYSTEM_NAME=Darwin \
|
||||
# -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
# -Werror=dev \
|
||||
# -B build_darwin
|
||||
# cmake --build build_darwin --config Release --verbose
|
||||
#
|
||||
# - name: 'CMake (configure + build) iOS'
|
||||
# run: |
|
||||
# cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
# -DTEST_SHARED=TRUE \
|
||||
# -DTEST_STATIC=FALSE \
|
||||
# -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
# -DCMAKE_SYSTEM_NAME=iOS \
|
||||
# -DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
# -Werror=dev \
|
||||
# -B build_ios
|
||||
# cmake --build build_ios --config Release --verbose
|
||||
# - name: 'CMake (configure + build) tvOS'
|
||||
# run: |
|
||||
# cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
# -DTEST_SHARED=TRUE \
|
||||
# -DTEST_STATIC=FALSE \
|
||||
# -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
# -DCMAKE_SYSTEM_NAME=tvOS \
|
||||
# -DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
# -Werror=dev \
|
||||
# -B build_tvos
|
||||
# cmake --build build_tvos --config Release --verbose
|
||||
# - name: 'CMake (configure + build) iOS simulator'
|
||||
# run: |
|
||||
# sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
|
||||
# echo "sysroot=$sysroot"
|
||||
# cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
# -DTEST_SHARED=TRUE \
|
||||
# -DTEST_STATIC=FALSE \
|
||||
# -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
# -DCMAKE_SYSTEM_NAME=iOS \
|
||||
# -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
# -DCMAKE_OSX_SYSROOT="${sysroot}" \
|
||||
# -Werror=dev \
|
||||
# -B build_ios_simulator
|
||||
# cmake --build build_ios_simulator --config Release --verbose
|
||||
# - name: 'CMake (configure + build) tvOS simulator'
|
||||
# run: |
|
||||
# sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
|
||||
# echo "sysroot=$sysroot"
|
||||
# cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
# -DTEST_SHARED=TRUE \
|
||||
# -DTEST_STATIC=FALSE \
|
||||
# -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
# -DCMAKE_SYSTEM_NAME=tvOS \
|
||||
# -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
# -DCMAKE_OSX_SYSROOT="${sysroot}" \
|
||||
# -Werror=dev \
|
||||
# -B build_tvos_simulator
|
||||
# cmake --build build_tvos_simulator --config Release --verbose
|
||||
msvc:
|
||||
needs: [src]
|
||||
runs-on: windows-2025
|
||||
outputs:
|
||||
VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
|
||||
VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
|
||||
VC-devel: ${{ steps.releaser.outputs.VC-devel }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
|
||||
id: zip
|
||||
run: |
|
||||
New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
|
||||
cd C:\temp
|
||||
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
|
||||
echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
|
||||
# - name: 'Download external dependencies'
|
||||
# run: |
|
||||
# ${{ steps.zip.outputs.path }}/external/Get-GitModules.ps1
|
||||
- name: 'Build MSVC binary archives'
|
||||
id: releaser
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py `
|
||||
--actions download msvc `
|
||||
--commit ${{ inputs.commit }} `
|
||||
--root "${{ steps.zip.outputs.path }}" `
|
||||
--github `
|
||||
--debug
|
||||
- name: 'Store MSVC archives'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: msvc
|
||||
path: '${{ github.workspace }}/dist'
|
||||
|
||||
msvc-verify:
|
||||
needs: [msvc, src]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: 'Fetch .github/actions/setup-ninja/action.yml'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: |
|
||||
.github/actions/setup-ninja/action.yml
|
||||
build-scripts/build-release.py
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Set up ninja
|
||||
uses: ./.github/actions/setup-ninja
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
|
||||
id: src
|
||||
run: |
|
||||
mkdir '${{ github.workspace }}/sources'
|
||||
cd '${{ github.workspace }}/sources'
|
||||
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
|
||||
echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py `
|
||||
--actions download `
|
||||
--commit ${{ inputs.commit }} `
|
||||
--root "${{ steps.src.outputs.path }}" `
|
||||
--github `
|
||||
--debug
|
||||
- name: 'Extract dependencies'
|
||||
id: deps-extract
|
||||
run: |
|
||||
mkdir '${{ github.workspace }}/deps-vc'
|
||||
cd '${{ github.workspace }}/deps-vc'
|
||||
unzip "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-VC.zip"
|
||||
echo "path=${{ github.workspace }}/deps-vc" >>$env:GITHUB_OUTPUT
|
||||
- name: 'Download MSVC binaries'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: msvc
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
|
||||
id: bin
|
||||
run: |
|
||||
mkdir '${{ github.workspace }}/vc'
|
||||
cd '${{ github.workspace }}/vc'
|
||||
unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
|
||||
echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
|
||||
- name: 'Configure vcvars x86'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64_x86
|
||||
- name: 'CMake (configure + build + tests) x86'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
|
||||
-B build_x86 `
|
||||
-GNinja `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-Werror=dev `
|
||||
-DTEST_SHARED=TRUE `
|
||||
-DTEST_STATIC=FALSE `
|
||||
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
|
||||
Start-Sleep -Seconds 2
|
||||
cmake --build build_x86 --config Release --verbose
|
||||
- name: 'Configure vcvars x64'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
- name: 'CMake (configure + build + tests) x64'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
|
||||
-B build_x64 `
|
||||
-GNinja `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-Werror=dev `
|
||||
-DTEST_SHARED=TRUE `
|
||||
-DTEST_STATIC=FALSE `
|
||||
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
|
||||
Start-Sleep -Seconds 2
|
||||
cmake --build build_x64 --config Release --verbose
|
||||
- name: 'Configure vcvars arm64'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64_arm64
|
||||
- name: 'CMake (configure + build + tests) arm64'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
|
||||
-B build_arm64 `
|
||||
-GNinja `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-Werror=dev `
|
||||
-DTEST_SHARED=TRUE `
|
||||
-DTEST_STATIC=FALSE `
|
||||
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
|
||||
Start-Sleep -Seconds 2
|
||||
cmake --build build_arm64 --config Release --verbose
|
||||
|
||||
mingw:
|
||||
needs: [src]
|
||||
runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
|
||||
outputs:
|
||||
mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
|
||||
mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Install Mingw toolchain'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: tar
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Build MinGW binary archives'
|
||||
id: releaser
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download mingw \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store MinGW archives'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mingw
|
||||
path: '${{ github.workspace }}/dist'
|
||||
|
||||
mingw-verify:
|
||||
needs: [mingw, src]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Install Mingw toolchain'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: src
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.src.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Untar and install dependencies'
|
||||
id: deps-extract
|
||||
run: |
|
||||
mkdir -p /tmp/deps-mingw/cmake
|
||||
mkdir -p /tmp/deps-mingw/i686-w64-mingw32
|
||||
mkdir -p /tmp/deps-mingw/x86_64-w64-mingw32
|
||||
|
||||
mkdir -p /tmp/deps-mingw-extract/sdl3
|
||||
tar -C /tmp/deps-mingw-extract/sdl3 -v -x -f "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-mingw.tar.gz"
|
||||
make -C /tmp/deps-mingw-extract/sdl3/SDL3-${{ steps.deps.outputs.dep-sdl-version }} install-all DESTDIR=/tmp/deps-mingw
|
||||
|
||||
# FIXME: this should be fixed in SDL3 releases after 3.1.3
|
||||
mkdir -p /tmp/deps-mingw/cmake
|
||||
cp -rv /tmp/deps-mingw-extract/sdl3/SDL3-${{ steps.deps.outputs.dep-sdl-version }}/cmake/* /tmp/deps-mingw/cmake
|
||||
- name: 'Download MinGW binaries'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: mingw
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar and install ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
|
||||
id: bin
|
||||
run: |
|
||||
mkdir -p /tmp/mingw-tardir
|
||||
tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
|
||||
make -C /tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }} install-all DESTDIR=/tmp/deps-mingw
|
||||
- name: 'CMake (configure + build) i686'
|
||||
run: |
|
||||
set -e
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DCMAKE_BUILD_TYPE="Release" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="/tmp/deps-mingw" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
|
||||
-Werror=dev \
|
||||
-B build_x86
|
||||
cmake --build build_x86 --config Release --verbose
|
||||
- name: 'CMake (configure + build) x86_64'
|
||||
run: |
|
||||
set -e
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DCMAKE_BUILD_TYPE="Release" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="/tmp/deps-mingw" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
|
||||
-Werror=dev \
|
||||
-B build_x64
|
||||
cmake --build build_x64 --config Release --verbose
|
||||
|
||||
android:
|
||||
needs: [src]
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
android-aar: ${{ steps.releaser.outputs.android-aar }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Setup Android NDK'
|
||||
uses: nttld/setup-ndk@v1
|
||||
with:
|
||||
local-cache: true
|
||||
ndk-version: r28c
|
||||
- name: 'Setup Java JDK'
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
- name: 'Install ninja'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y ninja-build
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: tar
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Build Android prefab binary archive(s)'
|
||||
id: releaser
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download android \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store Android archive(s)'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: android
|
||||
path: '${{ github.workspace }}/dist'
|
||||
|
||||
android-verify:
|
||||
needs: [android, src]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Download Android .aar archive'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: android
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: src
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Extract Android SDK from AAR'
|
||||
id: sdk
|
||||
run: |
|
||||
unzip -o "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}"
|
||||
python "${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" -o /tmp/SDL3_net-android
|
||||
echo "prefix=/tmp/SDL3_net-android" >>$GITHUB_OUTPUT
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python "${{ steps.src.outputs.path }}/build-scripts/build-release.py" \
|
||||
--actions download \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.src.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Extract dependencies'
|
||||
id: deps-extract
|
||||
run: |
|
||||
unzip -o "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-android.zip"
|
||||
python "SDL3-${{ steps.deps.outputs.dep-sdl-version }}.aar" -o /tmp/SDL3-android
|
||||
echo "sdl3-prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT
|
||||
- name: 'Install ninja'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y ninja-build
|
||||
- name: 'CMake (configure + build) x86, x64, arm32, arm64'
|
||||
run: |
|
||||
android_abis="x86 x86_64 armeabi-v7a arm64-v8a"
|
||||
for android_abi in ${android_abis}; do
|
||||
echo "Configuring ${android_abi}..."
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-GNinja \
|
||||
-DTEST_FULL=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }};${{ steps.deps-extract.outputs.sdl3-prefix }}" \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
|
||||
-DANDROID_ABI=${android_abi} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-B "${android_abi}"
|
||||
echo "Building ${android_abi}..."
|
||||
cmake --build "${android_abi}" --config Release --verbose
|
||||
done
|
||||
@@ -0,0 +1,68 @@
|
||||
build/
|
||||
buildbot/
|
||||
/VERSION.txt
|
||||
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.obj
|
||||
*.res
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.dSYM
|
||||
*,e1f
|
||||
*,ff8
|
||||
*.lnk
|
||||
*.err
|
||||
*.exp
|
||||
*.map
|
||||
*.orig
|
||||
*~
|
||||
*.swp
|
||||
*.tmp
|
||||
*.rej
|
||||
|
||||
sdl3-net.pc
|
||||
get-local-addrs
|
||||
resolve-hostnames
|
||||
simple-http-get
|
||||
voipchat
|
||||
|
||||
# for CMake
|
||||
CMakeFiles/
|
||||
CMakeScripts/
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
cmake_uninstall.cmake
|
||||
SDL3_netConfig.cmake
|
||||
SDL3_netConfigVersion.cmake
|
||||
compile_commands.json
|
||||
Makefile
|
||||
.ninja_*
|
||||
*.ninja
|
||||
SDL3_net.xcodeproj
|
||||
Debug/
|
||||
Release/
|
||||
RelWithDebInfo/
|
||||
MinSizeRel/
|
||||
dummy.sym
|
||||
|
||||
# for CLion
|
||||
.idea
|
||||
cmake-build-*
|
||||
|
||||
# for Visual C++
|
||||
.vs
|
||||
CMakeSettings.json
|
||||
out/
|
||||
/*.sln
|
||||
/*.vcxproj*
|
||||
*.dir
|
||||
*.user
|
||||
*.ncb
|
||||
*.suo
|
||||
*.sdf
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
; DO NOT EDIT (unless you know what you are doing)
|
||||
;
|
||||
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
|
||||
;
|
||||
[subrepo]
|
||||
remote = git@github.com:libsdl-org/SDL_net.git
|
||||
branch = main
|
||||
commit = 93a9967a91ccab166ecd0d7e992284066ab01cc9
|
||||
parent = 679bf7b60dca7cc8c4e892cffdeca83cfb6d1d00
|
||||
method = merge
|
||||
cmdver = 0.4.6
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
projectfullname = SDL_net
|
||||
projectshortname = SDL_net
|
||||
incsubdir = include/SDL3_net
|
||||
wikisubdir = SDL3_net
|
||||
apiprefixregex = (NET_|SDL_NET_)
|
||||
mainincludefname = SDL3_net/SDL_net.h
|
||||
versionfname = include/SDL3_net/SDL_net.h
|
||||
versionmajorregex = \A\#define\s+SDL_NET_MAJOR_VERSION\s+(\d+)\Z
|
||||
versionminorregex = \A\#define\s+SDL_NET_MINOR_VERSION\s+(\d+)\Z
|
||||
versionmicroregex = \A\#define\s+SDL_NET_MICRO_VERSION\s+(\d+)\Z
|
||||
selectheaderregex = \ASDL_net\.h\Z
|
||||
projecturl = https://libsdl.org/projects/SDL_net
|
||||
wikiurl = https://wiki.libsdl.org/SDL_net
|
||||
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
|
||||
warn_about_missing = 0
|
||||
wikipreamble = (This function is part of SDL_net, a separate library from SDL.)
|
||||
wikiheaderfiletext = Defined in [<SDL3_net/%fname%>](https://github.com/libsdl-org/SDL_net/blob/main/include/SDL3_net/%fname%)
|
||||
manpageheaderfiletext = Defined in SDL3_net/%fname%
|
||||
quickrefenabled = 1
|
||||
quickreftitle = SDL3_net API Quick Reference
|
||||
quickrefurl = https://libsdl.org/
|
||||
quickrefdesc = The latest version of this document can be found at https://wiki.libsdl.org/SDL3_net/QuickReference
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
###########################
|
||||
#
|
||||
# SDL_net shared library
|
||||
#
|
||||
###########################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := SDL3_net
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,,) \
|
||||
$(wildcard $(LOCAL_PATH)/src/*.c) \
|
||||
|
||||
LOCAL_CFLAGS =
|
||||
|
||||
# Warnings we haven't fixed (yet)
|
||||
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare
|
||||
|
||||
LOCAL_LDLIBS :=
|
||||
|
||||
LOCAL_LDFLAGS := -Wl,--no-undefined -Wl,--no-undefined-version -Wl,--version-script=$(LOCAL_PATH)/src/SDL_net.sym
|
||||
|
||||
ifeq ($(NDK_DEBUG),1)
|
||||
cmd-strip :=
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := SDL3
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
###########################
|
||||
#
|
||||
# SDL_net static library
|
||||
#
|
||||
###########################
|
||||
|
||||
LOCAL_MODULE := SDL3_net_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libSDL3_net
|
||||
|
||||
LOCAL_LDLIBS :=
|
||||
|
||||
LOCAL_LDFLAGS :=
|
||||
|
||||
LOCAL_EXPORT_LDLIBS :=
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := SDL3
|
||||
LOCAL_SHARED_LIBRARIES :=
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
+321
@@ -0,0 +1,321 @@
|
||||
cmake_minimum_required(VERSION 3.16...4.0)
|
||||
|
||||
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
set(cmake_build_type_undefined 1)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
# See docs/release_checklist.md
|
||||
set(MAJOR_VERSION 3)
|
||||
set(MINOR_VERSION 0)
|
||||
set(MICRO_VERSION 0)
|
||||
set(SDL_REQUIRED_VERSION 3.0.0)
|
||||
|
||||
project(SDL3_net
|
||||
LANGUAGES C
|
||||
VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}"
|
||||
)
|
||||
|
||||
include("${SDL3_net_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake")
|
||||
include("${SDL3_net_SOURCE_DIR}/cmake/PrivateSdlFunctions.cmake")
|
||||
include("${SDL3_net_SOURCE_DIR}/cmake/sdlmanpages.cmake")
|
||||
sdl_calculate_derived_version_variables(${MAJOR_VERSION} ${MINOR_VERSION} ${MICRO_VERSION})
|
||||
|
||||
message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(SDLNET_ROOTPROJECT ON)
|
||||
else()
|
||||
set(SDLNET_ROOTPROJECT OFF)
|
||||
endif()
|
||||
|
||||
# By default, configure in RelWithDebInfo configuration
|
||||
if(SDLNET_ROOTPROJECT)
|
||||
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(is_multi_config)
|
||||
# The first item in CMAKE_CONFIGURATION_TYPES is the default configuration
|
||||
if(DEFINED CMAKE_CONFIGURATION_TYPES AND "RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES)
|
||||
list(REMOVE_ITEM CMAKE_CONFIGURATION_TYPES "RelWithDebInfo")
|
||||
list(INSERT CMAKE_CONFIGURATION_TYPES 0 "RelWithDebInfo")
|
||||
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "CMake configuration types" FORCE)
|
||||
endif()
|
||||
else()
|
||||
if(cmake_build_type_undefined)
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "CMake build type" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(SDLNET_SAMPLES_DEFAULT ${SDLNET_ROOTPROJECT})
|
||||
if(ANDROID)
|
||||
set(SDLNET_SAMPLES_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
set(sdl3net_install_enableable ON)
|
||||
if((TARGET SDL3-shared OR TARGET SDL3-static) AND SDL_DISABLE_INSTALL)
|
||||
# Cannot install SDL3_net when SDL3 is built in same built, and is not installed.
|
||||
set(sdl3net_install_enableable OFF)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
endif()
|
||||
|
||||
include(CMakeDependentOption)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(PLATFORM_SUPPORTS_SHARED ON)
|
||||
if(EMSCRIPTEN OR VITA OR PSP OR PS2 OR N3DS OR RISCOS)
|
||||
set(PLATFORM_SUPPORTS_SHARED OFF)
|
||||
endif()
|
||||
|
||||
option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ${PLATFORM_SUPPORTS_SHARED})
|
||||
cmake_dependent_option(BUILD_SHARED_LIBS "Build the library as a shared library" ON PLATFORM_SUPPORTS_SHARED OFF)
|
||||
|
||||
cmake_dependent_option(SDLNET_INSTALL "Enable SDL3_net install target" ${SDLNET_ROOTPROJECT} "${sdl3net_install_enableable}" OFF)
|
||||
cmake_dependent_option(SDLNET_INSTALL_MAN "Install man pages for SDL3_net" OFF "SDLNET_INSTALL" OFF)
|
||||
cmake_dependent_option(SDLNET_RELOCATABLE "Create relocatable SDL_net package" "${MSVC}" SDLNET_INSTALL OFF)
|
||||
option(SDLNET_WERROR "Treat warnings as errors" OFF)
|
||||
|
||||
option(SDLNET_SAMPLES "Build the SDL3_net sample program(s)" ${SDLNET_SAMPLES_DEFAULT})
|
||||
cmake_dependent_option(SDLNET_SAMPLES_INSTALL "Install the SDL3_net sample program(s)" OFF "SDLNET_SAMPLES;SDLNET_INSTALL" OFF)
|
||||
|
||||
# Save BUILD_SHARED_LIBS variable
|
||||
set(SDLNET_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
||||
|
||||
set(sdl_required_components Headers)
|
||||
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
set(sdl3_net_target_name SDL3_net-shared)
|
||||
set(sdl3_target_name SDL3::SDL3-shared)
|
||||
|
||||
list(APPEND sdl_required_components SDL3-shared)
|
||||
else()
|
||||
set(sdl3_net_target_name SDL3_net-static)
|
||||
set(sdl3_target_name SDL3::SDL3)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET SDL3::Headers OR NOT TARGET ${sdl3_target_name})
|
||||
find_package(SDL3 ${SDL_REQUIRED_VERSION} REQUIRED COMPONENTS ${sdl_required_components})
|
||||
endif()
|
||||
|
||||
set(PC_LIBS)
|
||||
set(PC_REQUIRES)
|
||||
|
||||
add_library(${sdl3_net_target_name} src/SDL_net.c)
|
||||
add_library(SDL3_net::${sdl3_net_target_name} ALIAS ${sdl3_net_target_name})
|
||||
set_property(TARGET ${sdl3_net_target_name} PROPERTY C_STANDARD 99)
|
||||
if(NOT TARGET SDL3_net::SDL3_net)
|
||||
add_library(SDL3_net::SDL3_net ALIAS ${sdl3_net_target_name})
|
||||
endif()
|
||||
target_include_directories(${sdl3_net_target_name}
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
target_compile_definitions(${sdl3_net_target_name} PRIVATE
|
||||
BUILD_SDL
|
||||
SDL_BUILD_MAJOR_VERSION=${MAJOR_VERSION}
|
||||
SDL_BUILD_MINOR_VERSION=${MINOR_VERSION}
|
||||
SDL_BUILD_MICRO_VERSION=${MICRO_VERSION}
|
||||
)
|
||||
target_link_libraries(${sdl3_net_target_name} PUBLIC SDL3::Headers)
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
target_link_libraries(${sdl3_net_target_name} PRIVATE SDL3::SDL3-shared)
|
||||
endif()
|
||||
sdl_add_warning_options(${sdl3_net_target_name} WARNING_AS_ERROR ${SDLNET_WERROR})
|
||||
if(WIN32)
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
target_sources(${sdl3_net_target_name} PRIVATE
|
||||
src/version.rc
|
||||
)
|
||||
if(MINGW)
|
||||
target_link_options(${sdl3_net_target_name} PRIVATE -static-libgcc)
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(${sdl3_net_target_name} PRIVATE iphlpapi ws2_32)
|
||||
list(APPEND PC_LIBS -liphlpapi -lws2_32)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
|
||||
target_link_libraries(${sdl3_net_target_name} PRIVATE network)
|
||||
endif()
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
OUTPUT_NAME "SDL3_net"
|
||||
DEFINE_SYMBOL DLL_EXPORT
|
||||
EXPORT_NAME ${sdl3_net_target_name}
|
||||
C_VISIBILITY_PRESET "hidden"
|
||||
)
|
||||
|
||||
sdl_target_link_option_version_file(${sdl3_net_target_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/SDL_net.sym")
|
||||
|
||||
if(NOT ANDROID)
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
SOVERSION "${SO_VERSION_MAJOR}"
|
||||
VERSION "${SO_VERSION}"
|
||||
)
|
||||
if(APPLE)
|
||||
cmake_minimum_required(VERSION 3.17...3.28)
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
MACHO_COMPATIBILITY_VERSION "${DYLIB_COMPAT_VERSION}"
|
||||
MACHO_CURRENT_VERSION "${DYLIB_CURRENT_VERSION}"
|
||||
)
|
||||
sdl_no_deprecated_errors(${sdl3_net_target_name})
|
||||
endif()
|
||||
endif()
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
if(WIN32)
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
PREFIX ""
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(MSVC)
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
OUTPUT_NAME "SDL3_net-static"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use `Compatible Interface Properties` to ensure a shared SDL3_net is built with a shared SDL3
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
set_property(TARGET ${sdl3_net_target_name} PROPERTY INTERFACE_SDL3_SHARED TRUE)
|
||||
set_property(TARGET ${sdl3_net_target_name} APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL3_SHARED)
|
||||
endif()
|
||||
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
sdl_target_link_options_no_undefined(${sdl3_net_target_name})
|
||||
endif()
|
||||
|
||||
if(SDLNET_INSTALL)
|
||||
install(
|
||||
TARGETS ${sdl3_net_target_name}
|
||||
EXPORT SDL3NetExports
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT library
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT library
|
||||
)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/SDL3_net/SDL_net.h"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3_net" COMPONENT devel
|
||||
)
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(SDLNET_INSTALL_CMAKEDIR_ROOT_DEFAULT "cmake")
|
||||
else()
|
||||
set(SDLNET_INSTALL_CMAKEDIR_ROOT_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake")
|
||||
endif()
|
||||
set(SDLNET_INSTALL_CMAKEDIR_ROOT "${SDLNET_INSTALL_CMAKEDIR_ROOT_DEFAULT}" CACHE STRING "Root folder where to install SDL3_netConfig.cmake related files (SDL3_net subfolder for MSVC projects)")
|
||||
set(SDLNET_PKGCONFIG_INSTALLDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(SDLNET_INSTALL_CMAKEDIR "${SDLNET_INSTALL_CMAKEDIR_ROOT}")
|
||||
set(LICENSES_PREFIX "licenses/SDL3_net")
|
||||
else()
|
||||
set(SDLNET_INSTALL_CMAKEDIR "${SDLNET_INSTALL_CMAKEDIR_ROOT}/SDL3_net")
|
||||
set(LICENSES_PREFIX "${CMAKE_INSTALL_DATAROOTDIR}/licenses/SDL3_net")
|
||||
endif()
|
||||
|
||||
configure_package_config_file(cmake/SDL3_netConfig.cmake.in SDL3_netConfig.cmake
|
||||
INSTALL_DESTINATION "${SDLNET_INSTALL_CMAKEDIR}"
|
||||
)
|
||||
write_basic_package_version_file("${PROJECT_BINARY_DIR}/SDL3_netConfigVersion.cmake"
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/SDL3_netConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/SDL3_netConfigVersion.cmake"
|
||||
DESTINATION "${SDLNET_INSTALL_CMAKEDIR}"
|
||||
COMPONENT devel
|
||||
)
|
||||
install(EXPORT SDL3NetExports
|
||||
FILE ${sdl3_net_target_name}-targets.cmake
|
||||
NAMESPACE SDL3_net::
|
||||
DESTINATION "${SDLNET_INSTALL_CMAKEDIR}"
|
||||
COMPONENT devel
|
||||
)
|
||||
|
||||
if(SDLNET_RELOCATABLE)
|
||||
file(RELATIVE_PATH SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/${SDLNET_PKGCONFIG_INSTALLDIR}" "${CMAKE_INSTALL_PREFIX}")
|
||||
string(REGEX REPLACE "[/]+$" "" SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}")
|
||||
set(SDL_PKGCONFIG_PREFIX "\${pcfiledir}/${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}")
|
||||
else()
|
||||
set(SDL_PKGCONFIG_PREFIX "${CMAKE_PREFIX_PATH}")
|
||||
endif()
|
||||
|
||||
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(INCLUDEDIR_FOR_PKG_CONFIG "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
else()
|
||||
set(INCLUDEDIR_FOR_PKG_CONFIG "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
endif()
|
||||
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
|
||||
set(LIBDIR_FOR_PKG_CONFIG "${CMAKE_INSTALL_LIBDIR}")
|
||||
else()
|
||||
set(LIBDIR_FOR_PKG_CONFIG "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
string(JOIN " " PC_REQUIRES ${PC_REQUIRES})
|
||||
string(JOIN " " PC_LIBS ${PC_LIBS})
|
||||
configure_file(cmake/sdl3-net.pc.in sdl3-net.pc @ONLY)
|
||||
|
||||
# Always install sdl3-net.pc file: libraries might be different between config modes
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sdl3-net.pc"
|
||||
DESTINATION "${SDLNET_PKGCONFIG_INSTALLDIR}" COMPONENT devel)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(pdbdir "${CMAKE_INSTALL_BINDIR}")
|
||||
else()
|
||||
set(pdbdir "${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
if(MSVC)
|
||||
SDL_install_pdb("${sdl3_net_target_name}" "${pdbdir}")
|
||||
endif()
|
||||
|
||||
install(FILES "LICENSE.txt"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}"
|
||||
COMPONENT library
|
||||
)
|
||||
|
||||
export(TARGETS ${sdl3_net_target_name} NAMESPACE "SDL3_net::" FILE "${sdl3_net_target_name}-targets.cmake")
|
||||
|
||||
if(SDLNET_INSTALL_MAN)
|
||||
sdl_get_git_revision_hash(SDLNET_REVISION)
|
||||
SDL_generate_manpages(
|
||||
HEADERS_DIR "${PROJECT_SOURCE_DIR}/include/SDL3_net"
|
||||
SYMBOL "NET_Init"
|
||||
WIKIHEADERS_PL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build-scripts/wikiheaders.pl"
|
||||
REVISION "${SDLNET_REVISION}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDLNET_SAMPLES)
|
||||
function(add_sdl_net_example_executable TARGET)
|
||||
if(ANDROID)
|
||||
add_library(${TARGET} SHARED ${ARGN})
|
||||
else()
|
||||
add_executable(${TARGET} ${ARGN})
|
||||
endif()
|
||||
sdl_add_warning_options(${TARGET} WARNING_AS_ERROR ${SDLTTF_WERROR})
|
||||
sdl_target_link_options_no_undefined(${TARGET})
|
||||
target_link_libraries(${TARGET} PRIVATE SDL3_net::${sdl3_net_target_name})
|
||||
target_link_libraries(${TARGET} PRIVATE ${sdl3_target_name})
|
||||
set_property(TARGET ${TARGET} PROPERTY C_STANDARD 99)
|
||||
set_property(TARGET ${TARGET} PROPERTY C_EXTENSIONS FALSE)
|
||||
|
||||
if(SDLNET_SAMPLES_INSTALL)
|
||||
install(TARGETS ${TARGET}
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL3_net"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
add_sdl_net_example_executable(voipchat examples/voipchat.c)
|
||||
add_sdl_net_example_executable(simple-http-get examples/simple-http-get.c)
|
||||
add_sdl_net_example_executable(resolve-hostnames examples/resolve-hostnames.c)
|
||||
add_sdl_net_example_executable(get-local-addrs examples/get-local-addrs.c)
|
||||
add_sdl_net_example_executable(echo-server examples/echo-server.c)
|
||||
|
||||
# Build at least one example in C90
|
||||
set_property(TARGET get-local-addrs PROPERTY C_STANDARD 90)
|
||||
endif()
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
# SDL_net 3.0
|
||||
|
||||
The latest version of this library is available from GitHub:
|
||||
|
||||
https://github.com/libsdl-org/SDL_net/releases
|
||||
|
||||
This is a portable network library for use with SDL. It's goal is to
|
||||
simplify the use of the usual socket interfaces and use SDL infrastructure
|
||||
to handle some portability things (such as threading and reporting
|
||||
errors).
|
||||
|
||||
It is available under the zlib license, found in the file LICENSE.txt.
|
||||
The API can be found in the file SDL_net.h and online at https://wiki.libsdl.org/SDL3_net
|
||||
This library supports most platforms that offer both SDL3 and networking.
|
||||
|
||||
This is a work in progress!
|
||||
|
||||
Enjoy!
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3_net", "SDL_net.vcxproj", "{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get-local-addrs", "examples\get-local-addrs.vcxproj", "{7B1F60CD-2A09-4514-937C-D9DD044428FB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "resolve-hostnames", "examples\resolve-hostnames.vcxproj", "{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple-http-get", "examples\simple-http-get.vcxproj", "{35F14669-ED09-4105-A035-7984B94FDFBC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "voipchat", "examples\voipchat.vcxproj", "{A01E2216-139A-480E-8458-03CB4E90FE61}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "echo-server", "examples\echo-server.vcxproj", "{DFDBDF0E-87C3-4421-B6D1-90B2C5C28C2B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|x64.Build.0 = Debug|x64
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|Win32.Build.0 = Release|Win32
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|x64.ActiveCfg = Release|x64
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|x64.Build.0 = Release|x64
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.Build.0 = Debug|x64
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.Build.0 = Release|Win32
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.ActiveCfg = Release|x64
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.Build.0 = Release|x64
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Debug|x64.Build.0 = Debug|x64
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Release|Win32.Build.0 = Release|Win32
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Release|x64.ActiveCfg = Release|x64
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Release|x64.Build.0 = Release|x64
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Debug|x64.Build.0 = Debug|x64
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Release|Win32.Build.0 = Release|Win32
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Release|x64.ActiveCfg = Release|x64
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Release|x64.Build.0 = Release|x64
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Debug|x64.Build.0 = Debug|x64
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Release|Win32.Build.0 = Release|Win32
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Release|x64.ActiveCfg = Release|x64
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
{DFDBDF0E-87C3-4421-B6D1-90B2C5C28C2B} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F2325A01-6A77-410B-B0DA-E0F6B9313F15}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>SDL3_net</ProjectName>
|
||||
<ProjectGuid>{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}</ProjectGuid>
|
||||
<RootNamespace>SDL_net</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(ProjectDir)..\..\SDL\include;$(ProjectDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(ProjectDir)..\..\SDL\include;$(ProjectDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(ProjectDir)..\..\SDL\include;$(ProjectDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(ProjectDir)..\..\SDL\include;$(ProjectDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/SDL3_net.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/SDL3_net.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/SDL3_net.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/SDL3_net.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\SDL_net.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\SDL3_net/SDL_net.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\src\version.rc">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Sources">
|
||||
<UniqueIdentifier>{2cc01156-0219-4532-b5cc-4deb572c8d16}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Public Headers">
|
||||
<UniqueIdentifier>{64a63be2-c42b-4b99-a06a-61d4cc4efa21}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\SDL_net.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\SDL3_net/SDL_net.h">
|
||||
<Filter>Public Headers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\src\version.rc">
|
||||
<Filter>Sources</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete
|
||||
rm -rvf Win32 */Win32 x64 */x64
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DFDBDF0E-87C3-4421-B6D1-90B2C5C28C2B}</ProjectGuid>
|
||||
<RootNamespace>echo-server</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\echo-server.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7B1F60CD-2A09-4514-937C-D9DD044428FB}</ProjectGuid>
|
||||
<RootNamespace>get-local-addrs</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\get-local-addrs.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}</ProjectGuid>
|
||||
<RootNamespace>resolve-hostnames</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\resolve-hostnames.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{35F14669-ED09-4105-A035-7984B94FDFBC}</ProjectGuid>
|
||||
<RootNamespace>simple-http-get</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\simple-http-get.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A01E2216-139A-480E-8458-03CB4E90FE61}</ProjectGuid>
|
||||
<RootNamespace>voipchat</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\voipchat.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
+1561
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86)
|
||||
|
||||
find_program(CMAKE_C_COMPILER NAMES i686-w64-mingw32-gcc)
|
||||
find_program(CMAKE_CXX_COMPILER NAMES i686-w64-mingw32-g++)
|
||||
find_program(CMAKE_RC_COMPILER NAMES i686-w64-mingw32-windres windres)
|
||||
|
||||
if(NOT CMAKE_C_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_RC_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.")
|
||||
endif()
|
||||
@@ -0,0 +1,18 @@
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
find_program(CMAKE_C_COMPILER NAMES x86_64-w64-mingw32-gcc)
|
||||
find_program(CMAKE_CXX_COMPILER NAMES x86_64-w64-mingw32-g++)
|
||||
find_program(CMAKE_RC_COMPILER NAMES x86_64-w64-mingw32-windres windres)
|
||||
|
||||
if(NOT CMAKE_C_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_RC_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.")
|
||||
endif()
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def determine_remote() -> str:
|
||||
text = (ROOT / "build-scripts/release-info.json").read_text()
|
||||
release_info = json.loads(text)
|
||||
if "remote" in release_info:
|
||||
return release_info["remote"]
|
||||
project_with_version = release_info["name"]
|
||||
project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
|
||||
return f"libsdl-org/{project}"
|
||||
|
||||
|
||||
def main():
|
||||
default_remote = determine_remote()
|
||||
|
||||
parser = argparse.ArgumentParser(allow_abbrev=False)
|
||||
parser.add_argument("--ref", required=True, help=f"Name of branch or tag containing release.yml")
|
||||
parser.add_argument("--remote", "-R", default=default_remote, help=f"Remote repo (default={default_remote})")
|
||||
parser.add_argument("--commit", help=f"Input 'commit' of release.yml (default is the hash of the ref)")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.commit is None:
|
||||
args.commit = subprocess.check_output(["git", "rev-parse", args.ref], cwd=ROOT, text=True).strip()
|
||||
|
||||
|
||||
print(f"Running release.yml workflow:")
|
||||
print(f" remote = {args.remote}")
|
||||
print(f" ref = {args.ref}")
|
||||
print(f" commit = {args.commit}")
|
||||
|
||||
subprocess.check_call(["gh", "-R", args.remote, "workflow", "run", "release.yml", "--ref", args.ref, "-f", f"commit={args.commit}"], cwd=ROOT)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
|
||||
designed to make it easy to write multi-media software, such as games
|
||||
and emulators.
|
||||
|
||||
The Simple DirectMedia Layer library source code is available from:
|
||||
https://www.libsdl.org/
|
||||
|
||||
This library is distributed under the terms of the zlib license:
|
||||
http://www.zlib.net/zlib_license.html
|
||||
|
||||
# @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar
|
||||
|
||||
This Android archive allows use of @<@PROJECT_NAME@>@ in your Android project, without needing to copy any SDL source.
|
||||
|
||||
## Gradle integration
|
||||
|
||||
For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/).
|
||||
|
||||
Copy the aar archive (@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar) to a `app/libs` directory of your project.
|
||||
|
||||
In `app/build.gradle` of your Android project, add:
|
||||
```
|
||||
android {
|
||||
/* ... */
|
||||
buildFeatures {
|
||||
prefab true
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation files('libs/@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar')
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
If you're using CMake, add the following to your CMakeLists.txt:
|
||||
```
|
||||
find_package(@<@PROJECT_NAME@>@ REQUIRED CONFIG)
|
||||
target_link_libraries(yourgame PRIVATE @<@PROJECT_NAME@>@::@<@PROJECT_NAME@>@)
|
||||
```
|
||||
|
||||
If you use ndk-build, add the following before `include $(BUILD_SHARED_LIBRARY)` to your `Android.mk`:
|
||||
```
|
||||
LOCAL_SHARED_LIBARARIES := @<@PROJECT_NAME@>@
|
||||
```
|
||||
And add the following at the bottom:
|
||||
```
|
||||
# https://google.github.io/prefab/build-systems.html
|
||||
|
||||
# Add the prefab modules to the import path.
|
||||
$(call import-add-path,/out)
|
||||
|
||||
# Import @<@PROJECT_NAME@>@ so we can depend on it.
|
||||
$(call import-module,prefab/@<@PROJECT_NAME@>@)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Other build systems (advanced)
|
||||
|
||||
If you want to build a project without Gradle,
|
||||
running the following command will extract the Android archive into a more common directory structure.
|
||||
```
|
||||
python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o android_prefix
|
||||
```
|
||||
Add `--help` for a list of all available options.
|
||||
|
||||
|
||||
Look at the example programs in ./examples (of the source archive), and check out online documentation:
|
||||
https://wiki.libsdl.org/SDL3/FrontPage
|
||||
|
||||
Join the SDL discourse server if you want to join the community:
|
||||
https://discourse.libsdl.org/
|
||||
|
||||
|
||||
That's it!
|
||||
Sam Lantinga <slouken@libsdl.org>
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Create a @<@PROJECT_NAME@>@ SDK prefix from an Android archive
|
||||
This file is meant to be placed in a the root of an android .aar archive
|
||||
|
||||
Example usage:
|
||||
```sh
|
||||
python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o /usr/opt/android-sdks
|
||||
cmake -S my-project \
|
||||
-DCMAKE_PREFIX_PATH=/usr/opt/android-sdks \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
|
||||
-B build-arm64 -DANDROID_ABI=arm64-v8a \
|
||||
-DCMAKE_BUILD_TYPE=Releaase
|
||||
cmake --build build-arm64
|
||||
```
|
||||
"""
|
||||
import argparse
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import stat
|
||||
import zipfile
|
||||
|
||||
|
||||
AAR_PATH = pathlib.Path(__file__).resolve().parent
|
||||
ANDROID_ARCHS = { "armeabi-v7a", "arm64-v8a", "x86", "x86_64" }
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Convert a @<@PROJECT_NAME@>@ Android .aar archive into a SDK",
|
||||
allow_abbrev=False,
|
||||
)
|
||||
parser.add_argument("--version", action="version", version="@<@PROJECT_NAME@>@ @<@PROJECT_VERSION@>@")
|
||||
parser.add_argument("-o", dest="output", type=pathlib.Path, required=True, help="Folder where to store the SDK")
|
||||
args = parser.parse_args()
|
||||
|
||||
print(f"Creating a @<@PROJECT_NAME@>@ SDK at {args.output}...")
|
||||
|
||||
prefix = args.output
|
||||
incdir = prefix / "include"
|
||||
libdir = prefix / "lib"
|
||||
|
||||
RE_LIB_MODULE_ARCH = re.compile(r"prefab/modules/(?P<module>[A-Za-z0-9_-]+)/libs/android\.(?P<arch>[a-zA-Z0-9_-]+)/(?P<filename>lib[A-Za-z0-9_]+\.(?:so|a))")
|
||||
RE_INC_MODULE_ARCH = re.compile(r"prefab/modules/(?P<module>[A-Za-z0-9_-]+)/include/(?P<header>[a-zA-Z0-9_./-]+)")
|
||||
RE_LICENSE = re.compile(r"(?:.*/)?(?P<filename>(?:license|copying)(?:\.md|\.txt)?)", flags=re.I)
|
||||
RE_PROGUARD = re.compile(r"(?:.*/)?(?P<filename>proguard.*\.(?:pro|txt))", flags=re.I)
|
||||
RE_CMAKE = re.compile(r"(?:.*/)?(?P<filename>.*\.cmake)", flags=re.I)
|
||||
|
||||
with zipfile.ZipFile(AAR_PATH) as zf:
|
||||
project_description = json.loads(zf.read("description.json"))
|
||||
project_name = project_description["name"]
|
||||
project_version = project_description["version"]
|
||||
licensedir = prefix / "share/licenses" / project_name
|
||||
cmakedir = libdir / "cmake" / project_name
|
||||
javadir = prefix / "share/java" / project_name
|
||||
javadocdir = prefix / "share/javadoc" / project_name
|
||||
|
||||
def read_zipfile_and_write(path: pathlib.Path, zippath: str):
|
||||
data = zf.read(zippath)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_bytes(data)
|
||||
|
||||
for zip_info in zf.infolist():
|
||||
zippath = zip_info.filename
|
||||
if m := RE_LIB_MODULE_ARCH.match(zippath):
|
||||
lib_path = libdir / m["arch"] / m["filename"]
|
||||
read_zipfile_and_write(lib_path, zippath)
|
||||
if m["filename"].endswith(".so"):
|
||||
os.chmod(lib_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
|
||||
|
||||
elif m := RE_INC_MODULE_ARCH.match(zippath):
|
||||
header_path = incdir / m["header"]
|
||||
read_zipfile_and_write(header_path, zippath)
|
||||
elif m:= RE_LICENSE.match(zippath):
|
||||
license_path = licensedir / m["filename"]
|
||||
read_zipfile_and_write(license_path, zippath)
|
||||
elif m:= RE_PROGUARD.match(zippath):
|
||||
proguard_path = javadir / m["filename"]
|
||||
read_zipfile_and_write(proguard_path, zippath)
|
||||
elif m:= RE_CMAKE.match(zippath):
|
||||
cmake_path = cmakedir / m["filename"]
|
||||
read_zipfile_and_write(cmake_path, zippath)
|
||||
elif zippath == "classes.jar":
|
||||
versioned_jar_path = javadir / f"{project_name}-{project_version}.jar"
|
||||
unversioned_jar_path = javadir / f"{project_name}.jar"
|
||||
read_zipfile_and_write(versioned_jar_path, zippath)
|
||||
os.symlink(src=versioned_jar_path.name, dst=unversioned_jar_path)
|
||||
elif zippath == "classes-sources.jar":
|
||||
jarpath = javadir / f"{project_name}-{project_version}-sources.jar"
|
||||
read_zipfile_and_write(jarpath, zippath)
|
||||
elif zippath == "classes-doc.jar":
|
||||
jarpath = javadocdir / f"{project_name}-{project_version}-javadoc.jar"
|
||||
read_zipfile_and_write(jarpath, zippath)
|
||||
|
||||
print("... done")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
# SDL CMake configuration file:
|
||||
# This file is meant to be placed in lib/cmake/SDL3_net subfolder of a reconstructed Android SDL3_net SDK
|
||||
|
||||
cmake_minimum_required(VERSION 3.0...3.28)
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL3_net PROPERTIES
|
||||
URL "https://www.libsdl.org/projects/SDL_net/"
|
||||
DESCRIPTION "SDL_net is a simple, cross-platform wrapper over sockets"
|
||||
)
|
||||
|
||||
# Copied from `configure_package_config_file`
|
||||
macro(set_and_check _var _file)
|
||||
set(${_var} "${_file}")
|
||||
if(NOT EXISTS "${_file}")
|
||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Copied from `configure_package_config_file`
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
set(SDL3_net_FOUND TRUE)
|
||||
|
||||
if(SDL_CPU_X86)
|
||||
set(_sdl_arch_subdir "x86")
|
||||
elseif(SDL_CPU_X64)
|
||||
set(_sdl_arch_subdir "x86_64")
|
||||
elseif(SDL_CPU_ARM32)
|
||||
set(_sdl_arch_subdir "armeabi-v7a")
|
||||
elseif(SDL_CPU_ARM64)
|
||||
set(_sdl_arch_subdir "arm64-v8a")
|
||||
else()
|
||||
set(SDL3_net_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_filename_component(_sdl3net_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
||||
get_filename_component(_sdl3net_prefix "${_sdl3net_prefix}/.." ABSOLUTE)
|
||||
get_filename_component(_sdl3net_prefix "${_sdl3net_prefix}/.." ABSOLUTE)
|
||||
set_and_check(_sdl3net_prefix "${_sdl3net_prefix}")
|
||||
set_and_check(_sdl3net_include_dirs "${_sdl3net_prefix}/include")
|
||||
|
||||
set_and_check(_sdl3net_lib "${_sdl3net_prefix}/lib/${_sdl_arch_subdir}/libSDL3_net.so")
|
||||
|
||||
unset(_sdl_arch_subdir)
|
||||
unset(_sdl3net_prefix)
|
||||
|
||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||
# This is done for compatibility with CMake generated SDL3_net-target.cmake files.
|
||||
|
||||
set(SDL3_net_SDL3_net-shared_FOUND FALSE)
|
||||
if(EXISTS "${_sdl3net_lib}")
|
||||
if(NOT TARGET SDL3_net::SDL3_net-shared)
|
||||
add_library(SDL3_net::SDL3_net-shared SHARED IMPORTED)
|
||||
set_target_properties(SDL3_net::SDL3_net-shared
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${_sdl3net_lib}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3net_include_dirs}"
|
||||
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
||||
INTERFACE_SDL3_SHARED "ON"
|
||||
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
|
||||
INTERFACE_SDL_VERSION "SDL3"
|
||||
)
|
||||
endif()
|
||||
set(SDL3_net_SDL3_net-shared_FOUND TRUE)
|
||||
endif()
|
||||
unset(_sdl3net_include_dirs)
|
||||
unset(_sdl3net_lib)
|
||||
|
||||
set(SDL3_net_SDL3_net-static_FOUND FALSE)
|
||||
|
||||
if(SDL3_net_SDL3_net-shared_FOUND)
|
||||
set(SDL3_net_SDL3_net_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.18")
|
||||
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
||||
add_library(${NEW_TARGET} INTERFACE IMPORTED)
|
||||
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
|
||||
else()
|
||||
add_library(${NEW_TARGET} ALIAS ${TARGET})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Make sure SDL3_net::SDL3_net always exists
|
||||
if(NOT TARGET SDL3_net::SDL3_net)
|
||||
if(TARGET SDL3_net::SDL3_net-shared)
|
||||
_sdl_create_target_alias_compat(SDL3_net::SDL3_net SDL3_net::SDL3_net-shared)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_required_components(SDL3_net)
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
# SDL_net CMake version configuration file:
|
||||
# This file is meant to be placed in a lib/cmake/SDL3_net subfolder of a reconstructed Android SDL3_net SDK
|
||||
|
||||
set(PACKAGE_VERSION "@<@PROJECT_VERSION@>@")
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# Package version must be in the requested version range
|
||||
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if the using project doesn't have CMAKE_SIZEOF_VOID_P set, fail.
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake")
|
||||
SDL_DetectTargetCPUArchitectures(_detected_archs)
|
||||
|
||||
# check that the installed version has a compatible architecture as the one which is currently searching:
|
||||
if(NOT(SDL_CPU_X86 OR SDL_CPU_X64 OR SDL_CPU_ARM32 OR SDL_CPU_ARM64))
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (X86,X64,ARM32,ARM64)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "@<@PROJECT_NAME@>@",
|
||||
"version": "@<@PROJECT_VERSION@>@",
|
||||
"git-hash": "@<@PROJECT_COMMIT@>@"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Makefile for installing the mingw32 version of the SDL_net library
|
||||
|
||||
DESTDIR = /usr/local
|
||||
ARCHITECTURES := i686-w64-mingw32 x86_64-w64-mingw32
|
||||
|
||||
default:
|
||||
@echo "Run \"make install-i686\" to install 32-bit"
|
||||
@echo "Run \"make install-x86_64\" to install 64-bit"
|
||||
@echo "Run \"make install-all\" to install both"
|
||||
@echo "Add DESTDIR=/custom/path to change the destination folder"
|
||||
|
||||
install:
|
||||
@if test -d $(ARCH) && test -d $(DESTDIR); then \
|
||||
(cd $(ARCH) && cp -rv bin include lib share $(DESTDIR)/); \
|
||||
else \
|
||||
echo "*** ERROR: $(ARCH) or $(DESTDIR) does not exist!"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
install-i686:
|
||||
$(MAKE) install ARCH=i686-w64-mingw32
|
||||
|
||||
install-x86_64:
|
||||
$(MAKE) install ARCH=x86_64-w64-mingw32
|
||||
|
||||
install-all:
|
||||
@if test -d $(DESTDIR); then \
|
||||
mkdir -p $(DESTDIR)/cmake; \
|
||||
cp -rv cmake/* $(DESTDIR)/cmake; \
|
||||
for arch in $(ARCHITECTURES); do \
|
||||
$(MAKE) install ARCH=$$arch DESTDIR=$(DESTDIR)/$$arch; \
|
||||
done \
|
||||
else \
|
||||
echo "*** ERROR: $(DESTDIR) does not exist!"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: default install install-i686 install-x86_64 install-all
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
# SDL3_net CMake configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL3_net-devel-3.x.y-mingw
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(sdl3_net_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_net/SDL3_netConfig.cmake")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(sdl3_net_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_net/SDL3_netConfig.cmake")
|
||||
else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
|
||||
set(SDL3_net_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${sdl3_net_config_path}")
|
||||
message(WARNING "${sdl3_net_config_path} does not exist: MinGW development package is corrupted")
|
||||
set(SDL3_net_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include("${sdl3_net_config_path}")
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
# SDL3_net CMake version configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL3_net-devel-3.x.y-mingw
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(sdl3_net_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_net/SDL3_netConfigVersion.cmake")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(sdl3_net_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_net/SDL3_netConfigVersion.cmake")
|
||||
else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${sdl3_net_config_path}")
|
||||
message(WARNING "${sdl3_net_config_path} does not exist: MinGW development package is corrupted")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include("${sdl3_net_config_path}")
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
# @<@PROJECT_NAME@>@ CMake configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL3_net PROPERTIES
|
||||
URL "https://www.libsdl.org/projects/SDL_net/"
|
||||
DESCRIPTION "SDL_net is a simple, cross-platform wrapper over sockets"
|
||||
)
|
||||
|
||||
cmake_minimum_required(VERSION 3.0...3.28)
|
||||
|
||||
# Copied from `configure_package_config_file`
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
set(SDL3_net_FOUND TRUE)
|
||||
|
||||
|
||||
if(SDL_CPU_X86)
|
||||
set(_sdl3_net_arch_subdir "x86")
|
||||
elseif(SDL_CPU_X64 OR SDL_CPU_ARM64EC)
|
||||
set(_sdl3_net_arch_subdir "x64")
|
||||
elseif(SDL_CPU_ARM64)
|
||||
set(_sdl3_net_arch_subdir "arm64")
|
||||
else()
|
||||
set(SDL3_net_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_sdl3_net_incdir "${CMAKE_CURRENT_LIST_DIR}/../include")
|
||||
set(_sdl3_net_library "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl3_net_arch_subdir}/SDL3_net.lib")
|
||||
set(_sdl3_net_dll "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl3_net_arch_subdir}/SDL3_net.dll")
|
||||
|
||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||
# This is done for compatibility with CMake generated SDL3_net-target.cmake files.
|
||||
|
||||
set(SDL3_net_SDL3_net-shared_FOUND TRUE)
|
||||
if(NOT TARGET SDL3_net::SDL3_net-shared)
|
||||
add_library(SDL3_net::SDL3_net-shared SHARED IMPORTED)
|
||||
set_target_properties(SDL3_net::SDL3_net-shared
|
||||
PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_net_incdir}"
|
||||
IMPORTED_IMPLIB "${_sdl3_net_library}"
|
||||
IMPORTED_LOCATION "${_sdl3_net_dll}"
|
||||
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
||||
INTERFACE_SDL3_SHARED "ON"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(SDL3_net_SDL3_net-static_FOUND FALSE)
|
||||
|
||||
if(SDL3_net_SDL3_net-shared_FOUND OR SDL3_net_SDL3_net-static_FOUND)
|
||||
set(SDL3_net_SDL3_net_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.18")
|
||||
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
||||
add_library(${NEW_TARGET} INTERFACE IMPORTED)
|
||||
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
|
||||
else()
|
||||
add_library(${NEW_TARGET} ALIAS ${TARGET})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Make sure SDL3_net::SDL3_net always exists
|
||||
if(NOT TARGET SDL3_net::SDL3_net)
|
||||
if(TARGET SDL3_net::SDL3_net-shared)
|
||||
_sdl_create_target_alias_compat(SDL3_net::SDL3_net SDL3_net::SDL3_net-shared)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_sdl3_net_arch_subdir)
|
||||
unset(_sdl3_net_incdir)
|
||||
unset(_sdl3_net_library)
|
||||
unset(_sdl3_net_dll)
|
||||
|
||||
check_required_components(SDL3_net)
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
# @<@PROJECT_NAME@>@ CMake version configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip
|
||||
|
||||
set(PACKAGE_VERSION "@<@PROJECT_VERSION@>@")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake")
|
||||
SDL_DetectTargetCPUArchitectures(_detected_archs)
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# Package version must be in the requested version range
|
||||
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake")
|
||||
SDL_DetectTargetCPUArchitectures(_detected_archs)
|
||||
|
||||
# check that the installed version has a compatible architecture as the one which is currently searching:
|
||||
if(NOT(SDL_CPU_X86 OR SDL_CPU_X64 OR SDL_CPU_ARM64 OR SDL_CPU_ARM64EC))
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (X86,X64,ARM64)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
@@ -0,0 +1,200 @@
|
||||
{
|
||||
"name": "SDL3_net",
|
||||
"remote": "libsdl-org/SDL_net",
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"startswith": "3.",
|
||||
"repo": "libsdl-org/SDL"
|
||||
}
|
||||
},
|
||||
"version": {
|
||||
"file": "include/SDL3_net/SDL_net.h",
|
||||
"re_major": "^#define SDL_NET_MAJOR_VERSION\\s+([0-9]+)$",
|
||||
"re_minor": "^#define SDL_NET_MINOR_VERSION\\s+([0-9]+)$",
|
||||
"re_micro": "^#define SDL_NET_MICRO_VERSION\\s+([0-9]+)$"
|
||||
},
|
||||
"source": {
|
||||
"checks": [
|
||||
"src/SDL_net.c",
|
||||
"include/SDL3_net/SDL_net.h",
|
||||
"examples/voipchat.c"
|
||||
]
|
||||
},
|
||||
"dmg": {
|
||||
"project": "Xcode/SDL_net.xcodeproj",
|
||||
"path": "Xcode/build/SDL3_net.dmg",
|
||||
"scheme": "SDL3_net.dmg",
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL3-*.dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mingw": {
|
||||
"cmake": {
|
||||
"archs": ["x86", "x64"],
|
||||
"args": [
|
||||
"-DBUILD_SHARED_LIBS=ON",
|
||||
"-DSDLNET_RELOCATABLE=ON",
|
||||
"-DSDLNET_SAMPLES=OFF",
|
||||
"-DSDLNET_INSTALL=ON",
|
||||
"-DSDLNET_INSTALL_MAN=OFF"
|
||||
],
|
||||
"shared-static": "args"
|
||||
},
|
||||
"files": {
|
||||
"": [
|
||||
"LICENSE.txt",
|
||||
"README.md",
|
||||
"build-scripts/pkg-support/mingw/Makefile"
|
||||
],
|
||||
"cmake": [
|
||||
"build-scripts/pkg-support/mingw/cmake/SDL3_netConfig.cmake",
|
||||
"build-scripts/pkg-support/mingw/cmake/SDL3_netConfigVersion.cmake"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL3-devel-*-mingw.tar.gz",
|
||||
"install-command": "make install-@<@ARCH@>@ DESTDIR=@<@PREFIX@>@"
|
||||
}
|
||||
}
|
||||
},
|
||||
"msvc": {
|
||||
"msbuild": {
|
||||
"archs": [
|
||||
"x86",
|
||||
"x64"
|
||||
],
|
||||
"projects": [
|
||||
"VisualC/SDL_net.vcxproj"
|
||||
],
|
||||
"files-lib": {
|
||||
"": [
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_net.dll"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"lib/@<@ARCH@>@": [
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_net.dll",
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_net.lib",
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_net.pdb"
|
||||
]
|
||||
}
|
||||
},
|
||||
"cmake": {
|
||||
"archs": [
|
||||
"arm64"
|
||||
],
|
||||
"args": [
|
||||
"-DBUILD_SHARED_LIBS=ON",
|
||||
"-DSDLNET_RELOCATABLE=ON",
|
||||
"-DSDLNET_SAMPLES=OFF",
|
||||
"-DSDLNET_INSTALL=ON",
|
||||
"-DSDLNET_INSTALL_MAN=OFF"
|
||||
],
|
||||
"files-lib": {
|
||||
"": [
|
||||
"bin/SDL3_net.dll"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"lib/@<@ARCH@>@": [
|
||||
"bin/SDL3_net.dll",
|
||||
"bin/SDL3_net.pdb",
|
||||
"lib/SDL3_net.lib"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files-lib": {
|
||||
"": [
|
||||
"README.md"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"": [
|
||||
"LICENSE.txt",
|
||||
"README.md"
|
||||
],
|
||||
"cmake": [
|
||||
"build-scripts/pkg-support/msvc/cmake/SDL3_netConfig.cmake.in:SDL3_netConfig.cmake",
|
||||
"build-scripts/pkg-support/msvc/cmake/SDL3_netConfigVersion.cmake.in:SDL3_netConvigVersion.cmake",
|
||||
"cmake/sdlcpu.cmake"
|
||||
],
|
||||
"include/SDL3_net": [
|
||||
"include/SDL3_net/SDL_net.h"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL3-devel-*-VC.zip",
|
||||
"copy": [
|
||||
{
|
||||
"src": "lib/@<@ARCH@>@/SDL3.*",
|
||||
"dst": "../SDL/VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@"
|
||||
},
|
||||
{
|
||||
"src": "include/SDL3/*",
|
||||
"dst": "../SDL/include/SDL3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"cmake": {
|
||||
"args": [
|
||||
"-DBUILD_SHARED_LIBS=ON",
|
||||
"-DSDLNET_SAMPLES=OFF",
|
||||
"-DSDLNET_INSTALL=ON",
|
||||
"-DSDLNET_INSTALL_MAN=OFF"
|
||||
]
|
||||
},
|
||||
"modules": {
|
||||
"SDL3_net-shared": {
|
||||
"type": "library",
|
||||
"library": "lib/libSDL3_net.so",
|
||||
"includes": {
|
||||
"SDL3_net": ["include/SDL3_net/*.h"]
|
||||
}
|
||||
},
|
||||
"SDL3_net": {
|
||||
"type": "interface",
|
||||
"export-libraries": [":SDL3_net-shared"]
|
||||
}
|
||||
},
|
||||
"abis": [
|
||||
"armeabi-v7a",
|
||||
"arm64-v8a",
|
||||
"x86",
|
||||
"x86_64"
|
||||
],
|
||||
"api-minimum": 19,
|
||||
"api-target": 29,
|
||||
"ndk-minimum": 28,
|
||||
"aar-files": {
|
||||
"": [
|
||||
"build-scripts/pkg-support/android/aar/__main__.py.in:__main__.py",
|
||||
"build-scripts/pkg-support/android/aar/description.json.in:description.json"
|
||||
],
|
||||
"META-INF": [
|
||||
"LICENSE.txt"
|
||||
],
|
||||
"cmake": [
|
||||
"cmake/sdlcpu.cmake",
|
||||
"build-scripts/pkg-support/android/aar/cmake/SDL3_netConfig.cmake",
|
||||
"build-scripts/pkg-support/android/aar/cmake/SDL3_netConfigVersion.cmake.in:SDL3_netConfigVersion.cmake"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"": [
|
||||
"build-scripts/pkg-support/android/README.md.in:README.md"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL3-devel-*-android.zip"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2022 Collabora Ltd.
|
||||
# SPDX-License-Identifier: Zlib
|
||||
|
||||
set -eu
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
# Needed so sed doesn't report illegal byte sequences on macOS
|
||||
export LC_CTYPE=C
|
||||
|
||||
header=include/SDL3_net/SDL_net.h
|
||||
ref_major=$(sed -ne 's/^#define SDL_NET_MAJOR_VERSION *//p' $header)
|
||||
ref_minor=$(sed -ne 's/^#define SDL_NET_MINOR_VERSION *//p' $header)
|
||||
ref_micro=$(sed -ne 's/^#define SDL_NET_MICRO_VERSION *//p' $header)
|
||||
ref_version="${ref_major}.${ref_minor}.${ref_micro}"
|
||||
|
||||
tests=0
|
||||
failed=0
|
||||
|
||||
ok () {
|
||||
tests=$(( tests + 1 ))
|
||||
echo "ok - $*"
|
||||
}
|
||||
|
||||
not_ok () {
|
||||
tests=$(( tests + 1 ))
|
||||
echo "not ok - $*"
|
||||
failed=1
|
||||
}
|
||||
|
||||
major=$(sed -ne 's/^set(MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
minor=$(sed -ne 's/^set(MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
micro=$(sed -ne 's/^set(MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "CMakeLists.txt $version"
|
||||
else
|
||||
not_ok "CMakeLists.txt $version disagrees with SDL_net.h $ref_version"
|
||||
fi
|
||||
|
||||
for rcfile in src/version.rc; do
|
||||
tuple=$(sed -ne 's/^ *FILEVERSION *//p' "$rcfile" | tr -d '\r')
|
||||
ref_tuple="${ref_major},${ref_minor},${ref_micro},0"
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "$rcfile FILEVERSION $tuple"
|
||||
else
|
||||
not_ok "$rcfile FILEVERSION $tuple disagrees with SDL_net.h $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' "$rcfile" | tr -d '\r')
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "$rcfile PRODUCTVERSION $tuple"
|
||||
else
|
||||
not_ok "$rcfile PRODUCTVERSION $tuple disagrees with SDL_net.h $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
|
||||
ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0"
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "$rcfile FileVersion $tuple"
|
||||
else
|
||||
not_ok "$rcfile FileVersion $tuple disagrees with SDL_net.h $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "$rcfile ProductVersion $tuple"
|
||||
else
|
||||
not_ok "$rcfile ProductVersion $tuple disagrees with SDL_net.h $ref_tuple"
|
||||
fi
|
||||
done
|
||||
|
||||
#version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist)
|
||||
#
|
||||
#if [ "$ref_version" = "$version" ]; then
|
||||
# ok "Info-Framework.plist CFBundleShortVersionString $version"
|
||||
#else
|
||||
# not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with SDL_net.h $ref_version"
|
||||
#fi
|
||||
#
|
||||
#version=$(sed -Ene '/CFBundleVersion/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist)
|
||||
#
|
||||
#if [ "$ref_version" = "$version" ]; then
|
||||
# ok "Info-Framework.plist CFBundleVersion $version"
|
||||
#else
|
||||
# not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_net.h $ref_version"
|
||||
#fi
|
||||
#
|
||||
## For simplicity this assumes we'll never break ABI before SDL 3.
|
||||
#dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL_net.xcodeproj/project.pbxproj)
|
||||
#
|
||||
#case "$ref_minor" in
|
||||
# (*[02468])
|
||||
# major="$(( ref_minor * 100 + 1 ))"
|
||||
# minor="0"
|
||||
# ;;
|
||||
# (*)
|
||||
# major="$(( ref_minor * 100 + ref_micro + 1 ))"
|
||||
# minor="0"
|
||||
# ;;
|
||||
#esac
|
||||
#
|
||||
#ref="${major}.${minor}.0
|
||||
#${major}.${minor}.0"
|
||||
#
|
||||
#if [ "$ref" = "$dylib_compat" ]; then
|
||||
# ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent"
|
||||
#else
|
||||
# not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent, expected $ref, got $dylib_compat"
|
||||
#fi
|
||||
#
|
||||
#dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL_net.xcodeproj/project.pbxproj)
|
||||
#
|
||||
#case "$ref_minor" in
|
||||
# (*[02468])
|
||||
# major="$(( ref_minor * 100 + 1 ))"
|
||||
# minor="$ref_micro"
|
||||
# ;;
|
||||
# (*)
|
||||
# major="$(( ref_minor * 100 + ref_micro + 1 ))"
|
||||
# minor="0"
|
||||
# ;;
|
||||
#esac
|
||||
#
|
||||
#ref="${major}.${minor}.0
|
||||
#${major}.${minor}.0"
|
||||
#
|
||||
#if [ "$ref" = "$dylib_cur" ]; then
|
||||
# ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent"
|
||||
#else
|
||||
# not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur"
|
||||
#fi
|
||||
|
||||
echo "1..$tests"
|
||||
exit "$failed"
|
||||
+2969
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,284 @@
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the working tree (--dirty option),
|
||||
# and adjusting the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# git_local_changes(<var>)
|
||||
#
|
||||
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||
# Does not regard untracked files.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
#
|
||||
# Copyright 2009-2013, Iowa State University.
|
||||
# Copyright 2013-2020, Ryan Pavlik
|
||||
# Copyright 2013-2020, Contributors
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
# Function _git_find_closest_git_dir finds the next closest .git directory
|
||||
# that is part of any directory in the path defined by _start_dir.
|
||||
# The result is returned in the parent scope variable whose name is passed
|
||||
# as variable _git_dir_var. If no .git directory can be found, the
|
||||
# function returns an empty string via _git_dir_var.
|
||||
#
|
||||
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
|
||||
# neither foo nor bar contain a file/directory .git. This will return
|
||||
# C:/bla/.git
|
||||
#
|
||||
function(_git_find_closest_git_dir _start_dir _git_dir_var)
|
||||
set(cur_dir "${_start_dir}")
|
||||
set(git_dir "${_start_dir}/.git")
|
||||
while(NOT EXISTS "${git_dir}")
|
||||
# .git dir not found, search parent directories
|
||||
set(git_previous_parent "${cur_dir}")
|
||||
get_filename_component(cur_dir "${cur_dir}" DIRECTORY)
|
||||
if(cur_dir STREQUAL git_previous_parent)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_git_dir_var}
|
||||
""
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(git_dir "${cur_dir}/.git")
|
||||
endwhile()
|
||||
set(${_git_dir_var}
|
||||
"${git_dir}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
|
||||
|
||||
if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
|
||||
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
|
||||
else()
|
||||
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE)
|
||||
endif()
|
||||
if(NOT "${GIT_DIR}" STREQUAL "")
|
||||
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
|
||||
"${GIT_DIR}")
|
||||
if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
|
||||
# We've gone above the CMake root dir.
|
||||
set(GIT_DIR "")
|
||||
endif()
|
||||
endif()
|
||||
if("${GIT_DIR}" STREQUAL "")
|
||||
set(${_refspecvar}
|
||||
"GITDIR-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
set(${_hashvar}
|
||||
"GITDIR-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check if the current source dir is a git submodule or a worktree.
|
||||
# In both cases .git is a file instead of a directory.
|
||||
#
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
# The following git command will return a non empty string that
|
||||
# points to the super project working tree if the current
|
||||
# source dir is inside a git submodule.
|
||||
# Otherwise the command will return an empty string.
|
||||
#
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse
|
||||
--show-superproject-working-tree
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT "${out}" STREQUAL "")
|
||||
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
|
||||
${submodule})
|
||||
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
|
||||
ABSOLUTE)
|
||||
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||
else()
|
||||
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
|
||||
file(READ ${GIT_DIR} worktree_ref)
|
||||
# The .git directory contains a path to the worktree information directory
|
||||
# inside the parent git repo of the worktree.
|
||||
#
|
||||
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
|
||||
${worktree_ref})
|
||||
string(STRIP ${git_worktree_dir} git_worktree_dir)
|
||||
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
|
||||
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
|
||||
endif()
|
||||
else()
|
||||
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake" @ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
set(${_refspecvar}
|
||||
"${HEAD_REF}"
|
||||
PARENT_SCOPE)
|
||||
set(${_hashvar}
|
||||
"${HEAD_HASH}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var}
|
||||
"HEAD-HASH-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe_working_tree _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_local_changes _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var}
|
||||
"HEAD-HASH-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
set(${_var}
|
||||
"CLEAN"
|
||||
PARENT_SCOPE)
|
||||
else()
|
||||
set(${_var}
|
||||
"DIRTY"
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright 2009-2012, Iowa State University
|
||||
# Copyright 2011-2015, Contributors
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
else()
|
||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
||||
@@ -0,0 +1,363 @@
|
||||
# This file is shared amongst SDL_image/SDL_mixer/SDL_ttf
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CMakePushCheckState)
|
||||
|
||||
macro(sdl_calculate_derived_version_variables MAJOR MINOR MICRO)
|
||||
set(SO_VERSION_MAJOR "0")
|
||||
set(SO_VERSION_MINOR "${MINOR_VERSION}")
|
||||
set(SO_VERSION_MICRO "${MICRO_VERSION}")
|
||||
set(SO_VERSION "${SO_VERSION_MAJOR}.${SO_VERSION_MINOR}.${SO_VERSION_MICRO}")
|
||||
|
||||
if(MINOR MATCHES "[02468]$")
|
||||
math(EXPR DYLIB_COMPAT_VERSION_MAJOR "100 * ${MINOR} + 1")
|
||||
set(DYLIB_COMPAT_VERSION_MINOR "0")
|
||||
math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${DYLIB_COMPAT_VERSION_MAJOR}")
|
||||
set(DYLIB_CURRENT_VERSION_MINOR "${MICRO}")
|
||||
else()
|
||||
math(EXPR DYLIB_COMPAT_VERSION_MAJOR "100 * ${MINOR} + ${MICRO} + 1")
|
||||
set(DYLIB_COMPAT_VERSION_MINOR "0")
|
||||
math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${DYLIB_COMPAT_VERSION_MAJOR}")
|
||||
set(DYLIB_CURRENT_VERSION_MINOR "0")
|
||||
endif()
|
||||
set(DYLIB_COMPAT_VERSION_MICRO "0")
|
||||
set(DYLIB_CURRENT_VERSION_MICRO "0")
|
||||
|
||||
set(DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.${DYLIB_CURRENT_VERSION_MINOR}.${DYLIB_CURRENT_VERSION_MICRO}")
|
||||
set(DYLIB_COMPAT_VERSION "${DYLIB_COMPAT_VERSION_MAJOR}.${DYLIB_COMPAT_VERSION_MINOR}.${DYLIB_COMPAT_VERSION_MICRO}")
|
||||
endmacro()
|
||||
|
||||
function(read_absolute_symlink DEST PATH)
|
||||
file(READ_SYMLINK "${PATH}" p)
|
||||
if(NOT IS_ABSOLUTE "${p}")
|
||||
get_filename_component(pdir "${PATH}" DIRECTORY)
|
||||
set(p "${pdir}/${p}")
|
||||
endif()
|
||||
get_filename_component(p "${p}" ABSOLUTE)
|
||||
set("${DEST}" "${p}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(win32_implib_identify_dll DEST IMPLIB)
|
||||
cmake_parse_arguments(ARGS "NOTFATAL" "" "" ${ARGN})
|
||||
if(CMAKE_DLLTOOL)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_DLLTOOL}" --identify "${IMPLIB}"
|
||||
RESULT_VARIABLE retcode
|
||||
OUTPUT_VARIABLE stdout
|
||||
ERROR_VARIABLE stderr)
|
||||
if(NOT retcode EQUAL 0)
|
||||
if(NOT ARGS_NOTFATAL)
|
||||
message(FATAL_ERROR "${CMAKE_DLLTOOL} failed.")
|
||||
else()
|
||||
set("${DEST}" "${DEST}-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
string(STRIP "${stdout}" result)
|
||||
set(${DEST} "${result}" PARENT_SCOPE)
|
||||
elseif(MSVC)
|
||||
get_filename_component(CMAKE_C_COMPILER_DIRECTORY "${CMAKE_C_COMPILER}" DIRECTORY CACHE)
|
||||
find_program(CMAKE_DUMPBIN NAMES dumpbin PATHS "${CMAKE_C_COMPILER_DIRECTORY}")
|
||||
if(CMAKE_DUMPBIN)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_DUMPBIN}" "-headers" "${IMPLIB}"
|
||||
RESULT_VARIABLE retcode
|
||||
OUTPUT_VARIABLE stdout
|
||||
ERROR_VARIABLE stderr)
|
||||
if(NOT retcode EQUAL 0)
|
||||
if(NOT ARGS_NOTFATAL)
|
||||
message(FATAL_ERROR "dumpbin failed.")
|
||||
else()
|
||||
set(${DEST} "${DEST}-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
string(REGEX MATCH "DLL name[ ]+:[ ]+([^\n]+)\n" match "${stdout}")
|
||||
if(NOT match)
|
||||
if(NOT ARGS_NOTFATAL)
|
||||
message(FATAL_ERROR "dumpbin did not find any associated dll for ${IMPLIB}.")
|
||||
else()
|
||||
set(${DEST} "${DEST}-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
set(result "${CMAKE_MATCH_1}")
|
||||
set(${DEST} "${result}" PARENT_SCOPE)
|
||||
else()
|
||||
message(FATAL_ERROR "Cannot find dumpbin, please set CMAKE_DUMPBIN cmake variable")
|
||||
endif()
|
||||
else()
|
||||
if(NOT ARGS_NOTFATAL)
|
||||
message(FATAL_ERROR "Don't know how to identify dll from import library. Set CMAKE_DLLTOOL (for mingw) or CMAKE_DUMPBIN (for MSVC)")
|
||||
else()
|
||||
set(${DEST} "${DEST}-NOTFOUND")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(get_actual_target)
|
||||
set(dst "${ARGV0}")
|
||||
set(target "${${dst}}")
|
||||
set(input "${target}")
|
||||
get_target_property(alias "${target}" ALIASED_TARGET)
|
||||
while(alias)
|
||||
set(target "${alias}")
|
||||
get_target_property(alias "${target}" ALIASED_TARGET)
|
||||
endwhile()
|
||||
message(DEBUG "get_actual_target(\"${input}\") -> \"${target}\"")
|
||||
set("${dst}" "${target}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(target_get_dynamic_library DEST TARGET)
|
||||
set(result)
|
||||
if(DEFINED ${DEST})
|
||||
if(NOT EXISTS "${${DEST}}")
|
||||
message(FATAL_ERROR "${DEST}=${${DEST}} does not exist")
|
||||
endif()
|
||||
get_filename_component(filename ${${DEST}} NAME)
|
||||
set(${DEST} ${filename} PARENT_SCOPE)
|
||||
else()
|
||||
get_actual_target(TARGET)
|
||||
if(WIN32)
|
||||
# Use the target dll of the import library
|
||||
set(props_to_check IMPORTED_IMPLIB)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND props_to_check IMPORTED_IMPLIB_${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
list(APPEND props_to_check IMPORTED_LOCATION)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND props_to_check IMPORTED_LOCATION_${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
foreach (config_type ${CMAKE_CONFIGURATION_TYPES} RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
|
||||
list(APPEND props_to_check IMPORTED_IMPLIB_${config_type})
|
||||
list(APPEND props_to_check IMPORTED_LOCATION_${config_type})
|
||||
endforeach()
|
||||
|
||||
foreach(prop_to_check ${props_to_check})
|
||||
if(NOT result)
|
||||
get_target_property(propvalue "${TARGET}" ${prop_to_check})
|
||||
if(propvalue AND EXISTS "${propvalue}")
|
||||
win32_implib_identify_dll(result "${propvalue}" NOTFATAL)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
# 1. find the target library a file might be symbolic linking to
|
||||
# 2. find all other files in the same folder that symolic link to it
|
||||
# 3. sort all these files, and select the 1st item on Linux, and last on Macos
|
||||
set(location_properties IMPORTED_LOCATION)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND location_properties IMPORTED_LOCATION_${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
foreach (config_type ${CMAKE_CONFIGURATION_TYPES} RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
|
||||
list(APPEND location_properties IMPORTED_LOCATION_${config_type})
|
||||
endforeach()
|
||||
if(APPLE)
|
||||
set(valid_shared_library_regex "\\.[0-9]+\\.dylib$")
|
||||
else()
|
||||
set(valid_shared_library_regex "\\.so\\.([0-9.]+)?[0-9]")
|
||||
endif()
|
||||
foreach(location_property ${location_properties})
|
||||
if(NOT result)
|
||||
get_target_property(library_path "${TARGET}" ${location_property})
|
||||
message(DEBUG "get_target_property(${TARGET} ${location_propert}) -> ${library_path}")
|
||||
if(EXISTS "${library_path}")
|
||||
get_filename_component(library_path "${library_path}" ABSOLUTE)
|
||||
while (IS_SYMLINK "${library_path}")
|
||||
read_absolute_symlink(library_path "${library_path}")
|
||||
endwhile()
|
||||
message(DEBUG "${TARGET} -> ${library_path}")
|
||||
get_filename_component(libdir "${library_path}" DIRECTORY)
|
||||
file(GLOB subfiles "${libdir}/*")
|
||||
set(similar_files "${library_path}")
|
||||
foreach(subfile ${subfiles})
|
||||
if(IS_SYMLINK "${subfile}")
|
||||
read_absolute_symlink(subfile_target "${subfile}")
|
||||
while(IS_SYMLINK "${subfile_target}")
|
||||
read_absolute_symlink(subfile_target "${subfile_target}")
|
||||
endwhile()
|
||||
get_filename_component(subfile_target "${subfile_target}" ABSOLUTE)
|
||||
if(subfile_target STREQUAL library_path AND subfile MATCHES "${valid_shared_library_regex}")
|
||||
list(APPEND similar_files "${subfile}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
list(SORT similar_files)
|
||||
message(DEBUG "files that are similar to \"${library_path}\"=${similar_files}")
|
||||
if(APPLE)
|
||||
list(REVERSE similar_files)
|
||||
endif()
|
||||
list(GET similar_files 0 item)
|
||||
get_filename_component(result "${item}" NAME)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
if(result)
|
||||
string(TOLOWER "${result}" result_lower)
|
||||
if(WIN32 OR OS2)
|
||||
if(NOT result_lower MATCHES ".*dll")
|
||||
message(FATAL_ERROR "\"${result}\" is not a .dll library")
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if(NOT result_lower MATCHES ".*dylib.*")
|
||||
message(FATAL_ERROR "\"${result}\" is not a .dylib shared library")
|
||||
endif()
|
||||
else()
|
||||
if(NOT result_lower MATCHES ".*so.*")
|
||||
message(FATAL_ERROR "\"${result}\" is not a .so shared library")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
get_target_property(target_type ${TARGET} TYPE)
|
||||
if(target_type MATCHES "SHARED_LIBRARY|MODULE_LIBRARY")
|
||||
# OK
|
||||
elseif(target_type MATCHES "STATIC_LIBRARY|OBJECT_LIBRARY|INTERFACE_LIBRARY|EXECUTABLE")
|
||||
message(SEND_ERROR "${TARGET} is not a shared library, but has type=${target_type}")
|
||||
else()
|
||||
message(WARNING "Unable to extract dynamic library from target=${TARGET}, type=${target_type}.")
|
||||
endif()
|
||||
# TARGET_SONAME_FILE is not allowed for DLL target platforms.
|
||||
if(WIN32)
|
||||
set(result "$<TARGET_FILE_NAME:${TARGET}>")
|
||||
else()
|
||||
set(result "$<TARGET_SONAME_FILE_NAME:${TARGET}>")
|
||||
endif()
|
||||
endif()
|
||||
set(${DEST} ${result} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_check_project_in_subfolder relative_subfolder name vendored_option)
|
||||
cmake_parse_arguments(ARG "" "FILE" "" ${ARGN})
|
||||
if(NOT ARG_FILE)
|
||||
set(ARG_FILE "CMakeLists.txt")
|
||||
endif()
|
||||
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${relative_subfolder}/${ARG_FILE}")
|
||||
message(FATAL_ERROR "Could not find ${ARG_FILE} for ${name} in ${relative_subfolder}.\n"
|
||||
"Run the download script in the external folder, or re-configure with -D${vendored_option}=OFF to use system packages.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(sdl_check_linker_flag flag var)
|
||||
# FIXME: Use CheckLinkerFlag module once cmake minimum version >= 3.18
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "${flag}")
|
||||
check_c_source_compiles("int main() { return 0; }" ${var} FAIL_REGEX "(unsupported|syntax error|unrecognized option)")
|
||||
cmake_pop_check_state()
|
||||
endmacro()
|
||||
|
||||
function(SDL_detect_linker)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.29)
|
||||
if(NOT DEFINED SDL_CMAKE_C_COMPILER_LINKER_ID)
|
||||
execute_process(COMMAND ${CMAKE_LINKER} -v OUTPUT_VARIABLE LINKER_OUTPUT ERROR_VARIABLE LINKER_OUTPUT)
|
||||
string(REGEX REPLACE "[\r\n]" " " LINKER_OUTPUT "${LINKER_OUTPUT}")
|
||||
if(LINKER_OUTPUT MATCHES ".*Microsoft.*")
|
||||
set(linker MSVC)
|
||||
else()
|
||||
set(linker GNUlike)
|
||||
endif()
|
||||
message(STATUS "Linker identification: ${linker}")
|
||||
set(SDL_CMAKE_C_COMPILER_LINKER_ID "${linker}" CACHE STRING "Linker identification")
|
||||
mark_as_advanced(SDL_CMAKE_C_COMPILER_LINKER_ID)
|
||||
endif()
|
||||
set(CMAKE_C_COMPILER_LINKER_ID "${SDL_CMAKE_C_COMPILER_LINKER_ID}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(check_linker_support_version_script VAR)
|
||||
SDL_detect_linker()
|
||||
if(CMAKE_C_COMPILER_LINKER_ID MATCHES "^(MSVC)$")
|
||||
set(LINKER_SUPPORTS_VERSION_SCRIPT FALSE)
|
||||
else()
|
||||
cmake_push_check_state(RESET)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.sym" "n_0 {\n global:\n func;\n local: *;\n};\n")
|
||||
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/dummy.sym")
|
||||
check_c_source_compiles("int func(void) {return 0;} int main(int argc,char*argv[]){(void)argc;(void)argv;return func();}" LINKER_SUPPORTS_VERSION_SCRIPT FAIL_REGEX "(unsupported|syntax error|unrecognized option)")
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
set(${VAR} "${LINKER_SUPPORTS_VERSION_SCRIPT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(sdl_target_link_options_no_undefined TARGET)
|
||||
if(NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES ".*OpenBSD.*")
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
|
||||
target_link_options(${TARGET} PRIVATE "-Wl,-undefined,error")
|
||||
else()
|
||||
sdl_check_linker_flag("-Wl,--no-undefined" HAVE_WL_NO_UNDEFINED)
|
||||
if(HAVE_WL_NO_UNDEFINED AND NOT ((CMAKE_C_COMPILER_ID MATCHES "Clang") AND WIN32))
|
||||
target_link_options(${TARGET} PRIVATE "-Wl,--no-undefined")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_target_link_option_version_file TARGET VERSION_SCRIPT)
|
||||
check_linker_support_version_script(HAVE_WL_VERSION_SCRIPT)
|
||||
if(HAVE_WL_VERSION_SCRIPT)
|
||||
target_link_options(${TARGET} PRIVATE "-Wl,--version-script=${VERSION_SCRIPT}")
|
||||
set_property(TARGET ${TARGET} APPEND PROPERTY LINK_DEPENDS "${VERSION_SCRIPT}")
|
||||
else()
|
||||
if(LINUX OR ANDROID)
|
||||
message(FATAL_ERROR "Linker does not support '-Wl,--version-script=xxx.sym'. This is required on the current host platform.")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_add_warning_options TARGET)
|
||||
cmake_parse_arguments(ARGS "" "WARNING_AS_ERROR" "" ${ARGN})
|
||||
if(MSVC)
|
||||
target_compile_options(${TARGET} PRIVATE /W2)
|
||||
else()
|
||||
target_compile_options(${TARGET} PRIVATE -Wall -Wextra)
|
||||
endif()
|
||||
if(ARGS_WARNING_AS_ERROR)
|
||||
if(MSVC)
|
||||
target_compile_options(${TARGET} PRIVATE /WX)
|
||||
else()
|
||||
target_compile_options(${TARGET} PRIVATE -Werror)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_no_deprecated_errors TARGET)
|
||||
check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
|
||||
if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
|
||||
target_compile_options(${TARGET} PRIVATE "-Wno-error=deprecated-declarations")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_get_git_revision_hash VARNAME)
|
||||
set("${VARNAME}" "" CACHE STRING "${PROJECT_NAME} revision")
|
||||
set(revision "${${VARNAME}}")
|
||||
if(NOT revision)
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt")
|
||||
# If VERSION.txt exists, it contains the SDL version
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt" revision_version)
|
||||
string(STRIP "${revision_version}" revision_version)
|
||||
else()
|
||||
# If VERSION.txt does not exist, use git to calculate a version
|
||||
git_describe(revision_version)
|
||||
if(NOT revision_version)
|
||||
set(revision_version "${PROJECT_VERSION}-no-vcs")
|
||||
endif()
|
||||
endif()
|
||||
set(revision "${revision_version}")
|
||||
endif()
|
||||
set("${VARNAME}" "${revision}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(SDL_install_pdb TARGET DIRECTORY)
|
||||
get_property(type TARGET ${TARGET} PROPERTY TYPE)
|
||||
if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$")
|
||||
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION "${DIRECTORY}" OPTIONAL)
|
||||
elseif(type STREQUAL "STATIC_LIBRARY")
|
||||
# FIXME: Use $<TARGET_COMPILE_PDB_FILE:${TARGET} once it becomes available (https://gitlab.kitware.com/cmake/cmake/-/issues/25244)
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual Studio.*")
|
||||
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${TARGET}.pdb\")")
|
||||
else()
|
||||
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir/${TARGET}.pdb\")")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,38 @@
|
||||
# sdl3_net cmake project-config input for CMakeLists.txt script
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL3_net PROPERTIES
|
||||
URL "https://www.libsdl.org/projects/SDL_net/"
|
||||
DESCRIPTION "SDL_net is a simple, cross-platform wrapper over sockets"
|
||||
)
|
||||
|
||||
set(SDL3_net_FOUND ON)
|
||||
|
||||
set(SDLNET_SDL3_REQUIRED_VERSION @SDL_REQUIRED_VERSION@)
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_net-shared-targets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL3_net-shared-targets.cmake")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_net-static-targets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL3_net-static-targets.cmake")
|
||||
endif()
|
||||
|
||||
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.18")
|
||||
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
||||
add_library(${NEW_TARGET} INTERFACE IMPORTED)
|
||||
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
|
||||
else()
|
||||
add_library(${NEW_TARGET} ALIAS ${TARGET})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Make sure SDL3_net::SDL3_net always exists
|
||||
if(NOT TARGET SDL3_net::SDL3_net)
|
||||
if(TARGET SDL3_net::SDL3_net-shared)
|
||||
_sdl_create_target_alias_compat(SDL3_net::SDL3_net SDL3_net::SDL3_net-shared)
|
||||
else()
|
||||
_sdl_create_target_alias_compat(SDL3_net::SDL3_net SDL3_net::SDL3_net-static)
|
||||
endif()
|
||||
endif()
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
prefix=@SDL_PKGCONFIG_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=@LIBDIR_FOR_PKG_CONFIG@
|
||||
includedir=@INCLUDEDIR_FOR_PKG_CONFIG@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: net library for Simple DirectMedia Layer
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: sdl3 >= @SDL_REQUIRED_VERSION@
|
||||
Libs: -L${libdir} -lSDL3_net
|
||||
Requires.private: @PC_REQUIRES@
|
||||
Libs.private: @PC_LIBS@
|
||||
Cflags: -I${includedir}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
function(SDL_DetectTargetCPUArchitectures DETECTED_ARCHS)
|
||||
|
||||
set(known_archs EMSCRIPTEN ARM32 ARM64 ARM64EC LOONGARCH64 POWERPC32 POWERPC64 X86 X64)
|
||||
|
||||
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
set(SDL_CPU_${known_arch} "0")
|
||||
endforeach()
|
||||
set(detected_archs)
|
||||
foreach(osx_arch IN LISTS CMAKE_OSX_ARCHITECTURES)
|
||||
if(osx_arch STREQUAL "x86_64")
|
||||
set(SDL_CPU_X64 "1")
|
||||
list(APPEND detected_archs "X64")
|
||||
elseif(osx_arch STREQUAL "arm64")
|
||||
set(SDL_CPU_ARM64 "1")
|
||||
list(APPEND detected_archs "ARM64")
|
||||
endif()
|
||||
endforeach()
|
||||
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(detected_archs)
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
if(SDL_CPU_${known_arch})
|
||||
list(APPEND detected_archs "${known_arch}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(detected_archs)
|
||||
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(arch_check_ARM32 "defined(__arm__) || defined(_M_ARM)")
|
||||
set(arch_check_ARM64 "defined(__aarch64__) || defined(_M_ARM64)")
|
||||
set(arch_check_ARM64EC "defined(_M_ARM64EC)")
|
||||
set(arch_check_EMSCRIPTEN "defined(__EMSCRIPTEN__)")
|
||||
set(arch_check_LOONGARCH64 "defined(__loongarch64)")
|
||||
set(arch_check_POWERPC32 "(defined(__PPC__) || defined(__powerpc__)) && !defined(__powerpc64__)")
|
||||
set(arch_check_POWERPC64 "defined(__PPC64__) || defined(__powerpc64__)")
|
||||
set(arch_check_X86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)")
|
||||
set(arch_check_X64 "(defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)) && !defined(_M_ARM64EC)")
|
||||
|
||||
set(src_vars "")
|
||||
set(src_main "")
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
set(detected_${known_arch} "0")
|
||||
|
||||
string(APPEND src_vars "
|
||||
#if ${arch_check_${known_arch}}
|
||||
#define ARCH_${known_arch} \"1\"
|
||||
#else
|
||||
#define ARCH_${known_arch} \"0\"
|
||||
#endif
|
||||
const char *arch_${known_arch} = \"INFO<${known_arch}=\" ARCH_${known_arch} \">\";
|
||||
")
|
||||
string(APPEND src_main "
|
||||
result += arch_${known_arch}[argc];")
|
||||
endforeach()
|
||||
|
||||
set(src_arch_detect "${src_vars}
|
||||
int main(int argc, char *argv[]) {
|
||||
int result = 0;
|
||||
(void)argv;
|
||||
${src_main}
|
||||
return result;
|
||||
}")
|
||||
|
||||
if(CMAKE_C_COMPILER)
|
||||
set(ext ".c")
|
||||
elseif(CMAKE_CXX_COMPILER)
|
||||
set(ext ".cpp")
|
||||
else()
|
||||
enable_language(C)
|
||||
set(ext ".c")
|
||||
endif()
|
||||
set(path_src_arch_detect "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch${ext}")
|
||||
file(WRITE "${path_src_arch_detect}" "${src_arch_detect}")
|
||||
set(path_dir_arch_detect "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch")
|
||||
set(path_bin_arch_detect "${path_dir_arch_detect}/bin")
|
||||
|
||||
set(detected_archs)
|
||||
|
||||
set(msg "Detecting Target CPU Architecture")
|
||||
message(STATUS "${msg}")
|
||||
|
||||
include(CMakePushCheckState)
|
||||
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
|
||||
|
||||
cmake_push_check_state(RESET)
|
||||
try_compile(SDL_CPU_CHECK_ALL
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch"
|
||||
SOURCES "${path_src_arch_detect}"
|
||||
COPY_FILE "${path_bin_arch_detect}"
|
||||
)
|
||||
cmake_pop_check_state()
|
||||
if(NOT SDL_CPU_CHECK_ALL)
|
||||
message(STATUS "${msg} - <ERROR>")
|
||||
message(WARNING "Failed to compile source detecting the target CPU architecture")
|
||||
else()
|
||||
set(re "INFO<([A-Z0-9]+)=([01])>")
|
||||
file(STRINGS "${path_bin_arch_detect}" infos REGEX "${re}")
|
||||
|
||||
foreach(info_arch_01 IN LISTS infos)
|
||||
string(REGEX MATCH "${re}" A "${info_arch_01}")
|
||||
if(NOT "${CMAKE_MATCH_1}" IN_LIST known_archs)
|
||||
message(WARNING "Unknown architecture: \"${CMAKE_MATCH_1}\"")
|
||||
continue()
|
||||
endif()
|
||||
set(arch "${CMAKE_MATCH_1}")
|
||||
set(arch_01 "${CMAKE_MATCH_2}")
|
||||
set(detected_${arch} "${arch_01}")
|
||||
endforeach()
|
||||
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
if(detected_${known_arch})
|
||||
list(APPEND detected_archs ${known_arch})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(detected_archs)
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
set("SDL_CPU_${known_arch}" "${detected_${known_arch}}" CACHE BOOL "Detected architecture ${known_arch}")
|
||||
endforeach()
|
||||
message(STATUS "${msg} - ${detected_archs}")
|
||||
else()
|
||||
include(CheckCSourceCompiles)
|
||||
cmake_push_check_state(RESET)
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
if(NOT detected_archs)
|
||||
set(cache_variable "SDL_CPU_${known_arch}")
|
||||
set(test_src "
|
||||
int main(int argc, char *argv[]) {
|
||||
#if ${arch_check_${known_arch}}
|
||||
return 0;
|
||||
#else
|
||||
choke
|
||||
#endif
|
||||
}
|
||||
")
|
||||
check_c_source_compiles("${test_src}" "${cache_variable}")
|
||||
if(${cache_variable})
|
||||
set(SDL_CPU_${known_arch} "1" CACHE BOOL "Detected architecture ${known_arch}")
|
||||
set(detected_archs ${known_arch})
|
||||
else()
|
||||
set(SDL_CPU_${known_arch} "0" CACHE BOOL "Detected architecture ${known_arch}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
include(CMakeParseArguments)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
function(SDL_generate_manpages)
|
||||
cmake_parse_arguments(ARG "" "RESULT_VARIABLE;NAME;BUILD_DOCDIR;HEADERS_DIR;SOURCE_DIR;SYMBOL;OPTION_FILE;WIKIHEADERS_PL_PATH;REVISION" "" ${ARGN})
|
||||
|
||||
set(wikiheaders_extra_args)
|
||||
|
||||
if(NOT ARG_NAME)
|
||||
set(ARG_NAME "${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
if(NOT ARG_SOURCE_DIR)
|
||||
set(ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT ARG_OPTION_FILE)
|
||||
set(ARG_OPTION_FILE "${PROJECT_SOURCE_DIR}/.wikiheaders-options")
|
||||
endif()
|
||||
|
||||
if(NOT ARG_HEADERS_DIR)
|
||||
message(FATAL_ERROR "Missing required HEADERS_DIR argument")
|
||||
endif()
|
||||
|
||||
# FIXME: get rid of SYMBOL and let the perl script figure out the dependencies
|
||||
if(NOT ARG_SYMBOL)
|
||||
message(FATAL_ERROR "Missing required SYMBOL argument")
|
||||
endif()
|
||||
|
||||
if(ARG_REVISION)
|
||||
list(APPEND wikiheaders_extra_args "--rev=${ARG_REVISION}")
|
||||
endif()
|
||||
|
||||
if(NOT ARG_BUILD_DOCDIR)
|
||||
set(ARG_BUILD_DOCDIR "${CMAKE_CURRENT_BINARY_DIR}/docs")
|
||||
endif()
|
||||
set(BUILD_WIKIDIR "${ARG_BUILD_DOCDIR}/wiki")
|
||||
set(BUILD_MANDIR "${ARG_BUILD_DOCDIR}/man")
|
||||
|
||||
find_package(Perl)
|
||||
file(GLOB HEADER_FILES "${ARG_HEADERS_DIR}/*.h")
|
||||
|
||||
set(result FALSE)
|
||||
|
||||
if(PERL_FOUND AND EXISTS "${ARG_WIKIHEADERS_PL_PATH}")
|
||||
add_custom_command(
|
||||
OUTPUT "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md"
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${BUILD_WIKIDIR}"
|
||||
COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" --copy-to-wiki ${wikiheaders_extra_args}
|
||||
DEPENDS ${HEADER_FILES} "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}"
|
||||
COMMENT "Generating ${ARG_NAME} wiki markdown files"
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${BUILD_MANDIR}/man3/${ARG_SYMBOL}.3"
|
||||
COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" "--manpath=${BUILD_MANDIR}" --copy-to-manpages ${wikiheaders_extra_args}
|
||||
DEPENDS "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}"
|
||||
COMMENT "Generating ${ARG_NAME} man pages"
|
||||
)
|
||||
add_custom_target(${ARG_NAME}-docs ALL DEPENDS "${BUILD_MANDIR}/man3/${ARG_SYMBOL}.3")
|
||||
|
||||
install(DIRECTORY "${BUILD_MANDIR}/" DESTINATION "${CMAKE_INSTALL_MANDIR}")
|
||||
set(result TRUE)
|
||||
endif()
|
||||
|
||||
if(ARG_RESULT_VARIABLE)
|
||||
set(${ARG_RESULT_VARIABLE} ${result} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,44 @@
|
||||
# This cmake build script is meant for verifying the various CMake configuration script.
|
||||
|
||||
cmake_minimum_required(VERSION 3.12...3.28)
|
||||
project(sdl_test LANGUAGES C)
|
||||
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
|
||||
# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL3 outside of sysroot
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER)
|
||||
|
||||
include(FeatureSummary)
|
||||
|
||||
option(TEST_SHARED "Test linking to shared SDL3_net library" ON)
|
||||
add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library")
|
||||
|
||||
option(TEST_STATIC "Test linking to static SDL3_net library" ON)
|
||||
add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
|
||||
|
||||
if(ANDROID)
|
||||
macro(add_executable NAME)
|
||||
set(args ${ARGN})
|
||||
list(REMOVE_ITEM args WIN32)
|
||||
add_library(${NAME} SHARED ${args})
|
||||
unset(args)
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if(TEST_SHARED)
|
||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
|
||||
find_package(SDL3_net REQUIRED CONFIG)
|
||||
add_executable(main_shared main.c)
|
||||
target_link_libraries(main_shared PRIVATE SDL3_net::SDL3_net-shared SDL3::SDL3)
|
||||
endif()
|
||||
|
||||
if(TEST_STATIC)
|
||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
|
||||
# some static vendored libraries use c++ (enable CXX after `find_package` might show a warning)
|
||||
enable_language(CXX)
|
||||
find_package(SDL3_net REQUIRED CONFIG)
|
||||
add_executable(main_static main.c)
|
||||
target_link_libraries(main_static PRIVATE SDL3_net::SDL3_net-static SDL3::SDL3)
|
||||
endif()
|
||||
|
||||
feature_summary(WHAT ALL)
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3_net/SDL_net.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (!SDL_Init(0)) {
|
||||
SDL_Log("SDL_Init(0) failed: %s", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!NET_Init()) {
|
||||
SDL_Log("NET_Init() failed: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
NET_Quit();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3_net/SDL_net.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *interface = NULL;
|
||||
Uint16 server_port = 2382;
|
||||
int simulate_failure = 0;
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
if ((SDL_strcmp(arg, "--port") == 0) && (i < (argc-1))) {
|
||||
server_port = (Uint16) SDL_atoi(argv[++i]);
|
||||
} else if ((SDL_strcmp(arg, "--simulate-failure") == 0) && (i < (argc-1))) {
|
||||
simulate_failure = (int) SDL_atoi(argv[++i]);
|
||||
} else {
|
||||
interface = arg;
|
||||
}
|
||||
}
|
||||
|
||||
if (!NET_Init()) {
|
||||
SDL_Log("NET_Init failed: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (interface) {
|
||||
SDL_Log("Attempting to listen on interface '%s', port %d", interface, (int) server_port);
|
||||
} else {
|
||||
SDL_Log("Attempting to listen on all interfaces, port %d", (int) server_port);
|
||||
}
|
||||
|
||||
simulate_failure = SDL_clamp(simulate_failure, 0, 100);
|
||||
if (simulate_failure) {
|
||||
SDL_Log("Simulating failure at %d percent", simulate_failure);
|
||||
}
|
||||
|
||||
NET_Address *server_addr = NULL;
|
||||
if (interface) {
|
||||
server_addr = NET_ResolveHostname(interface);
|
||||
if (!server_addr || (NET_WaitUntilResolved(server_addr, -1) != NET_SUCCESS)) {
|
||||
SDL_Log("Failed to resolve interface for '%s': %s", interface, SDL_GetError());
|
||||
if (server_addr) {
|
||||
NET_UnrefAddress(server_addr);
|
||||
}
|
||||
NET_Quit();
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
} else {
|
||||
SDL_Log("Interface '%s' resolves to '%s' ...", interface, NET_GetAddressString(server_addr));
|
||||
}
|
||||
}
|
||||
|
||||
NET_Server *server = NET_CreateServer(server_addr, server_port);
|
||||
if (!server) {
|
||||
SDL_Log("Failed to create server: %s", SDL_GetError());
|
||||
} else {
|
||||
SDL_Log("Server is ready! Connect to port %d and send text!", (int) server_port);
|
||||
int num_vsockets = 1;
|
||||
void *vsockets[128];
|
||||
SDL_zeroa(vsockets);
|
||||
vsockets[0] = server;
|
||||
while (NET_WaitUntilInputAvailable(vsockets, num_vsockets, -1) >= 0) {
|
||||
NET_StreamSocket *streamsocket = NULL;
|
||||
if (!NET_AcceptClient(server, &streamsocket)) {
|
||||
SDL_Log("NET_AcceptClient failed: %s", SDL_GetError());
|
||||
break;
|
||||
} else if (streamsocket) { // new connection!
|
||||
SDL_Log("New connection from %s!", NET_GetAddressString(NET_GetStreamSocketAddress(streamsocket)));
|
||||
if (num_vsockets >= (int) (SDL_arraysize(vsockets) - 1)) {
|
||||
SDL_Log(" (too many connections, though, so dropping immediately.)");
|
||||
NET_DestroyStreamSocket(streamsocket);
|
||||
} else {
|
||||
if (simulate_failure) {
|
||||
NET_SimulateStreamPacketLoss(streamsocket, simulate_failure);
|
||||
}
|
||||
vsockets[num_vsockets++] = streamsocket;
|
||||
}
|
||||
}
|
||||
|
||||
// see if anything has new stuff.
|
||||
char buffer[1024];
|
||||
for (int i = 1; i < num_vsockets; i++) {
|
||||
bool kill_socket = false;
|
||||
streamsocket = (NET_StreamSocket *) vsockets[i];
|
||||
const int br = NET_ReadFromStreamSocket(streamsocket, buffer, sizeof (buffer));
|
||||
if (br < 0) { // uhoh, socket failed!
|
||||
kill_socket = true;
|
||||
} else if (br > 0) {
|
||||
const char *addrstr = NET_GetAddressString(NET_GetStreamSocketAddress(streamsocket));
|
||||
SDL_Log("Got %d more bytes from '%s'", br, addrstr);
|
||||
if (!NET_WriteToStreamSocket(streamsocket, buffer, br)) {
|
||||
SDL_Log("Failed to echo data back to '%s': %s", addrstr, SDL_GetError());
|
||||
kill_socket = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (kill_socket) {
|
||||
SDL_Log("Dropping connection to '%s'", NET_GetAddressString(NET_GetStreamSocketAddress(streamsocket)));
|
||||
NET_DestroyStreamSocket(streamsocket);
|
||||
vsockets[i] = NULL;
|
||||
if (i < (num_vsockets - 1)) {
|
||||
SDL_memmove(&vsockets[i], &vsockets[i+1], sizeof (vsockets[0]) * ((num_vsockets - i) - 1));
|
||||
}
|
||||
num_vsockets--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Log("Destroying server...");
|
||||
NET_DestroyServer(server);
|
||||
}
|
||||
|
||||
SDL_Log("Shutting down...");
|
||||
NET_Quit();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This is just for demonstration purposes! This doesn't
|
||||
* do anything as complicated as, say, the `ifconfig` utility.
|
||||
*
|
||||
* All this to say: don't use this for anything serious!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3_net/SDL_net.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
NET_Address **addrs = NULL;
|
||||
int num_addrs = 0;
|
||||
int i;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
if (!NET_Init()) {
|
||||
SDL_Log("NET_Init() failed: %s", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
addrs = NET_GetLocalAddresses(&num_addrs);
|
||||
if (addrs == NULL) {
|
||||
SDL_Log("Failed to determine local addresses: %s", SDL_GetError());
|
||||
NET_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Log("We saw %d local addresses:", num_addrs);
|
||||
for (i = 0; i < num_addrs; i++) {
|
||||
SDL_Log(" - %s", NET_GetAddressString(addrs[i]));
|
||||
}
|
||||
|
||||
NET_FreeLocalAddresses(addrs);
|
||||
NET_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This is just for demonstration purposes! This doesn't
|
||||
* do anything as complicated as, say, the `dig` utility.
|
||||
*
|
||||
* All this to say: don't use this for anything serious!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3_net/SDL_net.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (!NET_Init()) {
|
||||
SDL_Log("NET_Init() failed: %s", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
//NET_SimulateAddressResolutionLoss(3000, 30);
|
||||
|
||||
NET_Address **addrs = (NET_Address **) SDL_calloc(argc, sizeof (NET_Address *));
|
||||
for (int i = 1; i < argc; i++) {
|
||||
addrs[i] = NET_ResolveHostname(argv[i]);
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
NET_WaitUntilResolved(addrs[i], -1);
|
||||
|
||||
if (NET_GetAddressStatus(addrs[i]) == NET_FAILURE) {
|
||||
SDL_Log("%s: [FAILED TO RESOLVE: %s]", argv[i], SDL_GetError());
|
||||
} else {
|
||||
SDL_Log("%s: %s", argv[i], NET_GetAddressString(addrs[i]));
|
||||
}
|
||||
|
||||
NET_UnrefAddress(addrs[i]);
|
||||
}
|
||||
|
||||
NET_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This is just for demonstration purposes! A real HTTP solution would
|
||||
* be WAY more complicated, support HTTPS, cookies, etc. Use curl or
|
||||
* wget for real stuff, not this.
|
||||
*
|
||||
* All this to say: don't use this for anything serious!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3_net/SDL_net.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (!NET_Init()) {
|
||||
SDL_Log("NET_Init() failed: %s", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
SDL_Log("Looking up %s ...", argv[i]);
|
||||
NET_Address *addr = NET_ResolveHostname(argv[i]);
|
||||
if (NET_WaitUntilResolved(addr, -1) == NET_FAILURE) {
|
||||
SDL_Log("Failed to lookup %s: %s", argv[i], SDL_GetError());
|
||||
} else {
|
||||
SDL_Log("%s is %s", argv[i], NET_GetAddressString(addr));
|
||||
char *req = NULL;
|
||||
SDL_asprintf(&req, "GET / HTTP/1.0\r\nHost: %s\r\n\r\n", argv[i]);
|
||||
NET_StreamSocket *sock = req ? NET_CreateClient(addr, 80) : NULL;
|
||||
if (!req) {
|
||||
SDL_Log("Out of memory!");
|
||||
} else if (!sock) {
|
||||
SDL_Log("Failed to create stream socket to %s: %s\n", argv[i], SDL_GetError());
|
||||
} else if (NET_WaitUntilConnected(sock, -1) == NET_FAILURE) {
|
||||
SDL_Log("Failed to connect to %s: %s", argv[i], SDL_GetError());
|
||||
} else if (!NET_WriteToStreamSocket(sock, req, (int) SDL_strlen(req))) {
|
||||
SDL_Log("Failed to write to %s: %s", argv[i], SDL_GetError());
|
||||
} else if (NET_WaitUntilStreamSocketDrained(sock, -1) < 0) {
|
||||
SDL_Log("Failed to finish write to %s: %s", argv[i], SDL_GetError());
|
||||
} else {
|
||||
char buf[512];
|
||||
int br;
|
||||
while ((br = NET_ReadFromStreamSocket(sock, buf, sizeof (buf))) >= 0) {
|
||||
fwrite(buf, 1, br, stdout);
|
||||
}
|
||||
|
||||
printf("\n\n\n%s\n\n\n", SDL_GetError());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
if (sock) {
|
||||
NET_DestroyStreamSocket(sock);
|
||||
}
|
||||
|
||||
SDL_free(req);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NET_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+405
@@ -0,0 +1,405 @@
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3_net/SDL_net.h>
|
||||
|
||||
/*
|
||||
* This is just for demonstration purposes! A real VoIP solution would
|
||||
* definitely compress audio with a speech codec of some sort, it would
|
||||
* deal with packet loss better, it would have encryption, NAT punching,
|
||||
* and it wouldn't just allow _anyone_ to talk to you without some sort
|
||||
* of authorization step.
|
||||
*
|
||||
* All this to say: don't use this for anything serious!
|
||||
*/
|
||||
|
||||
typedef struct Voice
|
||||
{
|
||||
SDL_AudioStream *stream;
|
||||
NET_Address *addr;
|
||||
Uint16 port;
|
||||
Uint64 idnum;
|
||||
Uint64 last_seen;
|
||||
Uint64 last_packetnum;
|
||||
struct Voice *prev;
|
||||
struct Voice *next;
|
||||
} Voice;
|
||||
|
||||
static NET_DatagramSocket *sock = NULL; /* you talk over this, client or server. */
|
||||
static NET_Address *server_addr = NULL; /* address of the server you're talking to, NULL if you _are_ the server. */
|
||||
static Uint16 server_port = 3025;
|
||||
static int max_datagram = 0;
|
||||
static Voice *voices = NULL;
|
||||
static Uint64 next_idnum = 0;
|
||||
|
||||
static SDL_Window *window = NULL;
|
||||
static SDL_Renderer *renderer = NULL;
|
||||
static SDL_AudioDeviceID audio_device = 0;
|
||||
static SDL_AudioDeviceID capture_device = 0;
|
||||
static SDL_AudioStream *capture_stream = NULL;
|
||||
static const SDL_AudioSpec audio_spec = { SDL_AUDIO_S16LE, 1, 8000 };
|
||||
static Uint64 scratch_area[512];
|
||||
|
||||
static Voice *FindVoiceByAddr(const NET_Address *addr, const Uint16 port)
|
||||
{
|
||||
Voice *i;
|
||||
for (i = voices; i != NULL; i = i->next) {
|
||||
if ((i->port == port) && (NET_CompareAddresses(i->addr, addr) == 0)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Voice *FindVoiceByIdNum(const Uint64 idnum)
|
||||
{
|
||||
Voice *i;
|
||||
for (i = voices; i != NULL; i = i->next) {
|
||||
if (i->idnum == idnum) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ClearOldVoices(const Uint64 now)
|
||||
{
|
||||
Voice *i;
|
||||
Voice *next;
|
||||
for (i = voices; i != NULL; i = next) {
|
||||
next = i->next;
|
||||
if (!now || ((now - i->last_seen) > 60000)) { /* nothing new in 60+ seconds? (or shutting down?) */
|
||||
if (!i->stream || (SDL_GetAudioStreamAvailable(i->stream) == 0)) { /* they'll get a reprieve if data is still playing out */
|
||||
SDL_Log("Destroying voice #%" SDL_PRIu64, i->idnum);
|
||||
SDL_DestroyAudioStream(i->stream);
|
||||
NET_UnrefAddress(i->addr);
|
||||
if (i->prev) {
|
||||
i->prev->next = next;
|
||||
} else {
|
||||
voices = next;
|
||||
}
|
||||
if (next) {
|
||||
next->prev = i->prev;
|
||||
}
|
||||
SDL_free(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const int extra = (int) (sizeof (Uint64) * 2);
|
||||
static void SendClientAudioToServer(void)
|
||||
{
|
||||
const int br = SDL_GetAudioStreamData(capture_stream, scratch_area + (extra / sizeof(Uint64)), max_datagram - extra);
|
||||
if (br > 0) {
|
||||
next_idnum++;
|
||||
scratch_area[0] = SDL_Swap64LE(0); /* just being nice and leaving space in the buffer for the server to replace. */
|
||||
scratch_area[1] = SDL_Swap64LE(next_idnum);
|
||||
SDL_Log("CLIENT: Sending %d new bytes to server at %s:%d...", br + extra, NET_GetAddressString(server_addr), (int) server_port);
|
||||
if (!NET_SendDatagram(sock, server_addr, server_port, scratch_area, br + extra)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "NET_SendDatagram failed: %s", SDL_GetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void mainloop(void)
|
||||
{
|
||||
const bool is_client = (server_addr != NULL) ? true : false;
|
||||
bool done = false;
|
||||
Uint64 last_send_ticks = 0;
|
||||
|
||||
if (is_client) {
|
||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); /* red by default (green when recording) */
|
||||
}
|
||||
|
||||
while (!done) {
|
||||
bool activity = false;
|
||||
const Uint64 now = SDL_GetTicks();
|
||||
SDL_Event event;
|
||||
NET_Datagram *dgram = NULL;
|
||||
int rc;
|
||||
|
||||
while (((rc = NET_ReceiveDatagram(sock, &dgram)) == true) && (dgram != NULL)) {
|
||||
SDL_Log("%s: got %d-byte datagram from %s:%d", is_client ? "CLIENT" : "SERVER", (int) dgram->buflen, NET_GetAddressString(dgram->addr), (int) dgram->port);
|
||||
activity = true;
|
||||
if (!is_client) { /* we're the server? */
|
||||
Voice *voice = FindVoiceByAddr(dgram->addr, dgram->port);
|
||||
Voice *i;
|
||||
|
||||
if (!voice) {
|
||||
SDL_Log("SERVER: Creating voice idnum=%" SDL_PRIu64 " from %s:%d", next_idnum + 1, NET_GetAddressString(dgram->addr), (int) dgram->port);
|
||||
voice = (Voice *) SDL_calloc(1, sizeof (Voice));
|
||||
voice->addr = NET_RefAddress(dgram->addr);
|
||||
voice->port = dgram->port;
|
||||
voice->idnum = ++next_idnum;
|
||||
if (voices) {
|
||||
voice->next = voices;
|
||||
voices->prev = voice;
|
||||
}
|
||||
voices = voice;
|
||||
}
|
||||
|
||||
voice->last_seen = now;
|
||||
|
||||
/* send this new voice data to all recent speakers. */
|
||||
if (dgram->buflen > extra) { /* ignore it if too small, might just be a keepalive packet. */
|
||||
*((Uint64 *) dgram->buf) = SDL_Swap64LE(voice->idnum); /* the client leaves space to fill this in for convenience. */
|
||||
for (i = voices; i != NULL; i = i->next) {
|
||||
if ((voice->port != i->port) || (NET_CompareAddresses(voice->addr, i->addr) != 0)) { /* don't send client's own voice back to them. */
|
||||
SDL_Log("SERVER: sending %d-byte datagram to %s:%d", (int) dgram->buflen, NET_GetAddressString(i->addr), (int) i->port);
|
||||
NET_SendDatagram(sock, i->addr, i->port, dgram->buf, dgram->buflen);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { /* we're the client. */
|
||||
if ((dgram->port != server_port) || (NET_CompareAddresses(dgram->addr, server_addr) != 0)) {
|
||||
SDL_Log("CLIENT: Got packet from non-server address %s:%d. Ignoring.", NET_GetAddressString(dgram->addr), (int) dgram->port);
|
||||
} else if (dgram->buflen < extra) {
|
||||
SDL_Log("CLIENT: Got bogus packet from the server. Ignoring.");
|
||||
} else {
|
||||
const Uint64 idnum = SDL_Swap64LE(((const Uint64 *) dgram->buf)[0]);
|
||||
const Uint64 packetnum = SDL_Swap64LE(((const Uint64 *) dgram->buf)[1]);
|
||||
Voice *voice = FindVoiceByIdNum(idnum);
|
||||
if (!voice) {
|
||||
SDL_Log("CLIENT: Creating voice idnum=#%" SDL_PRIu64, idnum);
|
||||
voice = (Voice *) SDL_calloc(1, sizeof (Voice));
|
||||
if (audio_device) {
|
||||
voice->stream = SDL_CreateAudioStream(&audio_spec, &audio_spec);
|
||||
if (voice->stream) {
|
||||
SDL_BindAudioStream(audio_device, voice->stream);
|
||||
}
|
||||
}
|
||||
voice->idnum = idnum;
|
||||
if (voices) {
|
||||
voice->next = voices;
|
||||
voices->prev = voice;
|
||||
}
|
||||
voices = voice;
|
||||
}
|
||||
|
||||
voice->last_seen = now;
|
||||
|
||||
if (packetnum > voice->last_packetnum) { /* if packet arrived out of order, don't queue it for playing. */
|
||||
voice->last_packetnum = packetnum;
|
||||
SDL_PutAudioStreamData(voice->stream, dgram->buf + extra, dgram->buflen - extra);
|
||||
SDL_FlushAudioStream(voice->stream); /* flush right away so we have all data if the stream dries up. We can still safely add more data later. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NET_DestroyDatagram(dgram);
|
||||
}
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
activity = true;
|
||||
switch (event.type) {
|
||||
case SDL_EVENT_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
if (is_client && capture_stream && (event.button.button == SDL_BUTTON_LEFT)) {
|
||||
if (SDL_BindAudioStream(capture_device, capture_stream)) {
|
||||
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); /* green when recording */
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP:
|
||||
if (is_client && capture_stream && (event.button.button == SDL_BUTTON_LEFT)) {
|
||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); /* red when not recording */
|
||||
SDL_UnbindAudioStream(capture_stream);
|
||||
SDL_FlushAudioStream(capture_stream);
|
||||
while (SDL_GetAudioStreamAvailable(capture_stream) > 0) {
|
||||
SendClientAudioToServer();
|
||||
last_send_ticks = now;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_client) {
|
||||
if (capture_stream) {
|
||||
while (SDL_GetAudioStreamAvailable(capture_stream) > max_datagram) {
|
||||
SendClientAudioToServer();
|
||||
last_send_ticks = now;
|
||||
activity = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!last_send_ticks || ((now - last_send_ticks) > 5000)) { /* send a keepalive packet if we haven't transmitted for a bit. */
|
||||
next_idnum++;
|
||||
scratch_area[0] = SDL_Swap64LE(0);
|
||||
scratch_area[1] = SDL_Swap64LE(next_idnum);
|
||||
SDL_Log("CLIENT: Sending %d keepalive bytes to server at %s:%d...", extra, NET_GetAddressString(server_addr), (int) server_port);
|
||||
NET_SendDatagram(sock, server_addr, server_port, scratch_area, extra);
|
||||
last_send_ticks = now;
|
||||
}
|
||||
}
|
||||
|
||||
ClearOldVoices(now);
|
||||
|
||||
if (!activity) {
|
||||
SDL_Delay(10);
|
||||
}
|
||||
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
}
|
||||
static void print_usage(const char *prog) {
|
||||
SDL_Log("USAGE: %s <hostname|ip> [--help] [--server] [--port X] [--simulate-failure Y]", prog);
|
||||
}
|
||||
|
||||
static void run_voipchat(int argc, char **argv)
|
||||
{
|
||||
const char *hostname = NULL;
|
||||
bool is_server = false;
|
||||
int simulate_failure = 0;
|
||||
int i;
|
||||
NET_Address *socket_address = NULL;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
if (SDL_strcmp(arg, "--help") == 0) {
|
||||
print_usage(argv[0]);
|
||||
return;
|
||||
} else if (SDL_strcmp(arg, "--server") == 0) {
|
||||
is_server = true;
|
||||
} else if ((SDL_strcmp(arg, "--port") == 0) && (i < (argc-1))) {
|
||||
server_port = (Uint16) SDL_atoi(argv[++i]);
|
||||
} else if ((SDL_strcmp(arg, "--simulate-failure") == 0) && (i < (argc-1))) {
|
||||
simulate_failure = (int) SDL_atoi(argv[++i]);
|
||||
} else {
|
||||
hostname = arg;
|
||||
}
|
||||
}
|
||||
|
||||
simulate_failure = SDL_clamp(simulate_failure, 0, 100);
|
||||
if (simulate_failure) {
|
||||
SDL_Log("Simulating failure at %d percent", simulate_failure);
|
||||
}
|
||||
|
||||
if (!is_server && !hostname) {
|
||||
print_usage(argv[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_server) {
|
||||
if (hostname) {
|
||||
SDL_Log("SERVER: Resolving binding hostname '%s' ...", hostname);
|
||||
socket_address = NET_ResolveHostname(hostname);
|
||||
if (socket_address) {
|
||||
if (NET_WaitUntilResolved(socket_address, -1) == NET_FAILURE) {
|
||||
NET_UnrefAddress(socket_address);
|
||||
socket_address = NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int num_addresses;
|
||||
NET_Address **addresses;
|
||||
addresses = NET_GetLocalAddresses(&num_addresses);
|
||||
if (addresses == NULL || num_addresses <= 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to to get local addresses: %s", SDL_GetError());
|
||||
} else {
|
||||
socket_address = addresses[0];
|
||||
NET_RefAddress(socket_address);
|
||||
}
|
||||
}
|
||||
if (socket_address) {
|
||||
SDL_Log("SERVER: Listening on %s:%d.", NET_GetAddressString(socket_address), server_port);
|
||||
} else {
|
||||
SDL_Log("SERVER: Listening on port %d", server_port);
|
||||
}
|
||||
} else {
|
||||
SDL_Log("CLIENT: Resolving server hostname '%s' ...", hostname);
|
||||
server_addr = NET_ResolveHostname(hostname);
|
||||
if (server_addr) {
|
||||
if (NET_WaitUntilResolved(server_addr, -1) == NET_FAILURE) {
|
||||
NET_UnrefAddress(server_addr);
|
||||
server_addr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!server_addr) {
|
||||
SDL_Log("CLIENT: Failed! %s", SDL_GetError());
|
||||
SDL_Log("CLIENT: Giving up.");
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_Log("CLIENT: Server is at %s:%d.", NET_GetAddressString(server_addr), (int) server_port);
|
||||
|
||||
audio_device = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &audio_spec);
|
||||
if (!audio_device) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CLIENT: Failed to open output audio device (%s), going on without sound playback!", SDL_GetError());
|
||||
}
|
||||
|
||||
capture_device = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_RECORDING, &audio_spec);
|
||||
if (!capture_device) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CLIENT: Failed to open capture audio device (%s), going on without sound recording!", SDL_GetError());
|
||||
} else {
|
||||
capture_stream = SDL_CreateAudioStream(&audio_spec, &audio_spec);
|
||||
if (!capture_stream) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CLIENT: Failed to create capture audio stream (%s), going on without sound recording!", SDL_GetError());
|
||||
SDL_CloseAudioDevice(capture_device);
|
||||
capture_device = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* server _must_ be on the requested port. Clients can take anything available, server will respond to where it sees it come from. */
|
||||
sock = NET_CreateDatagramSocket(socket_address, is_server ? server_port : 0);
|
||||
NET_UnrefAddress(socket_address);
|
||||
if (!sock) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create datagram socket: %s", SDL_GetError());
|
||||
} else {
|
||||
if (simulate_failure) {
|
||||
NET_SimulateDatagramPacketLoss(sock, simulate_failure);
|
||||
}
|
||||
mainloop();
|
||||
}
|
||||
|
||||
SDL_Log("Shutting down...");
|
||||
|
||||
ClearOldVoices(0);
|
||||
|
||||
SDL_DestroyAudioStream(capture_stream);
|
||||
SDL_CloseAudioDevice(audio_device);
|
||||
SDL_CloseAudioDevice(capture_device);
|
||||
audio_device = capture_device = 0;
|
||||
|
||||
NET_UnrefAddress(server_addr);
|
||||
server_addr = NULL;
|
||||
NET_DestroyDatagramSocket(sock);
|
||||
sock = NULL;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init failed: %s", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!NET_Init()) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "NET_Init failed: %s", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow("SDL3_net voipchat example", 640, 480, 0);
|
||||
renderer = SDL_CreateRenderer(window, NULL);
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
|
||||
max_datagram = SDL_min(1200, (int) sizeof (scratch_area));
|
||||
|
||||
run_voipchat(argc, argv);
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
|
||||
NET_Quit();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
+1476
File diff suppressed because it is too large
Load Diff
+2154
File diff suppressed because it is too large
Load Diff
+37
@@ -0,0 +1,37 @@
|
||||
SDL3_net_0.0.0 {
|
||||
global:
|
||||
NET_AcceptClient;
|
||||
NET_CompareAddresses;
|
||||
NET_CreateClient;
|
||||
NET_CreateDatagramSocket;
|
||||
NET_CreateServer;
|
||||
NET_DestroyDatagram;
|
||||
NET_DestroyDatagramSocket;
|
||||
NET_DestroyServer;
|
||||
NET_DestroyStreamSocket;
|
||||
NET_FreeLocalAddresses;
|
||||
NET_GetAddressStatus;
|
||||
NET_GetAddressString;
|
||||
NET_GetConnectionStatus;
|
||||
NET_GetLocalAddresses;
|
||||
NET_GetStreamSocketAddress;
|
||||
NET_GetStreamSocketPendingWrites;
|
||||
NET_Version;
|
||||
NET_Init;
|
||||
NET_Quit;
|
||||
NET_ReadFromStreamSocket;
|
||||
NET_ReceiveDatagram;
|
||||
NET_RefAddress;
|
||||
NET_ResolveHostname;
|
||||
NET_SendDatagram;
|
||||
NET_SimulateAddressResolutionLoss;
|
||||
NET_SimulateDatagramPacketLoss;
|
||||
NET_SimulateStreamPacketLoss;
|
||||
NET_UnrefAddress;
|
||||
NET_WaitUntilConnected;
|
||||
NET_WaitUntilInputAvailable;
|
||||
NET_WaitUntilResolved;
|
||||
NET_WaitUntilStreamSocketDrained;
|
||||
NET_WriteToStreamSocket;
|
||||
local: *;
|
||||
};
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
|
||||
#include "winresrc.h"
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,0,0,0
|
||||
PRODUCTVERSION 3,0,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL_net\0"
|
||||
VALUE "FileVersion", "3, 0, 0, 0\0"
|
||||
VALUE "InternalName", "SDL_net\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL3_net.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "3, 0, 0, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
@@ -1,4 +1,4 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
if(POLICY CMP0025)
|
||||
# detect Apple's Clang
|
||||
cmake_policy(SET CMP0025 NEW)
|
||||
|
||||
Vendored
+5
-5
@@ -1,7 +1,7 @@
|
||||
#define MY_VER_MAJOR 24
|
||||
#define MY_VER_MINOR 9
|
||||
#define MY_VER_MAJOR 25
|
||||
#define MY_VER_MINOR 1
|
||||
#define MY_VER_BUILD 0
|
||||
#define MY_VERSION_NUMBERS "24.09"
|
||||
#define MY_VERSION_NUMBERS "25.01"
|
||||
#define MY_VERSION MY_VERSION_NUMBERS
|
||||
|
||||
#ifdef MY_CPU_NAME
|
||||
@@ -10,12 +10,12 @@
|
||||
#define MY_VERSION_CPU MY_VERSION
|
||||
#endif
|
||||
|
||||
#define MY_DATE "2024-11-29"
|
||||
#define MY_DATE "2025-08-03"
|
||||
#undef MY_COPYRIGHT
|
||||
#undef MY_VERSION_COPYRIGHT_DATE
|
||||
#define MY_AUTHOR_NAME "Igor Pavlov"
|
||||
#define MY_COPYRIGHT_PD "Igor Pavlov : Public domain"
|
||||
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2024 Igor Pavlov"
|
||||
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2025 Igor Pavlov"
|
||||
|
||||
#ifdef USE_COPYRIGHT_CR
|
||||
#define MY_COPYRIGHT MY_COPYRIGHT_CR
|
||||
|
||||
Vendored
+1
-1
@@ -29,5 +29,5 @@ set(lzma_SOURCES
|
||||
7zStream.c
|
||||
)
|
||||
|
||||
add_definitions(-D_7ZIP_PPMD_SUPPPORT -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
|
||||
add_definitions(-DZ7_PPMD_SUPPORT -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
|
||||
add_library(lzma STATIC ${lzma_SOURCES})
|
||||
|
||||
Vendored
+11
-1
@@ -1,5 +1,5 @@
|
||||
/* Compiler.h : Compiler specific defines and pragmas
|
||||
2024-01-22 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef ZIP7_INC_COMPILER_H
|
||||
#define ZIP7_INC_COMPILER_H
|
||||
@@ -183,6 +183,16 @@ typedef void (*Z7_void_Function)(void);
|
||||
#define Z7_ATTRIB_NO_VECTORIZE
|
||||
#endif
|
||||
|
||||
#if defined(Z7_MSC_VER_ORIGINAL) && (Z7_MSC_VER_ORIGINAL >= 1920)
|
||||
#define Z7_PRAGMA_OPTIMIZE_FOR_CODE_SIZE _Pragma("optimize ( \"s\", on )")
|
||||
#define Z7_PRAGMA_OPTIMIZE_DEFAULT _Pragma("optimize ( \"\", on )")
|
||||
#else
|
||||
#define Z7_PRAGMA_OPTIMIZE_FOR_CODE_SIZE
|
||||
#define Z7_PRAGMA_OPTIMIZE_DEFAULT
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(MY_CPU_X86_OR_AMD64) && ( \
|
||||
defined(__clang__) && (__clang_major__ >= 4) \
|
||||
|| defined(__GNUC__) && (__GNUC__ >= 5))
|
||||
|
||||
Vendored
+8
@@ -47,6 +47,12 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
|
||||
#define MY_CPU_SIZEOF_POINTER 4
|
||||
#endif
|
||||
|
||||
#if defined(__SSE2__) \
|
||||
|| defined(MY_CPU_AMD64) \
|
||||
|| defined(_M_IX86_FP) && (_M_IX86_FP >= 2)
|
||||
#define MY_CPU_SSE2
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_M_ARM64) \
|
||||
|| defined(_M_ARM64EC) \
|
||||
@@ -571,10 +577,12 @@ problem-4 : performace:
|
||||
#define Z7_CONV_BE_TO_NATIVE_CONST32(v) (v)
|
||||
#define Z7_CONV_LE_TO_NATIVE_CONST32(v) Z7_BSWAP32_CONST(v)
|
||||
#define Z7_CONV_NATIVE_TO_BE_32(v) (v)
|
||||
// #define Z7_GET_NATIVE16_FROM_2_BYTES(b0, b1) ((b1) | ((b0) << 8))
|
||||
#elif defined(MY_CPU_LE)
|
||||
#define Z7_CONV_BE_TO_NATIVE_CONST32(v) Z7_BSWAP32_CONST(v)
|
||||
#define Z7_CONV_LE_TO_NATIVE_CONST32(v) (v)
|
||||
#define Z7_CONV_NATIVE_TO_BE_32(v) Z7_BSWAP32(v)
|
||||
// #define Z7_GET_NATIVE16_FROM_2_BYTES(b0, b1) ((b0) | ((b1) << 8))
|
||||
#else
|
||||
#error Stop_Compiling_Unknown_Endian_CONV
|
||||
#endif
|
||||
|
||||
Vendored
+13
-13
@@ -1,5 +1,5 @@
|
||||
/* LzFind.c -- Match finder for LZ algorithms
|
||||
2024-03-01 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -404,7 +404,7 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
|
||||
const unsigned nbMax =
|
||||
(p->numHashBytes == 2 ? 16 :
|
||||
(p->numHashBytes == 3 ? 24 : 32));
|
||||
if (numBits > nbMax)
|
||||
if (numBits >= nbMax)
|
||||
numBits = nbMax;
|
||||
if (numBits >= 32)
|
||||
hs = (UInt32)0 - 1;
|
||||
@@ -416,14 +416,14 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
|
||||
hs |= (256 << kLzHash_CrcShift_2) - 1;
|
||||
{
|
||||
const UInt32 hs2 = MatchFinder_GetHashMask2(p, historySize);
|
||||
if (hs > hs2)
|
||||
if (hs >= hs2)
|
||||
hs = hs2;
|
||||
}
|
||||
hsCur = hs;
|
||||
if (p->expectedDataSize < historySize)
|
||||
{
|
||||
const UInt32 hs2 = MatchFinder_GetHashMask2(p, (UInt32)p->expectedDataSize);
|
||||
if (hsCur > hs2)
|
||||
if (hsCur >= hs2)
|
||||
hsCur = hs2;
|
||||
}
|
||||
}
|
||||
@@ -434,7 +434,7 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
|
||||
if (p->expectedDataSize < historySize)
|
||||
{
|
||||
hsCur = MatchFinder_GetHashMask(p, (UInt32)p->expectedDataSize);
|
||||
if (hsCur > hs) // is it possible?
|
||||
if (hsCur >= hs) // is it possible?
|
||||
hsCur = hs;
|
||||
}
|
||||
}
|
||||
@@ -598,7 +598,7 @@ void MatchFinder_Init(void *_p)
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
#if defined(__clang__) && (__clang_major__ >= 4) \
|
||||
|| defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40701)
|
||||
|| defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40900)
|
||||
// || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1900)
|
||||
|
||||
#define USE_LZFIND_SATUR_SUB_128
|
||||
@@ -890,7 +890,7 @@ static UInt32 * Hc_GetMatchesSpec(size_t lenLimit, UInt32 curMatch, UInt32 pos,
|
||||
return d;
|
||||
{
|
||||
const Byte *pb = cur - delta;
|
||||
curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
|
||||
curMatch = son[_cyclicBufferPos - delta + (_cyclicBufferPos < delta ? _cyclicBufferSize : 0)];
|
||||
if (pb[maxLen] == cur[maxLen] && *pb == *cur)
|
||||
{
|
||||
UInt32 len = 0;
|
||||
@@ -925,7 +925,7 @@ static UInt32 * Hc_GetMatchesSpec(size_t lenLimit, UInt32 curMatch, UInt32 pos,
|
||||
break;
|
||||
{
|
||||
ptrdiff_t diff;
|
||||
curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
|
||||
curMatch = son[_cyclicBufferPos - delta + (_cyclicBufferPos < delta ? _cyclicBufferSize : 0)];
|
||||
diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
|
||||
if (cur[maxLen] == cur[(ptrdiff_t)maxLen + diff])
|
||||
{
|
||||
@@ -972,7 +972,7 @@ UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byt
|
||||
// if (curMatch >= pos) { *ptr0 = *ptr1 = kEmptyHashValue; return NULL; }
|
||||
|
||||
cmCheck = (UInt32)(pos - _cyclicBufferSize);
|
||||
if ((UInt32)pos <= _cyclicBufferSize)
|
||||
if ((UInt32)pos < _cyclicBufferSize)
|
||||
cmCheck = 0;
|
||||
|
||||
if (cmCheck < curMatch)
|
||||
@@ -980,7 +980,7 @@ UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byt
|
||||
{
|
||||
const UInt32 delta = pos - curMatch;
|
||||
{
|
||||
CLzRef *pair = son + ((size_t)(_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
|
||||
CLzRef *pair = son + ((size_t)(_cyclicBufferPos - delta + (_cyclicBufferPos < delta ? _cyclicBufferSize : 0)) << 1);
|
||||
const Byte *pb = cur - delta;
|
||||
unsigned len = (len0 < len1 ? len0 : len1);
|
||||
const UInt32 pair0 = pair[0];
|
||||
@@ -1039,7 +1039,7 @@ static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const
|
||||
UInt32 cmCheck;
|
||||
|
||||
cmCheck = (UInt32)(pos - _cyclicBufferSize);
|
||||
if ((UInt32)pos <= _cyclicBufferSize)
|
||||
if ((UInt32)pos < _cyclicBufferSize)
|
||||
cmCheck = 0;
|
||||
|
||||
if (// curMatch >= pos || // failure
|
||||
@@ -1048,7 +1048,7 @@ static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const
|
||||
{
|
||||
const UInt32 delta = pos - curMatch;
|
||||
{
|
||||
CLzRef *pair = son + ((size_t)(_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
|
||||
CLzRef *pair = son + ((size_t)(_cyclicBufferPos - delta + (_cyclicBufferPos < delta ? _cyclicBufferSize : 0)) << 1);
|
||||
const Byte *pb = cur - delta;
|
||||
unsigned len = (len0 < len1 ? len0 : len1);
|
||||
if (pb[len] == cur[len])
|
||||
@@ -1595,7 +1595,7 @@ static void Bt5_MatchFinder_Skip(void *_p, UInt32 num)
|
||||
UInt32 pos = p->pos; \
|
||||
UInt32 num2 = num; \
|
||||
/* (p->pos == p->posLimit) is not allowed here !!! */ \
|
||||
{ const UInt32 rem = p->posLimit - pos; if (num2 > rem) num2 = rem; } \
|
||||
{ const UInt32 rem = p->posLimit - pos; if (num2 >= rem) num2 = rem; } \
|
||||
num -= num2; \
|
||||
{ const UInt32 cycPos = p->cyclicBufferPos; \
|
||||
son = p->son + cycPos; \
|
||||
|
||||
Vendored
+9
-1
@@ -1,5 +1,5 @@
|
||||
/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
|
||||
2024-01-22 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -82,6 +82,8 @@ extern UInt64 g_NumIters_Bytes;
|
||||
Z7_NO_INLINE
|
||||
static void MtSync_Construct(CMtSync *p)
|
||||
{
|
||||
p->affinityGroup = -1;
|
||||
p->affinityInGroup = 0;
|
||||
p->affinity = 0;
|
||||
p->wasCreated = False;
|
||||
p->csWasInitialized = False;
|
||||
@@ -259,6 +261,12 @@ static WRes MtSync_Create_WRes(CMtSync *p, THREAD_FUNC_TYPE startAddress, void *
|
||||
// return ERROR_TOO_MANY_POSTS; // for debug
|
||||
// return EINVAL; // for debug
|
||||
|
||||
#ifdef _WIN32
|
||||
if (p->affinityGroup >= 0)
|
||||
wres = Thread_Create_With_Group(&p->thread, startAddress, obj,
|
||||
(unsigned)(UInt32)p->affinityGroup, (CAffinityMask)p->affinityInGroup);
|
||||
else
|
||||
#endif
|
||||
if (p->affinity != 0)
|
||||
wres = Thread_Create_With_Affinity(&p->thread, startAddress, obj, (CAffinityMask)p->affinity);
|
||||
else
|
||||
|
||||
Vendored
+4
-2
@@ -1,5 +1,5 @@
|
||||
/* LzFindMt.h -- multithreaded Match finder for LZ algorithms
|
||||
2024-01-22 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef ZIP7_INC_LZ_FIND_MT_H
|
||||
#define ZIP7_INC_LZ_FIND_MT_H
|
||||
@@ -12,8 +12,10 @@ EXTERN_C_BEGIN
|
||||
typedef struct
|
||||
{
|
||||
UInt32 numProcessedBlocks;
|
||||
CThread thread;
|
||||
Int32 affinityGroup;
|
||||
UInt64 affinityInGroup;
|
||||
UInt64 affinity;
|
||||
CThread thread;
|
||||
|
||||
BoolInt wasCreated;
|
||||
BoolInt needStart;
|
||||
|
||||
Vendored
+3
-1
@@ -1,5 +1,5 @@
|
||||
/* Lzma2Enc.c -- LZMA2 Encoder
|
||||
2023-04-13 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -235,6 +235,7 @@ void Lzma2EncProps_Init(CLzma2EncProps *p)
|
||||
p->numBlockThreads_Reduced = -1;
|
||||
p->numBlockThreads_Max = -1;
|
||||
p->numTotalThreads = -1;
|
||||
p->numThreadGroups = 0;
|
||||
}
|
||||
|
||||
void Lzma2EncProps_Normalize(CLzma2EncProps *p)
|
||||
@@ -781,6 +782,7 @@ SRes Lzma2Enc_Encode2(CLzma2EncHandle p,
|
||||
}
|
||||
|
||||
p->mtCoder.numThreadsMax = (unsigned)p->props.numBlockThreads_Max;
|
||||
p->mtCoder.numThreadGroups = p->props.numThreadGroups;
|
||||
p->mtCoder.expectedDataSize = p->expectedDataSize;
|
||||
|
||||
{
|
||||
|
||||
Vendored
+1
@@ -18,6 +18,7 @@ typedef struct
|
||||
int numBlockThreads_Reduced;
|
||||
int numBlockThreads_Max;
|
||||
int numTotalThreads;
|
||||
unsigned numThreadGroups; // 0 : no groups
|
||||
} CLzma2EncProps;
|
||||
|
||||
void Lzma2EncProps_Init(CLzma2EncProps *p);
|
||||
|
||||
Vendored
+6
@@ -62,7 +62,9 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
|
||||
p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
|
||||
p->numHashOutBits = 0;
|
||||
p->writeEndMark = 0;
|
||||
p->affinityGroup = -1;
|
||||
p->affinity = 0;
|
||||
p->affinityInGroup = 0;
|
||||
}
|
||||
|
||||
void LzmaEncProps_Normalize(CLzmaEncProps *p)
|
||||
@@ -598,6 +600,10 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props2)
|
||||
p->multiThread = (props.numThreads > 1);
|
||||
p->matchFinderMt.btSync.affinity =
|
||||
p->matchFinderMt.hashSync.affinity = props.affinity;
|
||||
p->matchFinderMt.btSync.affinityGroup =
|
||||
p->matchFinderMt.hashSync.affinityGroup = props.affinityGroup;
|
||||
p->matchFinderMt.btSync.affinityInGroup =
|
||||
p->matchFinderMt.hashSync.affinityInGroup = props.affinityInGroup;
|
||||
#endif
|
||||
|
||||
return SZ_OK;
|
||||
|
||||
Vendored
+3
-1
@@ -1,5 +1,5 @@
|
||||
/* LzmaEnc.h -- LZMA Encoder
|
||||
2023-04-13 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef ZIP7_INC_LZMA_ENC_H
|
||||
#define ZIP7_INC_LZMA_ENC_H
|
||||
@@ -29,11 +29,13 @@ typedef struct
|
||||
int numThreads; /* 1 or 2, default = 2 */
|
||||
|
||||
// int _pad;
|
||||
Int32 affinityGroup;
|
||||
|
||||
UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1.
|
||||
Encoder uses this value to reduce dictionary size */
|
||||
|
||||
UInt64 affinity;
|
||||
UInt64 affinityInGroup;
|
||||
} CLzmaEncProps;
|
||||
|
||||
void LzmaEncProps_Init(CLzmaEncProps *p);
|
||||
|
||||
Vendored
+47
-14
@@ -1,5 +1,5 @@
|
||||
/* MtCoder.c -- Multi-thread Coder
|
||||
2023-09-07 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -39,14 +39,28 @@ void MtProgressThunk_CreateVTable(CMtProgressThunk *p)
|
||||
static THREAD_FUNC_DECL ThreadFunc(void *pp);
|
||||
|
||||
|
||||
static SRes MtCoderThread_CreateAndStart(CMtCoderThread *t)
|
||||
static SRes MtCoderThread_CreateAndStart(CMtCoderThread *t
|
||||
#ifdef _WIN32
|
||||
, CMtCoder * const mtc
|
||||
#endif
|
||||
)
|
||||
{
|
||||
WRes wres = AutoResetEvent_OptCreate_And_Reset(&t->startEvent);
|
||||
// printf("\n====== MtCoderThread_CreateAndStart : \n");
|
||||
if (wres == 0)
|
||||
{
|
||||
t->stop = False;
|
||||
if (!Thread_WasCreated(&t->thread))
|
||||
wres = Thread_Create(&t->thread, ThreadFunc, t);
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (mtc->numThreadGroups)
|
||||
wres = Thread_Create_With_Group(&t->thread, ThreadFunc, t,
|
||||
ThreadNextGroup_GetNext(&mtc->nextGroup), // group
|
||||
0); // affinityMask
|
||||
else
|
||||
#endif
|
||||
wres = Thread_Create(&t->thread, ThreadFunc, t);
|
||||
}
|
||||
if (wres == 0)
|
||||
wres = Event_Set(&t->startEvent);
|
||||
}
|
||||
@@ -56,6 +70,7 @@ static SRes MtCoderThread_CreateAndStart(CMtCoderThread *t)
|
||||
}
|
||||
|
||||
|
||||
Z7_FORCE_INLINE
|
||||
static void MtCoderThread_Destruct(CMtCoderThread *t)
|
||||
{
|
||||
if (Thread_WasCreated(&t->thread))
|
||||
@@ -85,7 +100,7 @@ static void MtCoderThread_Destruct(CMtCoderThread *t)
|
||||
|
||||
static SRes ThreadFunc2(CMtCoderThread *t)
|
||||
{
|
||||
CMtCoder *mtc = t->mtCoder;
|
||||
CMtCoder * const mtc = t->mtCoder;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@@ -185,7 +200,11 @@ static SRes ThreadFunc2(CMtCoderThread *t)
|
||||
if (mtc->numStartedThreads < mtc->numStartedThreadsLimit
|
||||
&& mtc->expectedDataSize != readProcessed)
|
||||
{
|
||||
res = MtCoderThread_CreateAndStart(&mtc->threads[mtc->numStartedThreads]);
|
||||
res = MtCoderThread_CreateAndStart(&mtc->threads[mtc->numStartedThreads]
|
||||
#ifdef _WIN32
|
||||
, mtc
|
||||
#endif
|
||||
);
|
||||
if (res == SZ_OK)
|
||||
mtc->numStartedThreads++;
|
||||
else
|
||||
@@ -221,7 +240,7 @@ static SRes ThreadFunc2(CMtCoderThread *t)
|
||||
}
|
||||
|
||||
{
|
||||
CMtCoderBlock *block = &mtc->blocks[bi];
|
||||
CMtCoderBlock * const block = &mtc->blocks[bi];
|
||||
block->res = res;
|
||||
block->bufIndex = bufIndex;
|
||||
block->finished = finished;
|
||||
@@ -311,7 +330,7 @@ static SRes ThreadFunc2(CMtCoderThread *t)
|
||||
|
||||
static THREAD_FUNC_DECL ThreadFunc(void *pp)
|
||||
{
|
||||
CMtCoderThread *t = (CMtCoderThread *)pp;
|
||||
CMtCoderThread * const t = (CMtCoderThread *)pp;
|
||||
for (;;)
|
||||
{
|
||||
if (Event_Wait(&t->startEvent) != 0)
|
||||
@@ -319,7 +338,7 @@ static THREAD_FUNC_DECL ThreadFunc(void *pp)
|
||||
if (t->stop)
|
||||
return 0;
|
||||
{
|
||||
SRes res = ThreadFunc2(t);
|
||||
const SRes res = ThreadFunc2(t);
|
||||
CMtCoder *mtc = t->mtCoder;
|
||||
if (res != SZ_OK)
|
||||
{
|
||||
@@ -328,7 +347,7 @@ static THREAD_FUNC_DECL ThreadFunc(void *pp)
|
||||
|
||||
#ifndef MTCODER_USE_WRITE_THREAD
|
||||
{
|
||||
unsigned numFinished = (unsigned)InterlockedIncrement(&mtc->numFinishedThreads);
|
||||
const unsigned numFinished = (unsigned)InterlockedIncrement(&mtc->numFinishedThreads);
|
||||
if (numFinished == mtc->numStartedThreads)
|
||||
if (Event_Set(&mtc->finishedEvent) != 0)
|
||||
return (THREAD_FUNC_RET_TYPE)SZ_ERROR_THREAD;
|
||||
@@ -346,6 +365,7 @@ void MtCoder_Construct(CMtCoder *p)
|
||||
|
||||
p->blockSize = 0;
|
||||
p->numThreadsMax = 0;
|
||||
p->numThreadGroups = 0;
|
||||
p->expectedDataSize = (UInt64)(Int64)-1;
|
||||
|
||||
p->inStream = NULL;
|
||||
@@ -429,6 +449,8 @@ SRes MtCoder_Code(CMtCoder *p)
|
||||
unsigned i;
|
||||
SRes res = SZ_OK;
|
||||
|
||||
// printf("\n====== MtCoder_Code : \n");
|
||||
|
||||
if (numThreads > MTCODER_THREADS_MAX)
|
||||
numThreads = MTCODER_THREADS_MAX;
|
||||
numBlocksMax = MTCODER_GET_NUM_BLOCKS_FROM_THREADS(numThreads);
|
||||
@@ -492,11 +514,22 @@ SRes MtCoder_Code(CMtCoder *p)
|
||||
|
||||
p->numStartedThreadsLimit = numThreads;
|
||||
p->numStartedThreads = 0;
|
||||
ThreadNextGroup_Init(&p->nextGroup, p->numThreadGroups, 0); // startGroup
|
||||
|
||||
// for (i = 0; i < numThreads; i++)
|
||||
{
|
||||
// here we create new thread for first block.
|
||||
// And each new thread will create another new thread after block reading
|
||||
// until numStartedThreadsLimit is reached.
|
||||
CMtCoderThread *nextThread = &p->threads[p->numStartedThreads++];
|
||||
RINOK(MtCoderThread_CreateAndStart(nextThread))
|
||||
{
|
||||
const SRes res2 = MtCoderThread_CreateAndStart(nextThread
|
||||
#ifdef _WIN32
|
||||
, p
|
||||
#endif
|
||||
);
|
||||
RINOK(res2)
|
||||
}
|
||||
}
|
||||
|
||||
RINOK_THREAD(Event_Set(&p->readEvent))
|
||||
@@ -513,9 +546,9 @@ SRes MtCoder_Code(CMtCoder *p)
|
||||
RINOK_THREAD(Event_Wait(&p->writeEvents[bi]))
|
||||
|
||||
{
|
||||
const CMtCoderBlock *block = &p->blocks[bi];
|
||||
unsigned bufIndex = block->bufIndex;
|
||||
BoolInt finished = block->finished;
|
||||
const CMtCoderBlock * const block = &p->blocks[bi];
|
||||
const unsigned bufIndex = block->bufIndex;
|
||||
const BoolInt finished = block->finished;
|
||||
if (res == SZ_OK && block->res != SZ_OK)
|
||||
res = block->res;
|
||||
|
||||
@@ -545,7 +578,7 @@ SRes MtCoder_Code(CMtCoder *p)
|
||||
}
|
||||
#else
|
||||
{
|
||||
WRes wres = Event_Wait(&p->finishedEvent);
|
||||
const WRes wres = Event_Wait(&p->finishedEvent);
|
||||
res = MY_SRes_HRESULT_FROM_WRes(wres);
|
||||
}
|
||||
#endif
|
||||
|
||||
Vendored
+5
-2
@@ -1,5 +1,5 @@
|
||||
/* MtCoder.h -- Multi-thread Coder
|
||||
2023-04-13 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef ZIP7_INC_MT_CODER_H
|
||||
#define ZIP7_INC_MT_CODER_H
|
||||
@@ -16,7 +16,7 @@ EXTERN_C_BEGIN
|
||||
|
||||
#ifndef Z7_ST
|
||||
#define MTCODER_GET_NUM_BLOCKS_FROM_THREADS(numThreads) ((numThreads) + (numThreads) / 8 + 1)
|
||||
#define MTCODER_THREADS_MAX 64
|
||||
#define MTCODER_THREADS_MAX 256
|
||||
#define MTCODER_BLOCKS_MAX (MTCODER_GET_NUM_BLOCKS_FROM_THREADS(MTCODER_THREADS_MAX) + 3)
|
||||
#else
|
||||
#define MTCODER_THREADS_MAX 1
|
||||
@@ -77,6 +77,7 @@ typedef struct CMtCoder_
|
||||
|
||||
size_t blockSize; /* size of input block */
|
||||
unsigned numThreadsMax;
|
||||
unsigned numThreadGroups;
|
||||
UInt64 expectedDataSize;
|
||||
|
||||
ISeqInStreamPtr inStream;
|
||||
@@ -125,6 +126,8 @@ typedef struct CMtCoder_
|
||||
CMtProgress mtProgress;
|
||||
CMtCoderBlock blocks[MTCODER_BLOCKS_MAX];
|
||||
CMtCoderThread threads[MTCODER_THREADS_MAX];
|
||||
|
||||
CThreadNextGroup nextGroup;
|
||||
} CMtCoder;
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
# LZMA SDK v24.09
|
||||
# LZMA SDK v25.01
|
||||
Downloaded from https://www.7-zip.org/sdk.html
|
||||
Vendored
+247
-120
@@ -1,141 +1,268 @@
|
||||
/* Sort.c -- Sort functions
|
||||
2014-04-05 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "Sort.h"
|
||||
#include "CpuArch.h"
|
||||
|
||||
#define HeapSortDown(p, k, size, temp) \
|
||||
{ for (;;) { \
|
||||
size_t s = (k << 1); \
|
||||
if (s > size) break; \
|
||||
if (s < size && p[s + 1] > p[s]) s++; \
|
||||
if (temp >= p[s]) break; \
|
||||
p[k] = p[s]; k = s; \
|
||||
} p[k] = temp; }
|
||||
#if ( (defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) \
|
||||
|| (defined(__clang__) && Z7_has_builtin(__builtin_prefetch)) \
|
||||
)
|
||||
// the code with prefetch is slow for small arrays on x86.
|
||||
// So we disable prefetch for x86.
|
||||
#ifndef MY_CPU_X86
|
||||
// #pragma message("Z7_PREFETCH : __builtin_prefetch")
|
||||
#define Z7_PREFETCH(a) __builtin_prefetch((a))
|
||||
#endif
|
||||
|
||||
void HeapSort(UInt32 *p, size_t size)
|
||||
{
|
||||
if (size <= 1)
|
||||
return;
|
||||
p--;
|
||||
{
|
||||
size_t i = size / 2;
|
||||
do
|
||||
{
|
||||
UInt32 temp = p[i];
|
||||
size_t k = i;
|
||||
HeapSortDown(p, k, size, temp)
|
||||
}
|
||||
while (--i != 0);
|
||||
}
|
||||
/*
|
||||
do
|
||||
{
|
||||
size_t k = 1;
|
||||
UInt32 temp = p[size];
|
||||
p[size--] = p[1];
|
||||
HeapSortDown(p, k, size, temp)
|
||||
}
|
||||
while (size > 1);
|
||||
*/
|
||||
while (size > 3)
|
||||
{
|
||||
UInt32 temp = p[size];
|
||||
size_t k = (p[3] > p[2]) ? 3 : 2;
|
||||
p[size--] = p[1];
|
||||
p[1] = p[k];
|
||||
HeapSortDown(p, k, size, temp)
|
||||
}
|
||||
{
|
||||
UInt32 temp = p[size];
|
||||
p[size] = p[1];
|
||||
if (size > 2 && p[2] < temp)
|
||||
{
|
||||
p[1] = p[2];
|
||||
p[2] = temp;
|
||||
}
|
||||
else
|
||||
p[1] = temp;
|
||||
}
|
||||
}
|
||||
#elif defined(_WIN32) // || defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
void HeapSort64(UInt64 *p, size_t size)
|
||||
{
|
||||
if (size <= 1)
|
||||
return;
|
||||
p--;
|
||||
{
|
||||
size_t i = size / 2;
|
||||
do
|
||||
{
|
||||
UInt64 temp = p[i];
|
||||
size_t k = i;
|
||||
HeapSortDown(p, k, size, temp)
|
||||
}
|
||||
while (--i != 0);
|
||||
}
|
||||
/*
|
||||
do
|
||||
{
|
||||
size_t k = 1;
|
||||
UInt64 temp = p[size];
|
||||
p[size--] = p[1];
|
||||
HeapSortDown(p, k, size, temp)
|
||||
}
|
||||
while (size > 1);
|
||||
*/
|
||||
while (size > 3)
|
||||
{
|
||||
UInt64 temp = p[size];
|
||||
size_t k = (p[3] > p[2]) ? 3 : 2;
|
||||
p[size--] = p[1];
|
||||
p[1] = p[k];
|
||||
HeapSortDown(p, k, size, temp)
|
||||
}
|
||||
{
|
||||
UInt64 temp = p[size];
|
||||
p[size] = p[1];
|
||||
if (size > 2 && p[2] < temp)
|
||||
{
|
||||
p[1] = p[2];
|
||||
p[2] = temp;
|
||||
}
|
||||
else
|
||||
p[1] = temp;
|
||||
}
|
||||
}
|
||||
#include "7zWindows.h"
|
||||
|
||||
// NOTE: CLANG/GCC/MSVC can define different values for _MM_HINT_T0 / PF_TEMPORAL_LEVEL_1.
|
||||
// For example, clang-cl can generate "prefetcht2" instruction for
|
||||
// PreFetchCacheLine(PF_TEMPORAL_LEVEL_1) call.
|
||||
// But we want to generate "prefetcht0" instruction.
|
||||
// So for CLANG/GCC we must use __builtin_prefetch() in code branch above
|
||||
// instead of PreFetchCacheLine() / _mm_prefetch().
|
||||
|
||||
// New msvc-x86 compiler generates "prefetcht0" instruction for PreFetchCacheLine() call.
|
||||
// But old x86 cpus don't support "prefetcht0".
|
||||
// So we will use PreFetchCacheLine(), only if we are sure that
|
||||
// generated instruction is supported by all cpus of that isa.
|
||||
#if defined(MY_CPU_AMD64) \
|
||||
|| defined(MY_CPU_ARM64) \
|
||||
|| defined(MY_CPU_IA64)
|
||||
// we need to use additional braces for (a) in PreFetchCacheLine call, because
|
||||
// PreFetchCacheLine macro doesn't use braces:
|
||||
// #define PreFetchCacheLine(l, a) _mm_prefetch((CHAR CONST *) a, l)
|
||||
// #pragma message("Z7_PREFETCH : PreFetchCacheLine")
|
||||
#define Z7_PREFETCH(a) PreFetchCacheLine(PF_TEMPORAL_LEVEL_1, (a))
|
||||
#endif
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
|
||||
#define PREFETCH_NO(p,k,s,size)
|
||||
|
||||
#ifndef Z7_PREFETCH
|
||||
#define SORT_PREFETCH(p,k,s,size)
|
||||
#else
|
||||
|
||||
// #define PREFETCH_LEVEL 2 // use it if cache line is 32-bytes
|
||||
#define PREFETCH_LEVEL 3 // it is fast for most cases (64-bytes cache line prefetch)
|
||||
// #define PREFETCH_LEVEL 4 // it can be faster for big array (128-bytes prefetch)
|
||||
|
||||
#if PREFETCH_LEVEL == 0
|
||||
|
||||
#define SORT_PREFETCH(p,k,s,size)
|
||||
|
||||
#else // PREFETCH_LEVEL != 0
|
||||
|
||||
/*
|
||||
#define HeapSortRefDown(p, vals, n, size, temp) \
|
||||
{ size_t k = n; UInt32 val = vals[temp]; for (;;) { \
|
||||
size_t s = (k << 1); \
|
||||
if (s > size) break; \
|
||||
if (s < size && vals[p[s + 1]] > vals[p[s]]) s++; \
|
||||
if (val >= vals[p[s]]) break; \
|
||||
p[k] = p[s]; k = s; \
|
||||
} p[k] = temp; }
|
||||
if defined(USE_PREFETCH_FOR_ALIGNED_ARRAY)
|
||||
we prefetch one value per cache line.
|
||||
Use it if array is aligned for cache line size (64 bytes)
|
||||
or if array is small (less than L1 cache size).
|
||||
|
||||
void HeapSortRef(UInt32 *p, UInt32 *vals, size_t size)
|
||||
if !defined(USE_PREFETCH_FOR_ALIGNED_ARRAY)
|
||||
we perfetch all cache lines that can be required.
|
||||
it can be faster for big unaligned arrays.
|
||||
*/
|
||||
#define USE_PREFETCH_FOR_ALIGNED_ARRAY
|
||||
|
||||
// s == k * 2
|
||||
#if 0 && PREFETCH_LEVEL <= 3 && defined(MY_CPU_X86_OR_AMD64)
|
||||
// x86 supports (lea r1*8+offset)
|
||||
#define PREFETCH_OFFSET(k,s) ((s) << PREFETCH_LEVEL)
|
||||
#else
|
||||
#define PREFETCH_OFFSET(k,s) ((k) << (PREFETCH_LEVEL + 1))
|
||||
#endif
|
||||
|
||||
#if 1 && PREFETCH_LEVEL <= 3 && defined(USE_PREFETCH_FOR_ALIGNED_ARRAY)
|
||||
#define PREFETCH_ADD_OFFSET 0
|
||||
#else
|
||||
// last offset that can be reqiured in PREFETCH_LEVEL step:
|
||||
#define PREFETCH_RANGE ((2 << PREFETCH_LEVEL) - 1)
|
||||
#define PREFETCH_ADD_OFFSET PREFETCH_RANGE / 2
|
||||
#endif
|
||||
|
||||
#if PREFETCH_LEVEL <= 3
|
||||
|
||||
#ifdef USE_PREFETCH_FOR_ALIGNED_ARRAY
|
||||
#define SORT_PREFETCH(p,k,s,size) \
|
||||
{ const size_t s2 = PREFETCH_OFFSET(k,s) + PREFETCH_ADD_OFFSET; \
|
||||
if (s2 <= size) { \
|
||||
Z7_PREFETCH((p + s2)); \
|
||||
}}
|
||||
#else /* for unaligned array */
|
||||
#define SORT_PREFETCH(p,k,s,size) \
|
||||
{ const size_t s2 = PREFETCH_OFFSET(k,s) + PREFETCH_RANGE; \
|
||||
if (s2 <= size) { \
|
||||
Z7_PREFETCH((p + s2 - PREFETCH_RANGE)); \
|
||||
Z7_PREFETCH((p + s2)); \
|
||||
}}
|
||||
#endif
|
||||
|
||||
#else // PREFETCH_LEVEL > 3
|
||||
|
||||
#ifdef USE_PREFETCH_FOR_ALIGNED_ARRAY
|
||||
#define SORT_PREFETCH(p,k,s,size) \
|
||||
{ const size_t s2 = PREFETCH_OFFSET(k,s) + PREFETCH_RANGE - 16 / 2; \
|
||||
if (s2 <= size) { \
|
||||
Z7_PREFETCH((p + s2 - 16)); \
|
||||
Z7_PREFETCH((p + s2)); \
|
||||
}}
|
||||
#else /* for unaligned array */
|
||||
#define SORT_PREFETCH(p,k,s,size) \
|
||||
{ const size_t s2 = PREFETCH_OFFSET(k,s) + PREFETCH_RANGE; \
|
||||
if (s2 <= size) { \
|
||||
Z7_PREFETCH((p + s2 - PREFETCH_RANGE)); \
|
||||
Z7_PREFETCH((p + s2 - PREFETCH_RANGE / 2)); \
|
||||
Z7_PREFETCH((p + s2)); \
|
||||
}}
|
||||
#endif
|
||||
|
||||
#endif // PREFETCH_LEVEL > 3
|
||||
#endif // PREFETCH_LEVEL != 0
|
||||
#endif // Z7_PREFETCH
|
||||
|
||||
|
||||
#if defined(MY_CPU_ARM64) \
|
||||
/* || defined(MY_CPU_AMD64) */ \
|
||||
/* || defined(MY_CPU_ARM) && !defined(_MSC_VER) */
|
||||
// we want to use cmov, if cmov is very fast:
|
||||
// - this cmov version is slower for clang-x64.
|
||||
// - this cmov version is faster for gcc-arm64 for some fast arm64 cpus.
|
||||
#define Z7_FAST_CMOV_SUPPORTED
|
||||
#endif
|
||||
|
||||
#ifdef Z7_FAST_CMOV_SUPPORTED
|
||||
// we want to use cmov here, if cmov is fast: new arm64 cpus.
|
||||
// we want the compiler to use conditional move for this branch
|
||||
#define GET_MAX_VAL(n0, n1, max_val_slow) if (n0 < n1) n0 = n1;
|
||||
#else
|
||||
// use this branch, if cpu doesn't support fast conditional move.
|
||||
// it uses slow array access reading:
|
||||
#define GET_MAX_VAL(n0, n1, max_val_slow) n0 = max_val_slow;
|
||||
#endif
|
||||
|
||||
#define HeapSortDown(p, k, size, temp, macro_prefetch) \
|
||||
{ \
|
||||
for (;;) { \
|
||||
UInt32 n0, n1; \
|
||||
size_t s = k * 2; \
|
||||
if (s >= size) { \
|
||||
if (s == size) { \
|
||||
n0 = p[s]; \
|
||||
p[k] = n0; \
|
||||
if (temp < n0) k = s; \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
n0 = p[k * 2]; \
|
||||
n1 = p[k * 2 + 1]; \
|
||||
s += n0 < n1; \
|
||||
GET_MAX_VAL(n0, n1, p[s]) \
|
||||
if (temp >= n0) break; \
|
||||
macro_prefetch(p, k, s, size) \
|
||||
p[k] = n0; \
|
||||
k = s; \
|
||||
} \
|
||||
p[k] = temp; \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
stage-1 : O(n) :
|
||||
we generate intermediate partially sorted binary tree:
|
||||
p[0] : it's additional item for better alignment of tree structure in memory.
|
||||
p[1]
|
||||
p[2] p[3]
|
||||
p[4] p[5] p[6] p[7]
|
||||
...
|
||||
p[x] >= p[x * 2]
|
||||
p[x] >= p[x * 2 + 1]
|
||||
|
||||
stage-2 : O(n)*log2(N):
|
||||
we move largest item p[0] from head of tree to the end of array
|
||||
and insert last item to sorted binary tree.
|
||||
*/
|
||||
|
||||
// (p) must be aligned for cache line size (64-bytes) for best performance
|
||||
|
||||
void Z7_FASTCALL HeapSort(UInt32 *p, size_t size)
|
||||
{
|
||||
if (size <= 1)
|
||||
if (size < 2)
|
||||
return;
|
||||
p--;
|
||||
if (size == 2)
|
||||
{
|
||||
size_t i = size / 2;
|
||||
const UInt32 a0 = p[0];
|
||||
const UInt32 a1 = p[1];
|
||||
const unsigned k = a1 < a0;
|
||||
p[k] = a0;
|
||||
p[k ^ 1] = a1;
|
||||
return;
|
||||
}
|
||||
{
|
||||
// stage-1 : O(n)
|
||||
// we transform array to partially sorted binary tree.
|
||||
size_t i = --size / 2;
|
||||
// (size) now is the index of the last item in tree,
|
||||
// if (i)
|
||||
{
|
||||
do
|
||||
{
|
||||
const UInt32 temp = p[i];
|
||||
size_t k = i;
|
||||
HeapSortDown(p, k, size, temp, PREFETCH_NO)
|
||||
}
|
||||
while (--i);
|
||||
}
|
||||
{
|
||||
const UInt32 temp = p[0];
|
||||
const UInt32 a1 = p[1];
|
||||
if (temp < a1)
|
||||
{
|
||||
size_t k = 1;
|
||||
p[0] = a1;
|
||||
HeapSortDown(p, k, size, temp, PREFETCH_NO)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (size < 3)
|
||||
{
|
||||
// size == 2
|
||||
const UInt32 a0 = p[0];
|
||||
p[0] = p[2];
|
||||
p[2] = a0;
|
||||
return;
|
||||
}
|
||||
if (size != 3)
|
||||
{
|
||||
// stage-2 : O(size) * log2(size):
|
||||
// we move largest item p[0] from head to the end of array,
|
||||
// and insert last item to sorted binary tree.
|
||||
do
|
||||
{
|
||||
UInt32 temp = p[i];
|
||||
HeapSortRefDown(p, vals, i, size, temp);
|
||||
const UInt32 temp = p[size];
|
||||
size_t k = p[2] < p[3] ? 3 : 2;
|
||||
p[size--] = p[0];
|
||||
p[0] = p[1];
|
||||
p[1] = p[k];
|
||||
HeapSortDown(p, k, size, temp, SORT_PREFETCH) // PREFETCH_NO
|
||||
}
|
||||
while (--i != 0);
|
||||
while (size != 3);
|
||||
}
|
||||
do
|
||||
{
|
||||
UInt32 temp = p[size];
|
||||
p[size--] = p[1];
|
||||
HeapSortRefDown(p, vals, 1, size, temp);
|
||||
const UInt32 a2 = p[2];
|
||||
const UInt32 a3 = p[3];
|
||||
const size_t k = a2 < a3;
|
||||
p[2] = p[1];
|
||||
p[3] = p[0];
|
||||
p[k] = a3;
|
||||
p[k ^ 1] = a2;
|
||||
}
|
||||
while (size > 1);
|
||||
}
|
||||
*/
|
||||
|
||||
Vendored
+2
-5
@@ -1,5 +1,5 @@
|
||||
/* Sort.h -- Sort functions
|
||||
2023-03-05 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef ZIP7_INC_SORT_H
|
||||
#define ZIP7_INC_SORT_H
|
||||
@@ -8,10 +8,7 @@
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
void HeapSort(UInt32 *p, size_t size);
|
||||
void HeapSort64(UInt64 *p, size_t size);
|
||||
|
||||
/* void HeapSortRef(UInt32 *p, UInt32 *vals, size_t size); */
|
||||
void Z7_FASTCALL HeapSort(UInt32 *p, size_t size);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
|
||||
Vendored
+234
-3
@@ -1,5 +1,5 @@
|
||||
/* Threads.c -- multithreading library
|
||||
2024-03-28 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -59,6 +59,100 @@ WRes Thread_Wait_Close(CThread *p)
|
||||
return (res != 0 ? res : res2);
|
||||
}
|
||||
|
||||
typedef struct MY_PROCESSOR_NUMBER {
|
||||
WORD Group;
|
||||
BYTE Number;
|
||||
BYTE Reserved;
|
||||
} MY_PROCESSOR_NUMBER, *MY_PPROCESSOR_NUMBER;
|
||||
|
||||
typedef struct MY_GROUP_AFFINITY {
|
||||
#if defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION < 100000)
|
||||
// KAFFINITY is not defined in old mingw
|
||||
ULONG_PTR
|
||||
#else
|
||||
KAFFINITY
|
||||
#endif
|
||||
Mask;
|
||||
WORD Group;
|
||||
WORD Reserved[3];
|
||||
} MY_GROUP_AFFINITY, *MY_PGROUP_AFFINITY;
|
||||
|
||||
typedef BOOL (WINAPI *Func_SetThreadGroupAffinity)(
|
||||
HANDLE hThread,
|
||||
CONST MY_GROUP_AFFINITY *GroupAffinity,
|
||||
MY_PGROUP_AFFINITY PreviousGroupAffinity);
|
||||
|
||||
typedef BOOL (WINAPI *Func_GetThreadGroupAffinity)(
|
||||
HANDLE hThread,
|
||||
MY_PGROUP_AFFINITY GroupAffinity);
|
||||
|
||||
typedef BOOL (WINAPI *Func_GetProcessGroupAffinity)(
|
||||
HANDLE hProcess,
|
||||
PUSHORT GroupCount,
|
||||
PUSHORT GroupArray);
|
||||
|
||||
Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
|
||||
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
#define PRF(x) x
|
||||
/*
|
||||
--
|
||||
before call of SetThreadGroupAffinity()
|
||||
GetProcessGroupAffinity return one group.
|
||||
after call of SetThreadGroupAffinity():
|
||||
GetProcessGroupAffinity return more than group,
|
||||
if SetThreadGroupAffinity() was to another group.
|
||||
--
|
||||
GetProcessAffinityMask MS DOCs:
|
||||
{
|
||||
If the calling process contains threads in multiple groups,
|
||||
the function returns zero for both affinity masks.
|
||||
}
|
||||
but tests in win10 with 2 groups (less than 64 cores total):
|
||||
GetProcessAffinityMask() still returns non-zero affinity masks
|
||||
even after SetThreadGroupAffinity() calls.
|
||||
*/
|
||||
static void PrintProcess_Info()
|
||||
{
|
||||
{
|
||||
const
|
||||
Func_GetProcessGroupAffinity fn_GetProcessGroupAffinity =
|
||||
(Func_GetProcessGroupAffinity) Z7_CAST_FUNC_C GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
|
||||
"GetProcessGroupAffinity");
|
||||
if (fn_GetProcessGroupAffinity)
|
||||
{
|
||||
unsigned i;
|
||||
USHORT GroupCounts[64];
|
||||
USHORT GroupCount = Z7_ARRAY_SIZE(GroupCounts);
|
||||
BOOL boolRes = fn_GetProcessGroupAffinity(GetCurrentProcess(),
|
||||
&GroupCount, GroupCounts);
|
||||
printf("\n====== GetProcessGroupAffinity : "
|
||||
"boolRes=%u GroupCounts = %u :",
|
||||
boolRes, (unsigned)GroupCount);
|
||||
for (i = 0; i < GroupCount; i++)
|
||||
printf(" %u", GroupCounts[i]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
DWORD_PTR processAffinityMask, systemAffinityMask;
|
||||
if (GetProcessAffinityMask(GetCurrentProcess(), &processAffinityMask, &systemAffinityMask))
|
||||
{
|
||||
PRF(printf("\n====== GetProcessAffinityMask : "
|
||||
": processAffinityMask=%x, systemAffinityMask=%x\n",
|
||||
(UInt32)processAffinityMask, (UInt32)systemAffinityMask);)
|
||||
}
|
||||
else
|
||||
printf("\n==GetProcessAffinityMask FAIL");
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifndef USE_THREADS_CreateThread
|
||||
// #define PRF(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param)
|
||||
{
|
||||
/* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */
|
||||
@@ -72,7 +166,43 @@ WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param)
|
||||
|
||||
unsigned threadId;
|
||||
*p = (HANDLE)(_beginthreadex(NULL, 0, func, param, 0, &threadId));
|
||||
|
||||
|
||||
#if 0 // 1 : for debug
|
||||
{
|
||||
DWORD_PTR prevMask;
|
||||
DWORD_PTR affinity = 1 << 0;
|
||||
prevMask = SetThreadAffinityMask(*p, (DWORD_PTR)affinity);
|
||||
prevMask = prevMask;
|
||||
}
|
||||
#endif
|
||||
#if 0 // 1 : for debug
|
||||
{
|
||||
/* win10: new thread will be created in same group that is assigned to parent thread
|
||||
but affinity mask will contain all allowed threads of that group,
|
||||
even if affinity mask of parent group is not full
|
||||
win11: what group it will be created, if we have set
|
||||
affinity of parent thread with ThreadGroupAffinity?
|
||||
*/
|
||||
const
|
||||
Func_GetThreadGroupAffinity fn =
|
||||
(Func_GetThreadGroupAffinity) Z7_CAST_FUNC_C GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
|
||||
"GetThreadGroupAffinity");
|
||||
if (fn)
|
||||
{
|
||||
// BOOL wres2;
|
||||
MY_GROUP_AFFINITY groupAffinity;
|
||||
memset(&groupAffinity, 0, sizeof(groupAffinity));
|
||||
/* wres2 = */ fn(*p, &groupAffinity);
|
||||
PRF(printf("\n==Thread_Create cur = %6u GetThreadGroupAffinity(): "
|
||||
"wres2_BOOL = %u, group=%u mask=%x\n",
|
||||
GetCurrentThreadId(),
|
||||
wres2,
|
||||
groupAffinity.Group,
|
||||
(UInt32)groupAffinity.Mask);)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* maybe we must use errno here, but probably GetLastError() is also OK. */
|
||||
@@ -110,7 +240,84 @@ WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param
|
||||
*/
|
||||
}
|
||||
{
|
||||
DWORD prevSuspendCount = ResumeThread(h);
|
||||
const DWORD prevSuspendCount = ResumeThread(h);
|
||||
/* ResumeThread() returns:
|
||||
0 : was_not_suspended
|
||||
1 : was_resumed
|
||||
-1 : error
|
||||
*/
|
||||
if (prevSuspendCount == (DWORD)-1)
|
||||
wres = GetError();
|
||||
}
|
||||
}
|
||||
|
||||
/* maybe we must use errno here, but probably GetLastError() is also OK. */
|
||||
return wres;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
WRes Thread_Create_With_Group(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, unsigned group, CAffinityMask affinityMask)
|
||||
{
|
||||
#ifdef USE_THREADS_CreateThread
|
||||
|
||||
UNUSED_VAR(group)
|
||||
UNUSED_VAR(affinityMask)
|
||||
return Thread_Create(p, func, param);
|
||||
|
||||
#else
|
||||
|
||||
/* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */
|
||||
HANDLE h;
|
||||
WRes wres;
|
||||
unsigned threadId;
|
||||
h = (HANDLE)(_beginthreadex(NULL, 0, func, param, CREATE_SUSPENDED, &threadId));
|
||||
*p = h;
|
||||
wres = HandleToWRes(h);
|
||||
if (h)
|
||||
{
|
||||
// PrintProcess_Info();
|
||||
{
|
||||
const
|
||||
Func_SetThreadGroupAffinity fn =
|
||||
(Func_SetThreadGroupAffinity) Z7_CAST_FUNC_C GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
|
||||
"SetThreadGroupAffinity");
|
||||
if (fn)
|
||||
{
|
||||
// WRes wres2;
|
||||
MY_GROUP_AFFINITY groupAffinity, prev_groupAffinity;
|
||||
memset(&groupAffinity, 0, sizeof(groupAffinity));
|
||||
// groupAffinity.Mask must use only bits that supported by current group
|
||||
// (groupAffinity.Mask = 0) means all allowed bits
|
||||
groupAffinity.Mask = affinityMask;
|
||||
groupAffinity.Group = (WORD)group;
|
||||
// wres2 =
|
||||
fn(h, &groupAffinity, &prev_groupAffinity);
|
||||
/*
|
||||
if (groupAffinity.Group == prev_groupAffinity.Group)
|
||||
wres2 = wres2;
|
||||
else
|
||||
wres2 = wres2;
|
||||
if (wres2 == 0)
|
||||
{
|
||||
wres2 = GetError();
|
||||
PRF(printf("\n==SetThreadGroupAffinity error: %u\n", wres2);)
|
||||
}
|
||||
else
|
||||
{
|
||||
PRF(printf("\n==Thread_Create_With_Group::SetThreadGroupAffinity()"
|
||||
" threadId = %6u"
|
||||
" group=%u mask=%x\n",
|
||||
threadId,
|
||||
prev_groupAffinity.Group,
|
||||
(UInt32)prev_groupAffinity.Mask);)
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
{
|
||||
const DWORD prevSuspendCount = ResumeThread(h);
|
||||
/* ResumeThread() returns:
|
||||
0 : was_not_suspended
|
||||
1 : was_resumed
|
||||
@@ -297,6 +504,13 @@ WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param)
|
||||
return Thread_Create_With_CpuSet(p, func, param, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
WRes Thread_Create_With_Group(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, unsigned group, CAffinityMask affinity)
|
||||
{
|
||||
UNUSED_VAR(group)
|
||||
return Thread_Create_With_Affinity(p, func, param, affinity);
|
||||
}
|
||||
*/
|
||||
|
||||
WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, CAffinityMask affinity)
|
||||
{
|
||||
@@ -577,5 +791,22 @@ WRes AutoResetEvent_OptCreate_And_Reset(CAutoResetEvent *p)
|
||||
return AutoResetEvent_CreateNotSignaled(p);
|
||||
}
|
||||
|
||||
void ThreadNextGroup_Init(CThreadNextGroup *p, UInt32 numGroups, UInt32 startGroup)
|
||||
{
|
||||
// printf("\n====== ThreadNextGroup_Init numGroups = %x: startGroup=%x\n", numGroups, startGroup);
|
||||
if (numGroups == 0)
|
||||
numGroups = 1;
|
||||
p->NumGroups = numGroups;
|
||||
p->NextGroup = startGroup % numGroups;
|
||||
}
|
||||
|
||||
|
||||
UInt32 ThreadNextGroup_GetNext(CThreadNextGroup *p)
|
||||
{
|
||||
const UInt32 next = p->NextGroup;
|
||||
p->NextGroup = (next + 1) % p->NumGroups;
|
||||
return next;
|
||||
}
|
||||
|
||||
#undef PRF
|
||||
#undef Print
|
||||
|
||||
Vendored
+11
-1
@@ -1,5 +1,5 @@
|
||||
/* Threads.h -- multithreading library
|
||||
2024-03-28 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef ZIP7_INC_THREADS_H
|
||||
#define ZIP7_INC_THREADS_H
|
||||
@@ -140,12 +140,22 @@ WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param
|
||||
WRes Thread_Wait_Close(CThread *p);
|
||||
|
||||
#ifdef _WIN32
|
||||
WRes Thread_Create_With_Group(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, unsigned group, CAffinityMask affinityMask);
|
||||
#define Thread_Create_With_CpuSet(p, func, param, cs) \
|
||||
Thread_Create_With_Affinity(p, func, param, *cs)
|
||||
#else
|
||||
WRes Thread_Create_With_CpuSet(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, const CCpuSet *cpuSet);
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned NumGroups;
|
||||
unsigned NextGroup;
|
||||
} CThreadNextGroup;
|
||||
|
||||
void ThreadNextGroup_Init(CThreadNextGroup *p, unsigned numGroups, unsigned startGroup);
|
||||
unsigned ThreadNextGroup_GetNext(CThreadNextGroup *p);
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
|
||||
+4
@@ -122,6 +122,10 @@ SOURCE=..\..\Compiler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\CpuArch.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\CpuArch.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+6
-2
@@ -43,7 +43,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /Gr /MT /W3 /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /FD /c
|
||||
# ADD CPP /nologo /Gr /MT /W4 /WX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
@@ -71,7 +71,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /D "COMPRESS_MF_MT" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /WX /Gm /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /D "COMPRESS_MF_MT" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
@@ -128,6 +128,10 @@ SOURCE=..\..\Compiler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\CpuArch.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\CpuArch.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
Vendored
+9
-3
@@ -1,5 +1,5 @@
|
||||
/* Xz.h - Xz interface
|
||||
2024-01-26 : Igor Pavlov : Public domain */
|
||||
Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef ZIP7_INC_XZ_H
|
||||
#define ZIP7_INC_XZ_H
|
||||
@@ -121,6 +121,7 @@ typedef struct
|
||||
UInt64 startOffset;
|
||||
} CXzStream;
|
||||
|
||||
#define Xz_CONSTRUCT(p) { (p)->numBlocks = 0; (p)->blocks = NULL; (p)->flags = 0; }
|
||||
void Xz_Construct(CXzStream *p);
|
||||
void Xz_Free(CXzStream *p, ISzAllocPtr alloc);
|
||||
|
||||
@@ -136,8 +137,13 @@ typedef struct
|
||||
CXzStream *streams;
|
||||
} CXzs;
|
||||
|
||||
#define Xzs_CONSTRUCT(p) { (p)->num = 0; (p)->numAllocated = 0; (p)->streams = NULL; }
|
||||
void Xzs_Construct(CXzs *p);
|
||||
void Xzs_Free(CXzs *p, ISzAllocPtr alloc);
|
||||
/*
|
||||
Xzs_ReadBackward() must be called for empty CXzs object.
|
||||
Xzs_ReadBackward() can return non empty object with (p->num != 0) even in case of error.
|
||||
*/
|
||||
SRes Xzs_ReadBackward(CXzs *p, ILookInStreamPtr inStream, Int64 *startOffset, ICompressProgressPtr progress, ISzAllocPtr alloc);
|
||||
|
||||
UInt64 Xzs_GetNumBlocks(const CXzs *p);
|
||||
@@ -268,8 +274,8 @@ typedef struct
|
||||
size_t outBufSize;
|
||||
size_t outDataWritten; // the size of data in (outBuf) that were fully unpacked
|
||||
|
||||
Byte shaDigest[SHA256_DIGEST_SIZE];
|
||||
Byte buf[XZ_BLOCK_HEADER_SIZE_MAX];
|
||||
UInt32 shaDigest32[SHA256_DIGEST_SIZE / 4];
|
||||
Byte buf[XZ_BLOCK_HEADER_SIZE_MAX]; // it must be aligned for 4-bytes
|
||||
} CXzUnpacker;
|
||||
|
||||
/* alloc : aligned for cache line allocation is better */
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* XzCrc64Opt.c -- CRC64 calculation (optimized functions)
|
||||
2023-12-08 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -235,7 +235,7 @@ CRC64_FUNC_PRE_BE(Z7_CRC64_NUM_TABLES_USE)
|
||||
v = Q32BE(1, w1) ^ Q32BE(0, w0);
|
||||
v ^= Q32BE(3, d1) ^ Q32BE(2, d0);
|
||||
#endif
|
||||
#elif
|
||||
#else
|
||||
#error Stop_Compiling_Bad_CRC64_NUM_TABLES
|
||||
#endif
|
||||
p += Z7_CRC64_NUM_TABLES_USE;
|
||||
|
||||
Vendored
+14
-15
@@ -1,5 +1,5 @@
|
||||
/* XzDec.c -- Xz Decode
|
||||
2024-03-01 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -59,7 +59,7 @@ unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value)
|
||||
|
||||
for (i = 0; i < limit;)
|
||||
{
|
||||
Byte b = p[i];
|
||||
const unsigned b = p[i];
|
||||
*value |= (UInt64)(b & 0x7F) << (7 * i++);
|
||||
if ((b & 0x80) == 0)
|
||||
return (b == 0 && i != 1) ? 0 : i;
|
||||
@@ -796,11 +796,10 @@ SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf)
|
||||
|
||||
static BoolInt Xz_CheckFooter(CXzStreamFlags flags, UInt64 indexSize, const Byte *buf)
|
||||
{
|
||||
return indexSize == (((UInt64)GetUi32(buf + 4) + 1) << 2)
|
||||
&& GetUi32(buf) == CrcCalc(buf + 4, 6)
|
||||
&& flags == GetBe16(buf + 8)
|
||||
&& buf[10] == XZ_FOOTER_SIG_0
|
||||
&& buf[11] == XZ_FOOTER_SIG_1;
|
||||
return indexSize == (((UInt64)GetUi32a(buf + 4) + 1) << 2)
|
||||
&& GetUi32a(buf) == CrcCalc(buf + 4, 6)
|
||||
&& flags == GetBe16a(buf + 8)
|
||||
&& GetUi16a(buf + 10) == (XZ_FOOTER_SIG_0 | (XZ_FOOTER_SIG_1 << 8));
|
||||
}
|
||||
|
||||
#define READ_VARINT_AND_CHECK(buf, pos, size, res) \
|
||||
@@ -1166,7 +1165,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
|
||||
p->indexPreSize = 1 + Xz_WriteVarInt(p->buf + 1, p->numBlocks);
|
||||
p->indexPos = p->indexPreSize;
|
||||
p->indexSize += p->indexPreSize;
|
||||
Sha256_Final(&p->sha, p->shaDigest);
|
||||
Sha256_Final(&p->sha, (Byte *)(void *)p->shaDigest32);
|
||||
Sha256_Init(&p->sha);
|
||||
p->crc = CrcUpdate(CRC_INIT_VAL, p->buf, p->indexPreSize);
|
||||
p->state = XZ_STATE_STREAM_INDEX;
|
||||
@@ -1241,10 +1240,10 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
|
||||
break;
|
||||
}
|
||||
{
|
||||
Byte digest[XZ_CHECK_SIZE_MAX];
|
||||
UInt32 digest32[XZ_CHECK_SIZE_MAX / 4];
|
||||
p->state = XZ_STATE_BLOCK_HEADER;
|
||||
p->pos = 0;
|
||||
if (XzCheck_Final(&p->check, digest) && memcmp(digest, p->buf, checkSize) != 0)
|
||||
if (XzCheck_Final(&p->check, (void *)digest32) && memcmp(digest32, p->buf, checkSize) != 0)
|
||||
return SZ_ERROR_CRC;
|
||||
if (p->decodeOnlyOneBlock)
|
||||
{
|
||||
@@ -1289,12 +1288,12 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
|
||||
}
|
||||
else
|
||||
{
|
||||
Byte digest[SHA256_DIGEST_SIZE];
|
||||
UInt32 digest32[SHA256_DIGEST_SIZE / 4];
|
||||
p->state = XZ_STATE_STREAM_INDEX_CRC;
|
||||
p->indexSize += 4;
|
||||
p->pos = 0;
|
||||
Sha256_Final(&p->sha, digest);
|
||||
if (memcmp(digest, p->shaDigest, SHA256_DIGEST_SIZE) != 0)
|
||||
Sha256_Final(&p->sha, (void *)digest32);
|
||||
if (memcmp(digest32, p->shaDigest32, SHA256_DIGEST_SIZE) != 0)
|
||||
return SZ_ERROR_CRC;
|
||||
}
|
||||
}
|
||||
@@ -1313,7 +1312,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
|
||||
const Byte *ptr = p->buf;
|
||||
p->state = XZ_STATE_STREAM_FOOTER;
|
||||
p->pos = 0;
|
||||
if (CRC_GET_DIGEST(p->crc) != GetUi32(ptr))
|
||||
if (CRC_GET_DIGEST(p->crc) != GetUi32a(ptr))
|
||||
return SZ_ERROR_CRC;
|
||||
}
|
||||
break;
|
||||
@@ -1343,7 +1342,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
|
||||
{
|
||||
if (*src != 0)
|
||||
{
|
||||
if (((UInt32)p->padSize & 3) != 0)
|
||||
if ((unsigned)p->padSize & 3)
|
||||
return SZ_ERROR_NO_ARCHIVE;
|
||||
p->pos = 0;
|
||||
p->state = XZ_STATE_STREAM_HEADER;
|
||||
|
||||
Vendored
+7
-1
@@ -1,5 +1,5 @@
|
||||
/* XzEnc.c -- Xz Encode
|
||||
2024-03-01 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -411,6 +411,7 @@ static SRes SeqInFilter_Read(ISeqInStreamPtr pp, void *data, size_t *size)
|
||||
}
|
||||
}
|
||||
|
||||
Z7_FORCE_INLINE
|
||||
static void SeqInFilter_Construct(CSeqInFilter *p)
|
||||
{
|
||||
p->buf = NULL;
|
||||
@@ -418,6 +419,7 @@ static void SeqInFilter_Construct(CSeqInFilter *p)
|
||||
p->vt.Read = SeqInFilter_Read;
|
||||
}
|
||||
|
||||
Z7_FORCE_INLINE
|
||||
static void SeqInFilter_Free(CSeqInFilter *p, ISzAllocPtr alloc)
|
||||
{
|
||||
if (p->StateCoder.p)
|
||||
@@ -507,6 +509,7 @@ void XzFilterProps_Init(CXzFilterProps *p)
|
||||
void XzProps_Init(CXzProps *p)
|
||||
{
|
||||
p->checkId = XZ_CHECK_CRC32;
|
||||
p->numThreadGroups = 0;
|
||||
p->blockSize = XZ_PROPS_BLOCK_SIZE_AUTO;
|
||||
p->numBlockThreads_Reduced = -1;
|
||||
p->numBlockThreads_Max = -1;
|
||||
@@ -689,6 +692,7 @@ typedef struct
|
||||
} CLzma2WithFilters;
|
||||
|
||||
|
||||
Z7_FORCE_INLINE
|
||||
static void Lzma2WithFilters_Construct(CLzma2WithFilters *p)
|
||||
{
|
||||
p->lzma2 = NULL;
|
||||
@@ -712,6 +716,7 @@ static SRes Lzma2WithFilters_Create(CLzma2WithFilters *p, ISzAllocPtr alloc, ISz
|
||||
}
|
||||
|
||||
|
||||
Z7_FORCE_INLINE
|
||||
static void Lzma2WithFilters_Free(CLzma2WithFilters *p, ISzAllocPtr alloc)
|
||||
{
|
||||
#ifdef USE_SUBBLOCK
|
||||
@@ -1236,6 +1241,7 @@ SRes XzEnc_Encode(CXzEncHandle p, ISeqOutStreamPtr outStream, ISeqInStreamPtr in
|
||||
}
|
||||
|
||||
p->mtCoder.numThreadsMax = (unsigned)props->numBlockThreads_Max;
|
||||
p->mtCoder.numThreadGroups = props->numThreadGroups;
|
||||
p->mtCoder.expectedDataSize = p->expectedDataSize;
|
||||
|
||||
RINOK(MtCoder_Code(&p->mtCoder))
|
||||
|
||||
Vendored
+2
-1
@@ -1,5 +1,5 @@
|
||||
/* XzEnc.h -- Xz Encode
|
||||
2023-04-13 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef ZIP7_INC_XZ_ENC_H
|
||||
#define ZIP7_INC_XZ_ENC_H
|
||||
@@ -31,6 +31,7 @@ typedef struct
|
||||
CLzma2EncProps lzma2Props;
|
||||
CXzFilterProps filterProps;
|
||||
unsigned checkId;
|
||||
unsigned numThreadGroups; // 0 : no groups
|
||||
UInt64 blockSize;
|
||||
int numBlockThreads_Reduced;
|
||||
int numBlockThreads_Max;
|
||||
|
||||
Vendored
+155
-110
@@ -1,38 +1,39 @@
|
||||
/* XzIn.c - Xz input
|
||||
2023-09-07 : Igor Pavlov : Public domain */
|
||||
: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "7zCrc.h"
|
||||
#include "CpuArch.h"
|
||||
#include "Xz.h"
|
||||
#include "CpuArch.h"
|
||||
|
||||
/*
|
||||
#define XZ_FOOTER_SIG_CHECK(p) (memcmp((p), XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) == 0)
|
||||
*/
|
||||
#define XZ_FOOTER_SIG_CHECK(p) ((p)[0] == XZ_FOOTER_SIG_0 && (p)[1] == XZ_FOOTER_SIG_1)
|
||||
|
||||
#define XZ_FOOTER_12B_ALIGNED16_SIG_CHECK(p) \
|
||||
(GetUi16a((const Byte *)(const void *)(p) + 10) == \
|
||||
(XZ_FOOTER_SIG_0 | (XZ_FOOTER_SIG_1 << 8)))
|
||||
|
||||
SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStreamPtr inStream)
|
||||
{
|
||||
Byte sig[XZ_STREAM_HEADER_SIZE];
|
||||
UInt32 data32[XZ_STREAM_HEADER_SIZE / 4];
|
||||
size_t processedSize = XZ_STREAM_HEADER_SIZE;
|
||||
RINOK(SeqInStream_ReadMax(inStream, sig, &processedSize))
|
||||
RINOK(SeqInStream_ReadMax(inStream, data32, &processedSize))
|
||||
if (processedSize != XZ_STREAM_HEADER_SIZE
|
||||
|| memcmp(sig, XZ_SIG, XZ_SIG_SIZE) != 0)
|
||||
|| memcmp(data32, XZ_SIG, XZ_SIG_SIZE) != 0)
|
||||
return SZ_ERROR_NO_ARCHIVE;
|
||||
return Xz_ParseHeader(p, sig);
|
||||
return Xz_ParseHeader(p, (const Byte *)(const void *)data32);
|
||||
}
|
||||
|
||||
#define READ_VARINT_AND_CHECK(buf, pos, size, res) \
|
||||
{ const unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \
|
||||
#define READ_VARINT_AND_CHECK(buf, size, res) \
|
||||
{ const unsigned s = Xz_ReadVarInt(buf, size, res); \
|
||||
if (s == 0) return SZ_ERROR_ARCHIVE; \
|
||||
pos += s; }
|
||||
size -= s; \
|
||||
buf += s; \
|
||||
}
|
||||
|
||||
SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStreamPtr inStream, BoolInt *isIndex, UInt32 *headerSizeRes)
|
||||
{
|
||||
MY_ALIGN(4)
|
||||
Byte header[XZ_BLOCK_HEADER_SIZE_MAX];
|
||||
unsigned headerSize;
|
||||
*headerSizeRes = 0;
|
||||
@@ -57,8 +58,12 @@ SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStreamPtr inStream, BoolInt *isIndex,
|
||||
return XzBlock_Parse(p, header);
|
||||
}
|
||||
|
||||
|
||||
#define ADD_SIZE_CHECK(size, val) \
|
||||
{ const UInt64 newSize = size + (val); if (newSize < size) return XZ_SIZE_OVERFLOW; size = newSize; }
|
||||
{ const UInt64 newSize = size + (val); \
|
||||
if (newSize < size) return XZ_SIZE_OVERFLOW; \
|
||||
size = newSize; \
|
||||
}
|
||||
|
||||
UInt64 Xz_GetUnpackSize(const CXzStream *p)
|
||||
{
|
||||
@@ -82,76 +87,85 @@ UInt64 Xz_GetPackSize(const CXzStream *p)
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
SRes XzBlock_ReadFooter(CXzBlock *p, CXzStreamFlags f, ISeqInStreamPtr inStream)
|
||||
{
|
||||
return SeqInStream_Read(inStream, p->check, XzFlags_GetCheckSize(f));
|
||||
}
|
||||
*/
|
||||
|
||||
static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAllocPtr alloc)
|
||||
// input;
|
||||
// CXzStream (p) is empty object.
|
||||
// size != 0
|
||||
// (size & 3) == 0
|
||||
// (buf) is aligned for at least 4 bytes.
|
||||
// output:
|
||||
// p->numBlocks is number of allocated items in p->blocks
|
||||
// p->blocks[*] values must be ignored, if function returns error.
|
||||
static SRes Xz_ParseIndex(CXzStream *p, const Byte *buf, size_t size, ISzAllocPtr alloc)
|
||||
{
|
||||
size_t numBlocks, pos = 1;
|
||||
UInt32 crc;
|
||||
|
||||
size_t numBlocks;
|
||||
if (size < 5 || buf[0] != 0)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
|
||||
size -= 4;
|
||||
crc = CrcCalc(buf, size);
|
||||
if (crc != GetUi32(buf + size))
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
|
||||
{
|
||||
const UInt32 crc = CrcCalc(buf, size);
|
||||
if (crc != GetUi32a(buf + size))
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
}
|
||||
buf++;
|
||||
size--;
|
||||
{
|
||||
UInt64 numBlocks64;
|
||||
READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64)
|
||||
READ_VARINT_AND_CHECK(buf, size, &numBlocks64)
|
||||
// (numBlocks64) is 63-bit value, so we can calculate (numBlocks64 * 2):
|
||||
if (numBlocks64 * 2 > size)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
if (numBlocks64 >= ((size_t)1 << (sizeof(size_t) * 8 - 1)) / sizeof(CXzBlockSizes))
|
||||
return SZ_ERROR_MEM; // SZ_ERROR_ARCHIVE
|
||||
numBlocks = (size_t)numBlocks64;
|
||||
if (numBlocks != numBlocks64 || numBlocks * 2 > size)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
}
|
||||
|
||||
Xz_Free(p, alloc);
|
||||
if (numBlocks != 0)
|
||||
// Xz_Free(p, alloc); // it's optional, because (p) is empty already
|
||||
if (numBlocks)
|
||||
{
|
||||
size_t i;
|
||||
p->numBlocks = numBlocks;
|
||||
p->blocks = (CXzBlockSizes *)ISzAlloc_Alloc(alloc, sizeof(CXzBlockSizes) * numBlocks);
|
||||
if (!p->blocks)
|
||||
CXzBlockSizes *blocks = (CXzBlockSizes *)ISzAlloc_Alloc(alloc, sizeof(CXzBlockSizes) * numBlocks);
|
||||
if (!blocks)
|
||||
return SZ_ERROR_MEM;
|
||||
for (i = 0; i < numBlocks; i++)
|
||||
p->blocks = blocks;
|
||||
p->numBlocks = numBlocks;
|
||||
// the caller will call Xz_Free() in case of error
|
||||
do
|
||||
{
|
||||
CXzBlockSizes *block = &p->blocks[i];
|
||||
READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize)
|
||||
READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize)
|
||||
if (block->totalSize == 0)
|
||||
READ_VARINT_AND_CHECK(buf, size, &blocks->totalSize)
|
||||
READ_VARINT_AND_CHECK(buf, size, &blocks->unpackSize)
|
||||
if (blocks->totalSize == 0)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
blocks++;
|
||||
}
|
||||
while (--numBlocks);
|
||||
}
|
||||
while ((pos & 3) != 0)
|
||||
if (buf[pos++] != 0)
|
||||
if (size >= 4)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
while (size)
|
||||
if (buf[--size])
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
static SRes Xz_ReadIndex(CXzStream *p, ILookInStreamPtr stream, UInt64 indexSize, ISzAllocPtr alloc)
|
||||
{
|
||||
SRes res;
|
||||
size_t size;
|
||||
Byte *buf;
|
||||
if (indexSize > ((UInt32)1 << 31))
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
if (indexSize >= ((size_t)1 << (sizeof(size_t) * 8 - 1)))
|
||||
return SZ_ERROR_MEM; // SZ_ERROR_ARCHIVE
|
||||
size = (size_t)indexSize;
|
||||
if (size != indexSize)
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
buf = (Byte *)ISzAlloc_Alloc(alloc, size);
|
||||
if (!buf)
|
||||
return SZ_ERROR_MEM;
|
||||
res = LookInStream_Read2(stream, buf, size, SZ_ERROR_UNSUPPORTED);
|
||||
if (res == SZ_OK)
|
||||
res = Xz_ReadIndex2(p, buf, size, alloc);
|
||||
res = Xz_ParseIndex(p, buf, size, alloc);
|
||||
ISzAlloc_Free(alloc, buf);
|
||||
return res;
|
||||
}
|
||||
*/
|
||||
|
||||
static SRes LookInStream_SeekRead_ForArc(ILookInStreamPtr stream, UInt64 offset, void *buf, size_t size)
|
||||
{
|
||||
@@ -160,84 +174,102 @@ static SRes LookInStream_SeekRead_ForArc(ILookInStreamPtr stream, UInt64 offset,
|
||||
/* return LookInStream_Read2(stream, buf, size, SZ_ERROR_NO_ARCHIVE); */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
in:
|
||||
(*startOffset) is position in (stream) where xz_stream must be finished.
|
||||
out:
|
||||
if returns SZ_OK, then (*startOffset) is position in stream that shows start of xz_stream.
|
||||
*/
|
||||
static SRes Xz_ReadBackward(CXzStream *p, ILookInStreamPtr stream, Int64 *startOffset, ISzAllocPtr alloc)
|
||||
{
|
||||
UInt64 indexSize;
|
||||
Byte buf[XZ_STREAM_FOOTER_SIZE];
|
||||
#define TEMP_BUF_SIZE (1 << 10)
|
||||
UInt32 buf32[TEMP_BUF_SIZE / 4];
|
||||
UInt64 pos = (UInt64)*startOffset;
|
||||
|
||||
if ((pos & 3) != 0 || pos < XZ_STREAM_FOOTER_SIZE)
|
||||
if ((pos & 3) || pos < XZ_STREAM_FOOTER_SIZE)
|
||||
return SZ_ERROR_NO_ARCHIVE;
|
||||
|
||||
pos -= XZ_STREAM_FOOTER_SIZE;
|
||||
RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf, XZ_STREAM_FOOTER_SIZE))
|
||||
RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf32, XZ_STREAM_FOOTER_SIZE))
|
||||
|
||||
if (!XZ_FOOTER_SIG_CHECK(buf + 10))
|
||||
if (!XZ_FOOTER_12B_ALIGNED16_SIG_CHECK(buf32))
|
||||
{
|
||||
UInt32 total = 0;
|
||||
pos += XZ_STREAM_FOOTER_SIZE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
size_t i;
|
||||
#define TEMP_BUF_SIZE (1 << 10)
|
||||
Byte temp[TEMP_BUF_SIZE];
|
||||
|
||||
i = (pos > TEMP_BUF_SIZE) ? TEMP_BUF_SIZE : (size_t)pos;
|
||||
// pos != 0
|
||||
// (pos & 3) == 0
|
||||
size_t i = pos >= TEMP_BUF_SIZE ? TEMP_BUF_SIZE : (size_t)pos;
|
||||
pos -= i;
|
||||
RINOK(LookInStream_SeekRead_ForArc(stream, pos, temp, i))
|
||||
total += (UInt32)i;
|
||||
for (; i != 0; i--)
|
||||
if (temp[i - 1] != 0)
|
||||
RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf32, i))
|
||||
i /= 4;
|
||||
do
|
||||
if (buf32[i - 1] != 0)
|
||||
break;
|
||||
if (i != 0)
|
||||
{
|
||||
if ((i & 3) != 0)
|
||||
return SZ_ERROR_NO_ARCHIVE;
|
||||
pos += i;
|
||||
break;
|
||||
}
|
||||
if (pos < XZ_STREAM_FOOTER_SIZE || total > (1 << 16))
|
||||
while (--i);
|
||||
|
||||
pos += i * 4;
|
||||
#define XZ_STREAM_BACKWARD_READING_PAD_MAX (1 << 16)
|
||||
// here we don't support rare case with big padding for xz stream.
|
||||
// so we have padding limit for backward reading.
|
||||
if ((UInt64)*startOffset - pos > XZ_STREAM_BACKWARD_READING_PAD_MAX)
|
||||
return SZ_ERROR_NO_ARCHIVE;
|
||||
if (i)
|
||||
break;
|
||||
}
|
||||
|
||||
// we try to open xz stream after skipping zero padding.
|
||||
// ((UInt64)*startOffset == pos) is possible here!
|
||||
if (pos < XZ_STREAM_FOOTER_SIZE)
|
||||
return SZ_ERROR_NO_ARCHIVE;
|
||||
pos -= XZ_STREAM_FOOTER_SIZE;
|
||||
RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf, XZ_STREAM_FOOTER_SIZE))
|
||||
if (!XZ_FOOTER_SIG_CHECK(buf + 10))
|
||||
RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf32, XZ_STREAM_FOOTER_SIZE))
|
||||
if (!XZ_FOOTER_12B_ALIGNED16_SIG_CHECK(buf32))
|
||||
return SZ_ERROR_NO_ARCHIVE;
|
||||
}
|
||||
|
||||
p->flags = (CXzStreamFlags)GetBe16(buf + 8);
|
||||
|
||||
p->flags = (CXzStreamFlags)GetBe16a(buf32 + 2);
|
||||
if (!XzFlags_IsSupported(p->flags))
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
|
||||
{
|
||||
/* to eliminate GCC 6.3 warning:
|
||||
dereferencing type-punned pointer will break strict-aliasing rules */
|
||||
const Byte *buf_ptr = buf;
|
||||
if (GetUi32(buf_ptr) != CrcCalc(buf + 4, 6))
|
||||
const UInt32 *buf_ptr = buf32;
|
||||
if (GetUi32a(buf_ptr) != CrcCalc(buf32 + 1, 6))
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
}
|
||||
|
||||
indexSize = ((UInt64)GetUi32(buf + 4) + 1) << 2;
|
||||
|
||||
if (pos < indexSize)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
|
||||
pos -= indexSize;
|
||||
RINOK(LookInStream_SeekTo(stream, pos))
|
||||
RINOK(Xz_ReadIndex(p, stream, indexSize, alloc))
|
||||
|
||||
{
|
||||
UInt64 totalSize = Xz_GetPackSize(p);
|
||||
if (totalSize == XZ_SIZE_OVERFLOW
|
||||
|| totalSize >= ((UInt64)1 << 63)
|
||||
|| pos < totalSize + XZ_STREAM_HEADER_SIZE)
|
||||
const UInt64 indexSize = ((UInt64)GetUi32a(buf32 + 1) + 1) << 2;
|
||||
if (pos < indexSize)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
pos -= (totalSize + XZ_STREAM_HEADER_SIZE);
|
||||
pos -= indexSize;
|
||||
// v25.00: relaxed indexSize check. We allow big index table.
|
||||
// if (indexSize > ((UInt32)1 << 31))
|
||||
if (indexSize >= ((size_t)1 << (sizeof(size_t) * 8 - 1)))
|
||||
return SZ_ERROR_MEM; // SZ_ERROR_ARCHIVE
|
||||
RINOK(LookInStream_SeekTo(stream, pos))
|
||||
// RINOK(Xz_ReadIndex(p, stream, indexSize, alloc))
|
||||
{
|
||||
SRes res;
|
||||
const size_t size = (size_t)indexSize;
|
||||
// if (size != indexSize) return SZ_ERROR_UNSUPPORTED;
|
||||
Byte *buf = (Byte *)ISzAlloc_Alloc(alloc, size);
|
||||
if (!buf)
|
||||
return SZ_ERROR_MEM;
|
||||
res = LookInStream_Read2(stream, buf, size, SZ_ERROR_UNSUPPORTED);
|
||||
if (res == SZ_OK)
|
||||
res = Xz_ParseIndex(p, buf, size, alloc);
|
||||
ISzAlloc_Free(alloc, buf);
|
||||
RINOK(res)
|
||||
}
|
||||
}
|
||||
{
|
||||
UInt64 total = Xz_GetPackSize(p);
|
||||
if (total == XZ_SIZE_OVERFLOW || total >= ((UInt64)1 << 63))
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
total += XZ_STREAM_HEADER_SIZE;
|
||||
if (pos < total)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
pos -= total;
|
||||
RINOK(LookInStream_SeekTo(stream, pos))
|
||||
*startOffset = (Int64)pos;
|
||||
}
|
||||
@@ -246,7 +278,6 @@ static SRes Xz_ReadBackward(CXzStream *p, ILookInStreamPtr stream, Int64 *startO
|
||||
CSecToRead secToRead;
|
||||
SecToRead_CreateVTable(&secToRead);
|
||||
secToRead.realStream = stream;
|
||||
|
||||
RINOK(Xz_ReadHeader(&headerFlags, &secToRead.vt))
|
||||
return (p->flags == headerFlags) ? SZ_OK : SZ_ERROR_ARCHIVE;
|
||||
}
|
||||
@@ -257,8 +288,7 @@ static SRes Xz_ReadBackward(CXzStream *p, ILookInStreamPtr stream, Int64 *startO
|
||||
|
||||
void Xzs_Construct(CXzs *p)
|
||||
{
|
||||
p->num = p->numAllocated = 0;
|
||||
p->streams = 0;
|
||||
Xzs_CONSTRUCT(p)
|
||||
}
|
||||
|
||||
void Xzs_Free(CXzs *p, ISzAllocPtr alloc)
|
||||
@@ -268,7 +298,7 @@ void Xzs_Free(CXzs *p, ISzAllocPtr alloc)
|
||||
Xz_Free(&p->streams[i], alloc);
|
||||
ISzAlloc_Free(alloc, p->streams);
|
||||
p->num = p->numAllocated = 0;
|
||||
p->streams = 0;
|
||||
p->streams = NULL;
|
||||
}
|
||||
|
||||
UInt64 Xzs_GetNumBlocks(const CXzs *p)
|
||||
@@ -307,34 +337,49 @@ UInt64 Xzs_GetPackSize(const CXzs *p)
|
||||
SRes Xzs_ReadBackward(CXzs *p, ILookInStreamPtr stream, Int64 *startOffset, ICompressProgressPtr progress, ISzAllocPtr alloc)
|
||||
{
|
||||
Int64 endOffset = 0;
|
||||
// it's supposed that CXzs object is empty here.
|
||||
// if CXzs object is not empty, it will add new streams to that non-empty object.
|
||||
// Xzs_Free(p, alloc); // it's optional call to empty CXzs object.
|
||||
RINOK(ILookInStream_Seek(stream, &endOffset, SZ_SEEK_END))
|
||||
*startOffset = endOffset;
|
||||
for (;;)
|
||||
{
|
||||
CXzStream st;
|
||||
SRes res;
|
||||
Xz_Construct(&st);
|
||||
Xz_CONSTRUCT(&st)
|
||||
res = Xz_ReadBackward(&st, stream, startOffset, alloc);
|
||||
// if (res == SZ_OK), then (*startOffset) is start offset of new stream if
|
||||
// if (res != SZ_OK), then (*startOffset) is unchend or it's expected start offset of stream with error
|
||||
st.startOffset = (UInt64)*startOffset;
|
||||
RINOK(res)
|
||||
// we must store (st) object to array, or we must free (st) local object.
|
||||
if (res != SZ_OK)
|
||||
{
|
||||
Xz_Free(&st, alloc);
|
||||
return res;
|
||||
}
|
||||
if (p->num == p->numAllocated)
|
||||
{
|
||||
const size_t newNum = p->num + p->num / 4 + 1;
|
||||
void *data = ISzAlloc_Alloc(alloc, newNum * sizeof(CXzStream));
|
||||
if (!data)
|
||||
{
|
||||
Xz_Free(&st, alloc);
|
||||
return SZ_ERROR_MEM;
|
||||
}
|
||||
p->numAllocated = newNum;
|
||||
if (p->num != 0)
|
||||
memcpy(data, p->streams, p->num * sizeof(CXzStream));
|
||||
ISzAlloc_Free(alloc, p->streams);
|
||||
p->streams = (CXzStream *)data;
|
||||
}
|
||||
// we use direct copying of raw data from local variable (st) to object in array.
|
||||
// so we don't need to call Xz_Free(&st, alloc) after copying and after p->num++
|
||||
p->streams[p->num++] = st;
|
||||
if (*startOffset == 0)
|
||||
break;
|
||||
RINOK(LookInStream_SeekTo(stream, (UInt64)*startOffset))
|
||||
return SZ_OK;
|
||||
// seek operation is optional:
|
||||
// RINOK(LookInStream_SeekTo(stream, (UInt64)*startOffset))
|
||||
if (progress && ICompressProgress_Progress(progress, (UInt64)(endOffset - *startOffset), (UInt64)(Int64)-1) != SZ_OK)
|
||||
return SZ_ERROR_PROGRESS;
|
||||
}
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
+25
-19
@@ -26,26 +26,20 @@ jobs:
|
||||
arch: x64
|
||||
- cc: Clang
|
||||
arch: x86
|
||||
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
|
||||
runs-on: ubuntu-22.04
|
||||
name: Linux / ${{ matrix.cc }} ${{ matrix.arch }}
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get build dependencies and arrange the environment
|
||||
run: |
|
||||
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
|
||||
export BUILD_DEPS="libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libsdl1.2-dev libsdl2-dev libvulkan-dev zlib1g-dev"
|
||||
export BUILD_DEPS="libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libsdl2-dev libvulkan-dev zlib1g-dev"
|
||||
./.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
- name: Build and related stuff, backup binaries
|
||||
run: |
|
||||
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
|
||||
export PATH="$(pwd)/.github/workflows/scripts:${PATH}"
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 SDL_CONFIG="sdl-config""
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1"
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 SDL_CONFIG="sdl2-config""
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 SDL_CONFIG="sdl-config" POSTFIX="-old""
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 SDL_CONFIG="sdl2-config" POSTFIX="-old""
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 POSTFIX="-old""
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
|
||||
- name: Upload artifact
|
||||
if: matrix.cc == 'GCC'
|
||||
@@ -63,12 +57,24 @@ jobs:
|
||||
arch: x64
|
||||
cross: x86_64
|
||||
env: MINGW64
|
||||
gbc: 0
|
||||
- cc: GCC
|
||||
arch: x86
|
||||
cross: i686
|
||||
env: MINGW32
|
||||
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
|
||||
runs-on: windows-2022
|
||||
gbc: 0
|
||||
- cc: GCC
|
||||
arch: x64
|
||||
cross: ucrt-x86_64
|
||||
env: UCRT64
|
||||
gbc: 1
|
||||
- cc: Clang
|
||||
arch: x64
|
||||
cross: clang-x86_64
|
||||
env: CLANG64
|
||||
gbc: 1
|
||||
name: Windows ${{ matrix.arch }} / MSYS2 ${{ matrix.env }} ${{ matrix.cc }}
|
||||
runs-on: windows-2025
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
@@ -82,7 +88,6 @@ jobs:
|
||||
git
|
||||
libtool
|
||||
make
|
||||
mingw-w64-${{ matrix.cross }}-gcc
|
||||
mingw-w64-${{ matrix.cross }}-toolchain
|
||||
mingw-w64-${{ matrix.cross }}-freetype
|
||||
mingw-w64-${{ matrix.cross }}-libpng
|
||||
@@ -93,10 +98,11 @@ jobs:
|
||||
mingw-w64-${{ matrix.cross }}-zlib
|
||||
- name: Build and related stuff, backup binaries
|
||||
run: |
|
||||
if [[ ${{ matrix.gbc }} -eq 1 ]]; then pacman --noconfirm -S --needed mingw-w64-${{ matrix.cross }}-opencv; fi
|
||||
export PATH="$(pwd)/.github/workflows/scripts:${PATH}"
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1"
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 OPENCV=${{ matrix.gbc }}"
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 POSTFIX="-old""
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 OPENCV=${{ matrix.gbc }} POSTFIX="-old""
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
- name: Backup dependencies, etc...
|
||||
run: |
|
||||
@@ -114,11 +120,11 @@ jobs:
|
||||
include:
|
||||
- toolset: v143
|
||||
arch: x64
|
||||
vs: 2022
|
||||
vs: 2025
|
||||
- toolset: v141_xp
|
||||
arch: x86
|
||||
vs: 2019
|
||||
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
|
||||
name: Windows ${{ matrix.arch }} / MSVC with ${{ matrix.toolset }}
|
||||
runs-on: windows-${{ matrix.vs }}
|
||||
defaults:
|
||||
run:
|
||||
@@ -131,7 +137,7 @@ jobs:
|
||||
set PATH=%CD%\.github\workflows\scripts;%PATH%
|
||||
set TOOLSET=${{ matrix.toolset }}
|
||||
call ci_msvc_build.cmd ${{ matrix.arch }}
|
||||
ci_msvc_build.cmd ${{ matrix.arch }} newdyn
|
||||
call ci_msvc_build.cmd ${{ matrix.arch }} newdyn
|
||||
- name: Backup dependencies, etc...
|
||||
run: |
|
||||
.\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} freetype.dll libpng16.dll SDL2.dll SDL2_net.dll zlib.dll
|
||||
|
||||
+25
-19
@@ -19,27 +19,21 @@ jobs:
|
||||
arch: x64
|
||||
- cc: Clang
|
||||
arch: x86
|
||||
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
|
||||
runs-on: ubuntu-22.04
|
||||
name: Linux / ${{ matrix.cc }} ${{ matrix.arch }}
|
||||
runs-on: ubuntu-24.04
|
||||
if: github.repository == 'mupen64plus/mupen64plus-core'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get build dependencies and arrange the environment
|
||||
run: |
|
||||
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
|
||||
export BUILD_DEPS="libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libsdl1.2-dev libsdl2-dev libvulkan-dev zlib1g-dev"
|
||||
export BUILD_DEPS="libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libsdl2-dev libvulkan-dev zlib1g-dev"
|
||||
./.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
- name: Build and related stuff, backup binaries
|
||||
run: |
|
||||
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
|
||||
export PATH="$(pwd)/.github/workflows/scripts:${PATH}"
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 SDL_CONFIG="sdl-config""
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1"
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 SDL_CONFIG="sdl2-config""
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 SDL_CONFIG="sdl-config" POSTFIX="-old""
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 SDL_CONFIG="sdl2-config" POSTFIX="-old""
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 POSTFIX="-old""
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
|
||||
- name: Upload artifact
|
||||
if: matrix.cc == 'GCC'
|
||||
@@ -57,12 +51,24 @@ jobs:
|
||||
arch: x64
|
||||
cross: x86_64
|
||||
env: MINGW64
|
||||
gbc: 0
|
||||
- cc: GCC
|
||||
arch: x86
|
||||
cross: i686
|
||||
env: MINGW32
|
||||
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
|
||||
runs-on: windows-2022
|
||||
gbc: 0
|
||||
- cc: GCC
|
||||
arch: x64
|
||||
cross: ucrt-x86_64
|
||||
env: UCRT64
|
||||
gbc: 1
|
||||
- cc: Clang
|
||||
arch: x64
|
||||
cross: clang-x86_64
|
||||
env: CLANG64
|
||||
gbc: 1
|
||||
name: Windows ${{ matrix.arch }} / MSYS2 ${{ matrix.env }} ${{ matrix.cc }}
|
||||
runs-on: windows-2025
|
||||
if: github.repository == 'mupen64plus/mupen64plus-core'
|
||||
defaults:
|
||||
run:
|
||||
@@ -77,7 +83,6 @@ jobs:
|
||||
git
|
||||
libtool
|
||||
make
|
||||
mingw-w64-${{ matrix.cross }}-gcc
|
||||
mingw-w64-${{ matrix.cross }}-toolchain
|
||||
mingw-w64-${{ matrix.cross }}-freetype
|
||||
mingw-w64-${{ matrix.cross }}-libpng
|
||||
@@ -88,10 +93,11 @@ jobs:
|
||||
mingw-w64-${{ matrix.cross }}-zlib
|
||||
- name: Build and related stuff, backup binaries
|
||||
run: |
|
||||
if [[ ${{ matrix.gbc }} -eq 1 ]]; then pacman --noconfirm -S --needed mingw-w64-${{ matrix.cross }}-opencv; fi
|
||||
export PATH="$(pwd)/.github/workflows/scripts:${PATH}"
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1"
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 OPENCV=${{ matrix.gbc }}"
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 POSTFIX="-old""
|
||||
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 OPENCV=${{ matrix.gbc }} POSTFIX="-old""
|
||||
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
|
||||
- name: Backup dependencies, etc...
|
||||
run: |
|
||||
@@ -109,11 +115,11 @@ jobs:
|
||||
include:
|
||||
- toolset: v143
|
||||
arch: x64
|
||||
vs: 2022
|
||||
vs: 2025
|
||||
- toolset: v141_xp
|
||||
arch: x86
|
||||
vs: 2019
|
||||
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
|
||||
name: Windows ${{ matrix.arch }} / MSVC with ${{ matrix.toolset }}
|
||||
runs-on: windows-${{ matrix.vs }}
|
||||
if: github.repository == 'mupen64plus/mupen64plus-core'
|
||||
defaults:
|
||||
@@ -127,7 +133,7 @@ jobs:
|
||||
set PATH=%CD%\.github\workflows\scripts;%PATH%
|
||||
set TOOLSET=${{ matrix.toolset }}
|
||||
call ci_msvc_build.cmd ${{ matrix.arch }}
|
||||
ci_msvc_build.cmd ${{ matrix.arch }} newdyn
|
||||
call ci_msvc_build.cmd ${{ matrix.arch }} newdyn
|
||||
- name: Backup dependencies, etc...
|
||||
run: |
|
||||
.\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} freetype.dll libpng16.dll SDL2.dll SDL2_net.dll zlib.dll
|
||||
|
||||
@@ -37,7 +37,7 @@ export REPO="${PWD##*/}"
|
||||
if [[ "${REPO}" == "" ]]; then exit 6; fi
|
||||
|
||||
export BIN_OS="$(uname -s | tr [A-Z] [a-z])"
|
||||
if [[ ! -z ${MSYSTEM} ]]; then export BIN_OS="msys2"; fi
|
||||
if [[ ! -z ${MSYSTEM} ]]; then export BIN_OS="msys2-$(echo "${MSYSTEM}" | tr [A-Z] [a-z])"; fi
|
||||
export ENV_NAME="$(uname -s)"
|
||||
export LDD="ldd"
|
||||
export PKG_PATH="usr/local/lib/mupen64plus/"
|
||||
@@ -105,6 +105,7 @@ if [[ -z ${ARTIFACT} ]]; then
|
||||
exit 5
|
||||
else
|
||||
cd pkg
|
||||
if [[ -f "mupen64plus.desktop" ]]; then rm -f mupen64plus.desktop; fi
|
||||
ls -gG "${PKG_PATH}${ARTIFACT}"
|
||||
echo ""
|
||||
${LDD} "${PKG_PATH}${ARTIFACT}" > ldd.log
|
||||
|
||||
+6
-2
@@ -1,12 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e +u
|
||||
|
||||
# NOTE: There is no native "libglew-dev:i386" in Ubuntu 22.04, we will use Debian ones...
|
||||
# NOTE: There is no native "libglew-dev:i386" in Ubuntu 24.04, we will use Debian ones...
|
||||
|
||||
export GLEWVER="$(apt list libglew-dev | grep "amd64" | cut -d ' ' -f2)"
|
||||
export PKGS="$(apt list libglew* | grep "${GLEWVER}" | cut -d '/' -f1)"
|
||||
export DEBSOURCE="http://http.us.debian.org/debian/pool/main/g/glew/"
|
||||
export PKGVER_LS="$(curl -sS ${DEBSOURCE} | grep "${GLEWVER}" | grep "amd64" | cut -d '_' -f2 | sort)"
|
||||
export BUILDP1="$(echo "${GLEWVER}" | cut -d '-' -f1)"
|
||||
export BUILDP2="$(echo "${GLEWVER}" | cut -d '-' -f2)"
|
||||
export GLEWBUILD="${BUILDP1}"
|
||||
if [[ "${GLEWBUILD}" != "${GLEWVER}" ]]; then export GLEWBUILD="${BUILDP1}-${BUILDP2:0:1}"; fi
|
||||
export PKGVER_LS="$(curl -sS ${DEBSOURCE} | grep "${GLEWBUILD}" | grep "amd64" | cut -d '_' -f2 | sort)"
|
||||
if [[ "${PKGVER_LS}" != "" ]]; then
|
||||
for VER in ${PKGVER_LS}; do export PKGVER="${VER}"; done
|
||||
cd /tmp
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ set -e +u
|
||||
if [[ ${#} -lt 2 ]]; then exit 9; fi
|
||||
|
||||
unset ARCH_DEP CC_DEP
|
||||
export BUILD_DEPS_I386="crossbuild-essential-i386 g++${C_GCC_SUFFIX}-i686-linux-gnu gcc${C_GCC_SUFFIX}-i686-linux-gnu libc6-i386"
|
||||
export BUILD_DEPS_I386="crossbuild-essential-i386 g++${C_GCC_SUFFIX}-i686-linux-gnu gcc${C_GCC_SUFFIX}-i686-linux-gnu"
|
||||
export HOTFIX_I386="libatomic1:i386 libgcc-s1:i386 libstdc++6:i386 ${HOTFIX_I386}"
|
||||
export ENV_ARGS="$(echo "${*}" | tr [A-Z] [a-z])"
|
||||
|
||||
@@ -17,7 +17,7 @@ for ARG in ${ENV_ARGS}; do
|
||||
export CC_DEP="g++${C_GCC_SUFFIX} gcc${C_GCC_SUFFIX}"
|
||||
;;
|
||||
multilib )
|
||||
export BUILD_DEPS_I386="g++${C_GCC_SUFFIX}-multilib gcc${C_GCC_SUFFIX}-multilib libc6-dev-i386"
|
||||
export BUILD_DEPS_I386="g++${C_GCC_SUFFIX}-multilib gcc${C_GCC_SUFFIX}-multilib"
|
||||
;;
|
||||
x64 )
|
||||
export ARCH_DEP="x64"
|
||||
@@ -31,9 +31,9 @@ done
|
||||
if [[ -z ${ARCH_DEP} ]]; then exit 8; fi
|
||||
if [[ -z ${CC_DEP} ]]; then exit 7; fi
|
||||
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
if [[ "${ARCH_DEP}" == "x86" ]]; then sudo dpkg --add-architecture i386; fi
|
||||
sudo apt-get update
|
||||
sudo apt-mark hold grub-common grub-efi-amd64-bin python3 python3-apt shim-signed
|
||||
sudo apt-get -y install build-essential git nasm pkg-config ${CC_DEP} ${BUILD_DEPS}
|
||||
if [[ "${ARCH_DEP}" == "x86" ]]; then
|
||||
if [[ "${BUILD_DEPS}" != "" ]]; then
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@
|
||||
[subrepo]
|
||||
remote = git@github.com:mupen64plus/mupen64plus-core.git
|
||||
branch = master
|
||||
commit = e170c409fb006aa38fd02031b5eefab6886ec125
|
||||
parent = 37839b0178b42b57a38a040bbf4e1f410e6952a1
|
||||
commit = c5b1e72be0d2b33c18be48c989e726ac176e7872
|
||||
parent = c8048741165583eaced380e84945764e924df6bf
|
||||
method = merge
|
||||
cmdver = 0.4.6
|
||||
cmdver = 0.4.9
|
||||
|
||||
+53
-14
@@ -6130,18 +6130,6 @@ RefMD5=70C525880240C1E838B8B1BE35666C3B
|
||||
GoodName=GoldenEye 007 Intro by SonCrap (PD)
|
||||
CRC=9303DD17 0813B398
|
||||
|
||||
[67F2E18ED18A5F0EA3FE2D913E3F1786]
|
||||
GoodName=GoldenEye X
|
||||
; Alternate Title=GoldenEye X (5e Clouds)
|
||||
CRC=FDF95D15 618546CA
|
||||
RefMD5=E03B088B6AC9E0080440EFED07C1E40F
|
||||
|
||||
[435D75D07878D305293EC4D591B86303]
|
||||
GoodName=GoldenEye X
|
||||
; Alternate Title=GoldenEye X (5e Cloudless)
|
||||
CRC=E8B3F63D E5A997B1
|
||||
RefMD5=E03B088B6AC9E0080440EFED07C1E40F
|
||||
|
||||
[EA0E3E6AEFA58738A12906298373218B]
|
||||
GoodName=GoldenEye 007 (UE) (Switch Online) [!]
|
||||
CRC=DCBC50D1 9FD1AA3
|
||||
@@ -12024,10 +12012,25 @@ Rumble=Yes
|
||||
Transferpak=Yes
|
||||
|
||||
[5D72155E00Bf2CAB41B0F4A2f2E09C61]
|
||||
GoodName=Perfect Dark Plus
|
||||
GoodName=Perfect Dark Plus [h1]
|
||||
CRC=FB453D58 AD565422
|
||||
RefMD5=E03B088B6AC9E0080440EFED07C1E40F
|
||||
|
||||
[67F2E18ED18A5F0EA3FE2D913E3F1786]
|
||||
GoodName=GoldenEye X [h2] (5e Clouds)
|
||||
CRC=FDF95D15 618546CA
|
||||
RefMD5=E03B088B6AC9E0080440EFED07C1E40F
|
||||
|
||||
[435D75D07878D305293EC4D591B86303]
|
||||
GoodName=GoldenEye X [h3] (5e Cloudless)
|
||||
CRC=E8B3F63D E5A997B1
|
||||
RefMD5=E03B088B6AC9E0080440EFED07C1E40F
|
||||
|
||||
[640923B68B9281044AC1B518612E979B]
|
||||
GoodName=GoldenEye X [h4] (6a)
|
||||
CRC=BE0052C3 2CA8CFB2
|
||||
RefMD5=E03B088B6AC9E0080440EFED07C1E40F
|
||||
|
||||
[E0BCB2758EDF0AC6AB7DB36D98E1E57C]
|
||||
GoodName=Pikachu Genki Dechu (J) [!]
|
||||
CRC=3F245305 FC0B74AA
|
||||
@@ -14372,6 +14375,11 @@ GoodName=Space Station Silicon Valley (E) (M7) [b1]
|
||||
CRC=FC70E272 08FFE7AA
|
||||
RefMD5=FCA7AFCADCF5E5545A62919BA94DAD18
|
||||
|
||||
[2E91FFB252AA28B99E82D8F74BCC3831]
|
||||
GoodName=Space Station Silicon Valley (E) (M7) [f1] (FBM Fix v1.2)
|
||||
CRC=FC70E272 08FFE7AA
|
||||
RefMD5=FCA7AFCADCF5E5545A62919BA94DAD18
|
||||
|
||||
[E66ED1CC4AB95D0872BB2EBC49B206C4]
|
||||
GoodName=Space Station Silicon Valley (J) [!]
|
||||
CRC=BFE23884 EF48EAAF
|
||||
@@ -14379,6 +14387,11 @@ Players=1
|
||||
SaveType=Eeprom 4KB
|
||||
Rumble=Yes
|
||||
|
||||
[042D1CBD3F4705642D12D004F0649558]
|
||||
GoodName=Space Station Silicon Valley (J) [f1] (ExpFBM Fix v1.2)
|
||||
CRC=7AB86C9B A6487448
|
||||
RefMD5=E66ED1CC4AB95D0872BB2EBC49B206C4
|
||||
|
||||
[868B37D1B66D1D994E2BAD4E218BF129]
|
||||
GoodName=Space Station Silicon Valley (U) [!]
|
||||
CRC=BFE23884 EF48EAAF
|
||||
@@ -14396,13 +14409,23 @@ GoodName=Space Station Silicon Valley (U) [f2] (PAL)
|
||||
CRC=BFE23884 EF48EAAF
|
||||
RefMD5=868B37D1B66D1D994E2BAD4E218BF129
|
||||
|
||||
[92EE9AF3DFEB19A1339F3C75BAED1E6B]
|
||||
GoodName=Space Station Silicon Valley (U) (M7) [f3] (ExpFBMLSelect Fix v1.2)
|
||||
CRC=7AB86C9D 37CD109C
|
||||
RefMD5=868B37D1B66D1D994E2BAD4E218BF129
|
||||
|
||||
[F1F1C5E2B895DB63348BC738C0CDC645]
|
||||
GoodName=Space Station Silicon Valley (U) (V1.1) [!]
|
||||
CRC=FC70E272 8FFE7AA
|
||||
CRC=FC70E272 08FFE7AA
|
||||
Players=1
|
||||
SaveType=Eeprom 4KB
|
||||
Rumble=Yes
|
||||
|
||||
[9325E39AF74FC9571B5F2EFFCC1676A9]
|
||||
GoodName=Space Station Silicon Valley (U) (V1.1) (M7) [f1] (FBMLSelect Fix v1.2)
|
||||
CRC=FC70E270 658EA161
|
||||
RefMD5=F1F1C5E2B895DB63348BC738C0CDC645
|
||||
|
||||
[630E4122B0743A29C246DA2C257F92DA]
|
||||
GoodName=Spacer by Memir (POM '99) (PD)
|
||||
CRC=A3A044B5 6DB1BF5E
|
||||
@@ -18329,9 +18352,19 @@ GoodName=64DD IPL (USA)
|
||||
|
||||
[8485643E5830CD67ED4C0A5FD49E2491]
|
||||
GoodName=Mario Artist Paint Studio (J)
|
||||
Transferpak=Yes
|
||||
|
||||
[B17771664DAF95D7E61D8549A8CEACC6]
|
||||
GoodName=Mario Artist Paint Studio (J) [English v2.1]
|
||||
Transferpak=Yes
|
||||
|
||||
[88228E990B58A94E9B3460BEFF632304]
|
||||
GoodName=Mario Artist Talent Studio (J)
|
||||
Transferpak=Yes
|
||||
|
||||
[F3767735B1610C2BCA3220B590D43232]
|
||||
GoodName=Mario Artist Talent Studio (J) [English v2.1]
|
||||
Transferpak=Yes
|
||||
|
||||
[114AF722029D6386C3BFEA4CC8FA603C]
|
||||
GoodName=Mario Artist Communication Kit (J)
|
||||
@@ -18339,9 +18372,15 @@ GoodName=Mario Artist Communication Kit (J)
|
||||
[DA23EE561578B7DAD77ED72728B46D30]
|
||||
GoodName=Mario Artist Polygon Studio (J)
|
||||
|
||||
[7B94CB9AF6FE351CA7B47F59594AF96C]
|
||||
GoodName=Mario Artist Polygon Studio (J) [English v3.0]
|
||||
|
||||
[EBBA03F20096FC2BC178FC3A1F4EC2B6]
|
||||
GoodName=Sim City 64 (J)
|
||||
|
||||
[4372F74477FE54CD363FE4F14984625A]
|
||||
GoodName=Sim City 64 (J) [English v0.6.38]
|
||||
|
||||
[9F797A9C704B5EBD04D6A2B036309AF2]
|
||||
GoodName=Nihon Pro Golf Tour 64 (J)
|
||||
|
||||
|
||||
+41
-15
@@ -253,7 +253,7 @@ ifeq ($(OS), OSX)
|
||||
endif
|
||||
ifeq ($(OS), MINGW)
|
||||
TARGET = mupen64plus$(POSTFIX).dll
|
||||
ifeq ($(CC), clang)
|
||||
ifeq (clang, $(word 1, $(shell $(CC) --version)))
|
||||
LDFLAGS += -shared -Wl,-export-all-symbols
|
||||
else
|
||||
LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-all-symbols
|
||||
@@ -339,11 +339,11 @@ LDLIBS += $(LIBPNG_LDLIBS)
|
||||
ifeq ($(OPENCV), 1)
|
||||
# OpenCV lib
|
||||
ifeq ($(origin OPENCV_CFLAGS) $(origin OPENCV_LDLIBS), undefined undefined)
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion opencv 2>/dev/null),)
|
||||
$(error No OpenCV development libraries found!)
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion opencv4 2>/dev/null),)
|
||||
$(error No OpenCV 4 development libraries found!)
|
||||
endif
|
||||
OPENCV_CFLAGS += $(shell $(PKG_CONFIG) --cflags opencv)
|
||||
OPENCV_LDLIBS += $(shell $(PKG_CONFIG) --libs opencv)
|
||||
OPENCV_CFLAGS += $(shell $(PKG_CONFIG) --cflags opencv4)
|
||||
OPENCV_LDLIBS += $(shell $(PKG_CONFIG) --libs opencv4)
|
||||
endif
|
||||
CFLAGS += $(OPENCV_CFLAGS)
|
||||
LDLIBS += $(OPENCV_LDLIBS)
|
||||
@@ -351,22 +351,44 @@ endif
|
||||
|
||||
# test for presence of SDL
|
||||
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
|
||||
$(error No SDL2 development libraries found!)
|
||||
endif
|
||||
ifeq ($(NETPLAY), 1)
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion SDL2_net 2>/dev/null),)
|
||||
$(error No SDL2_net development libraries found!)
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion sdl3 2>/dev/null),)
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
|
||||
$(error No SDL3 or SDL2 development libraries found!)
|
||||
endif
|
||||
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags SDL2_net)
|
||||
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs SDL2_net)
|
||||
ifeq ($(SDL3_CAMERA), 1)
|
||||
$(error SDL3_CAMERA requires SDL3!)
|
||||
endif
|
||||
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
|
||||
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
|
||||
else
|
||||
SDL3_CAMERA := 1
|
||||
SDL_CFLAGS += -DUSE_SDL3
|
||||
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl3)
|
||||
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl3)
|
||||
endif
|
||||
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
|
||||
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
|
||||
endif
|
||||
CFLAGS += $(SDL_CFLAGS)
|
||||
LDLIBS += $(SDL_LDLIBS)
|
||||
|
||||
# test for presence of SDL_net
|
||||
ifeq ($(NETPLAY), 1)
|
||||
ifeq ($(origin SDLNET_CFLAGS) $(origin SDLNET_LDLIBS), undefined undefined)
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion sdl3-net 2>/dev/null),)
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion SDL2_net 2>/dev/null),)
|
||||
$(error No SDL3_net or SDL2_net development libraries found!)
|
||||
endif
|
||||
SDLNET_CFLAGS += $(shell $(PKG_CONFIG) --cflags SDL2_net)
|
||||
SDLNET_LDLIBS += $(shell $(PKG_CONFIG) --libs SDL2_net)
|
||||
else
|
||||
SDLNET_CFLAGS += -DUSE_SDL3NET
|
||||
SDLNET_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl3-net)
|
||||
SDLNET_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl3-net)
|
||||
endif
|
||||
endif
|
||||
CFLAGS += $(SDLNET_CFLAGS)
|
||||
LDLIBS += $(SDLNET_LDLIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(VC), 1)
|
||||
CFLAGS += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/vmcs_host/linux
|
||||
LDLIBS += -L/opt/vc/lib -lbrcmEGL -lbcm_host -lvcos -lvchiq_arm
|
||||
@@ -744,6 +766,10 @@ ifeq ($(OPENCV), 1)
|
||||
CFLAGS += -DM64P_OPENCV
|
||||
endif
|
||||
|
||||
ifeq ($(SDL3_CAMERA), 1)
|
||||
SOURCE += $(SRCDIR)/backends/sdl3_video_capture.cpp
|
||||
CFLAGS += -DSDL3_CAMERA
|
||||
endif
|
||||
|
||||
# generate a list of object files to build, make a temporary directory for them
|
||||
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter $(SRCDIR)/%.c, $(SOURCE)))
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
* outside of the core library.
|
||||
*/
|
||||
|
||||
#ifdef USE_SDL3
|
||||
#include <SDL3/SDL.h>
|
||||
#else
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
+293
-220
@@ -22,14 +22,21 @@
|
||||
/* This file contains the Core video extension functions which will be exported
|
||||
* outside of the core library.
|
||||
*/
|
||||
|
||||
#ifdef USE_SDL3
|
||||
#include <SDL3/SDL.h>
|
||||
#else
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
/* we need at least SDL 2.0.6 for vulkan */
|
||||
#if !SDL_VERSION_ATLEAST(2,0,6)
|
||||
#undef VIDEXT_VULKAN
|
||||
#endif
|
||||
#ifdef VIDEXT_VULKAN
|
||||
#ifdef USE_SDL3
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
#else
|
||||
#include <SDL_vulkan.h>
|
||||
#endif
|
||||
#include <vulkan/vulkan.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
@@ -47,8 +54,6 @@
|
||||
static int l_ForceCompatibilityContext = 1;
|
||||
#endif
|
||||
|
||||
#include "vidext_sdl2_compat.h"
|
||||
|
||||
/* local variables */
|
||||
static m64p_video_extension_functions l_ExternalVideoFuncTable = {17, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||
static int l_VideoExtensionActive = 0;
|
||||
@@ -56,11 +61,62 @@ static int l_VideoOutputActive = 0;
|
||||
static int l_Fullscreen = 0;
|
||||
static int l_SwapControl = 0;
|
||||
static m64p_render_mode l_RenderMode = M64P_RENDER_OPENGL;
|
||||
static SDL_Surface *l_pScreen = NULL;
|
||||
static SDL_Window *l_pWindow = NULL;
|
||||
#ifdef USE_SDL3
|
||||
static SDL_GLContext l_pGLContext;
|
||||
static SDL_DisplayID* l_pDisplays = NULL;
|
||||
#else
|
||||
static SDL_GLContext *l_pGLContext;
|
||||
#endif
|
||||
static char* l_pWindowTitle = NULL;
|
||||
#ifdef VIDEXT_VULKAN
|
||||
static const char** l_VulkanExtensionNames = NULL;
|
||||
#endif
|
||||
|
||||
/* local helper functions */
|
||||
|
||||
static int get_current_display_number(void)
|
||||
{
|
||||
const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY");
|
||||
if ( !variable ) {
|
||||
variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD");
|
||||
}
|
||||
if ( variable ) {
|
||||
return SDL_atoi(variable);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_SDL3
|
||||
static SDL_DisplayID get_current_display(void)
|
||||
{
|
||||
int displayNumber = get_current_display_number();
|
||||
int displayCount = 0;
|
||||
|
||||
if (l_pDisplays == NULL)
|
||||
{
|
||||
l_pDisplays = SDL_GetDisplays(&displayCount);
|
||||
if (l_pDisplays == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetDisplays failed: %s", SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (displayNumber > 0 && displayNumber < displayCount)
|
||||
return l_pDisplays[displayNumber];
|
||||
else
|
||||
return l_pDisplays[0];
|
||||
}
|
||||
#else
|
||||
static int get_current_display(void)
|
||||
{
|
||||
return get_current_display_number();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* global function for use by frontend.c */
|
||||
m64p_error OverrideVideoFunctions(m64p_video_extension_functions *VideoFunctionStruct)
|
||||
{
|
||||
@@ -135,16 +191,25 @@ EXPORT m64p_error CALL VidExt_InitWithRenderMode(m64p_render_mode RenderMode)
|
||||
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
||||
/* retrieve default swap interval/VSync */
|
||||
if (RenderMode == M64P_RENDER_OPENGL) {
|
||||
if (RenderMode == M64P_RENDER_OPENGL)
|
||||
{
|
||||
#ifdef USE_SDL3
|
||||
l_SwapControl = 1;
|
||||
#else
|
||||
l_SwapControl = SDL_GL_GetSwapInterval();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,24,0)
|
||||
#if SDL_VERSION_ATLEAST(2,24,0) && !defined(USE_SDL3)
|
||||
/* fix DPI scaling issues on Windows */
|
||||
SDL_SetHint(SDL_HINT_WINDOWS_DPI_AWARENESS, "permonitorv2");
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDL3
|
||||
if (!SDL_InitSubSystem(SDL_INIT_VIDEO))
|
||||
#else
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
|
||||
#endif
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL video subsystem init failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
@@ -154,7 +219,11 @@ EXPORT m64p_error CALL VidExt_InitWithRenderMode(m64p_render_mode RenderMode)
|
||||
if (RenderMode == M64P_RENDER_VULKAN)
|
||||
{
|
||||
#ifdef VIDEXT_VULKAN
|
||||
#ifdef USE_SDL3
|
||||
if (!SDL_Vulkan_LoadLibrary(NULL))
|
||||
#else
|
||||
if (SDL_Vulkan_LoadLibrary(NULL) == -1)
|
||||
#endif
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_Vulkan_LoadLibrary failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
@@ -184,8 +253,36 @@ EXPORT m64p_error CALL VidExt_Quit(void)
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
#ifdef USE_SDL3
|
||||
SDL_ShowCursor();
|
||||
#else
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
SDL2_DestroyWindow();
|
||||
#endif
|
||||
|
||||
if (l_pGLContext != NULL) {
|
||||
#ifdef USE_SDL3
|
||||
SDL_GL_DestroyContext(l_pGLContext);
|
||||
#else
|
||||
SDL_GL_DeleteContext(l_pGLContext);
|
||||
#endif
|
||||
l_pGLContext = NULL;
|
||||
}
|
||||
if (l_pWindow != NULL) {
|
||||
SDL_DestroyWindow(l_pWindow);
|
||||
l_pWindow = NULL;
|
||||
}
|
||||
if (l_pWindowTitle != NULL) {
|
||||
free(l_pWindowTitle);
|
||||
l_pWindowTitle = NULL;
|
||||
}
|
||||
|
||||
#ifdef USE_SDL3
|
||||
if (l_pDisplays != NULL) {
|
||||
SDL_free(l_pDisplays);
|
||||
l_pDisplays = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VIDEXT_VULKAN
|
||||
if (l_RenderMode == M64P_RENDER_VULKAN) {
|
||||
SDL_Vulkan_UnloadLibrary();
|
||||
@@ -196,60 +293,66 @@ EXPORT m64p_error CALL VidExt_Quit(void)
|
||||
}
|
||||
#endif
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
l_pScreen = NULL;
|
||||
l_VideoOutputActive = 0;
|
||||
StateChanged(M64CORE_VIDEO_MODE, M64VIDEO_NONE);
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL VidExt_ListFullscreenModes(m64p_2d_size *SizeArray, int *NumSizes)
|
||||
{
|
||||
const SDL_VideoInfo *videoInfo;
|
||||
unsigned int videoFlags;
|
||||
SDL_Rect **modes;
|
||||
int i;
|
||||
|
||||
/* call video extension override if necessary */
|
||||
/* call video extension override if necessary */
|
||||
if (l_VideoExtensionActive)
|
||||
return (*l_ExternalVideoFuncTable.VidExtFuncListModes)(SizeArray, NumSizes);
|
||||
|
||||
#ifdef USE_SDL3
|
||||
SDL_DisplayMode** modes;
|
||||
#else
|
||||
SDL_DisplayMode mode;
|
||||
#endif
|
||||
int count = 0;
|
||||
int i;
|
||||
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
/* get a list of SDL video modes */
|
||||
videoFlags = SDL_OPENGL | SDL_FULLSCREEN;
|
||||
|
||||
if ((videoInfo = SDL_GetVideoInfo()) == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetVideoInfo query failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
|
||||
if(videoInfo->hw_available)
|
||||
videoFlags |= SDL_HWSURFACE;
|
||||
else
|
||||
videoFlags |= SDL_SWSURFACE;
|
||||
|
||||
modes = SDL_ListModes(NULL, videoFlags);
|
||||
|
||||
if (modes == (SDL_Rect **) 0 || modes == (SDL_Rect **) -1)
|
||||
#ifdef USE_SDL3
|
||||
modes = SDL_GetFullscreenDisplayModes(get_current_display(), &count);
|
||||
#else
|
||||
count = SDL_GetNumDisplayModes(get_current_display());
|
||||
#endif
|
||||
if (count <= 0)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "No fullscreen SDL video modes available");
|
||||
*NumSizes = 0;
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < *NumSizes && modes[i] != NULL)
|
||||
for (i = 0; i < count && i < *NumSizes; i++)
|
||||
{
|
||||
#ifdef USE_SDL3
|
||||
SizeArray[i].uiWidth = modes[i]->w;
|
||||
SizeArray[i].uiHeight = modes[i]->h;
|
||||
i++;
|
||||
#else
|
||||
if (SDL_GetDisplayMode(get_current_display(), i, &mode) == 0)
|
||||
{ /* assign mode when retrieval is successful */
|
||||
SizeArray[i].uiWidth = mode.w;
|
||||
SizeArray[i].uiHeight = mode.h;
|
||||
}
|
||||
else
|
||||
{ /* return error when failed */
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetDisplayMode() query failed: %s", SDL_GetError());
|
||||
*NumSizes = 0;
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
*NumSizes = i;
|
||||
#ifdef USE_SDL3
|
||||
SDL_free(modes);
|
||||
#endif
|
||||
|
||||
*NumSizes = i;
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -259,46 +362,17 @@ EXPORT m64p_error CALL VidExt_ListFullscreenRates(m64p_2d_size Size, int *NumRat
|
||||
if (l_VideoExtensionActive)
|
||||
return (*l_ExternalVideoFuncTable.VidExtFuncListRates)(Size, NumRates, Rates);
|
||||
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
int display = GetVideoDisplay();
|
||||
int modeCount = SDL_GetNumDisplayModes(display);
|
||||
SDL_DisplayMode displayMode;
|
||||
|
||||
if (modeCount < 1)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetNumDisplayModes failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
|
||||
int rateCount = 0;
|
||||
for (int i = 0; (i < modeCount) && (rateCount < *NumRates); i++)
|
||||
{
|
||||
if (SDL_GetDisplayMode(display, i, &displayMode) < 0)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetDisplayMode failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
|
||||
/* skip when we're not at the right resolution */
|
||||
if (displayMode.w != (int)Size.uiWidth ||
|
||||
displayMode.h != (int)Size.uiHeight)
|
||||
continue;
|
||||
|
||||
Rates[rateCount] = displayMode.refresh_rate;
|
||||
rateCount++;
|
||||
}
|
||||
|
||||
*NumRates = rateCount;
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
return M64ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL VidExt_SetVideoMode(int Width, int Height, int BitsPerPixel, m64p_video_mode ScreenMode, m64p_video_flags Flags)
|
||||
{
|
||||
const SDL_VideoInfo *videoInfo;
|
||||
int videoFlags = 0;
|
||||
int windowWidth = 0;
|
||||
int windowHeight = 0;
|
||||
Uint32 windowFlags = 0;
|
||||
#ifndef USE_SDL3
|
||||
windowFlags = SDL_WINDOW_SHOWN;
|
||||
#endif
|
||||
|
||||
/* call video extension override if necessary */
|
||||
if (l_VideoExtensionActive)
|
||||
@@ -317,59 +391,104 @@ EXPORT m64p_error CALL VidExt_SetVideoMode(int Width, int Height, int BitsPerPix
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
/* Get SDL video flags to use */
|
||||
/* set window mode */
|
||||
if (l_RenderMode == M64P_RENDER_OPENGL)
|
||||
{
|
||||
videoFlags = SDL_OPENGL;
|
||||
windowFlags |= SDL_WINDOW_OPENGL;
|
||||
}
|
||||
#ifdef VIDEXT_VULKAN
|
||||
else
|
||||
else if (l_RenderMode == M64P_RENDER_VULKAN)
|
||||
{
|
||||
videoFlags = SDL_VULKAN;
|
||||
windowFlags |= SDL_WINDOW_VULKAN;
|
||||
}
|
||||
#endif
|
||||
if (ScreenMode == M64VIDEO_WINDOWED)
|
||||
{
|
||||
if (Flags & M64VIDEOFLAG_SUPPORT_RESIZING)
|
||||
videoFlags |= SDL_RESIZABLE;
|
||||
{
|
||||
windowFlags |= SDL_WINDOW_RESIZABLE;
|
||||
}
|
||||
}
|
||||
else if (ScreenMode == M64VIDEO_FULLSCREEN)
|
||||
{
|
||||
videoFlags |= SDL_FULLSCREEN;
|
||||
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return M64ERR_INPUT_INVALID;
|
||||
}
|
||||
|
||||
if ((videoInfo = SDL_GetVideoInfo()) == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetVideoInfo query failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
if (videoInfo->hw_available)
|
||||
videoFlags |= SDL_HWSURFACE;
|
||||
else
|
||||
videoFlags |= SDL_SWSURFACE;
|
||||
|
||||
/* set the mode */
|
||||
if (BitsPerPixel > 0)
|
||||
DebugMessage(M64MSG_INFO, "Setting %i-bit video mode: %ix%i", BitsPerPixel, Width, Height);
|
||||
else
|
||||
DebugMessage(M64MSG_INFO, "Setting video mode: %ix%i", Width, Height);
|
||||
|
||||
l_pScreen = SDL_SetVideoMode(Width, Height, BitsPerPixel, videoFlags);
|
||||
if (l_pScreen == NULL)
|
||||
/* initialize window if needed */
|
||||
if (l_pWindow == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_SetVideoMode failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
if (l_RenderMode == M64P_RENDER_OPENGL)
|
||||
{
|
||||
#ifndef USE_GLES
|
||||
if (l_ForceCompatibilityContext)
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
|
||||
}
|
||||
#else
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
#endif // !USE_GLES
|
||||
}
|
||||
|
||||
/* set default window title when unset */
|
||||
if (l_pWindowTitle == NULL)
|
||||
l_pWindowTitle = strdup("Mupen64Plus");
|
||||
|
||||
#ifdef USE_SDL3
|
||||
l_pWindow = SDL_CreateWindow(l_pWindowTitle, Width, Height, windowFlags);
|
||||
#else
|
||||
l_pWindow = SDL_CreateWindow(l_pWindowTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, Width, Height, windowFlags);
|
||||
#endif
|
||||
if (l_pWindow == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_CreateWindow failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
|
||||
if (l_RenderMode == M64P_RENDER_OPENGL)
|
||||
{
|
||||
l_pGLContext = SDL_GL_CreateContext(l_pWindow);
|
||||
#ifdef USE_SDL3
|
||||
if (!SDL_GL_MakeCurrent(l_pWindow, l_pGLContext))
|
||||
#else
|
||||
if (SDL_GL_MakeCurrent(l_pWindow, l_pGLContext) != 0)
|
||||
#endif
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GL_MakeCurrent failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* resize window if needed */
|
||||
SDL_GetWindowSize(l_pWindow, &windowWidth, &windowHeight);
|
||||
if (windowWidth != Width || windowHeight != Height)
|
||||
{
|
||||
SDL_SetWindowSize(l_pWindow, Width, Height);
|
||||
}
|
||||
|
||||
#ifdef USE_SDL3
|
||||
SDL_HideCursor();
|
||||
#else
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
#endif
|
||||
|
||||
/* set swap interval/VSync */
|
||||
if (l_RenderMode == M64P_RENDER_OPENGL &&
|
||||
#ifdef USE_SDL3
|
||||
!SDL_GL_SetSwapInterval(l_SwapControl))
|
||||
#else
|
||||
SDL_GL_SetSwapInterval(l_SwapControl) != 0)
|
||||
#endif
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL swap interval (VSync) set failed: %s", SDL_GetError());
|
||||
}
|
||||
@@ -397,88 +516,13 @@ EXPORT m64p_error CALL VidExt_SetVideoModeWithRate(int Width, int Height, int Re
|
||||
return rval;
|
||||
}
|
||||
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO) || !SDL_VideoWindow)
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
int videoFlags = 0;
|
||||
int display = GetVideoDisplay();
|
||||
int modeCount = SDL_GetNumDisplayModes(display);
|
||||
SDL_DisplayMode displayMode;
|
||||
int modeFound = 0;
|
||||
|
||||
/* Get SDL video flags to use */
|
||||
if (ScreenMode == M64VIDEO_WINDOWED)
|
||||
videoFlags = 0;
|
||||
else if (ScreenMode == M64VIDEO_FULLSCREEN)
|
||||
videoFlags = SDL_WINDOW_FULLSCREEN;
|
||||
else
|
||||
return M64ERR_INPUT_INVALID;
|
||||
|
||||
if (modeCount < 1)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetNumDisplayModes failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
|
||||
/* Attempt to find valid screen mode */
|
||||
for (int i = 0; i < modeCount; i++)
|
||||
{
|
||||
if (SDL_GetDisplayMode(display, i, &displayMode) < 0)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetDisplayMode failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
|
||||
/* skip when we're not at the right mode */
|
||||
if (displayMode.w != Width ||
|
||||
displayMode.h != Height ||
|
||||
displayMode.refresh_rate != RefreshRate)
|
||||
continue;
|
||||
|
||||
modeFound = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* return when no modes with specifed size have been found */
|
||||
if (modeFound == 0)
|
||||
return M64ERR_INPUT_INVALID;
|
||||
|
||||
/* Set window in specified mode */
|
||||
if (SDL_SetWindowFullscreen(SDL_VideoWindow, videoFlags) < 0)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_SetWindowFullscreen failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
|
||||
if (ScreenMode == M64VIDEO_FULLSCREEN)
|
||||
{
|
||||
if (SDL_SetWindowDisplayMode(SDL_VideoWindow, &displayMode) < 0)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_SetWindowDisplayMode failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
/* set swap interval/VSync */
|
||||
if (SDL_GL_SetSwapInterval(l_SwapControl) != 0)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL swap interval (VSync) set failed: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
l_Fullscreen = (ScreenMode == M64VIDEO_FULLSCREEN);
|
||||
l_VideoOutputActive = 1;
|
||||
StateChanged(M64CORE_VIDEO_MODE, ScreenMode);
|
||||
StateChanged(M64CORE_VIDEO_SIZE, (Width << 16) | Height);
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
return M64ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL VidExt_ResizeWindow(int Width, int Height)
|
||||
{
|
||||
const SDL_VideoInfo *videoInfo;
|
||||
int videoFlags = 0;
|
||||
int windowWidth = 0;
|
||||
int windowHeight = 0;
|
||||
|
||||
/* call video extension override if necessary */
|
||||
if (l_VideoExtensionActive)
|
||||
@@ -497,7 +541,7 @@ EXPORT m64p_error CALL VidExt_ResizeWindow(int Width, int Height)
|
||||
return rval;
|
||||
}
|
||||
|
||||
if (!l_VideoOutputActive || !SDL_WasInit(SDL_INIT_VIDEO))
|
||||
if (!l_pWindow || !SDL_WasInit(SDL_INIT_VIDEO))
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
if (l_Fullscreen)
|
||||
@@ -506,38 +550,13 @@ EXPORT m64p_error CALL VidExt_ResizeWindow(int Width, int Height)
|
||||
return M64ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
/* Get SDL video flags to use */
|
||||
if (l_RenderMode == M64P_RENDER_OPENGL)
|
||||
videoFlags = SDL_OPENGL;
|
||||
#ifdef VIDEXT_VULKAN
|
||||
else
|
||||
videoFlags = SDL_VULKAN;
|
||||
#endif
|
||||
videoFlags |= SDL_RESIZABLE;
|
||||
if ((videoInfo = SDL_GetVideoInfo()) == NULL)
|
||||
SDL_GetWindowSize(l_pWindow, &windowWidth, &windowHeight);
|
||||
if (windowHeight != Width || windowHeight != Height)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GetVideoInfo query failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
if (videoInfo->hw_available)
|
||||
videoFlags |= SDL_HWSURFACE;
|
||||
else
|
||||
videoFlags |= SDL_SWSURFACE;
|
||||
|
||||
// destroy the On-Screen Display
|
||||
osd_exit();
|
||||
|
||||
/* set the re-sizing the screen will create a new OpenGL context */
|
||||
l_pScreen = SDL_SetVideoMode(Width, Height, 0, videoFlags);
|
||||
if (l_pScreen == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_SetVideoMode failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
SDL_SetWindowSize(l_pWindow, Width, Height);
|
||||
}
|
||||
|
||||
StateChanged(M64CORE_VIDEO_SIZE, (Width << 16) | Height);
|
||||
// re-create the On-Screen Display
|
||||
osd_init(Width, Height);
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -550,13 +569,28 @@ EXPORT m64p_error CALL VidExt_SetCaption(const char *Title)
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
SDL_WM_SetCaption(Title, "M64+ Video");
|
||||
/* set window title if window exists, else
|
||||
* store it for later when initializing
|
||||
* the window */
|
||||
if (l_pWindow)
|
||||
{
|
||||
SDL_SetWindowTitle(l_pWindow, Title);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (l_pWindowTitle != NULL)
|
||||
free(l_pWindowTitle);
|
||||
|
||||
l_pWindowTitle = strdup(Title);
|
||||
}
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL VidExt_ToggleFullScreen(void)
|
||||
{
|
||||
Uint32 windowFlags = 0;
|
||||
|
||||
/* call video extension override if necessary */
|
||||
if (l_VideoExtensionActive)
|
||||
{
|
||||
@@ -569,18 +603,24 @@ EXPORT m64p_error CALL VidExt_ToggleFullScreen(void)
|
||||
return rval;
|
||||
}
|
||||
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
if (!l_pWindow || !SDL_WasInit(SDL_INIT_VIDEO))
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
/* TODO:
|
||||
* SDL_WM_ToggleFullScreen doesn't work under Windows and others
|
||||
* (see http://wiki.libsdl.org/moin.cgi/FAQWindows for explanation).
|
||||
* Instead, we should call SDL_SetVideoMode with the SDL_FULLSCREEN flag.
|
||||
* (see http://sdl.beuc.net/sdl.wiki/SDL_SetVideoMode), but on Windows
|
||||
* this resets the OpenGL context and video plugins don't support it yet.
|
||||
* Uncomment the next line to test it: */
|
||||
//return VidExt_SetVideoMode(l_pScreen->w, l_pScreen->h, l_pScreen->format->BitsPerPixel, l_Fullscreen ? M64VIDEO_WINDOWED : M64VIDEO_FULLSCREEN);
|
||||
if (SDL_WM_ToggleFullScreen(l_pScreen) == 1)
|
||||
/* set correct flags */
|
||||
if (!(SDL_GetWindowFlags(l_pWindow) & SDL_WINDOW_FULLSCREEN))
|
||||
{
|
||||
#ifdef USE_SDL3
|
||||
windowFlags = 1;
|
||||
#else
|
||||
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_SDL3
|
||||
if (SDL_SetWindowFullscreen(l_pWindow, windowFlags))
|
||||
#else
|
||||
if (SDL_SetWindowFullscreen(l_pWindow, windowFlags) == 0)
|
||||
#endif
|
||||
{
|
||||
l_Fullscreen = !l_Fullscreen;
|
||||
StateChanged(M64CORE_VIDEO_MODE, l_Fullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED);
|
||||
@@ -588,7 +628,7 @@ EXPORT m64p_error CALL VidExt_ToggleFullScreen(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_WM_ToggleFullScreen failed: %s", SDL_GetError());
|
||||
DebugMessage(M64MSG_ERROR, "SDL_SetWindowFullscreen failed: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
@@ -615,7 +655,11 @@ OSAL_WARNING_POP
|
||||
|
||||
typedef struct {
|
||||
m64p_GLattr m64Attr;
|
||||
#ifdef USE_SDL3
|
||||
SDL_GLAttr sdlAttr;
|
||||
#else
|
||||
SDL_GLattr sdlAttr;
|
||||
#endif
|
||||
} GLAttrMapNode;
|
||||
|
||||
static const GLAttrMapNode GLAttrMap[] = {
|
||||
@@ -633,7 +677,6 @@ static const GLAttrMapNode GLAttrMap[] = {
|
||||
{ M64P_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_MASK }
|
||||
};
|
||||
static const int mapSize = sizeof(GLAttrMap) / sizeof(GLAttrMapNode);
|
||||
|
||||
EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
|
||||
{
|
||||
int i;
|
||||
@@ -680,7 +723,11 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
|
||||
{
|
||||
if (GLAttrMap[i].m64Attr == Attr)
|
||||
{
|
||||
#ifdef USE_SDL3
|
||||
if (!SDL_GL_SetAttribute(GLAttrMap[i].sdlAttr, Value))
|
||||
#else
|
||||
if (SDL_GL_SetAttribute(GLAttrMap[i].sdlAttr, Value) != 0)
|
||||
#endif
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
@@ -705,7 +752,14 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
|
||||
|
||||
if (Attr == M64P_GL_SWAP_CONTROL)
|
||||
{
|
||||
#ifdef USE_SDL3
|
||||
if (!SDL_GL_GetSwapInterval(pValue)) {
|
||||
DebugMessage(M64MSG_ERROR, "SDL_GL_GetSwapInterval failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
#else
|
||||
*pValue = SDL_GL_GetSwapInterval();
|
||||
#endif
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -714,7 +768,11 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
|
||||
if (GLAttrMap[i].m64Attr == Attr)
|
||||
{
|
||||
int NewValue = 0;
|
||||
#ifdef USE_SDL3
|
||||
if (!SDL_GL_GetAttribute(GLAttrMap[i].sdlAttr, &NewValue))
|
||||
#else
|
||||
if (SDL_GL_GetAttribute(GLAttrMap[i].sdlAttr, &NewValue) != 0)
|
||||
#endif
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
/* translate the GL context type mask if necessary */
|
||||
if (Attr == M64P_GL_CONTEXT_PROFILE_MASK)
|
||||
@@ -751,10 +809,10 @@ EXPORT m64p_error CALL VidExt_GL_SwapBuffers(void)
|
||||
if (l_RenderMode != M64P_RENDER_OPENGL)
|
||||
return M64ERR_INVALID_STATE;
|
||||
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
if (!l_pWindow || !SDL_WasInit(SDL_INIT_VIDEO))
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
SDL_GL_SwapWindow(l_pWindow);
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -771,16 +829,21 @@ EXPORT m64p_error CALL VidExt_VK_GetSurface(void** Surface, void* Instance)
|
||||
if (l_VideoExtensionActive)
|
||||
return (*l_ExternalVideoFuncTable.VidExtFuncVKGetSurface)(Surface, Instance);
|
||||
|
||||
#ifdef VIDEXT_VULKAN
|
||||
#if defined(VIDEXT_VULKAN)
|
||||
VkSurfaceKHR vulkanSurface = VK_NULL_HANDLE;
|
||||
|
||||
if (l_RenderMode != M64P_RENDER_VULKAN)
|
||||
return M64ERR_INVALID_STATE;
|
||||
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO) || !SDL_VideoWindow)
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO) || !l_pWindow)
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
if (SDL_Vulkan_CreateSurface(SDL_VideoWindow, (VkInstance)Instance, &vulkanSurface) == SDL_FALSE) {
|
||||
#ifdef USE_SDL3
|
||||
if (!SDL_Vulkan_CreateSurface(l_pWindow, (VkInstance)Instance, NULL, &vulkanSurface))
|
||||
#else
|
||||
if (SDL_Vulkan_CreateSurface(l_pWindow, (VkInstance)Instance, &vulkanSurface) == SDL_FALSE)
|
||||
#endif
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_Vulkan_CreateSurface failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
@@ -797,7 +860,7 @@ EXPORT m64p_error CALL VidExt_VK_GetInstanceExtensions(const char** Extensions[]
|
||||
if (l_VideoExtensionActive)
|
||||
return (*l_ExternalVideoFuncTable.VidExtFuncVKGetInstanceExtensions)(Extensions, NumExtensions);
|
||||
|
||||
#ifdef VIDEXT_VULKAN
|
||||
#if defined(VIDEXT_VULKAN)
|
||||
if (l_RenderMode != M64P_RENDER_VULKAN)
|
||||
return M64ERR_INVALID_STATE;
|
||||
|
||||
@@ -805,7 +868,13 @@ EXPORT m64p_error CALL VidExt_VK_GetInstanceExtensions(const char** Extensions[]
|
||||
return M64ERR_NOT_INIT;
|
||||
|
||||
unsigned int extensionCount = 0;
|
||||
if (SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, NULL) == SDL_FALSE) {
|
||||
#ifdef USE_SDL3
|
||||
const char * const *instance_extensions;
|
||||
if (!(instance_extensions = SDL_Vulkan_GetInstanceExtensions(&extensionCount)))
|
||||
#else
|
||||
if (SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, NULL) == SDL_FALSE)
|
||||
#endif
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SDL_Vulkan_GetInstanceExtensions failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
@@ -822,10 +891,14 @@ EXPORT m64p_error CALL VidExt_VK_GetInstanceExtensions(const char** Extensions[]
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
|
||||
#ifdef USE_SDL3
|
||||
memcpy(l_VulkanExtensionNames, instance_extensions, extensionCount * sizeof(const char*));
|
||||
#else
|
||||
if (SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, l_VulkanExtensionNames) == SDL_FALSE) {
|
||||
DebugMessage(M64MSG_ERROR, "SDL_Vulkan_GetInstanceExtensions failed: %s", SDL_GetError());
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
*NumExtensions = extensionCount;
|
||||
*Extensions = l_VulkanExtensionNames;
|
||||
|
||||
@@ -1,527 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include <SDL_config.h>
|
||||
#include <SDL_surface.h>
|
||||
|
||||
#ifndef USE_GLES
|
||||
|
||||
#ifndef SDL_VIDEO_OPENGL
|
||||
#error SDL is not build with OpenGL support. Try USE_GLES=1
|
||||
#endif
|
||||
|
||||
#else // !USE_GLES
|
||||
|
||||
#ifndef SDL_VIDEO_OPENGL_ES2
|
||||
#error SDL is not build with OpenGL ES2 support. Try USE_GLES=0
|
||||
#endif
|
||||
|
||||
#endif // !USE_GLES
|
||||
|
||||
typedef struct SDL_VideoInfo
|
||||
{
|
||||
Uint32 hw_available:1;
|
||||
Uint32 wm_available:1;
|
||||
Uint32 UnusedBits1:6;
|
||||
Uint32 UnusedBits2:1;
|
||||
Uint32 blit_hw:1;
|
||||
Uint32 blit_hw_CC:1;
|
||||
Uint32 blit_hw_A:1;
|
||||
Uint32 blit_sw:1;
|
||||
Uint32 blit_sw_CC:1;
|
||||
Uint32 blit_sw_A:1;
|
||||
Uint32 blit_fill:1;
|
||||
Uint32 UnusedBits3:16;
|
||||
Uint32 video_mem;
|
||||
|
||||
SDL_PixelFormat *vfmt;
|
||||
|
||||
int current_w;
|
||||
int current_h;
|
||||
} SDL_VideoInfo;
|
||||
|
||||
#define SDL_FULLSCREEN 0x00800000
|
||||
#define SDL_RESIZABLE 0x01000000
|
||||
#define SDL_NOFRAME 0x02000000
|
||||
#define SDL_OPENGL 0x04000000
|
||||
#define SDL_VULKAN 0x10000000
|
||||
#define SDL_HWSURFACE 0x08000001 /**< \note Not used */
|
||||
|
||||
#define SDL_BUTTON_WHEELUP 4
|
||||
#define SDL_BUTTON_WHEELDOWN 5
|
||||
|
||||
int initialized_video = 0;
|
||||
|
||||
static SDL_Window *SDL_VideoWindow = NULL;
|
||||
static SDL_Surface *SDL_VideoSurface = NULL;
|
||||
static SDL_Surface *SDL_PublicSurface = NULL;
|
||||
static SDL_Rect SDL_VideoViewport;
|
||||
static char *wm_title = NULL;
|
||||
static Uint32 SDL_VideoFlags = 0;
|
||||
static SDL_GLContext *SDL_VideoContext = NULL;
|
||||
static SDL_Surface *SDL_VideoIcon;
|
||||
|
||||
static void
|
||||
SDL_WM_SetCaption(const char *title, const char *icon)
|
||||
{
|
||||
if (wm_title) {
|
||||
SDL_free(wm_title);
|
||||
}
|
||||
if (title) {
|
||||
wm_title = SDL_strdup(title);
|
||||
} else {
|
||||
wm_title = NULL;
|
||||
}
|
||||
SDL_SetWindowTitle(SDL_VideoWindow, wm_title);
|
||||
}
|
||||
|
||||
static int
|
||||
GetVideoDisplay()
|
||||
{
|
||||
const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY");
|
||||
if ( !variable ) {
|
||||
variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD");
|
||||
}
|
||||
if ( variable ) {
|
||||
return SDL_atoi(variable);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static const SDL_VideoInfo *
|
||||
SDL_GetVideoInfo(void)
|
||||
{
|
||||
static SDL_VideoInfo info;
|
||||
SDL_DisplayMode mode;
|
||||
|
||||
/* Memory leak, compatibility code, who cares? */
|
||||
if (!info.vfmt && SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode) == 0) {
|
||||
info.vfmt = SDL_AllocFormat(mode.format);
|
||||
info.current_w = mode.w;
|
||||
info.current_h = mode.h;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
|
||||
static SDL_Rect **
|
||||
SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
|
||||
{
|
||||
int i, nmodes;
|
||||
SDL_Rect **modes;
|
||||
|
||||
if (!initialized_video) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(flags & SDL_FULLSCREEN)) {
|
||||
return (SDL_Rect **) (-1);
|
||||
}
|
||||
|
||||
if (!format) {
|
||||
format = SDL_GetVideoInfo()->vfmt;
|
||||
}
|
||||
|
||||
/* Memory leak, but this is a compatibility function, who cares? */
|
||||
nmodes = 0;
|
||||
modes = NULL;
|
||||
for (i = 0; i < SDL_GetNumDisplayModes(GetVideoDisplay()); ++i) {
|
||||
SDL_DisplayMode mode;
|
||||
int bpp;
|
||||
|
||||
SDL_GetDisplayMode(GetVideoDisplay(), i, &mode);
|
||||
if (!mode.w || !mode.h) {
|
||||
return (SDL_Rect **) (-1);
|
||||
}
|
||||
|
||||
/* Copied from src/video/SDL_pixels.c:SDL_PixelFormatEnumToMasks */
|
||||
if (SDL_BYTESPERPIXEL(mode.format) <= 2) {
|
||||
bpp = SDL_BITSPERPIXEL(mode.format);
|
||||
} else {
|
||||
bpp = SDL_BYTESPERPIXEL(mode.format) * 8;
|
||||
}
|
||||
|
||||
if (bpp != format->BitsPerPixel) {
|
||||
continue;
|
||||
}
|
||||
if (nmodes > 0 && modes[nmodes - 1]->w == mode.w
|
||||
&& modes[nmodes - 1]->h == mode.h) {
|
||||
continue;
|
||||
}
|
||||
|
||||
modes = SDL_realloc(modes, (nmodes + 2) * sizeof(*modes));
|
||||
if (!modes) {
|
||||
return NULL;
|
||||
}
|
||||
modes[nmodes] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect));
|
||||
if (!modes[nmodes]) {
|
||||
return NULL;
|
||||
}
|
||||
modes[nmodes]->x = 0;
|
||||
modes[nmodes]->y = 0;
|
||||
modes[nmodes]->w = mode.w;
|
||||
modes[nmodes]->h = mode.h;
|
||||
++nmodes;
|
||||
}
|
||||
if (modes) {
|
||||
modes[nmodes] = NULL;
|
||||
}
|
||||
return modes;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_GL_SwapBuffers(void)
|
||||
{
|
||||
SDL_GL_SwapWindow(SDL_VideoWindow);
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_WM_ToggleFullScreen(SDL_Surface * surface)
|
||||
{
|
||||
int window_w;
|
||||
int window_h;
|
||||
|
||||
if (
|
||||
#ifdef VIDEXT_VULKAN
|
||||
(SDL_VideoFlags & SDL_VULKAN && !SDL_VideoWindow) ||
|
||||
#endif
|
||||
(SDL_VideoFlags & SDL_OPENGL && !SDL_PublicSurface)) {
|
||||
SDL_SetError("SDL_SetVideoMode() hasn't been called");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Do the physical mode switch */
|
||||
if (SDL_GetWindowFlags(SDL_VideoWindow) & SDL_WINDOW_FULLSCREEN) {
|
||||
if (SDL_SetWindowFullscreen(SDL_VideoWindow, 0) < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (SDL_VideoFlags & SDL_OPENGL) {
|
||||
SDL_PublicSurface->flags &= ~SDL_FULLSCREEN;
|
||||
}
|
||||
} else {
|
||||
if (SDL_SetWindowFullscreen(SDL_VideoWindow, 1) < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (SDL_VideoFlags & SDL_OPENGL) {
|
||||
SDL_PublicSurface->flags |= SDL_FULLSCREEN;
|
||||
}
|
||||
}
|
||||
|
||||
/* Center the public surface in the window surface */
|
||||
SDL_GetWindowSize(SDL_VideoWindow, &window_w, &window_h);
|
||||
SDL_VideoViewport.x = 0;
|
||||
SDL_VideoViewport.y = 0;
|
||||
SDL_VideoViewport.w = window_w;
|
||||
SDL_VideoViewport.h = window_h;
|
||||
|
||||
/* We're done! */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
/* We can't resize something we don't have... */
|
||||
if (
|
||||
#ifdef VIDEXT_VULKAN
|
||||
(SDL_VideoFlags & SDL_VULKAN && !SDL_VideoWindow) ||
|
||||
#endif
|
||||
(SDL_VideoFlags & SDL_OPENGL && !SDL_PublicSurface)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We probably have to recreate the window in fullscreen mode */
|
||||
if (flags & SDL_FULLSCREEN) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* I don't think there's any change we can gracefully make in flags */
|
||||
if (flags != SDL_VideoFlags) {
|
||||
return -1;
|
||||
}
|
||||
if (bpp != SDL_VideoSurface->format->BitsPerPixel) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Resize the window */
|
||||
SDL_GetWindowSize(SDL_VideoWindow, &w, &h);
|
||||
if (w != width || h != height) {
|
||||
SDL_SetWindowSize(SDL_VideoWindow, width, height);
|
||||
}
|
||||
|
||||
SDL_VideoSurface->w = width;
|
||||
SDL_VideoSurface->h = height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_CompatEventFilter(void *userdata, SDL_Event * event)
|
||||
{
|
||||
SDL_Event fake;
|
||||
|
||||
switch (event->type) {
|
||||
case SDL_WINDOWEVENT:
|
||||
switch (event->window.event) {
|
||||
case SDL_WINDOWEVENT_CLOSE:
|
||||
fake.type = SDL_QUIT;
|
||||
SDL_PushEvent(&fake);
|
||||
break;
|
||||
}
|
||||
case SDL_TEXTINPUT:
|
||||
{
|
||||
/* FIXME: Generate an old style key repeat event if needed */
|
||||
//printf("TEXTINPUT: '%s'\n", event->text.text);
|
||||
break;
|
||||
}
|
||||
case SDL_MOUSEMOTION:
|
||||
{
|
||||
event->motion.x -= SDL_VideoViewport.x;
|
||||
event->motion.y -= SDL_VideoViewport.y;
|
||||
break;
|
||||
}
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
{
|
||||
event->button.x -= SDL_VideoViewport.x;
|
||||
event->button.y -= SDL_VideoViewport.y;
|
||||
break;
|
||||
}
|
||||
case SDL_MOUSEWHEEL:
|
||||
{
|
||||
Uint8 button;
|
||||
int x, y;
|
||||
|
||||
if (event->wheel.y == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
SDL_GetMouseState(&x, &y);
|
||||
|
||||
if (event->wheel.y > 0) {
|
||||
button = SDL_BUTTON_WHEELUP;
|
||||
} else {
|
||||
button = SDL_BUTTON_WHEELDOWN;
|
||||
}
|
||||
|
||||
fake.button.button = button;
|
||||
fake.button.x = x;
|
||||
fake.button.y = y;
|
||||
fake.button.windowID = event->wheel.windowID;
|
||||
|
||||
fake.type = SDL_MOUSEBUTTONDOWN;
|
||||
fake.button.state = SDL_PRESSED;
|
||||
SDL_PushEvent(&fake);
|
||||
|
||||
fake.type = SDL_MOUSEBUTTONUP;
|
||||
fake.button.state = SDL_RELEASED;
|
||||
SDL_PushEvent(&fake);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
GetEnvironmentWindowPosition(int w, int h, int *x, int *y)
|
||||
{
|
||||
int display = GetVideoDisplay();
|
||||
const char *window = SDL_getenv("SDL_VIDEO_WINDOW_POS");
|
||||
const char *center = SDL_getenv("SDL_VIDEO_CENTERED");
|
||||
if (window) {
|
||||
if (SDL_sscanf(window, "%d,%d", x, y) == 2) {
|
||||
return;
|
||||
}
|
||||
if (SDL_strcmp(window, "center") == 0) {
|
||||
center = window;
|
||||
}
|
||||
}
|
||||
if (center) {
|
||||
*x = SDL_WINDOWPOS_CENTERED_DISPLAY(display);
|
||||
*y = SDL_WINDOWPOS_CENTERED_DISPLAY(display);
|
||||
}
|
||||
}
|
||||
|
||||
static void SDL2_DestroyWindow(void)
|
||||
{
|
||||
/* Destroy existing window */
|
||||
SDL_PublicSurface = NULL;
|
||||
if (SDL_VideoSurface) {
|
||||
SDL_VideoSurface->flags &= ~SDL_DONTFREE;
|
||||
SDL_FreeSurface(SDL_VideoSurface);
|
||||
SDL_VideoSurface = NULL;
|
||||
}
|
||||
if (SDL_VideoContext) {
|
||||
/* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */
|
||||
SDL_GL_DeleteContext(SDL_VideoContext);
|
||||
SDL_VideoContext = NULL;
|
||||
}
|
||||
if (SDL_VideoWindow) {
|
||||
SDL_DestroyWindow(SDL_VideoWindow);
|
||||
SDL_VideoWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_Surface *
|
||||
SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
|
||||
{
|
||||
SDL_DisplayMode desktop_mode;
|
||||
int display = GetVideoDisplay();
|
||||
int window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(display);
|
||||
int window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(display);
|
||||
Uint32 window_flags;
|
||||
Uint32 surface_flags;
|
||||
|
||||
if (!initialized_video) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
initialized_video = 1;
|
||||
}
|
||||
|
||||
SDL_GetDesktopDisplayMode(display, &desktop_mode);
|
||||
|
||||
if (width == 0) {
|
||||
width = desktop_mode.w;
|
||||
}
|
||||
if (height == 0) {
|
||||
height = desktop_mode.h;
|
||||
}
|
||||
if (bpp == 0) {
|
||||
bpp = SDL_BITSPERPIXEL(desktop_mode.format);
|
||||
}
|
||||
|
||||
/* See if we can simply resize the existing window and surface */
|
||||
if (SDL_ResizeVideoMode(width, height, bpp, flags) == 0) {
|
||||
return SDL_PublicSurface;
|
||||
}
|
||||
|
||||
/* Destroy existing window */
|
||||
if (SDL_VideoWindow)
|
||||
SDL_GetWindowPosition(SDL_VideoWindow, &window_x, &window_y);
|
||||
SDL2_DestroyWindow();
|
||||
|
||||
/* Set up the event filter */
|
||||
if (!SDL_GetEventFilter(NULL, NULL)) {
|
||||
SDL_SetEventFilter(SDL_CompatEventFilter, NULL);
|
||||
}
|
||||
|
||||
#ifndef USE_GLES
|
||||
if (flags & SDL_OPENGL && l_ForceCompatibilityContext)
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
|
||||
}
|
||||
#else // !USE_GLES
|
||||
if (flags & SDL_OPENGL) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
}
|
||||
#endif // !USE_GLES
|
||||
|
||||
/* Create a new window */
|
||||
window_flags = SDL_WINDOW_SHOWN;
|
||||
if (flags & SDL_FULLSCREEN) {
|
||||
window_flags |= SDL_WINDOW_FULLSCREEN;
|
||||
}
|
||||
if (flags & SDL_OPENGL) {
|
||||
window_flags |= SDL_WINDOW_OPENGL;
|
||||
}
|
||||
#ifdef VIDEXT_VULKAN
|
||||
if (flags & SDL_VULKAN) {
|
||||
window_flags |= SDL_WINDOW_VULKAN;
|
||||
}
|
||||
#endif
|
||||
if (flags & SDL_RESIZABLE) {
|
||||
window_flags |= SDL_WINDOW_RESIZABLE;
|
||||
}
|
||||
if (flags & SDL_NOFRAME) {
|
||||
window_flags |= SDL_WINDOW_BORDERLESS;
|
||||
}
|
||||
GetEnvironmentWindowPosition(width, height, &window_x, &window_y);
|
||||
SDL_VideoWindow =
|
||||
SDL_CreateWindow(wm_title, window_x, window_y, width, height,
|
||||
window_flags);
|
||||
if (!SDL_VideoWindow) {
|
||||
return NULL;
|
||||
}
|
||||
SDL_SetWindowIcon(SDL_VideoWindow, SDL_VideoIcon);
|
||||
|
||||
window_flags = SDL_GetWindowFlags(SDL_VideoWindow);
|
||||
surface_flags = 0;
|
||||
if (window_flags & SDL_WINDOW_FULLSCREEN) {
|
||||
surface_flags |= SDL_FULLSCREEN;
|
||||
}
|
||||
if ((window_flags & SDL_WINDOW_OPENGL) && (flags & SDL_OPENGL)) {
|
||||
surface_flags |= SDL_OPENGL;
|
||||
}
|
||||
#ifdef VIDEXT_VULKAN
|
||||
if ((window_flags & SDL_WINDOW_VULKAN) && (flags & SDL_VULKAN)) {
|
||||
surface_flags |= SDL_VULKAN;
|
||||
}
|
||||
#endif
|
||||
if (window_flags & SDL_WINDOW_RESIZABLE) {
|
||||
surface_flags |= SDL_RESIZABLE;
|
||||
}
|
||||
if (window_flags & SDL_WINDOW_BORDERLESS) {
|
||||
surface_flags |= SDL_NOFRAME;
|
||||
}
|
||||
|
||||
SDL_VideoFlags = flags;
|
||||
|
||||
/* If we're in OpenGL mode, just create a stub surface and we're done! */
|
||||
if (flags & SDL_OPENGL) {
|
||||
SDL_VideoContext = SDL_GL_CreateContext(SDL_VideoWindow);
|
||||
if (!SDL_VideoContext) {
|
||||
return NULL;
|
||||
}
|
||||
if (SDL_GL_MakeCurrent(SDL_VideoWindow, SDL_VideoContext) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Pitch: size of of line in bytes */
|
||||
/* Add 7 to bpp before division, to ensure correct rounding towards infinity
|
||||
* in cases where bits per pixel do not cleanly divide by 8 (such as 15)
|
||||
*/
|
||||
int pitch = (bpp + 7) / 8 * width;
|
||||
SDL_VideoSurface =
|
||||
SDL_CreateRGBSurfaceFrom(NULL, width, height, bpp, pitch, 0, 0, 0, 0);
|
||||
if (!SDL_VideoSurface) {
|
||||
return NULL;
|
||||
}
|
||||
SDL_VideoSurface->flags |= surface_flags;
|
||||
SDL_PublicSurface = SDL_VideoSurface;
|
||||
return SDL_PublicSurface;
|
||||
}
|
||||
#ifdef VIDEXT_VULKAN
|
||||
else if (flags & SDL_VULKAN) {
|
||||
/* Vulkan doesn't have a video surface,
|
||||
* so just return a stub */
|
||||
return (SDL_Surface*)0x1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We're finally done! */
|
||||
return NULL;
|
||||
}
|
||||
@@ -28,12 +28,18 @@ extern const struct video_capture_backend_interface g_idummy_video_capture_backe
|
||||
#if defined(M64P_OPENCV)
|
||||
extern const struct video_capture_backend_interface g_iopencv_video_capture_backend;
|
||||
#endif
|
||||
#if defined(SDL3_CAMERA)
|
||||
extern const struct video_capture_backend_interface g_isdl3_video_capture_backend;
|
||||
#endif
|
||||
|
||||
|
||||
const struct video_capture_backend_interface* g_video_capture_backend_interfaces[] =
|
||||
{
|
||||
#if defined(M64P_OPENCV)
|
||||
&g_iopencv_video_capture_backend,
|
||||
#endif
|
||||
#if defined(SDL3_CAMERA)
|
||||
&g_isdl3_video_capture_backend,
|
||||
#endif
|
||||
&g_idummy_video_capture_backend,
|
||||
NULL /* sentinel - must be last element */
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#if !defined(DEFAULT_VIDEO_CAPTURE_BACKEND)
|
||||
#if defined(M64P_OPENCV)
|
||||
#define DEFAULT_VIDEO_CAPTURE_BACKEND "opencv"
|
||||
#elif defined(SDL3_CAMERA)
|
||||
#define DEFAULT_VIDEO_CAPTURE_BACKEND "sdl3"
|
||||
#else
|
||||
#define DEFAULT_VIDEO_CAPTURE_BACKEND ""
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user