Skip to content

Commit

Permalink
Merge branch 'SDL2' into MorphOS-SDL-2
Browse files Browse the repository at this point in the history
  • Loading branch information
BeWorld2018 committed Nov 15, 2023
2 parents b6df5a7 + cc7c0a2 commit 663f65c
Show file tree
Hide file tree
Showing 427 changed files with 3,676 additions and 2,860 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/vmactions.yml → .github/workflows/cpactions.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
name: Build (VM Actions)
name: Build (C/P Actions)

on: [push, pull_request]

jobs:
freebsd:
runs-on: macos-12
runs-on: ubuntu-latest
name: FreeBSD
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Build
uses: vmactions/freebsd-vm@v0
uses: cross-platform-actions/action@v0.19.1
with:
usesh: true
prepare: |
pkg install -y \
operating_system: freebsd
version: '13.2'
shell: bash
run: |
sudo pkg update
sudo pkg install -y \
gmake \
pkgconf \
libXcursor \
Expand All @@ -34,17 +37,15 @@ jobs:
libinotify \
alsa-lib \
jackit \
nas \
pipewire \
pulseaudio \
sndio \
dbus \
zh-fcitx \
ibus \
libsamplerate \
libudev-devd
run: |
mkdir build_autotools
(cd build_autotools && CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ../configure)
export CPPFLAGS="-I/usr/local/include"
export LDFLAGS="-L/usr/local/lib"
(cd build_autotools && ../configure --disable-static)
gmake -C build_autotools -j`sysctl -n hw.ncpu` V=1
20 changes: 12 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 }
- { name: Ubuntu 20.04 (CMake), os: ubuntu-20.04, shell: sh }
- { name: Ubuntu 20.04 (autotools), os: ubuntu-20.04, shell: sh, autotools: true }
#- { name: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true,
# source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'}
#- { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF',
# source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; '}
- { name: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true,
source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'}
- { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF',
source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; '}

- { name: Ubuntu 22.04 (CMake), os: ubuntu-22.04, shell: sh }
- { name: Ubuntu 22.04 (autotools), os: ubuntu-22.04, shell: sh, autotools: true }
Expand Down Expand Up @@ -70,10 +70,14 @@ jobs:
- name: Setup Intel oneAPI
if: matrix.platform.intel
run: |
# Setup oneAPI repo
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# Download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# Add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# Update package list
sudo apt-get update -y
# Install oneAPI
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ jobs:
os.makedirs(builddir)
with open(f"{ builddir }/CMakeLists.txt", "w") as f:
f.write(textwrap.dedent(f"""\
cmake_minimum_required(VERSION 3.0...3.5)
# Always build .PDB symbol file
set(CMAKE_POLICY_DEFAULT_CMP0141 "NEW" CACHE STRING "MSVC debug information format flags are selected by an abstraction")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format")
set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables")
set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries")
cmake_minimum_required(VERSION 3.0...3.25)
project(sdl_user)
add_subdirectory("{ srcdir }" SDL)
"""))
Expand Down
47 changes: 31 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,6 @@ if(SDL_LIBC)
string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER})
check_include_file("${_HEADER}" ${_HAVE_H})
endforeach()
check_include_file(linux/input.h HAVE_LINUX_INPUT_H)

set(STDC_HEADER_NAMES "stddef.h;stdarg.h;stdlib.h;string.h;stdio.h;wchar.h;float.h")
check_include_files("${STDC_HEADER_NAMES}" STDC_HEADERS)
Expand Down Expand Up @@ -1507,7 +1506,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
#ifndef EVIOCGNAME
#error EVIOCGNAME() ioctl not available
#endif
int main(int argc, char** argv) { return 0; }" HAVE_INPUT_EVENTS)
int main(int argc, char** argv) { return 0; }" HAVE_LINUX_INPUT_H)

if(LINUX)
check_c_source_compiles("
Expand Down Expand Up @@ -1543,11 +1542,11 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
}" HAVE_INPUT_WSCONS)
endif()

