mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-23 02:43:30 +08:00
Add parametrized build script
[ci skip]
This commit is contained in:
parent
57f2577c65
commit
45dfdfbb7b
4
.github/workflows/generic.yml
vendored
4
.github/workflows/generic.yml
vendored
@ -191,9 +191,9 @@ jobs:
|
||||
run: |
|
||||
echo "This should show us the SDL_REVISION"
|
||||
echo "Shared library:"
|
||||
${{ (matrix.platform.shared-lib && format('strings build/{0} | grep SDL-', matrix.platform.shared-lib)) || 'echo "<Shared library not supported by platform>"' }}
|
||||
${{ (matrix.platform.shared-lib && format('strings build/{0} | grep "Github Workflow"', matrix.platform.shared-lib)) || 'echo "<Shared library not supported by platform>"' }}
|
||||
echo "Static library:"
|
||||
${{ (matrix.platform.static-lib && format('strings build/{0} | grep SDL-', matrix.platform.static-lib)) || 'echo "<Static library not supported by platform>"' }}
|
||||
${{ (matrix.platform.static-lib && format('strings build/{0} | grep "Github Workflow"', matrix.platform.static-lib)) || 'echo "<Static library not supported by platform>"' }}
|
||||
- name: 'Run build-time tests (CMake)'
|
||||
id: tests
|
||||
if: ${{ !matrix.platform.no-cmake && matrix.platform.run-tests }}
|
||||
|
125
.github/workflows/release.yml
vendored
125
.github/workflows/release.yml
vendored
@ -37,9 +37,8 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--create source \
|
||||
--actions source \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--project SDL3 \
|
||||
--root "${{ github.workspace }}/SDL" \
|
||||
--github \
|
||||
--debug
|
||||
@ -93,7 +92,7 @@ jobs:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@ -114,9 +113,8 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--create xcframework \
|
||||
--actions dmg \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--project SDL3 \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
@ -240,12 +238,13 @@ jobs:
|
||||
outputs:
|
||||
VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
|
||||
VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
|
||||
VC-arm64: ${{ steps.releaser.outputs.VC-arm64 }}
|
||||
VC-devel: ${{ steps.releaser.outputs.VC-devel }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@ -265,12 +264,11 @@ jobs:
|
||||
- name: 'Build MSVC binary archives'
|
||||
id: releaser
|
||||
run: |
|
||||
python build-scripts/build-release.py `
|
||||
--create win32 `
|
||||
--commit ${{ inputs.commit }} `
|
||||
--project SDL3 `
|
||||
--root "${{ steps.zip.outputs.path }}" `
|
||||
--github `
|
||||
python build-scripts/build-release.py `
|
||||
--actions msvc `
|
||||
--commit ${{ inputs.commit }} `
|
||||
--root "${{ steps.zip.outputs.path }}" `
|
||||
--github `
|
||||
--debug
|
||||
- name: 'Store MSVC archives'
|
||||
uses: actions/upload-artifact@v4
|
||||
@ -405,7 +403,7 @@ jobs:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@ -428,12 +426,11 @@ jobs:
|
||||
- name: 'Build MinGW binary archives'
|
||||
id: releaser
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--create mingw \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--project SDL3 \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
python build-scripts/build-release.py \
|
||||
--actions mingw \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store MinGW archives'
|
||||
uses: actions/upload-artifact@v4
|
||||
@ -507,7 +504,7 @@ jobs:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@ -540,12 +537,11 @@ jobs:
|
||||
- name: 'Build Android prefab binary archive(s)'
|
||||
id: releaser
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--create android \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--project SDL3 \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
python build-scripts/build-release.py \
|
||||
--actions android \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store Android archive(s)'
|
||||
uses: actions/upload-artifact@v4
|
||||
@ -560,7 +556,7 @@ jobs:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
@ -581,37 +577,6 @@ jobs:
|
||||
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: 'Create gradle project'
|
||||
id: create-gradle-project
|
||||
run: |
|
||||
python ${{ steps.src.outputs.path }}/build-scripts/create-android-project.py \
|
||||
org.libsdl.testspriteminimal \
|
||||
${{ steps.src.outputs.path }}/test/testspriteminimal.c \
|
||||
${{ steps.src.outputs.path }}/test/icon.h \
|
||||
--variant aar \
|
||||
--output "/tmp/projects"
|
||||
echo "path=/tmp/projects/org.libsdl.testspriteminimal" >>$GITHUB_OUTPUT
|
||||
|
||||
echo ""
|
||||
echo "Project contents:"
|
||||
echo ""
|
||||
find "/tmp/projects/org.libsdl.testspriteminimal"
|
||||
- name: 'Copy SDL3 aar into Gradle project'
|
||||
run: |
|
||||
cp "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs"
|
||||
|
||||
echo ""
|
||||
echo "Project contents:"
|
||||
echo ""
|
||||
find "${{ steps.create-gradle-project.outputs.path }}"
|
||||
- name: 'Build app (Gradle & ndk-build)'
|
||||
run: |
|
||||
cd "${{ steps.create-gradle-project.outputs.path }}"
|
||||
./gradlew -i assembleRelease -PBUILD_WITH_CMAKE=1
|
||||
- name: 'Build app (Gradle & CMake)'
|
||||
run: |
|
||||
cd "${{ steps.create-gradle-project.outputs.path }}"
|
||||
./gradlew -i assembleRelease
|
||||
- name: 'Extract Android SDK from AAR'
|
||||
id: sdk
|
||||
run: |
|
||||
@ -622,16 +587,42 @@ jobs:
|
||||
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" \
|
||||
-DTEST_FULL=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DTEST_TEST=TRUE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }}" \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
|
||||
-DANDROID_ABI=${android_abi} \
|
||||
-Werror=dev \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_FULL=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DTEST_TEST=TRUE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }}" \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
|
||||
-DANDROID_ABI=${android_abi} \
|
||||
-Werror=dev \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-B "${android_abi}"
|
||||
echo "Building ${android_abi}..."
|
||||
cmake --build "${android_abi}" --config Release --verbose
|
||||
done
|
||||
- name: 'Create gradle project'
|
||||
id: create-gradle-project
|
||||
run: |
|
||||
python ${{ steps.src.outputs.path }}/build-scripts/create-android-project.py \
|
||||
org.libsdl.testspriteminimal \
|
||||
${{ steps.src.outputs.path }}/test/testspriteminimal.c \
|
||||
${{ steps.src.outputs.path }}/test/icon.h \
|
||||
--variant aar \
|
||||
--output "/tmp/projects"
|
||||
echo "path=/tmp/projects/org.libsdl.testspriteminimal" >>$GITHUB_OUTPUT
|
||||
- name: 'Copy SDL3 aar into Gradle project'
|
||||
run: |
|
||||
cp "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs"
|
||||
|
||||
echo ""
|
||||
echo "Project contents:"
|
||||
echo ""
|
||||
find "${{ steps.create-gradle-project.outputs.path }}"
|
||||
- name: 'Build app (Gradle & CMake)'
|
||||
run: |
|
||||
cd "${{ steps.create-gradle-project.outputs.path }}"
|
||||
./gradlew -i assembleRelease -Pandroid.native.buildOutput=verbose -PBUILD_WITH_CMAKE=1
|
||||
- name: 'Build app (Gradle & ndk-build)'
|
||||
run: |
|
||||
cd "${{ steps.create-gradle-project.outputs.path }}"
|
||||
./gradlew -i assembleRelease -Pandroid.native.buildOutput=verbose
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -51,6 +51,7 @@ cmake-build-*
|
||||
.DS_Store
|
||||
xcuserdata
|
||||
*.xcworkspace
|
||||
Xcode/build.xcconfig
|
||||
|
||||
# for Visual Studio Code
|
||||
.vscode/
|
||||
|
@ -1415,13 +1415,20 @@ if(ANDROID)
|
||||
set(javadoc_index_html "${javadocdir}/index.html")
|
||||
add_custom_command(
|
||||
OUTPUT "${javadoc_index_html}"
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${javadocdir}"
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${javadocdir}" "${javadocjar}"
|
||||
COMMAND ${Java_JAVADOC_EXECUTABLE} -encoding utf8 -d "${javadocdir}"
|
||||
-classpath "${path_android_jar}"
|
||||
-author -use -version ${SDL_JAVA_SOURCES}
|
||||
DEPENDS ${SDL_JAVA_SOURCES} "${path_android_jar}"
|
||||
)
|
||||
add_custom_target(SDL3-javadoc ALL DEPENDS "${javadoc_index_html}")
|
||||
add_custom_command(
|
||||
OUTPUT "${javadocjar}"
|
||||
COMMAND ${Java_JAR_EXECUTABLE} -c -f "${javadocjar}"
|
||||
-C "${javadocdir}" *
|
||||
WORKING_DIRECTORY "${javadocdir}"
|
||||
DEPENDS ${javadoc_index_html}
|
||||
)
|
||||
add_custom_target(SDL3-javadoc ALL DEPENDS "${javadoc_index_html}" "${javadocjar}")
|
||||
set_property(TARGET SDL3-javadoc PROPERTY OUTPUT_DIR "${javadocdir}")
|
||||
endif()
|
||||
endif()
|
||||
@ -3044,21 +3051,17 @@ foreach(_hdr IN LISTS SDL3_INCLUDE_FILES)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(SDL_REVISION "" CACHE STRING "Custom SDL revision (overrides SDL_REVISION_SUFFIX)")
|
||||
if(NOT SDL_REVISION)
|
||||
set(SDL_REVISION_SUFFIX "" CACHE STRING "Suffix for the SDL 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" SDL_REVISION_CENTER)
|
||||
string(STRIP "${SDL_REVISION_CENTER}" SDL_REVISION_CENTER)
|
||||
# If REVISION.txt exists, then we are building from a SDL release.
|
||||
# SDL_revision.h(.cmake) in source releases have SDL_REVISION baked into them.
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/REVISION.txt")
|
||||
set(SDL_REVISION "" CACHE STRING "Custom SDL revision")
|
||||
if(SDL_REVISION)
|
||||
set(SDL_REVISION_CENTER "${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_MICRO}-${SDL_REVISION}")
|
||||
else()
|
||||
# If VERSION does not exist, use git to calculate a version
|
||||
# If SDL_REVISION is not overrided, use git to describe
|
||||
git_describe(SDL_REVISION_CENTER)
|
||||
if(NOT SDL_REVISION_CENTER)
|
||||
set(SDL_REVISION_CENTER "${SDL3_VERSION}-no-vcs")
|
||||
endif()
|
||||
endif()
|
||||
set(SDL_REVISION "SDL-${SDL_REVISION_CENTER}${SDL_REVISION_SUFFIX}")
|
||||
set(SDL_REVISION "SDL3-${SDL_REVISION_CENTER}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include/SDL3")
|
||||
@ -3645,7 +3648,7 @@ if(NOT SDL_DISABLE_INSTALL)
|
||||
)
|
||||
endif()
|
||||
if(TARGET SDL3-javasources)
|
||||
install(FILES "${SDL3_BINARY_DIR}/SDL3-${SDL3_VERSION}-sources.jar"
|
||||
install(FILES "${SDL3_BINARY_DIR}/SDL3-${SDL3_VERSION}-sources.jar"
|
||||
DESTINATION "${SDL_INSTALL_JAVADIR}/SDL3")
|
||||
endif()
|
||||
endif()
|
||||
@ -3659,7 +3662,7 @@ if(NOT SDL_DISABLE_INSTALL)
|
||||
)
|
||||
if(TARGET SDL3-javadoc)
|
||||
set(SDL_INSTALL_JAVADOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/javadoc" CACHE PATH "Path where to install SDL3 javadoc")
|
||||
install(DIRECTORY "${SDL3_BINARY_DIR}/docs/javadoc/"
|
||||
install(FILES "${SDL3_BINARY_DIR}/SDL3-${SDL3_VERSION}-javadoc.jar"
|
||||
DESTINATION "${SDL_INSTALL_JAVADOCDIR}/SDL3")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -2795,7 +2795,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "set -ex\n\nmkdir -p build/dmg-tmp/share/cmake/SDL3\ncp -a build/SDL3.xcframework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\ncp pkg-support/resources/share/cmake/SDL3/sdl3-config.cmake build/dmg-tmp/share/cmake/SDL3\ncp pkg-support/resources/share/cmake/SDL3/sdl3-config-version.cmake build/dmg-tmp/share/cmake/SDL3\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n";
|
||||
shellScript = "set -ex\n\nmkdir -p build/dmg-tmp/share/cmake/SDL3\ncp -a build/SDL3.xcframework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\ncp pkg-support/share/cmake/SDL3/SDL3Config.cmake build/dmg-tmp/share/cmake/SDL3\ncp pkg-support/share/cmake/SDL3/SDL3ConfigVersion.cmake build/dmg-tmp/share/cmake/SDL3\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n";
|
||||
};
|
||||
F3B38CF0296F63D1005DA6D3 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
|
8
Xcode/SDL/pkg-support/build.xcconfig
Normal file
8
Xcode/SDL/pkg-support/build.xcconfig
Normal file
@ -0,0 +1,8 @@
|
||||
//
|
||||
// build.xcconfig
|
||||
//
|
||||
|
||||
// Configuration settings file format documentation can be found at:
|
||||
// https://help.apple.com/xcode/#/dev745c5c974
|
||||
|
||||
SDL_PREPROCESSOR_DEFINITIONS = SDL_VENDOR_INFO=\"libsdl.org\"
|
@ -32,14 +32,24 @@ endmacro()
|
||||
set(SDL3_FOUND TRUE)
|
||||
|
||||
macro(_check_target_is_simulator)
|
||||
include(CheckCSourceCompiles)
|
||||
check_c_source_compiles([===[
|
||||
set(src [===[
|
||||
#include <TargetConditionals.h>
|
||||
#if defined(TARGET_OS_SIMULATOR)
|
||||
#if defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR
|
||||
int target_is_simulator;
|
||||
#endif
|
||||
int main(int argc, char *argv[]) { return target_is_simulator; }
|
||||
]===] SDL_TARGET_IS_SIMULATOR)
|
||||
]===])
|
||||
if(CMAKE_C_COMPILER)
|
||||
include(CheckCSourceCompiles)
|
||||
check_c_source_compiles("${src}" SDL_TARGET_IS_SIMULATOR)
|
||||
elseif(CMAKE_CXX_COMPILER)
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("${src}" SDL_TARGET_IS_SIMULATOR)
|
||||
else()
|
||||
enable_language(C)
|
||||
include(CheckCSourceCompiles)
|
||||
check_c_source_compiles("${src}" SDL_TARGET_IS_SIMULATOR)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
@ -59,7 +69,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(_xcfw_target_subdir "macos-arm64_x86_64")
|
||||
else()
|
||||
message(WARNING "Unsupported Apple platform (${CMAKE_SYSTEM_NAME}) and broken sdl3-config-version.cmake")
|
||||
message(WARNING "Unsupported Apple platform (${CMAKE_SYSTEM_NAME}) and broken SDL3ConfigVersion.cmake")
|
||||
set(SDL3_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
@ -89,7 +99,9 @@ set(SDL3_Headers_FOUND TRUE)
|
||||
|
||||
if(NOT TARGET SDL3::SDL3-shared)
|
||||
add_library(SDL3::SDL3-shared SHARED IMPORTED)
|
||||
if(CMAKE_VERSION GREATER_EQUAL "3.28")
|
||||
# CMake does not automatically add RPATHS when using xcframeworks
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/25998
|
||||
if(0) # if(CMAKE_VERSION GREATER_EQUAL "3.28")
|
||||
set_target_properties(SDL3::SDL3-shared
|
||||
PROPERTIES
|
||||
FRAMEWORK "TRUE"
|
File diff suppressed because it is too large
Load Diff
@ -45,6 +45,9 @@ def android_mk_use_prefab(path: Path) -> None:
|
||||
|
||||
data, _ = re.subn("[\n]{3,}", "\n\n", data)
|
||||
|
||||
data, count = re.subn(r"(LOCAL_SHARED_LIBRARIES\s*:=\s*SDL3)", "LOCAL_SHARED_LIBRARIES := SDL3 SDL3-Headers", data)
|
||||
assert count == 1, f"Must have injected SDL3-Headers in {path} exactly once"
|
||||
|
||||
newdata = data + textwrap.dedent("""
|
||||
# https://google.github.io/prefab/build-systems.html
|
||||
|
||||
@ -116,7 +119,7 @@ def main() -> int:
|
||||
description = "Create a simple Android gradle project from input sources."
|
||||
epilog = textwrap.dedent("""\
|
||||
You need to manually copy a prebuilt SDL3 Android archive into the project tree when using the aar variant.
|
||||
|
||||
|
||||
Any changes you have done to the sources in the Android project will be lost
|
||||
""")
|
||||
parser = ArgumentParser(description=description, epilog=epilog, allow_abbrev=False)
|
||||
|
43
build-scripts/create-release.py
Executable file
43
build-scripts/create-release.py
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
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()
|
||||
|
||||
current_commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip()
|
||||
|
||||
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", default=current_commit, help=f"Commit (default={current_commit})")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
print(f"Running release.yml workflow:")
|
||||
print(f" commit = {args.commit}")
|
||||
print(f" remote = {args.remote}")
|
||||
|
||||
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())
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
commit=$(git rev-parse HEAD)
|
||||
echo "Creating release workflow for commit $commit"
|
||||
gh workflow run release.yml --ref main -f commit=$commit
|
||||
|
@ -1,58 +1,61 @@
|
||||
|
||||
This Android archive allows use of @PROJECT_NAME@ in your Android project, without needing to copy any SDL source.
|
||||
For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/).
|
||||
|
||||
Copy this 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're using ndk-build, add the following somewhere after `LOCAL_MODULE := yourgame` to your `Android.mk` or `Application.mk`:
|
||||
```
|
||||
# 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@)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
For advanced users:
|
||||
|
||||
If you want to build a 3rd party library outside 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 ./test (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>
|
||||
This Android archive allows use of @<@PROJECT_NAME@>@ in your Android project, without needing to copy any SDL source.
|
||||
For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/).
|
||||
|
||||
Copy this 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 := SDL3 SDL3-Headers
|
||||
```
|
||||
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@>@)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
For advanced users:
|
||||
|
||||
If you want to build a 3rd party library outside 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 ./test (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>
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Create a @PROJECT_NAME@ SDK prefix from an Android archive
|
||||
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
|
||||
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 \
|
||||
@ -31,13 +31,14 @@ 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",
|
||||
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}...")
|
||||
print(f"Creating a @<@PROJECT_NAME@>@ SDK at {args.output}...")
|
||||
|
||||
prefix = args.output
|
||||
incdir = prefix / "include"
|
||||
@ -92,9 +93,8 @@ def main():
|
||||
jarpath = javadir / f"{project_name}-{project_version}-sources.jar"
|
||||
read_zipfile_and_write(jarpath, zippath)
|
||||
elif zippath == "classes-doc.jar":
|
||||
data = zf.read(zippath)
|
||||
with zipfile.ZipFile(io.BytesIO(data)) as doc_zf:
|
||||
doc_zf.extractall(javadocdir)
|
||||
jarpath = javadocdir / f"{project_name}-{project_version}-javadoc.jar"
|
||||
read_zipfile_and_write(jarpath, zippath)
|
||||
|
||||
print("... done")
|
||||
return 0
|
||||
|
@ -1,26 +1,7 @@
|
||||
# based on the files generated by CMake's write_basic_package_version_file
|
||||
# @<@PROJECT_NAME@>@ CMake version configuration file:
|
||||
# This file is meant to be placed in a lib/cmake/@<@PROJECT_NAME@>@ subfolder of a reconstructed Android SDL3 SDK
|
||||
|
||||
# SDL CMake version configuration file:
|
||||
# This file is meant to be placed in a lib/cmake/SDL3 subfolder of a reconstructed Android SDL3 SDK
|
||||
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../../include/SDL3/SDL_version.h")
|
||||
message(AUTHOR_WARNING "Could not find SDL3/SDL_version.h. This script is meant to be placed in the root of SDL3-devel-3.x.y-VC")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../../../include/SDL3/SDL_version.h" _sdl_version_h)
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
|
||||
set(_sdl_major "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
|
||||
set(_sdl_minor "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_version_h}")
|
||||
set(_sdl_micro "${CMAKE_MATCH_1}")
|
||||
if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
|
||||
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "Could not extract version from SDL3/SDL_version.h.")
|
||||
return()
|
||||
endif()
|
||||
set(PACKAGE_VERSION "@<@PROJECT_VERSION@>@")
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# Package version must be in the requested version range
|
5
build-scripts/pkg-support/android/description.json.in
Normal file
5
build-scripts/pkg-support/android/description.json.in
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "@<@PROJECT_NAME@>@",
|
||||
"version": "@<@PROJECT_VERSION@>@",
|
||||
"git-hash": "@<@PROJECT_COMMIT@>@"
|
||||
}
|
@ -26,6 +26,8 @@ install-x86_64:
|
||||
|
||||
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 \
|
||||
|
8
build-scripts/pkg-support/msvc/Directory.Build.props
Normal file
8
build-scripts/pkg-support/msvc/Directory.Build.props
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>SDL_VENDOR_INFO="libsdl.org";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
@ -1,5 +1,5 @@
|
||||
# SDL CMake configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-VC
|
||||
# @<@PROJECT_NAME@>@ CMake configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip
|
||||
|
||||
cmake_minimum_required(VERSION 3.0...3.5)
|
||||
|
||||
@ -105,7 +105,7 @@ else()
|
||||
endif()
|
||||
unset(_sdl3test_lib)
|
||||
|
||||
if(SDL3_SDL3-shared_FOUND)
|
||||
if(SDL3_SDL3-shared_FOUND OR SDL3_SDL3-static_FOUND)
|
||||
set(SDL3_SDL3_FOUND TRUE)
|
||||
endif()
|
||||
|
@ -1,26 +1,7 @@
|
||||
# based on the files generated by CMake's write_basic_package_version_file
|
||||
# @<@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
|
||||
|
||||
# SDL CMake version configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-VC
|
||||
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../include/SDL3/SDL_version.h")
|
||||
message(AUTHOR_WARNING "Could not find SDL3/SDL_version.h. This script is meant to be placed in the root of SDL3-devel-3.x.y-VC")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../include/SDL3/SDL_version.h" _sdl_version_h)
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
|
||||
set(_sdl_major "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
|
||||
set(_sdl_minor "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_version_h}")
|
||||
set(_sdl_micro "${CMAKE_MATCH_1}")
|
||||
if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
|
||||
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "Could not extract version from SDL3/SDL_version.h.")
|
||||
return()
|
||||
endif()
|
||||
set(PACKAGE_VERSION "@<@PROJECT_VERSION@>@")
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# Package version must be in the requested version range
|
41
build-scripts/pkg-support/source/SDL_revision.h.cmake.in
Normal file
41
build-scripts/pkg-support/source/SDL_revision.h.cmake.in
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2024 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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: Version */
|
||||
|
||||
/*
|
||||
* SDL_revision.h contains the SDL revision, which might be defined on the
|
||||
* compiler command line, or generated right into the header itself by the
|
||||
* build system.
|
||||
*/
|
||||
|
||||
#ifndef SDL_revision_h_
|
||||
#define SDL_revision_h_
|
||||
|
||||
#cmakedefine SDL_VENDOR_INFO "@SDL_VENDOR_INFO@"
|
||||
|
||||
#if defined(SDL_VENDOR_INFO)
|
||||
#define SDL_REVISION "@<@PROJECT_REVISION@>@ (" SDL_VENDOR_INFO ")"
|
||||
#else
|
||||
#define SDL_REVISION "@<@PROJECT_REVISION@>@"
|
||||
#endif
|
||||
|
||||
#endif /* SDL_revision_h_ */
|
56
build-scripts/pkg-support/source/SDL_revision.h.in
Normal file
56
build-scripts/pkg-support/source/SDL_revision.h.in
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2024 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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: Version */
|
||||
|
||||
/*
|
||||
* SDL_revision.h contains the SDL revision, which might be defined on the
|
||||
* compiler command line, or generated right into the header itself by the
|
||||
* build system.
|
||||
*/
|
||||
|
||||
#ifndef SDL_revision_h_
|
||||
#define SDL_revision_h_
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* This macro is a string describing the source at a particular point in
|
||||
* development.
|
||||
*
|
||||
* This string is often generated from revision control's state at build time.
|
||||
*
|
||||
* This string can be quite complex and does not follow any standard. For
|
||||
* example, it might be something like "SDL-prerelease-3.1.1-47-gf687e0732".
|
||||
* It might also be user-defined at build time, so it's best to treat it as a
|
||||
* clue in debugging forensics and not something the app will parse in any
|
||||
* way.
|
||||
*
|
||||
* \since This macro is available since SDL 3.0.0.
|
||||
*/
|
||||
#define SDL_REVISION "Some arbitrary string decided at SDL build time"
|
||||
#elif defined(SDL_VENDOR_INFO)
|
||||
#define SDL_REVISION "@<@PROJECT_REVISION@>@ (" SDL_VENDOR_INFO ")"
|
||||
#else
|
||||
#define SDL_REVISION "@<@PROJECT_REVISION@>@"
|
||||
#endif
|
||||
|
||||
#endif /* SDL_revision_h_ */
|
215
build-scripts/release-info.json
Normal file
215
build-scripts/release-info.json
Normal file
@ -0,0 +1,215 @@
|
||||
{
|
||||
"name": "SDL3",
|
||||
"remote": "libsdl-org/SDL",
|
||||
"version": {
|
||||
"file": "include/SDL3/SDL_version.h",
|
||||
"re_major": "^#define SDL_MAJOR_VERSION\\s+([0-9]+)$",
|
||||
"re_minor": "^#define SDL_MINOR_VERSION\\s+([0-9]+)$",
|
||||
"re_micro": "^#define SDL_MICRO_VERSION\\s+([0-9]+)$"
|
||||
},
|
||||
"source": {
|
||||
"checks": [
|
||||
"src/SDL.c",
|
||||
"include/SDL3/SDL.h",
|
||||
"test/testsprite.c",
|
||||
"android-project/app/src/main/java/org/libsdl/app/SDLActivity.java"
|
||||
],
|
||||
"files": {
|
||||
"include/SDL3": [
|
||||
"build-scripts/pkg-support/source/SDL_revision.h.in:SDL_revision.h"
|
||||
],
|
||||
"include/build_config": [
|
||||
"build-scripts/pkg-support/source/SDL_revision.h.cmake.in:SDL_revision.h.cmake"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dmg": {
|
||||
"project": "Xcode/SDL/SDL.xcodeproj",
|
||||
"path": "Xcode/SDL/build/SDL3.dmg",
|
||||
"target": "SDL3.dmg",
|
||||
"build-xcconfig": "Xcode/SDL/pkg-support/build.xcconfig"
|
||||
},
|
||||
"mingw": {
|
||||
"cmake": {
|
||||
"archs": ["x86", "x64"],
|
||||
"args": [
|
||||
"-DSDL_SHARED=ON",
|
||||
"-DSDL_STATIC=ON",
|
||||
"-DSDL_DISABLE_INSTALL_DOCS=ON",
|
||||
"-DSDL_TEST_LIBRARY=ON",
|
||||
"-DSDL_VENDOR_INFO=libsdl.org",
|
||||
"-DSDL_TESTS=OFF"
|
||||
],
|
||||
"shared-static": "args"
|
||||
},
|
||||
"files": {
|
||||
"": [
|
||||
"build-scripts/pkg-support/mingw/INSTALL.txt",
|
||||
"build-scripts/pkg-support/mingw/Makefile",
|
||||
"BUGS.txt",
|
||||
"CREDITS.md",
|
||||
"README-SDL.txt",
|
||||
"WhatsNew.txt",
|
||||
"LICENSE.txt",
|
||||
"README.md"
|
||||
],
|
||||
"cmake": [
|
||||
"build-scripts/pkg-support/mingw/cmake/SDL3Config.cmake",
|
||||
"build-scripts/pkg-support/mingw/cmake/SDL3ConfigVersion.cmake"
|
||||
],
|
||||
"docs": [
|
||||
"docs/*"
|
||||
],
|
||||
"test": [
|
||||
"test/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"msvc": {
|
||||
"msbuild": {
|
||||
"archs": [
|
||||
"x86",
|
||||
"x64"
|
||||
],
|
||||
"directory-build-props": "build-scripts/pkg-support/msvc/Directory.Build.props",
|
||||
"projects": [
|
||||
"VisualC/SDL/SDL.vcxproj",
|
||||
"VisualC/SDL_test/SDL_test.vcxproj"
|
||||
],
|
||||
"files-lib": {
|
||||
"": [
|
||||
"VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3.dll"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"lib/@<@ARCH@>@": [
|
||||
"VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3.dll",
|
||||
"VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3.lib",
|
||||
"VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3.pdb",
|
||||
"VisualC/SDL_test/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_test.lib"
|
||||
]
|
||||
}
|
||||
},
|
||||
"cmake": {
|
||||
"archs": [
|
||||
"arm64"
|
||||
],
|
||||
"args": [
|
||||
"-DSDL_SHARED=ON",
|
||||
"-DSDL_STATIC=OFF",
|
||||
"-DSDL_TEST_LIBRARY=ON",
|
||||
"-DSDL_TESTS=OFF",
|
||||
"-DSDL_DISABLE_INSTALL_DOCS=ON",
|
||||
"-DSDL_VENDOR_INFO=libsdl.org"
|
||||
],
|
||||
"files-lib": {
|
||||
"": [
|
||||
"bin/SDL3.dll"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"lib/@<@ARCH@>@": [
|
||||
"bin/SDL3.dll",
|
||||
"bin/SDL3.pdb",
|
||||
"lib/SDL3.lib",
|
||||
"lib/SDL3_test.lib"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files-lib": {
|
||||
"": [
|
||||
"README-SDL.txt"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"": [
|
||||
"README-SDL.txt",
|
||||
"BUGS.txt",
|
||||
"LICENSE.txt",
|
||||
"README.md",
|
||||
"WhatsNew.txt"
|
||||
],
|
||||
"cmake": [
|
||||
"build-scripts/pkg-support/msvc/cmake/SDL3Config.cmake.in:SDL3Config.cmake",
|
||||
"build-scripts/pkg-support/msvc/cmake/SDL3ConfigVersion.cmake.in:SDL3ConfigVersion.cmake",
|
||||
"cmake/sdlcpu.cmake"
|
||||
],
|
||||
"docs": [
|
||||
"docs/*"
|
||||
],
|
||||
"include/SDL3": [
|
||||
"include/SDL3/*.h"
|
||||
]
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"cmake": {
|
||||
"args": [
|
||||
"-DSDL_SHARED=ON",
|
||||
"-DSDL_STATIC=OFF",
|
||||
"-DSDL_TEST_LIBRARY=ON",
|
||||
"-DSDL_TESTS=OFF",
|
||||
"-DSDL_DISABLE_ANDROID_JAR=OFF",
|
||||
"-DSDL_DISABLE_INSTALL=OFF",
|
||||
"-DSDL_DISABLE_INSTALL_DOCS=OFF",
|
||||
"-DSDL_VENDOR_INFO=libsdl.org"
|
||||
]
|
||||
},
|
||||
"modules": {
|
||||
"SDL3-Headers": {
|
||||
"type": "interface",
|
||||
"includes": {
|
||||
"SDL3": ["include/SDL3/*.h"]
|
||||
}
|
||||
},
|
||||
"Headers": {
|
||||
"type": "interface",
|
||||
"export-libraries": [":SDL3-Headers"]
|
||||
},
|
||||
"SDL3_test": {
|
||||
"type": "library",
|
||||
"library": "lib/libSDL3_test.a",
|
||||
"export-libraries": [":Headers"]
|
||||
},
|
||||
"SDL3-shared": {
|
||||
"type": "library",
|
||||
"library": "lib/libSDL3.so",
|
||||
"export-libraries": [":Headers"]
|
||||
},
|
||||
"SDL3": {
|
||||
"type": "interface",
|
||||
"export-libraries": [":SDL3-shared"]
|
||||
}
|
||||
},
|
||||
"jars": {
|
||||
"classes": "share/java/@<@PROJECT_NAME@>@/@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.jar",
|
||||
"sources": "share/java/@<@PROJECT_NAME@>@/@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@-sources.jar",
|
||||
"doc": "share/javadoc/@<@PROJECT_NAME@>@/@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@-javadoc.jar"
|
||||
},
|
||||
"abis": [
|
||||
"armeabi-v7a",
|
||||
"arm64-v8a",
|
||||
"x86",
|
||||
"x86_64"
|
||||
],
|
||||
"api-minimum": 19,
|
||||
"api-target": 29,
|
||||
"ndk-minimum": 21,
|
||||
"files": {
|
||||
"": [
|
||||
"android-project/app/proguard-rules.pro:proguard.txt",
|
||||
"build-scripts/pkg-support/android/INSTALL.md.in:INSTALL.md",
|
||||
"build-scripts/pkg-support/android/__main__.py.in:__main__.py",
|
||||
"build-scripts/pkg-support/android/description.json.in:description.json"
|
||||
],
|
||||
"META-INF": [
|
||||
"LICENSE.txt"
|
||||
],
|
||||
"cmake": [
|
||||
"cmake/sdlcpu.cmake",
|
||||
"build-scripts/pkg-support/android/cmake/SDL3Config.cmake",
|
||||
"build-scripts/pkg-support/android/cmake/SDL3ConfigVersion.cmake.in:SDL3ConfigVersion.cmake"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -40,7 +40,6 @@ if [ "$rev" != "" ]; then
|
||||
echo "#else" >>"$header.new"
|
||||
echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new"
|
||||
echo "#endif" >>"$header.new"
|
||||
echo "#define SDL_REVISION_NUMBER 0" >>"$header.new"
|
||||
if diff $header $header.new >/dev/null 2>&1; then
|
||||
rm "$header.new"
|
||||
else
|
||||
|
@ -104,8 +104,9 @@ endfunction()
|
||||
set(SDL_ANDROID_PLATFORM_ANDROID_JAR "SDL_ANDROID_PLATFORM_ANDROID_JAR-NOTFOUND")
|
||||
|
||||
if(NOT DEFINED SDL_ANDROID_PLATFORM_ROOT)
|
||||
_sdl_find_android_platform_root(SDL_ANDROID_PLATFORM_ROOT)
|
||||
set(SDL_ANDROID_PLATFORM_ROOT "${SDL_ANDROID_PLATFORM_ROOT}" CACHE PATH "Path of Android platform")
|
||||
_sdl_find_android_platform_root(_new_sdl_android_platform_root)
|
||||
set(SDL_ANDROID_PLATFORM_ROOT "${_new_sdl_android_platform_root}" CACHE PATH "Path of Android platform")
|
||||
unset(_new_sdl_android_platform_root)
|
||||
endif()
|
||||
if(SDL_ANDROID_PLATFORM_ROOT)
|
||||
_sdl_is_valid_android_platform_root(_valid SDL_ANDROID_PLATFORM_VERSION "${SDL_ANDROID_PLATFORM_ROOT}")
|
||||
|
@ -46,7 +46,7 @@ function(SDL_AddCommonCompilerFlags TARGET)
|
||||
cmake_push_check_state()
|
||||
check_c_compiler_flag("-gdwarf-4" HAVE_GDWARF_4)
|
||||
if(HAVE_GDWARF_4)
|
||||
target_compile_options(${TARGET} PRIVATE "-gdwarf-4")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:-gdwarf-4>")
|
||||
endif()
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
|
@ -1,148 +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[]) {
|
||||
(void)argv;
|
||||
int result = 0;
|
||||
${src_main}
|
||||
return result;
|
||||
}")
|
||||
|
||||
set(path_src_arch_detect "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch.c")
|
||||
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()
|
||||
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[]) {
|
||||
(void)argv;
|
||||
int result = 0;
|
||||
${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()
|
||||
|
@ -126,13 +126,10 @@ Here's an explanation of the files in the Android project, so you can customize
|
||||
Using the SDL3 Android Archive (.aar)
|
||||
================================================================================
|
||||
|
||||
The `create-android-project.py` script can
|
||||
./create-android-project.py com.yourcompany.yourapp < sources.list
|
||||
|
||||
The Android archive allows use of SDL3 in your Android project, without needing to copy any SDL c or java source.
|
||||
The Android archive allows use of SDL3 in your Android project, without needing to copy any SDL C or JAVA source into your project.
|
||||
For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/).
|
||||
|
||||
Copy the archive to a `app/libs` directory of your project and add the following to `app/gradle.build`:
|
||||
Copy the archive to a `app/libs` directory in your project and add the following to `app/gradle.build`:
|
||||
```
|
||||
android {
|
||||
/* ... */
|
||||
@ -141,29 +138,34 @@ android {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation files('libs/@PROJECT_NAME@-@PROJECT_VERSION@.aar')
|
||||
implementation files('libs/SDL3-X.Y.Z.aar') /* Replace with the filename of the actual SDL3-x.y.z.aar file you downloaded */
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
If you're using CMake, add the following to your CMakeLists.txt:
|
||||
If you use CMake, add the following to your CMakeLists.txt:
|
||||
```
|
||||
find_package(@PROJECT_NAME@ REQUIRED CONFIG)
|
||||
target_link_libraries(yourgame PRIVATE @PROJECT_NAME@::@PROJECT_NAME@)
|
||||
find_package(SDL3 REQUIRED CONFIG)
|
||||
target_link_libraries(yourgame PRIVATE SDL3::SDL3)
|
||||
```
|
||||
|
||||
If you're using ndk-build, add the following somewhere after `LOCAL_MODULE := yourgame` to your `Android.mk` or `Application.mk`:
|
||||
If you use ndk-build, add the following before `include $(BUILD_SHARED_LIBRARY)` to your `Android.mk`:
|
||||
```
|
||||
LOCAL_SHARED_LIBARARIES := SDL3 SDL3-Headers
|
||||
```
|
||||
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@)
|
||||
```
|
||||
|
||||
If you want to avoid adding the complete SDL source base as a subproject, or adding the Java sources of the bindings to your Android project
|
||||
The `build-scripts/create-android-project.py` script can create a project using Android aar-chives from scratch:
|
||||
```
|
||||
build-scripts/create-android-project.py --variant aar com.yourcompany.yourapp < sources.list
|
||||
```
|
||||
|
||||
Customizing your application name
|
||||
================================================================================
|
||||
|
@ -11,19 +11,19 @@
|
||||
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.
|
||||
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.
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_revision.h
|
||||
*
|
||||
* Header file containing the SDL revision.
|
||||
*/
|
||||
* \file SDL_revision.h
|
||||
*
|
||||
* Header file containing the SDL revision.
|
||||
*/
|
||||
|
||||
#ifndef SDL_revision_h_
|
||||
#define SDL_revision_h_
|
||||
|
Loading…
Reference in New Issue
Block a user