Commit Graph

759 Commits (2f1f55aeb16a34c903f7d82dac9f4e73d12aae17)

Author SHA1 Message Date
Sam Lantinga d3930893aa KMSDRM is now a dependent option 2024-02-22 06:25:33 -08:00
Anonymous Maarten 7b1127d1fe cmake: Apple did not test SDL_CAMERA before adding camera support 2024-02-22 07:18:22 -05:00
Anonymous Maarten e176626bac cmake: only enable SDL drivers when its subsystem is enabled 2024-02-22 07:18:22 -05:00
Anonymous Maarten 99cef7e13b cmake: check SDL subsystem dependencies (and include Camera) 2024-02-22 07:18:22 -05:00
Anonymous Maarten 9a44d44cee cmake: build Windows mediafoundation SDL_camera support 2024-02-22 07:18:22 -05:00
Anonymous Maarten 7eca84d57e cmake: don't use target_compile_features when the CMake thinks the compiler does not support it
This happens when using an older CMake with a new LLVM toolchain (e.g. Android ndk)
2024-02-21 00:51:40 +01:00
Ryan C. Gordon 67708f9110 camera: Emscripten support!
This also adds code to deal with waiting for the user to approve camera
access, reworks testcameraminimal to use main callbacks, etc.
2024-02-20 15:56:26 -05:00
Ryan C. Gordon cb10c80aaf camera: Reworked to operate with a driver interface, like other subsystems. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon 7ae955ce68 camera: Renamed everything from "video capture" to "camera", wired to CMake. 2024-02-20 15:56:26 -05:00
Ryan C. Gordon f49ce4a15d camera: Renamed "video_capture" files to "camera" and moved to own subdir. 2024-02-20 15:56:26 -05:00
Sam Lantinga d6a48e4958 Don't use the system iconv on Apple mobile platforms
Fixes https://github.com/libsdl-org/SDL/issues/8964
2024-02-01 15:53:27 -08:00
Sam Lantinga 8f20ef5b43 Re-enable C runtime with Mingw, and disable the problematic math test 2024-01-21 06:55:29 -08:00
Sam Lantinga 1f177be1e4 Disable the Mingw C runtime by default
Mingw seems to have a bad pow implementation in the C runtime:
'Pow(-72.300000,12.000000), expected [20401381050275984310272.000000], got 20401381050275996893184.000000': Failed
2024-01-21 06:55:29 -08:00
Sam Lantinga 5e70ee29cc Build SDL with the static C runtime on Visual Studio 2024-01-21 06:55:29 -08:00
Sam Lantinga 5db543a66a Just use the khronos headers for the checks that need them 2024-01-19 23:55:05 -08:00
Sam Lantinga 116c60c5b0 Run EGL/GLES cmake tests with the Khronos headers available 2024-01-19 22:31:40 -08:00
Anonymous Maarten 49adb23ad9 Build yuv_rgb_lsx.c with -mlsx 2024-01-18 10:59:13 -08:00
Sam Lantinga f224af5ac5 Updated Haptic API for SDL 3.0 conventions
Also removed the XInput haptic support since using the haptic API for rumble is no longer supported.
2024-01-18 03:26:11 -08:00
Sam Lantinga 130b361904 Removed SDL_MISC_DISABLED 2024-01-17 09:24:04 -08:00
Sam Lantinga 20fa5e6ad0 Removed SDL_LOCALE_DISABLED 2024-01-17 09:24:04 -08:00
Sam Lantinga 6efadfdb77 Removed SDL_FILESYSTEM_DISABLED 2024-01-17 09:24:04 -08:00
Sam Lantinga 3d951134a3 Removed SDL_FILE_DISABLED
This didn't actually do anything except break functionality on Apple platforms
2024-01-17 09:24:04 -08:00
Sam Lantinga ac367be171 Updated CMakeLists.txt now that timers and threads can't be disabled 2024-01-17 09:24:04 -08:00
Sam Lantinga 31f34e9504 Removed SDL_ATOMIC_DISABLED
It turns out that because we redefine SDL functions internally, it is safe to call SDL mutex functions while initializing the jump table
2024-01-17 09:24:04 -08:00
Sam Lantinga 6e1b11368d Removed SDL_CPUINFO_DISABLED
CPU info is a core part of the SDL API, and shouldn't be disabled
2024-01-17 09:24:04 -08:00
Sam Lantinga 52d6587084 Removed SDL_EVENTS_DISABLED
Events are a core part of the SDL API, and shouldn't be disabled
2024-01-17 09:24:04 -08:00
Sam Lantinga ba02722755 Removed SDL_LOADSO_DISABLED
Loading shared libraries is core functionality on platforms that support it.
2024-01-17 09:24:04 -08:00
Sam Lantinga 0d7df16812 Timers are a required platform feature
Many SDL subsystems depend on being able to see time passing. If you are porting to a new platform, you'll need to fill in a timer implementation as part of the initial port.