if(HAVE_INPUT_EVENTS)
if(HAVE_LINUX_INPUT_H)
set(SDL_INPUT_LINUXEV 1)
endif()

if(SDL_HAPTIC AND HAVE_INPUT_EVENTS)
if(SDL_HAPTIC AND HAVE_LINUX_INPUT_H)
set(SDL_HAPTIC_LINUX 1)
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c)
list(APPEND SOURCE_FILES ${HAPTIC_SOURCES})
Expand Down Expand Up @@ -1633,7 +1632,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c")
endif()

if(HAVE_INPUT_EVENTS)
if(HAVE_LINUX_INPUT_H)
list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c")
list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c")
endif()
Expand Down Expand Up @@ -1825,16 +1824,6 @@ elseif(WINDOWS)
#include <windows.h>
#include <xinput.h>
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H)
check_c_source_compiles("
#include <windows.h>
#include <xinput.h>
XINPUT_GAMEPAD_EX x1;
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_GAMEPAD_EX)
check_c_source_compiles("
#include <windows.h>
#include <xinput.h>
XINPUT_STATE_EX s1;
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_STATE_EX)
check_c_source_compiles("
#define COBJMACROS
#include <windows.gaming.input.h>
Expand Down Expand Up @@ -3108,9 +3097,17 @@ else()
set(sdl_static_libname "SDL2")
endif()

set(prefix ${CMAKE_INSTALL_PREFIX})
# CMAKE_PREFIX_PATH and CMAKE_INSTALL_FULL_BINDIR can be a non-absolute path
# when a master-project does e.g. `set(CMAKE_INSTALL_PREFIX "libs/SDL2" CACHE PATH "prefix" FORCE)`.
if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}")
endif()
if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_FULL_BINDIR}")
set(CMAKE_INSTALL_FULL_BINDIR "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_FULL_BINDIR}")
endif()
file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}")

set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
Expand Down Expand Up @@ -3354,6 +3351,12 @@ if(ANDROID)
endif()

if(APPLE)
cmake_push_check_state(RESET)
check_c_compiler_flag(-fobjc-arc COMPILER_SUPPORTS_FOBJC_ARC)
cmake_pop_check_state()
if(NOT COMPILER_SUPPORTS_FOBJC_ARC)
message(FATAL_ERROR "Compiler does not support -fobjc-arc: this is required on Apple platforms")
endif()
target_compile_options(sdl-build-options INTERFACE "-fobjc-arc")
endif()

Expand Down Expand Up @@ -3507,27 +3510,39 @@ if(NOT SDL2_DISABLE_INSTALL)
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(MSVC)
SDL_install_pdb(SDL2 "${CMAKE_INSTALL_BINDIR}")
endif()
endif()

