mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-22 19:45:40 +00:00
cmake+ci: fix+test sdl2-config + sdl2.pc for all supported platforms
This commit is contained in:
parent
c61367c273
commit
78a3751659
27
.github/workflows/android.yml
vendored
27
.github/workflows/android.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
matrix:
|
||||
platform:
|
||||
- { name: Android.mk }
|
||||
- { name: CMake, cmake: '-DCMAKE_SYSTEM_PROCESSOR=aarch64 -DANDROID_PLATFORM=android-23 -DCMAKE_SYSTEM_VERSION=23 ' }
|
||||
- { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" }
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -28,13 +28,14 @@ jobs:
|
|||
if: ${{ matrix.platform.name == 'CMake' }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ninja-build
|
||||
sudo apt-get install ninja-build pkg-config
|
||||
- name: Configure (CMake)
|
||||
if: ${{ matrix.platform.name == 'CMake' }}
|
||||
run: |
|
||||
cmake -B build \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
|
||||
${{ matrix.platform.cmake }} \
|
||||
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
|
||||
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
|
||||
-DSDL_STATIC_PIC=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=prefix \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
|
@ -54,7 +55,25 @@ jobs:
|
|||
run: |
|
||||
cmake -S cmake/test -B cmake_config_build -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
|
||||
${{ matrix.platform.cmake }} \
|
||||
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
|
||||
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
|
||||
cmake --build cmake_config_build --verbose
|
||||
- name: Verify sdl2-config
|
||||
if: ${{ matrix.platform.name == 'CMake' }}
|
||||
run: |
|
||||
export CC="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
|
||||
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
|
||||
cmake/test/test_sdlconfig.sh
|
||||
- name: Verify sdl2.pc
|
||||
if: ${{ matrix.platform.name == 'CMake' }}
|
||||
run: |
|
||||
export CC="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
|
||||
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
|
||||
cmake/test/test_pkgconfig.sh
|
||||
- name: Verify Android.mk
|
||||
if: ${{ matrix.platform.name == 'CMake' }}
|
||||
run: |
|
||||
export NDK_MODULE_PATH=${{ env.SDL2_DIR }}/share/ndk-modules
|
||||
ndk-build -C ${{ github.workspace }}/cmake/test APP_PLATFORM=android-${{ matrix.platform.android_platform }} APP_ABI=${{ matrix.platform.android_abi }} NDK_OUT=$PWD NDK_LIBS_OUT=$PWD V=1
|
||||
|
|
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
|
@ -189,6 +189,16 @@ jobs:
|
|||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
|
||||
cmake --build cmake_config_build --verbose
|
||||
- name: Verify sdl2-config
|
||||
run: |
|
||||
export CC=${{ matrix.platform.cc || 'gcc' }}
|
||||
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
|
||||
cmake/test/test_sdlconfig.sh
|
||||
- name: Verify sdl2.pc
|
||||
run: |
|
||||
export CC=${{ matrix.platform.cc || 'gcc' }}
|
||||
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
|
||||
cmake/test/test_pkgconfig.sh
|
||||
- name: Distcheck (Autotools)
|
||||
if: matrix.platform.autotools
|
||||
run: |
|
||||
|
|
38
.github/workflows/ps2.yaml
vendored
38
.github/workflows/ps2.yaml
vendored
|
@ -11,11 +11,41 @@ jobs:
|
|||
- name: Setup dependencies
|
||||
run: |
|
||||
apk update
|
||||
apk add cmake gmp mpc1 mpfr4 make
|
||||
- name: Configure CMake
|
||||
run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake -DSDL_TESTS=ON
|
||||
apk add cmake gmp mpc1 mpfr4 ninja pkgconf
|
||||
- name: Configure (CMake)
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja\
|
||||
-DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \
|
||||
-DSDL_TESTS=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
run: cmake --build build --config Release --verbose --parallel
|
||||
- name: Install (CMake)
|
||||
run: |
|
||||
set -eu
|
||||
cmake --install build/ --config Release
|
||||
echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
|
||||
( cd cmake_prefix; find ) | LC_ALL=C sort -u
|
||||
|
||||
- name: Verify CMake configuration files
|
||||
run: |
|
||||
cmake -S cmake/test -B cmake_config_build -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \
|
||||
-DTEST_SHARED=FALSE \
|
||||
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build cmake_config_build --verbose
|
||||
- name: Verify sdl2-config
|
||||
run: |
|
||||
export CC=mips64r5900el-ps2-elf-gcc
|
||||
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
|
||||
cmake/test/test_sdlconfig.sh
|
||||
- name: Verify sdl2.pc
|
||||
run: |
|
||||
export CC=mips64r5900el-ps2-elf-gcc
|
||||
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
|
||||
cmake/test/test_pkgconfig.sh
|
||||
|
||||
- name: Get short SHA
|
||||
id: slug
|
||||
|
|
14
.github/workflows/psp.yaml
vendored
14
.github/workflows/psp.yaml
vendored
|
@ -11,7 +11,7 @@ jobs:
|
|||
- name: Setup dependencies
|
||||
run: |
|
||||
apk update
|
||||
apk add cmake gmp mpc1 mpfr4 make
|
||||
apk add cmake gmp mpc1 mpfr4 make pkgconf
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake -S . -B build \
|
||||
|
@ -35,3 +35,15 @@ jobs:
|
|||
-DTEST_SHARED=FALSE \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build cmake_config_build --verbose
|
||||
- name: Verify sdl2-config
|
||||
run: |
|
||||
export CC=psp-gcc
|
||||
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
|
||||
export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
|
||||
cmake/test/test_sdlconfig.sh
|
||||
- name: Verify sdl2.pc
|
||||
run: |
|
||||
export CC=psp-gcc
|
||||
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
|
||||
export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
|
||||
cmake/test/test_pkgconfig.sh
|
||||
|
|
14
.github/workflows/vita.yaml
vendored
14
.github/workflows/vita.yaml
vendored
|
@ -13,10 +13,10 @@ jobs:
|
|||
image: vitasdk/vitasdk:latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install CMake and GNU Make
|
||||
- name: Install build requirements
|
||||
run: |
|
||||
apk update
|
||||
apk add cmake make ninja
|
||||
apk add cmake ninja pkgconf
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
|
@ -40,3 +40,13 @@ jobs:
|
|||
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build cmake_config_build --verbose
|
||||
- name: Verify sdl2-config
|
||||
run: |
|
||||
export CC=arm-vita-eabi-gcc
|
||||
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
|
||||
cmake/test/test_sdlconfig.sh
|
||||
- name: Verify sdl2.pc
|
||||
run: |
|
||||
export CC=arm-vita-eabi-gcc
|
||||
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
|
||||
cmake/test/test_pkgconfig.sh
|
||||
|
|
|
@ -1865,11 +1865,11 @@ elseif(WINDOWS)
|
|||
file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc)
|
||||
file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c)
|
||||
if(MINGW OR CYGWIN)
|
||||
list(APPEND SDL_LIBS "-lmingw32" "-mwindows")
|
||||
if(NOT SDL2_DISABLE_SDL2MAIN)
|
||||
list(APPEND SDL_CFLAGS "-Dmain=SDL_main")
|
||||
list(APPEND SDL_LIBS "-lSDL2main")
|
||||
list(INSERT SDL_LIBS 0 "-lSDL2main")
|
||||
endif(NOT SDL2_DISABLE_SDL2MAIN)
|
||||
list(INSERT SDL_LIBS 0 "-lmingw32" "-mwindows")
|
||||
endif()
|
||||
|
||||
elseif(APPLE)
|
||||
|
@ -2520,7 +2520,10 @@ elseif(PSP)
|
|||
pspaudio
|
||||
pspvram
|
||||
GL
|
||||
)
|
||||
)
|
||||
if(NOT SDL2_DISABLE_SDL2MAIN)
|
||||
list(INSERT SDL_LIBS 0 "-lSDL2main")
|
||||
endif(NOT SDL2_DISABLE_SDL2MAIN)
|
||||
|
||||
elseif(PS2)
|
||||
list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__")
|
||||
|
@ -2796,23 +2799,14 @@ Libs.private:")
|
|||
endif()
|
||||
|
||||
# Clean up the different lists
|
||||
if (VITA)
|
||||
listtostrrev(EXTRA_LIBS _EXTRA_LIBS "-l")
|
||||
set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
|
||||
list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
|
||||
listtostrrev(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
|
||||
set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
|
||||
listtostrrev(SDL_LIBS _SDL_LIBS)
|
||||
set(SDL_LIBS ${_SDL_LIBS})
|
||||
else()
|
||||
listtostr(EXTRA_LIBS _EXTRA_LIBS "-l")
|
||||
set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
|
||||
list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
|
||||
listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
|
||||
set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
|
||||
listtostr(SDL_LIBS _SDL_LIBS)
|
||||
set(SDL_LIBS ${_SDL_LIBS})
|
||||
endif()
|
||||
listtostr(EXTRA_LIBS _EXTRA_LIBS "-l")
|
||||
set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
|
||||
list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
|
||||
listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
|
||||
set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
|
||||
message("sdl_libs: ${SDL_LIBS}")
|
||||
listtostr(SDL_LIBS _SDL_LIBS)
|
||||
set(SDL_LIBS ${_SDL_LIBS})
|
||||
listtostr(SDL_CFLAGS _SDL_CFLAGS "")
|
||||
set(SDL_CFLAGS ${_SDL_CFLAGS})
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ macro(LISTTOSTR _LIST _OUTPUT)
|
|||
# Do not use string(REPLACE ";" " ") here to avoid messing up list
|
||||
# entries
|
||||
foreach(_ITEM ${${_LIST}})
|
||||
set(${_OUTPUT} "${_LPREFIX}${_ITEM} ${${_OUTPUT}}")
|
||||
set(${_OUTPUT} "${${_OUTPUT}} ${_LPREFIX}${_ITEM}")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
@ -88,7 +88,7 @@ macro(LISTTOSTRREV _LIST _OUTPUT)
|
|||
# Do not use string(REPLACE ";" " ") here to avoid messing up list
|
||||
# entries
|
||||
foreach(_ITEM ${${_LIST}})
|
||||
set(${_OUTPUT} "${${_OUTPUT}} ${_LPREFIX}${_ITEM}")
|
||||
set(${_OUTPUT} "${_LPREFIX}${_ITEM} ${${_OUTPUT}}")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
|
11
cmake/test/jni/Android.mk
Normal file
11
cmake/test/jni/Android.mk
Normal file
|
@ -0,0 +1,11 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := main_gui_androidmk
|
||||
LOCAL_SRC_FILES := ../main_gui.c
|
||||
LOCAL_SHARED_LIBRARIES += SDL2
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,SDL2main)
|
||||
$(call import-module,SDL2)
|
46
cmake/test/test_pkgconfig.sh
Executable file
46
cmake/test/test_pkgconfig.sh
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
if test "x$CC" = "x"; then
|
||||
CC=gcc
|
||||
fi
|
||||
|
||||
machine="$($CC -dumpmachine)"
|
||||
case "$machine" in
|
||||
*mingw* )
|
||||
EXEPREFIX=""
|
||||
EXESUFFIX=".exe"
|
||||
;;
|
||||
*android* )
|
||||
EXEPREFIX="lib"
|
||||
EXESUFFIX=".so"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
|
||||
;;
|
||||
* )
|
||||
EXEPREFIX=""
|
||||
EXESUFFIX=""
|
||||
;;
|
||||
esac
|
||||
|
||||
set -e
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
CFLAGS="$( pkg-config sdl2 --cflags )"
|
||||
LDFLAGS="$( pkg-config sdl2 --libs )"
|
||||
|
||||
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $CFLAGS $EXTRA_CFLAGS"
|
||||
link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
|
||||
|
||||
echo "-- CC: $CC"
|
||||
echo "-- CFLAGS: $CFLAGS"
|
||||
echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS"
|
||||
echo "-- LDFLASG: $LDFLAGS"
|
||||
echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
|
||||
|
||||
echo "-- COMPILE: $compile_cmd"
|
||||
echo "-- LINK: $link_cmd"
|
||||
|
||||
set -x
|
||||
|
||||
$compile_cmd
|
||||
$link_cmd
|
46
cmake/test/test_sdlconfig.sh
Executable file
46
cmake/test/test_sdlconfig.sh
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
if test "x$CC" = "x"; then
|
||||
CC=gcc
|
||||
fi
|
||||
|
||||
machine="$($CC -dumpmachine)"
|
||||
case "$machine" in
|
||||
*mingw* )
|
||||
EXEPREFIX=""
|
||||
EXESUFFIX=".exe"
|
||||
;;
|
||||
*android* )
|
||||
EXEPREFIX="lib"
|
||||
EXESUFFIX=".so"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
|
||||
;;
|
||||
* )
|
||||
EXEPREFIX=""
|
||||
EXESUFFIX=""
|
||||
;;
|
||||
esac
|
||||
|
||||
set -e
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
CFLAGS="$( sdl2-config --cflags )"
|
||||
LDFLAGS="$( sdl2-config --libs )"
|
||||
|
||||
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $EXTRA_CFLAGS"
|
||||
link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
|
||||
|
||||
echo "-- CC: $CC"
|
||||
echo "-- CFLAGS: $CFLAGS"
|
||||
echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS"
|
||||
echo "-- LDFLASG: $LDFLAGS"
|
||||
echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
|
||||
|
||||
echo "-- COMPILE: $compile_cmd"
|
||||
echo "-- LINK: $link_cmd"
|
||||
|
||||
set -x
|
||||
|
||||
$compile_cmd
|
||||
$link_cmd
|
|
@ -53,7 +53,7 @@ while test $# -gt 0; do
|
|||
@ENABLE_SHARED_TRUE@ ;;
|
||||
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs)
|
||||
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs)
|
||||
@ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL2[ $]#-Wl,-Bstatic -lSDL2 -Wl,-Bdynamic #g")
|
||||
@ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
@ENABLE_STATIC_TRUE@ echo -L@libdir@ $sdl_static_libs
|
||||
@ENABLE_STATIC_TRUE@ ;;
|
||||
*)
|
||||
|
|
Loading…
Reference in a new issue