Fixes https://github.com/libsdl-org/SDL/issues/8850
2024-01-16 20:50:08 -08:00
Anonymous Maarten 5cbdeab799 Rename SDL_mslibc_x64.asm -> SDL_mslibc_x64.masm
The .masm suffix should give meson sufficient info about the file
being MASM instead of NASM/YASM.
2024-01-04 17:46:07 +01:00
Julian Uy 10a8b750a0 Use common generic syscond for platforms with no cond implementation 2023-12-24 06:52:42 -08:00
Sam Lantinga ac0751a652 Added SDL_strnstr() 2023-12-03 15:06:46 -08:00
Anonymous Maarten 5772e00c3f cmake: disable oss by default on OpenBSD, not FreeBSD
This fixes ed3fad1880
2023-11-28 16:45:33 +01:00
Anonymous Maarten ed3fad1880 cmake: disable oss by default on Linux, NetBSD and FreeBSD 2023-11-27 22:04:04 +01:00
Ozkan Sezer d486de6349 cmake: fixed iconv detection test program
Fixes https://github.com/libsdl-org/SDL/issues/8614
2023-11-26 01:55:28 +03:00
Anonymous Maarten e548044a82 ci: add NetBSD to test matrix
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2023-11-24 21:34:56 +01:00
Ozkan Sezer 42c8366fdc revise iconv detection:
- check libiconv with a linkage test with iconv.h included
- check libc iconv with a linkage test with iconv.h included
  and LIBICONV_PLUG defined (in case libiconv header is in
  include path)
- add new configuration option to prefer iconv from libiconv,
  if available, over the libc version: SDL_LIBICONV, defaults
  to disabled.
- remove FindIconv + pkg_check_modules for iconv, and use our
  manual iconv finding only
- change FreeBSD specific LIBICONV_PLUG define in SDL_iconv.c
  to configuration result.
2023-11-23 04:30:56 +03:00
Anonymous Maarten a45b371de0 cmake: create and install SDL3::Jar target for Android 2023-11-23 02:13:08 +01:00
Ozkan Sezer d1def7f033 cmake: add openbsd wscons sources to build, if supported 2023-11-22 06:21:28 +03:00
Sylvain 59f93e20a7 Add SDL Video Capture, with back-end for linux/macos/ios/android 2023-11-09 08:36:23 -08:00
Anonymous Maarten a6541166bc cmake: also install pdb files of static libraries 2023-11-09 02:17:07 +01:00
Anonymous Maarten 2e3f574f8f cmake: don't add the C runtime library to the .obj file (when using MSVC)
Using /Zl, the obj files will no longer add a link requirement to the C
runtime libraries. Meanwhile, also add /NODEFAULTLIB for non-UWP MSVC
toolchains.

Because /Zl is a compile option, it can also be used when building a
static SDL3 library, and SDL3_test.
2023-11-09 02:10:58 +01:00
Sam Lantinga 415283ef38 Fixed checking for linux/input.h 2023-11-08 00:13:16 -08:00
Frank Praznik 1a57f6bb29 wayland: Remove QtWayland extensions
These were added a very long time ago and seem to serve no purpose now, as the functionality they provided is now in core Wayland protocols, current information on their usage and status is nonexistent, no modern compositor seems to support them, and the code paths are untested and subject to bit-rot at this point. It also causes duplicate symbol issues when statically linking an application to both Qt and SDL.
2023-11-07 11:00:32 -05:00
Sam Lantinga d3f2eb2aba Use XINPUT_STATE instead of XINPUT_STATE_EX (thanks Andrew!)
XINPUT_STATE_EX isn't actually a thing, we can just use the normal XINPUT_STATE

Fixes https://github.com/libsdl-org/SDL/issues/2797

