update SDL_mixer to SDL3_mixer 3.2.0
This commit is contained in:
@@ -0,0 +1,358 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if ! [ "x${ANDROID_NDK_HOME}" != "x" -a -d "${ANDROID_NDK_HOME}" ]; then
|
||||
echo "ANDROID_NDK_HOME environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ "x${ANDROID_HOME}" != "x" -a -d "${ANDROID_HOME}" ]; then
|
||||
echo "ANDROID_HOME environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ANDROID_PLATFORM="${ANDROID_PLATFORM:-16}"
|
||||
|
||||
if [ "x${android_platform}" = "x" ]; then
|
||||
ANDROID_API="$(ls "${ANDROID_HOME}/platforms" | grep -E "^android-[0-9]+$" | sed 's/android-//' | sort -n -r | head -1)"
|
||||
if [ "x${ANDROID_API}" = "x" ]; then
|
||||
echo "No Android platform found in $ANDROID_HOME/platforms"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if ! [ -d "${ANDROID_HOME}/platforms/android-${ANDROID_API}" ]; then
|
||||
echo "Android api version ${ANDROID_API} is not available (${ANDROID_HOME}/platforms/android-${ANDROID_API} does not exist)" >2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
android_platformdir="${ANDROID_HOME}/platforms/android-${ANDROID_API}"
|
||||
|
||||
echo "Building with ANDROID_PLATFORM=${ANDROID_PLATFORM}"
|
||||
echo "android_platformdir=${android_platformdir}"
|
||||
|
||||
scriptdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
sdlmixer_root=$(cd -P -- "$(dirname -- "$0")/.." && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
build_root="${sdlmixer_root}/build-android-prefab"
|
||||
|
||||
android_abis="armeabi-v7a arm64-v8a x86 x86_64"
|
||||
android_api=19
|
||||
android_ndk=21
|
||||
android_stl="c++_shared"
|
||||
|
||||
sdlmixer_major=$(sed -ne 's/^#define SDL_MIXER_MAJOR_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
|
||||
sdlmixer_minor=$(sed -ne 's/^#define SDL_MIXER_MINOR_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
|
||||
sdlmixer_micro=$(sed -ne 's/^#define SDL_MIXER_MICRO_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
|
||||
sdlmixer_version="${sdlmixer_major}.${sdlmixer_minor}.${sdlmixer_micro}"
|
||||
echo "Building Android prefab package for SDL_mixer version $sdlmixer_version"
|
||||
|
||||
if test ! -d "${sdl_build_root}"; then
|
||||
echo "sdl_build_root is not defined or is not a directory."
|
||||
echo "Set this environment folder to the root of an android SDL${sdlmixer_major} prefab build"
|
||||
echo "This usually is SDL/build-android-prefab"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
prefabhome="${build_root}/prefab-${sdlmixer_version}"
|
||||
rm -rf "$prefabhome"
|
||||
mkdir -p "${prefabhome}"
|
||||
|
||||
build_cmake_projects() {
|
||||
for android_abi in $android_abis; do
|
||||
|
||||
rm -rf "${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
for build_shared_libs in ON OFF; do
|
||||
echo "Configuring CMake project for $android_abi (shared=${build_shared_libs})"
|
||||
cmake -S "${sdlmixer_root}" -B "${build_root}/build_${android_abi}/shared_${build_shared_libs}" \
|
||||
-DSDLMIXER_DEPS_SHARED=ON \
|
||||
-DSDLMIXER_VENDORED=ON \
|
||||
-DSDLMIXER_FLAC=ON \
|
||||
-DWITH_ASM=OFF \
|
||||
-DSDLMIXER_FLAC_LIBFLAC=ON \
|
||||
-DSDLMIXER_MOD=ON \
|
||||
-DSDLMIXER_MOD_XMP=ON \
|
||||
-DSDLMIXER_MP3=ON \
|
||||
-DSDLMIXER_MP3_MPG123=ON \
|
||||
-DSDLMIXER_MIDI=ON \
|
||||
-DSDLMIXER_MIDI_TIMIDITY=ON \
|
||||
-DSDLMIXER_OPUS=ON \
|
||||
-DSDLMIXER_VORBIS=STB \
|
||||
-DSDLMIXER_WAVPACK=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
|
||||
-DSDL${sdlmixer_major}_DIR="${sdl_build_root}/build_${android_abi}/prefix/lib/cmake/SDL${sdlmixer_major}" \
|
||||
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
|
||||
-DANDROID_ABI=${android_abi} \
|
||||
-DBUILD_SHARED_LIBS=${build_shared_libs} \
|
||||
-DCMAKE_INSTALL_PREFIX="${build_root}/build_${android_abi}/prefix" \
|
||||
-DCMAKE_INSTALL_INCLUDEDIR=include \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DSDL${sdlmixer_major}MIXER_SAMPLES=OFF \
|
||||
-GNinja
|
||||
|
||||
echo "Building CMake project for $android_abi (shared=${build_shared_libs})"
|
||||
cmake --build "${build_root}/build_${android_abi}/shared_${build_shared_libs}"
|
||||
|
||||
echo "Installing CMake project for $android_abi (shared=${build_shared_libs})"
|
||||
cmake --install "${build_root}/build_${android_abi}/shared_${build_shared_libs}"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
pom_filename="SDL${sdlmixer_major}_mixer-${sdlmixer_version}.pom"
|
||||
pom_filepath="${prefabhome}/${pom_filename}"
|
||||
create_pom_xml() {
|
||||
echo "Creating ${pom_filename}"
|
||||
cat >"${pom_filepath}" <<EOF
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.libsdl.android</groupId>
|
||||
<artifactId>SDL${sdlmixer_major}_mixer</artifactId>
|
||||
<version>${sdlmixer_version}</version>
|
||||
<packaging>aar</packaging>
|
||||
<name>SDL${sdlmixer_major}_mixer</name>
|
||||
<description>The AAR for SDL${sdlmixer_major}_mixer</description>
|
||||
<url>https://libsdl.org/</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>zlib License</name>
|
||||
<url>https://github.com/libsdl-org/SDL_mixer/blob/main/LICENSE.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Sam Lantinga</name>
|
||||
<email>slouken@libsdl.org</email>
|
||||
<organization>SDL</organization>
|
||||
<organizationUrl>https://www.libsdl.org</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/libsdl-org/SDL_mixer</connection>
|
||||
<developerConnection>scm:git:ssh://github.com:libsdl-org/SDL_mixer.git</developerConnection>
|
||||
<url>https://github.com/libsdl-org/SDL_mixer</url>
|
||||
</scm>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<plugin>
|
||||
<groupId>com.simpligility.maven.plugins</groupId>
|
||||
<artifactId>android-maven-plugin</artifactId>
|
||||
<version>4.6.0</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<sign>
|
||||
<debug>false</debug>
|
||||
</sign>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</project>
|
||||
EOF
|
||||
}
|
||||
|
||||
create_aar_androidmanifest() {
|
||||
echo "Creating AndroidManifest.xml"
|
||||
cat >"${aar_root}/AndroidManifest.xml" <<EOF
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.libsdl.android" android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="16"
|
||||
android:targetSdkVersion="29"/>
|
||||
</manifest>
|
||||
EOF
|
||||
}
|
||||
|
||||
echo "Creating AAR root directory"
|
||||
aar_root="${prefabhome}/SDL${sdlmixer_major}_mixer-${sdlmixer_version}"
|
||||
mkdir -p "${aar_root}"
|
||||
|
||||
aar_metainfdir_path=${aar_root}/META-INF
|
||||
mkdir -p "${aar_metainfdir_path}"
|
||||
cp "${sdlmixer_root}/LICENSE.txt" "${aar_metainfdir_path}"
|
||||
|
||||
prefabworkdir="${aar_root}/prefab"
|
||||
mkdir -p "${prefabworkdir}"
|
||||
|
||||
cat >"${prefabworkdir}/prefab.json" <<EOF
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "SDL${sdlmixer_major}_mixer",
|
||||
"version": "${sdlmixer_version}",
|
||||
"dependencies": ["SDL${sdlmixer_major}"]
|
||||
}
|
||||
EOF
|
||||
|
||||
modulesworkdir="${prefabworkdir}/modules"
|
||||
mkdir -p "${modulesworkdir}"
|
||||
|
||||
create_shared_sdl_mixer_module() {
|
||||
echo "Creating SDL${sdlmixer_major}_mixer prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdlmixer_major}_mixer"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": ["//SDL${sdlmixer_major}:SDL${sdlmixer_major}"],
|
||||
"library_name": "libSDL${sdlmixer_major}_mixer"
|
||||
}
|
||||
EOF
|
||||
mkdir -p "${sdl_moduleworkdir}/include/SDL${sdlmixer_major}"
|
||||
cp -r "${abi_build_prefix}/include/SDL${sdlmixer_major}/"* "${sdl_moduleworkdir}/include/SDL${sdlmixer_major}"
|
||||
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": false
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdlmixer_major}_mixer.so" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
create_static_sdl_mixer_module() {
|
||||
echo "Creating SDL${sdlmixer_major}_mixer-static prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdlmixer_major}_mixer-static"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": ["//SDL${sdlmixer_major}:SDL${sdlmixer_major}-static"],
|
||||
"library_name": "libSDL${sdlmixer_major}_mixer"
|
||||
}
|
||||
EOF
|
||||
mkdir -p "${sdl_moduleworkdir}/include/SDL${sdlmixer_major}"
|
||||
cp -r "${abi_build_prefix}/include/SDL${sdlmixer_major}/"* "${sdl_moduleworkdir}/include/SDL${sdlmixer_major}"
|
||||
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": true
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdlmixer_major}_mixer.a" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
create_shared_module() {
|
||||
modulename=$1
|
||||
libraryname=$2
|
||||
export_libraries=$3
|
||||
echo "Creating $modulename prefab module"
|
||||
|
||||
export_libraries_json="[]"
|
||||
if test "x$export_libraries" != "x"; then
|
||||
export_libraries_json="["
|
||||
for export_library in $export_libraries; do
|
||||
if test "x$export_libraries_json" != "x["; then
|
||||
export_libraries_json="$export_libraries_json, "
|
||||
fi
|
||||
export_libraries_json="$export_libraries_json\"$export_library\""
|
||||
done
|
||||
export_libraries_json="$export_libraries_json]"
|
||||
fi
|
||||
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/$modulename"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": $export_libraries_json,
|
||||
"library_name": "$libraryname"
|
||||
}
|
||||
EOF
|
||||
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}"
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/$libraryname.so" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
build_cmake_projects
|
||||
|
||||
create_pom_xml
|
||||
|
||||
create_aar_androidmanifest
|
||||
|
||||
create_shared_sdl_mixer_module
|
||||
|
||||
create_static_sdl_mixer_module
|
||||
|
||||
create_shared_module external_libogg libogg ""
|
||||
cp "${sdlmixer_root}/external/ogg/COPYING" "${aar_metainfdir_path}/LICENSE.libogg.txt"
|
||||
|
||||
create_shared_module external_libflac libFLAC ":external_libogg"
|
||||
for ext in FDL GPL LGPL Xiph; do
|
||||
cp "${sdlmixer_root}/external/flac/COPYING.$ext" "${aar_metainfdir_path}/LICENSE.libflac.$ext.txt"
|
||||
done
|
||||
|
||||
create_shared_module external_libmpg123 libmpg123 ""
|
||||
cp "${sdlmixer_root}/external/mpg123/COPYING" "${aar_metainfdir_path}/LICENSE.libmpg123.txt"
|
||||
|
||||
create_shared_module external_libopus libopus ":external_libogg"
|
||||
cp "${sdlmixer_root}/external/opus/COPYING" "${aar_metainfdir_path}/LICENSE.libopus.txt"
|
||||
|
||||
create_shared_module external_libopusfile libopusfile ":external_libopus"
|
||||
cp "${sdlmixer_root}/external/opusfile/COPYING" "${aar_metainfdir_path}/LICENSE.libopusfile.txt"
|
||||
|
||||
create_shared_module external_libxmp libxmp ""
|
||||
tail -n15 "${sdlmixer_root}/external/libxmp/README" >"${aar_metainfdir_path}/LICENSE.libxmp.txt"
|
||||
|
||||
create_shared_module external_libwavpack libwavpack ""
|
||||
tail -n15 "${sdlmixer_root}/external/wavpack/COPYING" >"${aar_metainfdir_path}/LICENSE.wavpack.txt"
|
||||
|
||||
pushd "${aar_root}"
|
||||
aar_filename="SDL${sdlmixer_major}_mixer-${sdlmixer_version}.aar"
|
||||
zip -r "${aar_filename}" AndroidManifest.xml prefab META-INF
|
||||
zip -Tv "${aar_filename}" 2>/dev/null ;
|
||||
mv "${aar_filename}" "${prefabhome}"
|
||||
popd
|
||||
|
||||
maven_filename="SDL${sdlmixer_major}_mixer-${sdlmixer_version}.zip"
|
||||
|
||||
pushd "${prefabhome}"
|
||||
zip_filename="SDL${sdlmixer_major}_mixer-${sdlmixer_version}.zip"
|
||||
zip "${maven_filename}" "${aar_filename}" "${pom_filename}" 2>/dev/null;
|
||||
zip -Tv "${zip_filename}" 2>/dev/null;
|
||||
popd
|
||||
|
||||
echo "Prefab zip is ready at ${prefabhome}/${aar_filename}"
|
||||
echo "Maven archive is ready at ${prefabhome}/${zip_filename}"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,434 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Simple DirectMedia Layer
|
||||
# Copyright (C) 1997-2026 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.
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use File::Copy;
|
||||
use Cwd qw(abs_path);
|
||||
use IPC::Open2;
|
||||
|
||||
my $examples_dir = abs_path(dirname(__FILE__) . "/../examples");
|
||||
my $project = undef;
|
||||
my $emsdk_dir = undef;
|
||||
my $compile_dir = undef;
|
||||
my $cmake_flags = undef;
|
||||
my $output_dir = undef;
|
||||
|
||||
sub usage {
|
||||
die("USAGE: $0 <project_name> <emsdk_dir> <compiler_output_directory> <cmake_flags> <html_output_directory>\n\n");
|
||||
}
|
||||
|
||||
sub do_system {
|
||||
my $cmd = shift;
|
||||
$cmd = "exec /bin/bash -c \"$cmd\"";
|
||||
print("$cmd\n");
|
||||
return system($cmd);
|
||||
}
|
||||
|
||||
sub do_mkdir {
|
||||
my $d = shift;
|
||||
if ( ! -d $d ) {
|
||||
print("mkdir '$d'\n");
|
||||
mkdir($d) or die("Couldn't mkdir('$d'): $!\n");
|
||||
}
|
||||
}
|
||||
|
||||
sub do_copy {
|
||||
my $src = shift;
|
||||
my $dst = shift;
|
||||
print("cp '$src' '$dst'\n");
|
||||
copy($src, $dst) or die("Failed to copy '$src' to '$dst': $!\n");
|
||||
}
|
||||
|
||||
sub build_latest {
|
||||
# Try to build just the latest without re-running cmake, since that is SLOW.
|
||||
print("Building latest version of $project ...\n");
|
||||
if (do_system("EMSDK_QUIET=1 source '$emsdk_dir/emsdk_env.sh' && cd '$compile_dir' && ninja") != 0) {
|
||||
# Build failed? Try nuking the build dir and running CMake from scratch.
|
||||
print("\n\nBuilding latest version of $project FROM SCRATCH ...\n");
|
||||
if (do_system("EMSDK_QUIET=1 source '$emsdk_dir/emsdk_env.sh' && rm -rf '$compile_dir' && mkdir '$compile_dir' && cd '$compile_dir' && emcmake cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel $cmake_flags '$examples_dir/..' && ninja") != 0) {
|
||||
die("Failed to build latest version of $project!\n"); # oh well.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub get_category_description {
|
||||
my $category = shift;
|
||||
my $retval = ucfirst($category);
|
||||
|
||||
if (open(my $fh, '<', "$examples_dir/$category/description.txt")) {
|
||||
$retval = <$fh>;
|
||||
chomp($retval);
|
||||
close($fh);
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
sub get_categories {
|
||||
my @categories = ();
|
||||
|
||||
if (open(my $fh, '<', "$examples_dir/categories.txt")) {
|
||||
while (<$fh>) {
|
||||
chomp;
|
||||
s/\A\s+//;
|
||||
s/\s+\Z//;
|
||||
next if $_ eq '';
|
||||
next if /\A\#/;
|
||||
push @categories, $_;
|
||||
}
|
||||
close($fh);
|
||||
} else {
|
||||
opendir(my $dh, $examples_dir) or die("Couldn't opendir '$examples_dir': $!\n");
|
||||
foreach my $dir (sort readdir $dh) {
|
||||
next if ($dir eq '.') || ($dir eq '..'); # obviously skip current and parent entries.
|
||||
next if not -d "$examples_dir/$dir"; # only care about subdirectories.
|
||||
push @categories, $dir;
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
|
||||
return @categories;
|
||||
}
|
||||
|
||||
sub get_examples_for_category {
|
||||
my $category = shift;
|
||||
|
||||
my @examples = ();
|
||||
|
||||
opendir(my $dh, "$examples_dir/$category") or die("Couldn't opendir '$examples_dir/$category': $!\n");
|
||||
foreach my $dir (sort readdir $dh) {
|
||||
next if ($dir eq '.') || ($dir eq '..'); # obviously skip current and parent entries.
|
||||
next if not -d "$examples_dir/$category/$dir"; # only care about subdirectories.
|
||||
|
||||
push @examples, $dir;
|
||||
}
|
||||
closedir($dh);
|
||||
|
||||
return @examples;
|
||||
}
|
||||
|
||||
sub handle_example_dir {
|
||||
my $category = shift;
|
||||
my $example = shift;
|
||||
|
||||
my @files = ();
|
||||
my $files_str = '';
|
||||
opendir(my $dh, "$examples_dir/$category/$example") or die("Couldn't opendir '$examples_dir/$category/$example': $!\n");
|
||||
my $spc = '';
|
||||
while (readdir($dh)) {
|
||||
my $path = "$examples_dir/$category/$example/$_";
|
||||
next if not -f $path; # only care about files.
|
||||
push @files, $path if /\.[ch]\Z/; # add .c and .h files to source code.
|
||||
if (/\.c\Z/) { # only care about .c files for compiling.
|
||||
$files_str .= "$spc$path";
|
||||
$spc = ' ';
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
|
||||
my $dst = "$output_dir/$category/$example";
|
||||
|
||||
print("Building $category/$example ...\n");
|
||||
|
||||
my $basefname = "$example";
|
||||
$basefname =~ s/\A\d+\-//;
|
||||
$basefname = "$category-$basefname";
|
||||
my $jsfname = "$basefname.js";
|
||||
my $wasmfname = "$basefname.wasm";
|
||||
my $thumbnailfname = 'thumbnail.png';
|
||||
my $onmouseoverfname = 'onmouseover.webp';
|
||||
my $jssrc = "$compile_dir/examples/$jsfname";
|
||||
my $wasmsrc = "$compile_dir/examples/$wasmfname";
|
||||
my $thumbnailsrc = "$examples_dir/$category/$example/$thumbnailfname";
|
||||
my $onmouseoversrc = "$examples_dir/$category/$example/$onmouseoverfname";
|
||||
my $jsdst = "$dst/$jsfname";
|
||||
my $wasmdst = "$dst/$wasmfname";
|
||||
my $thumbnaildst = "$dst/$thumbnailfname";
|
||||
my $onmouseoverdst = "$dst/$onmouseoverfname";
|
||||
|
||||
my $description = '';
|
||||
my $has_paragraph = 0;
|
||||
if (open(my $readmetxth, '<', "$examples_dir/$category/$example/README.txt")) {
|
||||
while (<$readmetxth>) {
|
||||
chomp;
|
||||
s/\A\s+//;
|
||||
s/\s+\Z//;
|
||||
if (($_ eq '') && ($description ne '')) {
|
||||
$has_paragraph = 1;
|
||||
} else {
|
||||
if ($has_paragraph) {
|
||||
$description .= "\n<br/>\n<br/>\n";
|
||||
$has_paragraph = 0;
|
||||
}
|
||||
$description .= "$_ ";
|
||||
}
|
||||
}
|
||||
close($readmetxth);
|
||||
$description =~ s/\s+\Z//;
|
||||
}
|
||||
|
||||
my $short_description = "$description";
|
||||
$short_description =~ s/\<br\/\>\n.*//gms;
|
||||
$short_description =~ s/\A\s+//;
|
||||
$short_description =~ s/\s+\Z//;
|
||||
|
||||
do_mkdir($dst);
|
||||
do_copy($jssrc, $jsdst);
|
||||
do_copy($wasmsrc, $wasmdst);
|
||||
do_copy($thumbnailsrc, $thumbnaildst) if ( -f $thumbnailsrc );
|
||||
do_copy($onmouseoversrc, $onmouseoverdst) if ( -f $onmouseoversrc );
|
||||
|
||||
my $highlight_cmd = "highlight '--outdir=$dst' --style-outfile=highlight.css --fragment --enclose-pre --stdout --syntax=c '--plug-in=$examples_dir/highlight-plugin.lua'";
|
||||
print("$highlight_cmd\n");
|
||||
my $pid = open2(my $child_out, my $child_in, $highlight_cmd);
|
||||
|
||||
my $htmlified_source_code = '';
|
||||
foreach (sort(@files)) {
|
||||
my $path = $_;
|
||||
open my $srccode, '<', $path or die("Couldn't open '$path': $!\n");
|
||||
my $fname = "$path";
|
||||
$fname =~ s/\A.*\///;
|
||||
print $child_in "/* $fname ... */\n\n";
|
||||
while (<$srccode>) {
|
||||
print $child_in $_;
|
||||
}
|
||||
print $child_in "\n\n\n";
|
||||
close($srccode);
|
||||
}
|
||||
|
||||
close($child_in);
|
||||
|
||||
while (<$child_out>) {
|
||||
$htmlified_source_code .= $_;
|
||||
}
|
||||
close($child_out);
|
||||
|
||||
waitpid($pid, 0);
|
||||
|
||||
my $other_examples_html = "<ul>";
|
||||
foreach my $example (get_examples_for_category($category)) {
|
||||
$other_examples_html .= "<li><a href='/$project/$category/$example/'>$category/$example</a></li>";
|
||||
}
|
||||
$other_examples_html .= "</ul>";
|
||||
|
||||
my $category_description = get_category_description($category);
|
||||
my $preview_image = get_example_thumbnail($project, $category, $example);
|
||||
|
||||
my $html = '';
|
||||
open my $htmltemplate, '<', "$examples_dir/template.html" or die("Couldn't open '$examples_dir/template.html': $!\n");
|
||||
while (<$htmltemplate>) {
|
||||
s/\@project_name\@/$project/g;
|
||||
s/\@category_name\@/$category/g;
|
||||
s/\@category_description\@/$category_description/g;
|
||||
s/\@example_name\@/$example/g;
|
||||
s/\@javascript_file\@/$jsfname/g;
|
||||
s/\@htmlified_source_code\@/$htmlified_source_code/g;
|
||||
s/\@short_description\@/$short_description/g;
|
||||
s/\@description\@/$description/g;
|
||||
s/\@preview_image\@/$preview_image/g;
|
||||
s/\@other_examples_html\@/$other_examples_html/g;
|
||||
$html .= $_;
|
||||
}
|
||||
close($htmltemplate);
|
||||
|
||||
open my $htmloutput, '>', "$dst/index.html" or die("Couldn't open '$dst/index.html': $!\n");
|
||||
print $htmloutput $html;
|
||||
close($htmloutput);
|
||||
}
|
||||
|
||||
sub get_example_thumbnail {
|
||||
my $project = shift;
|
||||
my $category = shift;
|
||||
my $example = shift;
|
||||
|
||||
if ( -f "$examples_dir/$category/$example/thumbnail.png" ) {
|
||||
return "/$project/$category/$example/thumbnail.png";
|
||||
} elsif ( -f "$examples_dir/$category/thumbnail.png" ) {
|
||||
return "/$project/$category/thumbnail.png";
|
||||
}
|
||||
|
||||
return "/$project/thumbnail.png";
|
||||
}
|
||||
|
||||
sub generate_example_thumbnail {
|
||||
my $project = shift;
|
||||
my $category = shift;
|
||||
my $example = shift;
|
||||
my $preloadhtmlref = shift;
|
||||
|
||||
my $example_no_num = "$example";
|
||||
$example_no_num =~ s/\A\d+\-//;
|
||||
|
||||
my $example_image_url = get_example_thumbnail($project, $category, $example);
|
||||
|
||||
my $example_mouseover_html = '';
|
||||
if ( -f "$examples_dir/$category/$example/onmouseover.webp" ) {
|
||||
$example_mouseover_html = "onmouseover=\"this.src='/$project/$category/$example/onmouseover.webp'\" onmouseout=\"this.src='$example_image_url';\"";
|
||||
$$preloadhtmlref .= " <link rel='preload' as='image' href='/$project/$category/$example/onmouseover.webp'>\n";
|
||||
} elsif ( -f "$examples_dir/$category/onmouseover.webp" ) {
|
||||
$example_mouseover_html = "onmouseover=\"this.src='/$project/$category/onmouseover.webp'\" onmouseout=\"this.src='$example_image_url';\"";
|
||||
$$preloadhtmlref .= " <link rel='preload' as='image' href='/$project/$category/onmouseover.webp'>\n";
|
||||
}
|
||||
|
||||
return "
|
||||
<a href='/$project/$category/$example/'>
|
||||
<div>
|
||||
<img src='$example_image_url' $example_mouseover_html />
|
||||
<div>$example_no_num</div>
|
||||
</div>
|
||||
</a>"
|
||||
;
|
||||
}
|
||||
|
||||
sub generate_example_thumbnails_for_category {
|
||||
my $project = shift;
|
||||
my $category = shift;
|
||||
my $preloadhtmlref = shift;
|
||||
my @examples = get_examples_for_category($category);
|
||||
my $retval = '';
|
||||
foreach my $example (@examples) {
|
||||
$retval .= generate_example_thumbnail($project, $category, $example, $preloadhtmlref);
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
sub handle_category_dir {
|
||||
my $category = shift;
|
||||
|
||||
print("Category $category ...\n");
|
||||
|
||||
do_mkdir("$output_dir/$category");
|
||||
|
||||
opendir(my $dh, "$examples_dir/$category") or die("Couldn't opendir '$examples_dir/$category': $!\n");
|
||||
|
||||
while (readdir($dh)) {
|
||||
next if ($_ eq '.') || ($_ eq '..'); # obviously skip current and parent entries.
|
||||
next if not -d "$examples_dir/$category/$_"; # only care about subdirectories.
|
||||
handle_example_dir($category, $_);
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
|
||||
my $preloadhtml = '';
|
||||
my $examples_list_html = generate_example_thumbnails_for_category($project, $category, \$preloadhtml);
|
||||
|
||||
my $dst = "$output_dir/$category";
|
||||
|
||||
do_copy("$examples_dir/$category/thumbnail.png", "$dst/thumbnail.png") if ( -f "$examples_dir/$category/thumbnail.png" );
|
||||
do_copy("$examples_dir/$category/onmouseover.webp", "$dst/onmouseover.webp") if ( -f "$examples_dir/$category/onmouseover.webp" );
|
||||
|
||||
my $category_description = get_category_description($category);
|
||||
my $preview_image = "/$project/thumbnail.png";
|
||||
if ( -f "$examples_dir/$category/thumbnail.png" ) {
|
||||
$preview_image = "/$project/$category/thumbnail.png";
|
||||
}
|
||||
|
||||
# write category page
|
||||
my $html = '';
|
||||
open my $htmltemplate, '<', "$examples_dir/template-category.html" or die("Couldn't open '$examples_dir/template-category.html': $!\n");
|
||||
while (<$htmltemplate>) {
|
||||
s/\@project_name\@/$project/g;
|
||||
s/\@category_name\@/$category/g;
|
||||
s/\@category_description\@/$category_description/g;
|
||||
s/\@preload_images_html\@/$preloadhtml/g;
|
||||
s/\@examples_list_html\@/$examples_list_html/g;
|
||||
s/\@preview_image\@/$preview_image/g;
|
||||
$html .= $_;
|
||||
}
|
||||
close($htmltemplate);
|
||||
|
||||
open my $htmloutput, '>', "$dst/index.html" or die("Couldn't open '$dst/index.html': $!\n");
|
||||
print $htmloutput $html;
|
||||
close($htmloutput);
|
||||
}
|
||||
|
||||
|
||||
# Mainline!
|
||||
|
||||
foreach (@ARGV) {
|
||||
$project = $_, next if not defined $project;
|
||||
$emsdk_dir = $_, next if not defined $emsdk_dir;
|
||||
$compile_dir = $_, next if not defined $compile_dir;
|
||||
$cmake_flags = $_, next if not defined $cmake_flags;
|
||||
$output_dir = $_, next if not defined $output_dir;
|
||||
usage(); # too many arguments.
|
||||
}
|
||||
|
||||
usage() if not defined $output_dir;
|
||||
|
||||
print("Examples dir: $examples_dir\n");
|
||||
print("emsdk dir: $emsdk_dir\n");
|
||||
print("Compile dir: $compile_dir\n");
|
||||
print("CMake flags: $cmake_flags\n");
|
||||
print("Output dir: $output_dir\n");
|
||||
|
||||
do_system("rm -rf '$output_dir'");
|
||||
do_mkdir($output_dir);
|
||||
|
||||
build_latest();
|
||||
|
||||
do_copy("$examples_dir/template.css", "$output_dir/examples.css");
|
||||
do_copy("$examples_dir/template-placeholder.png", "$output_dir/thumbnail.png");
|
||||
|
||||
opendir(my $dh, $examples_dir) or die("Couldn't opendir '$examples_dir': $!\n");
|
||||
|
||||
while (readdir($dh)) {
|
||||
next if ($_ eq '.') || ($_ eq '..'); # obviously skip current and parent entries.
|
||||
next if not -d "$examples_dir/$_"; # only care about subdirectories.
|
||||
# !!! FIXME: this needs to generate a preview page for all the categories.
|
||||
handle_category_dir($_);
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
|
||||
# write homepage
|
||||
my $homepage_list_html = '';
|
||||
my $homepage_preloadhtml = '';
|
||||
foreach my $category (get_categories()) {
|
||||
my $category_description = get_category_description($category);
|
||||
$homepage_list_html .= "<h2>$category_description</h2>";
|
||||
$homepage_list_html .= "<div class='list'>";
|
||||
$homepage_list_html .= generate_example_thumbnails_for_category($project, $category, \$homepage_preloadhtml);
|
||||
$homepage_list_html .= "</div>";
|
||||
}
|
||||
|
||||
my $preview_image = "/$project/thumbnail.png";
|
||||
|
||||
my $dst = "$output_dir/";
|
||||
my $html = '';
|
||||
open my $htmltemplate, '<', "$examples_dir/template-homepage.html" or die("Couldn't open '$examples_dir/template-category.html': $!\n");
|
||||
while (<$htmltemplate>) {
|
||||
s/\@project_name\@/$project/g;
|
||||
s/\@homepage_list_html\@/$homepage_list_html/g;
|
||||
s/\@preview_image\@/$preview_image/g;
|
||||
s/\@preload_images_html\@/$homepage_preloadhtml/g;
|
||||
$html .= $_;
|
||||
}
|
||||
close($htmltemplate);
|
||||
|
||||
open my $htmloutput, '>', "$dst/index.html" or die("Couldn't open '$dst/index.html': $!\n");
|
||||
print $htmloutput $html;
|
||||
close($htmloutput);
|
||||
|
||||
print("All examples built successfully!\n");
|
||||
exit(0); # success!
|
||||
@@ -0,0 +1,127 @@
|
||||
#!/bin/bash
|
||||
progname="${0##*/}"
|
||||
progname="${progname%.sh}"
|
||||
|
||||
# usage: check_elf_alignment.sh [path to *.so files|path to *.apk]
|
||||
|
||||
cleanup_trap() {
|
||||
if [ -n "${tmp}" -a -d "${tmp}" ]; then
|
||||
rm -rf ${tmp}
|
||||
fi
|
||||
exit $1
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Host side script to check the ELF alignment of shared libraries."
|
||||
echo "Shared libraries are reported ALIGNED when their ELF regions are"
|
||||
echo "16 KB or 64 KB aligned. Otherwise they are reported as UNALIGNED."
|
||||
echo
|
||||
echo "Usage: ${progname} [input-path|input-APK|input-APEX]"
|
||||
}
|
||||
|
||||
if [ ${#} -ne 1 ]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
case ${1} in
|
||||
--help | -h | -\?)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
|
||||
*)
|
||||
dir="${1}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [ -f "${dir}" -o -d "${dir}" ]; then
|
||||
echo "Invalid file: ${dir}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${dir}" == *.apk ]]; then
|
||||
trap 'cleanup_trap' EXIT
|
||||
|
||||
echo
|
||||
echo "Recursively analyzing $dir"
|
||||
echo
|
||||
|
||||
if { zipalign --help 2>&1 | grep -q "\-P <pagesize_kb>"; }; then
|
||||
echo "=== APK zip-alignment ==="
|
||||
zipalign -v -c -P 16 4 "${dir}" | egrep 'lib/arm64-v8a|lib/x86_64|Verification'
|
||||
echo "========================="
|
||||
else
|
||||
echo "NOTICE: Zip alignment check requires build-tools version 35.0.0-rc3 or higher."
|
||||
echo " You can install the latest build-tools by running the below command"
|
||||
echo " and updating your \$PATH:"
|
||||
echo
|
||||
echo " sdkmanager \"build-tools;35.0.0-rc3\""
|
||||
fi
|
||||
|
||||
dir_filename=$(basename "${dir}")
|
||||
tmp=$(mktemp -d -t "${dir_filename%.apk}_out_XXXXX")
|
||||
unzip "${dir}" lib/* -d "${tmp}" >/dev/null 2>&1
|
||||
dir="${tmp}"
|
||||
fi
|
||||
|
||||
if [[ "${dir}" == *.apex ]]; then
|
||||
trap 'cleanup_trap' EXIT
|
||||
|
||||
echo
|
||||
echo "Recursively analyzing $dir"
|
||||
echo
|
||||
|
||||
dir_filename=$(basename "${dir}")
|
||||
tmp=$(mktemp -d -t "${dir_filename%.apex}_out_XXXXX")
|
||||
deapexer extract "${dir}" "${tmp}" || { echo "Failed to deapex." && exit 1; }
|
||||
dir="${tmp}"
|
||||
fi
|
||||
|
||||
RED="\e[31m"
|
||||
GREEN="\e[32m"
|
||||
ENDCOLOR="\e[0m"
|
||||
|
||||
unaligned_libs=()
|
||||
unaligned_critical_libs=()
|
||||
|
||||
echo
|
||||
echo "=== ELF alignment ==="
|
||||
|
||||
matches="$(find "${dir}" -type f)"
|
||||
IFS=$'\n'
|
||||
for match in $matches; do
|
||||
# We could recursively call this script or rewrite it to though.
|
||||
[[ "${match}" == *".apk" ]] && echo "WARNING: doesn't recursively inspect .apk file: ${match}"
|
||||
[[ "${match}" == *".apex" ]] && echo "WARNING: doesn't recursively inspect .apex file: ${match}"
|
||||
|
||||
[[ $(file "${match}") == *"ELF"* ]] || continue
|
||||
|
||||
res="$(objdump -p "${match}" | grep LOAD | awk '{ print $NF }' | head -1)"
|
||||
if [[ $res =~ 2\*\*(1[4-9]|[2-9][0-9]|[1-9][0-9]{2,}) ]]; then
|
||||
echo -e "${match}: ${GREEN}ALIGNED${ENDCOLOR} ($res)"
|
||||
else
|
||||
unaligned_libs+=("${match}")
|
||||
# Check if this is a critical architecture (arm64-v8a or x86_64)
|
||||
if [[ "${match}" == *"arm64-v8a"* ]] || [[ "${match}" == *"x86_64"* ]]; then
|
||||
unaligned_critical_libs+=("${match}")
|
||||
echo -e "${match}: ${RED}UNALIGNED${ENDCOLOR} ($res)"
|
||||
else
|
||||
echo -e "${match}: UNALIGNED ($res)"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#unaligned_libs[@]} -gt 0 ]; then
|
||||
echo -e "Found ${#unaligned_libs[@]} unaligned libs (only arm64-v8a/x86_64 libs need to be aligned).${ENDCOLOR}"
|
||||
fi
|
||||
echo "====================="
|
||||
|
||||
# Exit with appropriate code: 1 if critical unaligned libs found, 0 otherwise
|
||||
if [ ${#unaligned_critical_libs[@]} -gt 0 ]; then
|
||||
echo -e "${RED}Found ${#unaligned_critical_libs[@]} critical unaligned libs.${ENDCOLOR}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${GREEN}ELF Verification Successful${ENDCOLOR}"
|
||||
exit 0
|
||||
fi
|
||||
@@ -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()
|
||||
@@ -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,85 @@
|
||||
|
||||
# Using this package
|
||||
|
||||
This package contains @<@PROJECT_NAME@>@ built for the Android platform.
|
||||
|
||||
## 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.
|
||||
|
||||
# Documentation
|
||||
|
||||
An API reference and additional documentation is available at:
|
||||
|
||||
https://wiki.libsdl.org/@<@PROJECT_NAME@>@
|
||||
|
||||
# Discussions
|
||||
|
||||
## Discord
|
||||
|
||||
You can join the official Discord server at:
|
||||
|
||||
https://discord.com/invite/BwpFGBWsv8
|
||||
|
||||
## Forums/mailing lists
|
||||
|
||||
You can join SDL development discussions at:
|
||||
|
||||
https://discourse.libsdl.org/
|
||||
|
||||
Once you sign up, you can use the forum through the website or as a mailing list from your email client.
|
||||
|
||||
## Announcement list
|
||||
|
||||
You can sign up for the low traffic announcement list at:
|
||||
|
||||
https://www.libsdl.org/mailing-list.php
|
||||
|
||||
@@ -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())
|
||||
@@ -0,0 +1,133 @@
|
||||
# SDL CMake configuration file:
|
||||
# This file is meant to be placed in lib/cmake/SDL3_mixer subfolder of a reconstructed Android SDL3_mixer SDK
|
||||
|
||||
cmake_minimum_required(VERSION 3.0...3.28)
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL3_mixer PROPERTIES
|
||||
URL "https://www.libsdl.org/projects/SDL_mixer/"
|
||||
DESCRIPTION "SDL_mixer is a sample multi-channel audio mixer library"
|
||||
)
|
||||
|
||||
# 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_mixer_FOUND TRUE)
|
||||
|
||||
set(SDLMIXER_VENDORED TRUE)
|
||||
|
||||
set(SDLMIXER_FLAC_LIBFLAC FALSE)
|
||||
set(SDLMIXER_FLAC_DRFLAC TRUE)
|
||||
|
||||
set(SDLMIXER_GME FALSE)
|
||||
|
||||
set(SDLMIXER_MOD FALSE)
|
||||
set(SDLMIXER_MOD_XMP FALSE)
|
||||
set(SDLMIXER_MOD_XMP_LITE FALSE)
|
||||
|
||||
set(SDLMIXER_MP3 TRUE)
|
||||
set(SDLMIXER_MP3_DRMP3 TRUE)
|
||||
set(SDLMIXER_MP3_MPG123 FALSE)
|
||||
|
||||
set(SDLMIXER_MIDI FALSE)
|
||||
set(SDLMIXER_MIDI_FLUIDSYNTH FALSE)
|
||||
set(SDLMIXER_MIDI_NATIVE FALSE)
|
||||
set(SDLMIXER_MIDI_TIMIDITY TRUE)
|
||||
|
||||
set(SDLMIXER_OPUS FALSE)
|
||||
|
||||
set(SDLMIXER_VORBIS STB)
|
||||
set(SDLMIXER_VORBIS_STB TRUE)
|
||||
set(SDLMIXER_VORBIS_TREMOR FALSE)
|
||||
set(SDLMIXER_VORBIS_VORBISFILE FALSE)
|
||||
|
||||
set(SDLMIXER_WAVE TRUE)
|
||||
|
||||
set(SDL3_mixer_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_mixer_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_filename_component(_sdl3mixer_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
||||
get_filename_component(_sdl3mixer_prefix "${_sdl3mixer_prefix}/.." ABSOLUTE)
|
||||
get_filename_component(_sdl3mixer_prefix "${_sdl3mixer_prefix}/.." ABSOLUTE)
|
||||
set_and_check(_sdl3mixer_prefix "${_sdl3mixer_prefix}")
|
||||
set_and_check(_sdl3mixer_include_dirs "${_sdl3mixer_prefix}/include")
|
||||
|
||||
set_and_check(_sdl3mixer_lib "${_sdl3mixer_prefix}/lib/${_sdl_arch_subdir}/libSDL3_mixer.so")
|
||||
|
||||
unset(_sdl_arch_subdir)
|
||||
unset(_sdl3mixer_prefix)
|
||||
|
||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||
# This is done for compatibility with CMake generated SDL3_mixer-target.cmake files.
|
||||
|
||||
set(SDL3_mixer_SDL3_mixer-shared_FOUND FALSE)
|
||||
if(EXISTS "${_sdl3mixer_lib}")
|
||||
if(NOT TARGET SDL3_mixer::SDL3_mixer-shared)
|
||||
add_library(SDL3_mixer::SDL3_mixer-shared SHARED IMPORTED)
|
||||
set_target_properties(SDL3_mixer::SDL3_mixer-shared
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${_sdl3mixer_lib}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3mixer_include_dirs}"
|
||||
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
||||
INTERFACE_SDL3_SHARED "ON"
|
||||
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
|
||||
INTERFACE_SDL_VERSION "SDL3"
|
||||
)
|
||||
endif()
|
||||
set(SDL3_mixer_SDL3_mixer-shared_FOUND TRUE)
|
||||
endif()
|
||||
unset(_sdl3mixer_include_dirs)
|
||||
unset(_sdl3mixer_lib)
|
||||
|
||||
set(SDL3_mixer_SDL3_mixer-static_FOUND FALSE)
|
||||
|
||||
if(SDL3_mixer_SDL3_mixer-shared_FOUND)
|
||||
set(SDL3_mixer_SDL3_mixer_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_mixer::SDL3_mixer always exists
|
||||
if(NOT TARGET SDL3_mixer::SDL3_mixer)
|
||||
if(TARGET SDL3_mixer::SDL3_mixer-shared)
|
||||
_sdl_create_target_alias_compat(SDL3_mixer::SDL3_mixer SDL3_mixer::SDL3_mixer-shared)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_required_components(SDL3_mixer)
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
# SDL3_mixer CMake version configuration file:
|
||||
# This file is meant to be placed in a lib/cmake/SDL3_mixer subfolder of a reconstructed Android SDL3_mixer 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()
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "@<@PROJECT_NAME@>@",
|
||||
"version": "@<@PROJECT_VERSION@>@",
|
||||
"git-hash": "@<@PROJECT_COMMIT@>@"
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
# Using this package
|
||||
|
||||
This package contains @<@PROJECT_NAME@>@ built for the mingw-w64 toolchain.
|
||||
|
||||
The files for 32-bit architecture are in i686-w64-mingw32
|
||||
The files for 64-bit architecture are in x86_64-w64-mingw32
|
||||
|
||||
You can install them to another location, just type `make` for help.
|
||||
|
||||
To use this package, install the latest SDL3 package, point your include path at _arch_/include and your library path at _arch_/lib, link with the @<@PROJECT_NAME@>@ library and copy _arch_/bin/@<@PROJECT_NAME@>@.dll next to your executable.
|
||||
|
||||
e.g.
|
||||
```sh
|
||||
gcc -o hello.exe hello.c -Ix86_64-w64-mingw32/include -Lx86_64-w64-mingw32/lib -l@<@PROJECT_NAME@>@ -lSDL3
|
||||
cp x86_64-w64-mingw32/bin/@<@PROJECT_NAME@>@.dll .
|
||||
cp _SDL3_INSTALL_PATH_/bin/SDL3.dll .
|
||||
./hello.exe
|
||||
```
|
||||
|
||||
# Documentation
|
||||
|
||||
An API reference and additional documentation is available at:
|
||||
|
||||
https://wiki.libsdl.org/@<@PROJECT_NAME@>@
|
||||
|
||||
# Discussions
|
||||
|
||||
## Discord
|
||||
|
||||
You can join the official Discord server at:
|
||||
|
||||
https://discord.com/invite/BwpFGBWsv8
|
||||
|
||||
## Forums/mailing lists
|
||||
|
||||
You can join SDL development discussions at:
|
||||
|
||||
https://discourse.libsdl.org/
|
||||
|
||||
Once you sign up, you can use the forum through the website or as a mailing list from your email client.
|
||||
|
||||
## Announcement list
|
||||
|
||||
You can sign up for the low traffic announcement list at:
|
||||
|
||||
https://www.libsdl.org/mailing-list.php
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Makefile for installing the mingw32 version of the SDL_mixer 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
|
||||
@@ -0,0 +1,19 @@
|
||||
# SDL3_mixer CMake configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL3_mixer-devel-3.x.y-mingw
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(sdl3_mixer_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_mixer/SDL3_mixerConfig.cmake")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(sdl3_mixer_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_mixer/SDL3_mixerConfig.cmake")
|
||||
else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
|
||||
set(SDL3_mixer_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${sdl3_mixer_config_path}")
|
||||
message(WARNING "${sdl3_mixer_config_path} does not exist: MinGW development package is corrupted")
|
||||
set(SDL3_mixer_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include("${sdl3_mixer_config_path}")
|
||||
@@ -0,0 +1,19 @@
|
||||
# SDL3_mixer CMake version configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL3_mixer-devel-3.x.y-mingw
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(sdl3_mixer_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_mixer/SDL3_mixerConfigVersion.cmake")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(sdl3_mixer_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_mixer/SDL3_mixerConfigVersion.cmake")
|
||||
else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${sdl3_mixer_config_path}")
|
||||
message(WARNING "${sdl3_mixer_config_path} does not exist: MinGW development package is corrupted")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include("${sdl3_mixer_config_path}")
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
# Using this package
|
||||
|
||||
This package contains @<@PROJECT_NAME@>@ built for Visual Studio.
|
||||
|
||||
To use this package, edit your project properties:
|
||||
- Add the include directory to "VC++ Directories" -> "Include Directories"
|
||||
- Add the lib/_arch_ directory to "VC++ Directories" -> "Library Directories"
|
||||
- Add @<@PROJECT_NAME@>@.lib to Linker -> Input -> "Additional Dependencies"
|
||||
- Copy lib/_arch_/@<@PROJECT_NAME@>@.dll to your project directory.
|
||||
|
||||
You can include support for additional audio formats by including the license and DLL files in the lib/_arch_/optional directory in your application. They will be automatically loaded by SDL_mixer as needed.
|
||||
|
||||
# Documentation
|
||||
|
||||
An API reference and additional documentation is available at:
|
||||
|
||||
https://wiki.libsdl.org/@<@PROJECT_NAME@>@
|
||||
|
||||
# Discussions
|
||||
|
||||
## Discord
|
||||
|
||||
You can join the official Discord server at:
|
||||
|
||||
https://discord.com/invite/BwpFGBWsv8
|
||||
|
||||
## Forums/mailing lists
|
||||
|
||||
You can join SDL development discussions at:
|
||||
|
||||
https://discourse.libsdl.org/
|
||||
|
||||
Once you sign up, you can use the forum through the website or as a mailing list from your email client.
|
||||
|
||||
## Announcement list
|
||||
|
||||
You can sign up for the low traffic announcement list at:
|
||||
|
||||
https://www.libsdl.org/mailing-list.php
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
# Using this package
|
||||
|
||||
This package contains @<@PROJECT_NAME@>@ built for arm64 Windows.
|
||||
|
||||
To use this package, simply replace an existing 64-bit ARM @<@PROJECT_NAME@>@.dll with the one included here.
|
||||
|
||||
You can include support for additional audio formats by including the license and DLL files in the optional directory in your application. They will be automatically loaded by SDL_mixer as needed.
|
||||
|
||||
# Development packages
|
||||
|
||||
If you're looking for packages with headers and libraries, you can download one of these:
|
||||
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio
|
||||
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# @<@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_mixer PROPERTIES
|
||||
URL "https://www.libsdl.org/projects/SDL_mixer/"
|
||||
DESCRIPTION "SDL_mixer is a sample multi-channel audio mixer library"
|
||||
)
|
||||
|
||||
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_mixer_FOUND TRUE)
|
||||
|
||||
set(SDLMIXER_VENDORED TRUE)
|
||||
|
||||
set(SDLMIXER_FLAC_LIBFLAC FALSE)
|
||||
set(SDLMIXER_FLAC_DRFLAC TRUE)
|
||||
|
||||
set(SDLMIXER_GME FALSE)
|
||||
|
||||
set(SDLMIXER_MOD TRUE)
|
||||
set(SDLMIXER_MOD_XMP TRUE)
|
||||
set(SDLMIXER_MOD_XMP_LITE FALSE)
|
||||
|
||||
set(SDLMIXER_MP3 TRUE)
|
||||
set(SDLMIXER_MP3_DRMP3 TRUE)
|
||||
set(SDLMIXER_MP3_MPG123 FALSE)
|
||||
|
||||
set(SDLMIXER_MIDI TRUE)
|
||||
set(SDLMIXER_MIDI_FLUIDSYNTH FALSE)
|
||||
set(SDLMIXER_MIDI_TIMIDITY TRUE)
|
||||
|
||||
set(SDLMIXER_OPUS TRUE)
|
||||
|
||||
set(SDLMIXER_VORBIS STB)
|
||||
set(SDLMIXER_VORBIS_STB TRUE)
|
||||
set(SDLMIXER_VORBIS_TREMOR FALSE)
|
||||
set(SDLMIXER_VORBIS_VORBISFILE FALSE)
|
||||
|
||||
set(SDLMIXER_WAVE TRUE)
|
||||
|
||||
|
||||
if(SDL_CPU_X86)
|
||||
set(_sdl3_mixer_arch_subdir "x86")
|
||||
elseif(SDL_CPU_X64 OR SDL_CPU_ARM64EC)
|
||||
set(_sdl3_mixer_arch_subdir "x64")
|
||||
elseif(SDL_CPU_ARM64)
|
||||
set(_sdl3_mixer_arch_subdir "arm64")
|
||||
else()
|
||||
set(SDL3_mixer_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_sdl3_mixer_incdir "${CMAKE_CURRENT_LIST_DIR}/../include")
|
||||
set(_sdl3_mixer_library "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl3_mixer_arch_subdir}/SDL3_mixer.lib")
|
||||
set(_sdl3_mixer_dll "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl3_mixer_arch_subdir}/SDL3_mixer.dll")
|
||||
|
||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||
# This is done for compatibility with CMake generated SDL3_mixer-target.cmake files.
|
||||
|
||||
set(SDL3_mixer_SDL3_mixer-shared_FOUND TRUE)
|
||||
if(NOT TARGET SDL3_mixer::SDL3_mixer-shared)
|
||||
add_library(SDL3_mixer::SDL3_mixer-shared SHARED IMPORTED)
|
||||
set_target_properties(SDL3_mixer::SDL3_mixer-shared
|
||||
PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_mixer_incdir}"
|
||||
IMPORTED_IMPLIB "${_sdl3_mixer_library}"
|
||||
IMPORTED_LOCATION "${_sdl3_mixer_dll}"
|
||||
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
||||
INTERFACE_SDL3_SHARED "ON"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(SDL3_mixer_SDL3_mixer-static_FOUND FALSE)
|
||||
|
||||
if(SDL3_mixer_SDL3_mixer-shared_FOUND OR SDL3_mixer_SDL3_mixer-static_FOUND)
|
||||
set(SDL3_mixer_SDL3_mixer_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_mixer::SDL3_mixer always exists
|
||||
if(NOT TARGET SDL3_mixer::SDL3_mixer)
|
||||
if(TARGET SDL3_mixer::SDL3_mixer-shared)
|
||||
_sdl_create_target_alias_compat(SDL3_mixer::SDL3_mixer SDL3_mixer::SDL3_mixer-shared)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_sdl3_mixer_arch_subdir)
|
||||
unset(_sdl3_mixer_incdir)
|
||||
unset(_sdl3_mixer_library)
|
||||
unset(_sdl3_mixer_dll)
|
||||
|
||||
check_required_components(SDL3_mixer)
|
||||
@@ -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,15 @@
|
||||
|
||||
# Using this package
|
||||
|
||||
This package contains @<@PROJECT_NAME@>@ built for x64 Windows.
|
||||
|
||||
To use this package, simply replace an existing 64-bit @<@PROJECT_NAME@>@.dll with the one included here.
|
||||
|
||||
You can include support for additional audio formats by including the license and DLL files in the optional directory in your application. They will be automatically loaded by SDL_mixer as needed.
|
||||
|
||||
# Development packages
|
||||
|
||||
If you're looking for packages with headers and libraries, you can download one of these:
|
||||
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio
|
||||
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
# Using this package
|
||||
|
||||
This package contains @<@PROJECT_NAME@>@ built for x86 Windows.
|
||||
|
||||
To use this package, simply replace an existing 32-bit @<@PROJECT_NAME@>@.dll with the one included here.
|
||||
|
||||
You can include support for additional audio formats by including the license and DLL files in the optional directory in your application. They will be automatically loaded by SDL_mixer as needed.
|
||||
|
||||
# Development packages
|
||||
|
||||
If you're looking for packages with headers and libraries, you can download one of these:
|
||||
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio
|
||||
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
{
|
||||
"name": "SDL3_mixer",
|
||||
"remote": "libsdl-org/SDL_mixer",
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"startswith": "3.4",
|
||||
"repo": "libsdl-org/SDL"
|
||||
}
|
||||
},
|
||||
"version": {
|
||||
"file": "include/SDL3_mixer/SDL_mixer.h",
|
||||
"re_major": "^#define SDL_MIXER_MAJOR_VERSION\\s+([0-9]+)$",
|
||||
"re_minor": "^#define SDL_MIXER_MINOR_VERSION\\s+([0-9]+)$",
|
||||
"re_micro": "^#define SDL_MIXER_MICRO_VERSION\\s+([0-9]+)$"
|
||||
},
|
||||
"source": {
|
||||
"checks": [
|
||||
"src/SDL_mixer.c",
|
||||
"include/SDL3_mixer/SDL_mixer.h",
|
||||
"test/testmixer.c"
|
||||
]
|
||||
},
|
||||
"dmg": {
|
||||
"project": "Xcode/SDL_mixer.xcodeproj",
|
||||
"path": "Xcode/build/SDL3_mixer.dmg",
|
||||
"scheme": "SDL3_mixer.dmg",
|
||||
"build-xcconfig": "Xcode/pkg-support/build.xcconfig",
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL3-*.dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mingw": {
|
||||
"cmake": {
|
||||
"archs": ["x86", "x64"],
|
||||
"args": [
|
||||
"-DBUILD_SHARED_LIBS=ON",
|
||||
"-DSDLMIXER_FLAC=ON",
|
||||
"-DSDLMIXER_FLAC_DRFLAC=ON",
|
||||
"-DSDLMIXER_FLAC_LIBFLAC=OFF",
|
||||
"-DSDLMIXER_GME=ON",
|
||||
"-DSDLMIXER_MOD=ON",
|
||||
"-DSDLMIXER_MOD_XMP=ON",
|
||||
"-DSDLMIXER_MP3=ON",
|
||||
"-DSDLMIXER_MP3_DRMP3=ON",
|
||||
"-DSDLMIXER_MP3_MPG123=OFF",
|
||||
"-DSDLMIXER_MIDI=ON",
|
||||
"-DSDLMIXER_MIDI_FLUIDSYNTH=OFF",
|
||||
"-DSDLMIXER_MIDI_TIMIDITY=ON",
|
||||
"-DSDLMIXER_OPUS=ON",
|
||||
"-DSDLMIXER_VORBIS_STB=ON",
|
||||
"-DSDLMIXER_VORBIS_TREMOR=OFF",
|
||||
"-DSDLMIXER_VORBIS_VORBISFILE=OFF",
|
||||
"-DSDLMIXER_WAVE=ON",
|
||||
"-DSDLMIXER_WAVPACK=ON",
|
||||
"-DSDLMIXER_RELOCATABLE=ON",
|
||||
"-DSDLMIXER_TESTS=OFF",
|
||||
"-DSDLMIXER_VENDORED=OFF",
|
||||
"-DCMAKE_C_FLAGS=-I@<@PROJECT_ROOT@>@/VisualC/external/include",
|
||||
"-DSDLMIXER_DYNAMIC_GME=@<@PROJECT_ROOT@>@/VisualC/external/optional/@<@ARCH@>@/libgme.dll",
|
||||
"-DSDLMIXER_DYNAMIC_WAVPACK=@<@PROJECT_ROOT@>@/VisualC/external/optional/@<@ARCH@>@/libwavpack-1.dll",
|
||||
"-DSDLMIXER_DYNAMIC_OPUSFILE=@<@PROJECT_ROOT@>@/VisualC/external/optional/@<@ARCH@>@/libopusfile-0.dll",
|
||||
"-DSDLMIXER_DYNAMIC_MOD_XMP=@<@PROJECT_ROOT@>@/VisualC/external/optional/@<@ARCH@>@/libxmp.dll"
|
||||
],
|
||||
"shared-static": "args"
|
||||
},
|
||||
"files": {
|
||||
"": [
|
||||
"build-scripts/pkg-support/mingw/INSTALL.md.in:INSTALL.md",
|
||||
"build-scripts/pkg-support/mingw/Makefile",
|
||||
"LICENSE.txt",
|
||||
"README.md"
|
||||
],
|
||||
"cmake": [
|
||||
"build-scripts/pkg-support/mingw/cmake/SDL3_mixerConfig.cmake",
|
||||
"build-scripts/pkg-support/mingw/cmake/SDL3_mixerConfigVersion.cmake"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL3-devel-*-mingw.tar.gz",
|
||||
"install-command": "make install-@<@ARCH@>@ DESTDIR=@<@PREFIX@>@"
|
||||
}
|
||||
}
|
||||
},
|
||||
"msvc": {
|
||||
"msbuild": {
|
||||
"archs": [
|
||||
"x86",
|
||||
"x64"
|
||||
],
|
||||
"projects": [
|
||||
"VisualC/SDL_mixer.vcxproj"
|
||||
],
|
||||
"prebuilt": [
|
||||
"VisualC/external/optional/@<@ARCH@>@/*"
|
||||
],
|
||||
"files-lib": {
|
||||
"": [
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_mixer.dll"
|
||||
],
|
||||
"optional": [
|
||||
"VisualC/external/optional/@<@ARCH@>@/libgme.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libogg-0.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libopus-0.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libopusfile-0.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libwavpack-1.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libxmp.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.gme.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.ogg-vorbis.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.opus.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.opusfile.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.wavpack.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.xmp.txt"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"lib/@<@ARCH@>@": [
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_mixer.dll",
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_mixer.lib",
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_mixer.pdb"
|
||||
],
|
||||
"lib/@<@ARCH@>@/optional": [
|
||||
"VisualC/external/optional/@<@ARCH@>@/libgme.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libogg-0.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libopus-0.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libopusfile-0.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libwavpack-1.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/libxmp.dll",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.gme.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.ogg-vorbis.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.opus.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.opusfile.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.wavpack.txt",
|
||||
"VisualC/external/optional/@<@ARCH@>@/LICENSE.xmp.txt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"cmake": {
|
||||
"archs": [
|
||||
"arm64"
|
||||
],
|
||||
"args": [
|
||||
"-DSDLMIXER_SNDFILE=ON",
|
||||
"-DSDLMIXER_FLAC=ON",
|
||||
"-DSDLMIXER_FLAC_DRFLAC=ON",
|
||||
"-DSDLMIXER_FLAC_LIBFLAC=OFF",
|
||||
"-DSDLMIXER_GME=ON",
|
||||
"-DSDLMIXER_MOD=ON",
|
||||
"-DSDLMIXER_MOD_XMP=ON",
|
||||
"-DSDLMIXER_MP3=ON",
|
||||
"-DSDLMIXER_MP3_DRMP3=ON",
|
||||
"-DSDLMIXER_MP3_MPG123=OFF",
|
||||
"-DSDLMIXER_MIDI=ON",
|
||||
"-DSDLMIXER_MIDI_FLUIDSYNTH=OFF",
|
||||
"-DSDLMIXER_MIDI_TIMIDITY=ON",
|
||||
"-DSDLMIXER_OPUS=ON",
|
||||
"-DSDLMIXER_VORBIS_STB=ON",
|
||||
"-DSDLMIXER_VORBIS_TREMOR=OFF",
|
||||
"-DSDLMIXER_VORBIS_VORBISFILE=OFF",
|
||||
"-DSDLMIXER_WAVE=ON",
|
||||
"-DSDLMIXER_WAVPACK=ON",
|
||||
"-DSDLMIXER_RELOCATABLE=ON",
|
||||
"-DSDLMIXER_TESTS=OFF",
|
||||
"-DSDLMIXER_DEPS_SHARED=ON",
|
||||
"-DSDLMIXER_VENDORED=ON"
|
||||
],
|
||||
"files-lib": {
|
||||
"": [
|
||||
"bin/SDL3_mixer.dll"
|
||||
],
|
||||
"optional": [
|
||||
"bin/gme.dll",
|
||||
"bin/libxmp.dll",
|
||||
"bin/ogg-0.dll",
|
||||
"bin/opus-0.dll",
|
||||
"bin/opusfile-0.dll",
|
||||
"bin/libwavpack-1.dll",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.gme.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.ogg-vorbis.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.opus.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.opusfile.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.wavpack.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.xmp.txt"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"lib/@<@ARCH@>@": [
|
||||
"bin/SDL3_mixer.dll",
|
||||
"bin/SDL3_mixer.pdb",
|
||||
"lib/SDL3_mixer.lib"
|
||||
],
|
||||
"lib/@<@ARCH@>@/optional": [
|
||||
"bin/gme.dll",
|
||||
"bin/libxmp.dll",
|
||||
"bin/ogg-0.dll",
|
||||
"bin/opus-0.dll",
|
||||
"bin/opusfile-0.dll",
|
||||
"bin/libwavpack-1.dll",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.gme.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.ogg-vorbis.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.opus.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.opusfile.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.wavpack.txt",
|
||||
"share/licenses/SDL3_mixer/optional/LICENSE.xmp.txt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files-lib": {
|
||||
"": [
|
||||
"build-scripts/pkg-support/msvc/@<@ARCH@>@/INSTALL.md.in:INSTALL.md",
|
||||
"LICENSE.txt",
|
||||
"README.md"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"": [
|
||||
"build-scripts/pkg-support/msvc/INSTALL.md.in:INSTALL.md",
|
||||
"LICENSE.txt",
|
||||
"README.md"
|
||||
],
|
||||
"cmake": [
|
||||
"build-scripts/pkg-support/msvc/cmake/SDL3_mixerConfig.cmake.in:SDL3_mixerConfig.cmake",
|
||||
"build-scripts/pkg-support/msvc/cmake/SDL3_mixerConfigVersion.cmake.in:SDL3_mixerConfigVersion.cmake",
|
||||
"cmake/sdlcpu.cmake"
|
||||
],
|
||||
"include/SDL3_mixer": [
|
||||
"include/SDL3_mixer/SDL_mixer.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",
|
||||
"-DSDLMIXER_SNDFILE=ON",
|
||||
"-DSDLMIXER_FLAC=ON",
|
||||
"-DSDLMIXER_FLAC_DRFLAC=ON",
|
||||
"-DSDLMIXER_FLAC_LIBFLAC=OFF",
|
||||
"-DSDLMIXER_GME=OFF",
|
||||
"-DSDLMIXER_MOD=OFF",
|
||||
"-DSDLMIXER_MOD_XMP=OFF",
|
||||
"-DSDLMIXER_MP3=ON",
|
||||
"-DSDLMIXER_MP3_DRMP3=ON",
|
||||
"-DSDLMIXER_MP3_MPG123=OFF",
|
||||
"-DSDLMIXER_MIDI=ON",
|
||||
"-DSDLMIXER_MIDI_FLUIDSYNTH=OFF",
|
||||
"-DSDLMIXER_MIDI_TIMIDITY=ON",
|
||||
"-DSDLMIXER_OPUS=OFF",
|
||||
"-DSDLMIXER_VORBIS_STB=ON",
|
||||
"-DSDLMIXER_VORBIS_TREMOR=OFF",
|
||||
"-DSDLMIXER_VORBIS_VORBISFILE=OFF",
|
||||
"-DSDLMIXER_WAVE=ON",
|
||||
"-DSDLMIXER_WAVPACK=OFF",
|
||||
"-DSDLMIXER_TESTS=OFF",
|
||||
"-DSDLMIXER_VENDORED=ON"
|
||||
]
|
||||
},
|
||||
"modules": {
|
||||
"SDL3_mixer-shared": {
|
||||
"type": "library",
|
||||
"library": "lib/libSDL3_mixer.so",
|
||||
"includes": {
|
||||
"SDL3_mixer": ["include/SDL3_mixer/*.h"]
|
||||
}
|
||||
},
|
||||
"SDL3_mixer": {
|
||||
"type": "interface",
|
||||
"export-libraries": [":SDL3_mixer-shared"]
|
||||
}
|
||||
},
|
||||
"abis": [
|
||||
"armeabi-v7a",
|
||||
"arm64-v8a",
|
||||
"x86",
|
||||
"x86_64"
|
||||
],
|
||||
"api-minimum": 21,
|
||||
"api-target": 35,
|
||||
"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_mixerConfig.cmake",
|
||||
"build-scripts/pkg-support/android/aar/cmake/SDL3_mixerConfigVersion.cmake.in:SDL3_mixerConfigVersion.cmake"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"": [
|
||||
"build-scripts/pkg-support/android/INSTALL.md.in:INSTALL.md",
|
||||
"LICENSE.txt",
|
||||
"README.md"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL3-devel-*-android.zip"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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_mixer/SDL_mixer.h
|
||||
ref_major=$(sed -ne 's/^#define SDL_MIXER_MAJOR_VERSION *//p' $header)
|
||||
ref_minor=$(sed -ne 's/^#define SDL_MIXER_MINOR_VERSION *//p' $header)
|
||||
ref_micro=$(sed -ne 's/^#define SDL_MIXER_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_mixer.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_mixer.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_mixer.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_mixer.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_mixer.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_mixer.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_mixer.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_mixer.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_mixer.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"
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user