if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN)
install(TARGETS SDL2main EXPORT SDL2mainTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(MSVC)
SDL_install_pdb(SDL2main "${CMAKE_INSTALL_LIBDIR}")
endif()
endif()

if(SDL_STATIC)
install(TARGETS SDL2-static EXPORT SDL2staticTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(MSVC)
SDL_install_pdb(SDL2-static "${CMAKE_INSTALL_LIBDIR}")
endif()
endif()

if(SDL_TEST)
install(TARGETS SDL2_test EXPORT SDL2testTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(MSVC)
SDL_install_pdb(SDL2_test "${CMAKE_INSTALL_LIBDIR}")
endif()
endif()

##### Export files #####
Expand Down
6 changes: 3 additions & 3 deletions VisualC-GDK/tests/testgdk/src/testgdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ main(int argc, char *argv[])

/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO);
if (state == NULL) {
if (!state) {
return 1;
}

Expand Down Expand Up @@ -446,7 +446,7 @@ main(int argc, char *argv[])
/* Create the windows, initialize the renderers, and load the textures */
sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
if (sprites == NULL) {
if (!sprites) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
}
Expand All @@ -461,7 +461,7 @@ main(int argc, char *argv[])

soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");

if (soundname == NULL) {
if (!soundname) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
quit(1);
}
Expand Down
3 changes: 2 additions & 1 deletion VisualC/tests/testautomation/testautomation.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@
<ClCompile Include="..\..\..\test\testautomation_syswm.c" />
<ClCompile Include="..\..\..\test\testautomation_timer.c" />
<ClCompile Include="..\..\..\test\testautomation_video.c" />
<ClCompile Include="..\..\..\test\testautomation_subsystems.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\test\testautomation_suites.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
9 changes: 9 additions & 0 deletions WhatsNew.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@

This is a list of major changes in SDL's version history.

---------------------------------------------------------------------------
2.30.0:
---------------------------------------------------------------------------

Xbox:
* Added the function SDL_GDKGetDefaultUser()


---------------------------------------------------------------------------
2.28.2:
---------------------------------------------------------------------------

General:
* Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers

Expand Down
10 changes: 5 additions & 5 deletions Xcode-iOS/Demos/src/accelerometer.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ initializeTextures(SDL_Renderer *renderer)

/* load the ship */
bmp_surface = SDL_LoadBMP("ship.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not ship.bmp");
}
/* set blue to transparent on the ship */
Expand All @@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer)

/* create ship texture from surface */
ship = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (ship == NULL) {
if (!ship) {
fatalError("could not create ship texture");
}
SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
Expand All @@ -140,12 +140,12 @@ initializeTextures(SDL_Renderer *renderer)

/* load the space background */
bmp_surface = SDL_LoadBMP("space.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load space.bmp");
}
/* create space texture from surface */
space = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (space == NULL) {
if (!space) {
fatalError("could not create space texture");
}
SDL_FreeSurface(bmp_surface);
Expand Down Expand Up @@ -179,7 +179,7 @@ main(int argc, char *argv[])
printf("There are %d joysticks available\n", SDL_NumJoysticks());
printf("Default joystick (index 0) is %s\n", SDL_JoystickName(0));
accelerometer = SDL_JoystickOpen(0);
if (accelerometer == NULL) {
if (!accelerometer) {
fatalError("Could not open joystick (accelerometer)");
}
printf("joystick number of axis = %d\n",
Expand Down
2 changes: 1 addition & 1 deletion Xcode-iOS/Demos/src/fireworks.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ initializeTexture()
to format passed into OpenGL */

bmp_surface = SDL_LoadBMP("stroke.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load stroke.bmp");
}

Expand Down
4 changes: 2 additions & 2 deletions Xcode-iOS/Demos/src/happy.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ initializeTexture(SDL_Renderer *renderer)
SDL_Surface *bmp_surface;
/* load the bmp */
bmp_surface = SDL_LoadBMP("icon.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load bmp");
}
/* set white to transparent on the happyface */
Expand All @@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer)

/* convert RGBA surface to texture */
texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (texture == NULL) {
if (!texture) {
fatalError("could not create texture");
}
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
Expand Down
4 changes: 2 additions & 2 deletions Xcode-iOS/Demos/src/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ loadFont(void)
{
SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp");

if (surface == NULL) {
if (!surface) {
printf("Error loading bitmap: %s\n", SDL_GetError());
return 0;
} else {
Expand All @@ -183,7 +183,7 @@ loadFont(void)
SDL_BlitSurface(surface, NULL, converted, NULL);
/* create our texture */
texture = SDL_CreateTextureFromSurface(renderer, converted);
if (texture == NULL) {
if (!texture) {
printf("texture creation failed: %s\n", SDL_GetError());
} else {
/* set blend mode for our texture */
Expand Down
4 changes: 2 additions & 2 deletions Xcode-iOS/Demos/src/rectangles.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ main(int argc, char *argv[])

/* create window and renderer */
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
if (window == NULL) {
if (!window) {
fatalError("Could not initialize Window");
}
renderer = SDL_CreateRenderer(window, -1, 0);
if (renderer == NULL) {
if (!renderer) {
fatalError("Could not create renderer");
}

Expand Down
Loading

0 comments on commit 663f65c

Please sign in to comment.