Commit Graph

376 Commits

Author SHA1 Message Date
Sam Lantinga
7fe30b04bf Revert "cmake: rpi videocore needs brcmegl as well"
This reverts commit cd31381185.

Linking libbrcmEGL.so explicitly breaks (causes segmentation faults) in other code that links and runs the X11 EGL.

Reopens https://github.com/libsdl-org/SDL/issues/14749

At least in my Raspbian Stretch build environment, the vc_dispmanx symbols that were missing are found in libbcm_host.so, which is linked by default.
2026-01-22 17:53:47 -08:00
Anonymous Maarten
f3a3c803ca cmake: avoid re-running checks by wrapping check_c_compiler_flag 2026-01-19 22:18:24 +01:00
Anonymous Maarten
c34b67250c cmake: use readelf to extract soname from shared elf library 2026-01-19 22:18:24 +01:00
Anonymous Maarten
8a62d6d406 cmake: don't set <PackageName>_FOUND to FALSE before pkg_search_modules 2026-01-19 22:18:24 +01:00
Brad Smith
d4d66e77cc cmake: Replace sys/types.h usage with stdint.h with CheckUSBHID 2026-01-18 16:18:26 -08:00
Brad Smith
410a35fbee cmake: Fix header detection with CheckUSBHID
Make use of check_include_files to be able to also include
stdint.h when checking for the headers. Fixes detection of
usbhid.h on OpenBSD.

/usr/include/usbhid.h:40:2: error: unknown type name 'uint32_t'
   40 |         uint32_t _usage_page;
      |         ^
2026-01-18 10:29:51 -08:00
bubbleguuum
7690e00f42 x11: fix compilation failure on older XInput2
Older versions of XInput2 do not declare struct XIGesturePinchEvent
in XInput2.h, causing compilation failure in SDL_x11xinput2.c