(cherry picked from commit e8f4045d0bccacbf8f4b716d0dde17140e9f2cc4)
2023-11-04 22:28:09 -07:00
Anonymous Maarten 6cf84e2c5b cmake: fold HAVE_INPUT_EVENTS into HAVE_LINUX_INPUT_H 2023-11-02 21:31:37 +01:00
Sam Lantinga 618d15bce6 Fixed typo 2023-11-02 10:33:44 -07:00
Ryan C. Gordon 9c664b0062
main: Added _optional_ callback entry points.
This lets apps optionally have a handful of callbacks for their entry points instead of a single main function. If used, the actual main/SDL_main/whatever entry point will be implemented in the single-header library SDL_main.h and the app will implement four separate functions:

First:

    int SDL_AppInit(int argc, char **argv);

This will be called once before anything else. argc/argv work like they always do. If this returns 0, the app runs. If it returns < 0, the app calls SDL_AppQuit and terminates with an exit code that reports an error to the platform. If it returns > 0, the app calls SDL_AppQuit and terminates with an exit code that reports success to the platform. This function should not go into an infinite mainloop; it should do any one-time startup it requires and then return.

Then:

     int SDL_AppIterate(void);

This is called over and over, possibly at the refresh rate of the display or some other metric that the platform dictates. This is where the heart of your app runs. It should return as quickly as reasonably possible, but it's not a "run one memcpy and that's all the time you have" sort of thing. The app should do any game updates, and render a frame of video. If it returns < 0, SDL will call SDL_AppQuit and terminate the process with an exit code that reports an error to the platform. If it returns > 0, the app calls SDL_AppQuit and terminates with an exit code that reports success to the platform. If it returns 0, then SDL_AppIterate will be called again at some regular frequency. The platform may choose to run this more or less (perhaps less in the background, etc), or it might just call this function in a loop as fast as possible. You do not check the event queue in this function (SDL_AppEvent exists for that).

Next:

    int SDL_AppEvent(const SDL_Event *event);

This will be called once for each event pushed into the SDL queue. This may be called from any thread, and possibly in parallel to SDL_AppIterate. The fields in event do not need to be free'd (as you would normally need to do for SDL_EVENT_DROP_FILE, etc), and your app should not call SDL_PollEvent, SDL_PumpEvent, etc, as SDL will manage this for you. Return values are the same as from SDL_AppIterate(), so you can terminate in response to SDL_EVENT_QUIT, etc.

Finally:

    void SDL_AppQuit(void);

This is called once before terminating the app--assuming the app isn't being forcibly killed or crashed--as a last chance to clean up. After this returns, SDL will call SDL_Quit so the app doesn't have to (but it's safe for the app to call it, too). Process termination proceeds as if the app returned normally from main(), so atexit handles will run, if your platform supports that.

The app does not implement SDL_main if using this. To turn this on, define SDL_MAIN_USE_CALLBACKS before including SDL_main.h. Defines like SDL_MAIN_HANDLED and SDL_MAIN_NOIMPL are also respected for callbacks, if the app wants to do some sort of magic main implementation thing.

In theory, on most platforms these can be implemented in the app itself, but this saves some #ifdefs in the app and lets everyone struggle less against some platforms, and might be more efficient in the long run, too.

On some platforms, it's possible this is the only reasonable way to go, but we haven't actually hit one that 100% requires it yet (but we will, if we want to write a RetroArch backend, for example).

Using the callback entry points works on every platform, because on platforms that don't require them, we can fake them with a simple loop in an internal implementation of the usual SDL_main.

The primary way we expect people to write SDL apps is with SDL_main, and this is not intended to replace it. If the app chooses to use this, it just removes some platform-specific details they might have to otherwise manage, and maybe removes a barrier to entry on some future platform.

Fixes #6785.
Reference PR #8247.
2023-11-01 18:40:41 -04:00
Anonymous Maarten 5d95cbde37 cmake: reset check state before testing -fobjc-arc 2023-10-30 21:14:39 +01:00
Anonymous Maarten f18120c83c cmake: check -fobjc-arc compiler flag on Apple platforms 2023-10-30 19:59:28 +01:00
Anonymous Maarten 6127ac0871 Use SDL_DISABLE_ALLOCA instead of HAVE_ALLOCA in SDL_stdinc.h 2023-10-28 18:54:12 +02:00