Check for XIGesturePinchEvent in the test for enabling
SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_GESTURE
2026-01-06 06:49:38 -08:00
Anonymous Maarten
cd31381185 cmake: rpi videocore needs brcmegl as well 2026-01-05 23:45:32 +01:00
Joshua Vandaële
4a29b6a651 Fix dynamic library handling for LibUSB
`target_get_dynamic_library` should not be called if `SDL_HIDAPI_LIBUSB_SHARED` is set to OFF, it otherwise causes a warning at best, or a build failure if libusb is provided by a parent project and not installed on the system
2026-01-02 07:39:30 -08:00
Anonymous Maarten
d7a2d007d0 Remove superfluous comma from SDL_missing_dependency calls 2025-12-31 04:23:27 +01:00
Fredrik Foss-Indrehus
bdb72bb3f0 cmake: add reftable ref storage support to GetGitRevisionDescription
The script assumed Git's traditional loose refs or packed-refs format.
When cloning with extensions.refstorage=reftable, neither .git/refs/*
nor .git/packed-refs exist, causing cmake configuration to fail.

Fall back to git rev-parse when file-based ref lookup fails.
2025-12-11 16:13:49 -08:00
eafton
36976ecb43 X11TK: Introduce Thai support and rewrite/cleanup messagebox positioning code (#14474) 2025-11-20 15:26:46 -08:00
tsst-tsst
d4bef0d5ba Add support for tcc to cmake (#14464)
This PR adds support to the cmake build scripts so to allow building SDL with the Tiny C Compiler (tcc).

TinyCC supports the subset of C99 used by SDL and will complete the build once the --version-script linker flag is removed. The changes have been tested with various build configurations, including X11 and Wayland, and using tcc version 0.9.28rc 2025-10-27 mob@f4e01bfc on x86_64 Linux.
2025-11-15 11:24:15 -08:00
Donovan Maas
879f081de3 Improve OpenGL detection checks in CMake (#14443)
The OpenGL headers are not always implicitly available, so this improves the check by calling `find_package` and using the `OPENGL_INCLUDE_DIRS` or `OPENGL_INCLUDE_DIR` var for the `check_c_source_compiles` test.
The minimum CMake version currently set is 3.16, `OPENGL_INCLUDE_DIRS` was only added in 3.29, so the code is set to choose `OPENGL_INCLUDE_DIRS` if it exists. If the minimum CMake version is ever set to >= 3.29 this check can be removed and just the `OPENGL_INCLUDE_DIRS` variable can be chosen.
2025-11-14 00:18:33 -08:00
Ryan C. Gordon
2382d3831c cmake: List enabled camera backends. 2025-11-09 12:05:05 -05:00
Ryan C. Gordon
f8a959da05 cmake: Add some symbols to the Emscripten preseed cache. 2025-11-06 13:41:55 -05:00
Sam Lantinga
4560fae07e Fail configuration if X11 dependency packages aren't available
It happens fairly often that people enable X11 support but don't install the extension libraries that SDL depends on. This makes those required if not explicitly disabled, which should help prevent accidentally broken builds.
2025-11-03 13:01:41 -08:00
Anonymous Maarten
5ad12c47dc cmake: make sure VARIABLE of check_linker_supports_version_file ends up in cache 2025-10-27 03:01:57 +01:00
Sam Lantinga
1506c40ec8 Fixed line endings in FindLibUSB.cmake 2025-10-24 10:48:25 -07:00
Dmitry Marakasov
5c56cf110b Add libusb library name for detection on FreeBSD 2025-10-24 10:41:08 -07:00
Anonymous Maarten
c5b0187fc9 cmake: fix typo
INTERFACE_COMPILE_COMPILE_OPTIONS -> INTERFACE_COMPILE_OPTIONS
2025-10-22 19:00:41 +02:00
Sylvain Becker
71bf56c9e4 Add SDL Pinch events (#9445) 2025-10-12 14:44:23 -07:00
Anonymous Maarten
40d8ec4be9 cmake: cannot use CheckSymbolExists for _alloca
_alloca is an intrinsic function on MSVC, which means it has no address and is no symbol.
Hence CheckSymbolExists will always fail finding it.
2025-10-10 17:31:33 +02:00
Anonymous Maarten
0f9d032885 ci+docs: add fribidi dependency 2025-10-04 21:25:45 +02:00
eafton
c2429e85ec X11TK: Add Arabic/Hebrew/Farsi support by increasing font size slightly and using FriBidi. (#14134) 2025-10-03 19:08:24 -07:00
Anonymous Maarten
0bbfbf5b37 cmake: use correct suffix in PkgConfigHelper 2025-10-03 20:58:45 +02:00
Anonymous Maarten
23646aed53 cmake: quietly look for SDL3-static and SDL3_test framework in SDL3Config.cmake 2025-10-03 19:14:40 +02:00
Anonymous Maarten
fd4c2f8cfd ci: build testffmpeg on MinGW (msys2) build bots 2025-09-30 17:42:11 +02:00
Anonymous Maarten
e62a6e9729 cmake: detect RISC-V architectures
This is only used for naming binary CPack artifacts
2025-09-26 21:39:06 +02:00
Ryan C. Gordon
de1b52f161 cmake: Adjust Enabled Backends list for render drivers to catch opengles2.
This happens to work here because we don't have anything too complex, afaik.
Rejecting strings with underscores was crucial for other things, like video
with all its X11 variables, so this can't be applied to the other subsystems.

(Also, renaming the `SDL_VIDEO_RENDER_OGL_ES2` variable might be nice, too,
but let's keep this simple for now.)

Fixes #13938.
2025-09-13 11:28:57 -04:00
Ryan C. Gordon
1c784c453d cmake: Report enabled subsystem backends in a compact form. (#13926)
Looks like this:

```
-- Enabled backends:
--   Video drivers: dummy kmsdrm(dynamic) offscreen wayland(dynamic) x11(dynamic)
--   X11 libraries: xcursor xdbe xfixes xinput2 xrandr xscrnsaver xshape xsync xtest
--   Render drivers: gpu ogl vulkan
--   GPU drivers: vulkan
--   Audio drivers: alsa(dynamic) disk dummy jack(dynamic) pipewire(dynamic) pulseaudio(dynamic) sndio(dynamic)
--   Joystick drivers: hidapi linux virtual
```

Fixes #7922.

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2025-09-12 14:59:43 -04:00
nightmareci
2f5bc17ea6 Fix support for Windows XP and up (#13904) 2025-09-08 13:00:26 -07:00
Ozkan Sezer
83bb0f9105 cmake: simd detection clean-up for Apple multi-arch configs. 2025-09-02 22:34:10 +03:00
Anonymous Maarten
e15e2808f2 cmake: use 'TargetConditionals.h' on Apple for SIMD tests 2025-09-02 21:29:50 +02:00
Joshua T. Fisher
dfb343a5f8 cmake: use CONFIGURE_DEPENDS flag in GLOBs 2025-08-28 01:10:16 +00:00
Joshua T. Fisher
f053be22be Improve CMake for IDE Projects (Visual Studio) (#13704) 2025-08-14 08:19:14 -07:00
Anonymous Maarten
de742e9f9a cmake: detect RISCOS platform before GNU/Hurd 2025-08-08 12:47:09 -07:00
Pino Toscano
171885010d Add GNU/Hurd as platform
SDL has been building on GNU/Hurd for a long time, using either drivers
based on external libraries (e.g. X11, pulseaudio, sndio, etc) or dummy
drivers. This commit introduces it explicitly as platform, so it can be
recognized, and tweaked as needed. In particular:
- introduce the SDL_PLATFORM_HURD define
- tighten/improve the platform detection in cmake, and use "Hurd" as
  identifier
- return the platform name in SDL_GetPlatform()
- tweak the CFLAGS/LDFLAGS so pthreads can be used properly
- implement SDL_GetExeName(), using /proc/self/exe as provided by the
  basic Linux-like procfs
- enable GLES 2 in tests (mostly for consistency with Linux)
2025-08-08 12:47:09 -07:00
Frank Praznik
f439e44771 x11: Modernize and optimize key handling
- Use modern Xkb functions where appropriate and cleanly separate the modern and legacy paths.
- Remove the deprecated XKeycodeToKeysym function in favor of directly querying the keymap on the legacy path.
- Look up virtual modifiers by name on the Xkb path to better handle remapping (equivalent to the modifier handling under Wayland).
- Optimize keymap creation on the Xkb path to cut keymap build times and enable fast group switching  (equivalent to keymap handling on Wayland).
- Enable and handle Xkb events to handle changes to the group, mapping, and modifier states. This is more reliable than using the legacy events (group changes may not arrive if the window lacks pointer focus), and better handles cases where modifiers are latched, locked, or activated externally rather than physically pressed.
2025-08-06 13:35:32 -07:00
Frank Praznik
483b8d4d98 x11: Implement precision/pixel scrolling
Manual rebase of #5382 with some changes for SDL3 (thanks @wooosh).
2025-08-04 12:50:06 -04:00
Ozkan Sezer
f241e8e8fd windows: replace shobjidl_core.h usage with shobjidl.h except for when targeting xbox
Closes https://github.com/libsdl-org/SDL/pull/13571
2025-08-01 17:11:49 -07:00
Anonymous Maarten
89eef1bd34 cmake: Android always needs a native HIDAPI implementation 2025-06-26 22:34:30 +00:00
Edu García
d9af41b5ac cmake: more private definitions 2025-06-06 10:29:20 -07:00
Frank Praznik
c764e8864b wayland: Update xkbcommon to avoid using deprecated modifier names
xkbcommon 1.10.0 declared certain modifier names to be deprecated, and the current plan is to remove them in 1.12.0. Use the new recommended names and modifier mask retrieval function when building against version 1.10.0 and higher.
2025-05-31 13:40:58 -04:00
Michael Fitzmayer
7ae64592c9 Restore support for the Nokia N-Gage (#12148) 2025-05-22 11:07:22 -07:00
Anonymous Maarten
ebb52973e1 cmake: make SDL_CPU_xxx variable visible when using CMAKE_OSX_ARCHITECTURES 2025-04-03 19:07:24 +02:00
Max Bachmann
b4af01cd08 only build static library in some feature tests
This fixes the feature detection in cases where linking the final executable would fail.
This is fine since SDL only opens these libraries using dlopen as well.
2025-04-03 16:45:48 +00:00
Anonymous Maarten
87d6beb895 Rename cmake/sdltargets.cmake -> cmake/sdlcommands.cmake 2025-04-02 23:55:29 +02:00
Rémy Tassoux
7a10fcdccc Add progress bar support for Windows (#12530) 2025-03-22 08:04:10 -07:00
Dragon-Baroque
07e4dea693 The posix4 library has been merged into the libc library 2025-03-19 16:57:45 -07:00