Commit Graph

307 Commits

Author SHA1 Message Date
Anonymous Maarten
4162bddca7 cmake: fix configuration with -DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON 2024-10-15 19:09:54 +02:00
Anonymous Maarten
45dfdfbb7b Add parametrized build script
[ci skip]
2024-10-14 21:30:48 +02:00
Anonymous Maarten
3166a05c18 cmake: don't prepend absolute CMAKE_INSTALL_{INCLUDE,LIB}DIR with ${prefix} 2024-09-14 16:21:42 +02:00
Ryan C. Gordon
154452a726 winrt: Removed WinRT/Windows Phone/UWP support.
Fixes #10724.
2024-09-06 13:28:39 -04:00
Anonymous Maarten
baa1a5e2f4 Add SDL_strpbrk 2024-09-06 01:35:43 +02:00
Sam Lantinga
f08ac438ed Use stdbool for SDL_bool
This helps the compiler warn people when they're doing something like "if (SDL_Init(0) < 0)"
2024-08-27 10:31:46 -07:00
Sam Lantinga
9ff3446f03 Use SDL_bool instead an int return code in the SDL API
Most SDL functions used to indicate success or failure using an int return code. These functions have been changed to return SDL_bool.

Here is a coccinelle patch to change code that previously compared the return value to 0 and changes it to a boolean test:
@ bool_return_type  @
identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAlternateImage|SDL_AddVulkanRenderSemaphores|SDL_BindAudioStream|SDL_BindAudioStreams|SDL_BlitSurface|SDL_BlitSurface9Grid|SDL_BlitSurfaceScaled|SDL_BlitSurfaceTiled|SDL_BlitSurfaceTiledWithScale|SDL_BlitSurfaceUnchecked|SDL_BlitSurfaceUncheckedScaled|SDL_CaptureMouse|SDL_ClearAudioStream|SDL_ClearClipboardData|SDL_ClearComposition|SDL_ClearError|SDL_ClearProperty|SDL_ClearSurface|SDL_CloseIO|SDL_CloseStorage|SDL_ConvertAudioSamples|SDL_ConvertEventToRenderCoordinates|SDL_ConvertPixels|SDL_ConvertPixelsAndColorspace|SDL_CopyFile|SDL_CopyProperties|SDL_CopyStorageFile|SDL_CreateDirectory|SDL_CreateStorageDirectory|SDL_CreateWindowAndRenderer|SDL_DateTimeToTime|SDL_DestroyWindowSurface|SDL_DetachVirtualJoystick|SDL_DisableScreenSaver|SDL_EnableScreenSaver|SDL_EnumerateDirectory|SDL_EnumerateProperties|SDL_EnumerateStorageDirectory|SDL_FillSurfaceRect|SDL_FillSurfaceRects|SDL_FlashWindow|SDL_FlipSurface|SDL_FlushAudioStream|SDL_FlushRenderer|SDL_GL_DestroyContext|SDL_GL_GetAttribute|SDL_GL_GetSwapInterval|SDL_GL_LoadLibrary|SDL_GL_MakeCurrent|SDL_GL_SetAttribute|SDL_GL_SetSwapInterval|SDL_GL_SwapWindow|SDL_GetAudioDeviceFormat|SDL_GetAudioStreamFormat|SDL_GetCameraFormat|SDL_GetClosestFullscreenDisplayMode|SDL_GetCurrentRenderOutputSize|SDL_GetCurrentTime|SDL_GetDXGIOutputInfo|SDL_GetDateTimeLocalePreferences|SDL_GetDisplayBounds|SDL_GetDisplayUsableBounds|SDL_GetGDKDefaultUser|SDL_GetGDKTaskQueue|SDL_GetGamepadSensorData|SDL_GetGamepadTouchpadFinger|SDL_GetHapticEffectStatus|SDL_GetJoystickBall|SDL_GetMasksForPixelFormat|SDL_GetPathInfo|SDL_GetRectUnion|SDL_GetRectUnionFloat|SDL_GetRenderClipRect|SDL_GetRenderColorScale|SDL_GetRenderDrawBlendMode|SDL_GetRenderDrawColor|SDL_GetRenderDrawColorFloat|SDL_GetRenderLogicalPresentation|SDL_GetRenderLogicalPresentationRect|SDL_GetRenderOutputSize|SDL_GetRenderSafeArea|SDL_GetRenderScale|SDL_GetRenderVSync|SDL_GetRenderViewport|SDL_GetSensorData|SDL_GetStorageFileSize|SDL_GetStoragePathInfo|SDL_GetSurfaceAlphaMod|SDL_GetSurfaceBlendMode|SDL_GetSurfaceClipRect|SDL_GetSurfaceColorKey|SDL_GetSurfaceColorMod|SDL_GetTextInputArea|SDL_GetTextureAlphaMod|SDL_GetTextureAlphaModFloat|SDL_GetTextureBlendMode|SDL_GetTextureColorMod|SDL_GetTextureColorModFloat|SDL_GetTextureScaleMode|SDL_GetTextureSize|SDL_GetWindowAspectRatio|SDL_GetWindowBordersSize|SDL_GetWindowMaximumSize|SDL_GetWindowMinimumSize|SDL_GetWindowPosition|SDL_GetWindowRelativeMouseMode|SDL_GetWindowSafeArea|SDL_GetWindowSize|SDL_GetWindowSizeInPixels|SDL_GetWindowSurfaceVSync|SDL_HideCursor|SDL_HideWindow|SDL_Init|SDL_InitHapticRumble|SDL_InitSubSystem|SDL_LoadWAV|SDL_LoadWAV_IO|SDL_LockAudioStream|SDL_LockProperties|SDL_LockSurface|SDL_LockTexture|SDL_LockTextureToSurface|SDL_MaximizeWindow|SDL_MinimizeWindow|SDL_MixAudio|SDL_OpenURL|SDL_OutOfMemory|SDL_PauseAudioDevice|SDL_PauseAudioStreamDevice|SDL_PauseHaptic|SDL_PlayHapticRumble|SDL_PremultiplyAlpha|SDL_PremultiplySurfaceAlpha|SDL_PushEvent|SDL_PutAudioStreamData|SDL_RaiseWindow|SDL_ReadStorageFile|SDL_ReadSurfacePixel|SDL_ReadSurfacePixelFloat|SDL_RegisterApp|SDL_ReloadGamepadMappings|SDL_RemovePath|SDL_RemoveStoragePath|SDL_RemoveTimer|SDL_RenamePath|SDL_RenameStoragePath|SDL_RenderClear|SDL_RenderCoordinatesFromWindow|SDL_RenderCoordinatesToWindow|SDL_RenderFillRect|SDL_RenderFillRects|SDL_RenderGeometry|SDL_RenderGeometryRaw|SDL_RenderLine|SDL_RenderLines|SDL_RenderPoint|SDL_RenderPoints|SDL_RenderPresent|SDL_RenderRect|SDL_RenderRects|SDL_RenderTexture|SDL_RenderTexture9Grid|SDL_RenderTextureRotated|SDL_RenderTextureTiled|SDL_RequestAndroidPermission|SDL_RestoreWindow|SDL_ResumeAudioDevice|SDL_ResumeAudioStreamDevice|SDL_ResumeHaptic|SDL_RumbleGamepad|SDL_RumbleGamepadTriggers|SDL_RumbleJoystick|SDL_RumbleJoystickTriggers|SDL_RunHapticEffect|SDL_SaveBMP|SDL_SaveBMP_IO|SDL_SendAndroidMessage|SDL_SendGamepadEffect|SDL_SendJoystickEffect|SDL_SendJoystickVirtualSensorData|SDL_SetAppMetadata|SDL_SetAppMetadataProperty|SDL_SetAudioDeviceGain|SDL_SetAudioPostmixCallback|SDL_SetAudioStreamFormat|SDL_SetAudioStreamFrequencyRatio|SDL_SetAudioStreamGain|SDL_SetAudioStreamGetCallback|SDL_SetAudioStreamInputChannelMap|SDL_SetAudioStreamOutputChannelMap|SDL_SetAudioStreamPutCallback|SDL_SetBooleanProperty|SDL_SetClipboardData|SDL_SetClipboardText|SDL_SetCursor|SDL_SetFloatProperty|SDL_SetGamepadLED|SDL_SetGamepadMapping|SDL_SetGamepadPlayerIndex|SDL_SetGamepadSensorEnabled|SDL_SetHapticAutocenter|SDL_SetHapticGain|SDL_SetJoystickLED|SDL_SetJoystickPlayerIndex|SDL_SetJoystickVirtualAxis|SDL_SetJoystickVirtualBall|SDL_SetJoystickVirtualButton|SDL_SetJoystickVirtualHat|SDL_SetJoystickVirtualTouchpad|SDL_SetLinuxThreadPriority|SDL_SetLinuxThreadPriorityAndPolicy|SDL_SetLogPriorityPrefix|SDL_SetMemoryFunctions|SDL_SetNumberProperty|SDL_SetPaletteColors|SDL_SetPointerProperty|SDL_SetPointerPropertyWithCleanup|SDL_SetPrimarySelectionText|SDL_SetRenderClipRect|SDL_SetRenderColorScale|SDL_SetRenderDrawBlendMode|SDL_SetRenderDrawColor|SDL_SetRenderDrawColorFloat|SDL_SetRenderLogicalPresentation|SDL_SetRenderScale|SDL_SetRenderTarget|SDL_SetRenderVSync|SDL_SetRenderViewport|SDL_SetScancodeName|SDL_SetStringProperty|SDL_SetSurfaceAlphaMod|SDL_SetSurfaceBlendMode|SDL_SetSurfaceColorKey|SDL_SetSurfaceColorMod|SDL_SetSurfaceColorspace|SDL_SetSurfacePalette|SDL_SetSurfaceRLE|SDL_SetTLS|SDL_SetTextInputArea|SDL_SetTextureAlphaMod|SDL_SetTextureAlphaModFloat|SDL_SetTextureBlendMode|SDL_SetTextureColorMod|SDL_SetTextureColorModFloat|SDL_SetTextureScaleMode|SDL_SetThreadPriority|SDL_SetWindowAlwaysOnTop|SDL_SetWindowAspectRatio|SDL_SetWindowBordered|SDL_SetWindowFocusable|SDL_SetWindowFullscreen|SDL_SetWindowFullscreenMode|SDL_SetWindowHitTest|SDL_SetWindowIcon|SDL_SetWindowKeyboardGrab|SDL_SetWindowMaximumSize|SDL_SetWindowMinimumSize|SDL_SetWindowModalFor|SDL_SetWindowMouseGrab|SDL_SetWindowMouseRect|SDL_SetWindowOpacity|SDL_SetWindowPosition|SDL_SetWindowRelativeMouseMode|SDL_SetWindowResizable|SDL_SetWindowShape|SDL_SetWindowSize|SDL_SetWindowSurfaceVSync|SDL_SetWindowTitle|SDL_SetiOSAnimationCallback|SDL_ShowAndroidToast|SDL_ShowCursor|SDL_ShowMessageBox|SDL_ShowSimpleMessageBox|SDL_ShowWindow|SDL_ShowWindowSystemMenu|SDL_StartTextInput|SDL_StartTextInputWithProperties|SDL_StopHapticEffect|SDL_StopHapticEffects|SDL_StopHapticRumble|SDL_StopTextInput|SDL_SyncWindow|SDL_TimeToDateTime|SDL_TryLockMutex|SDL_TryLockRWLockForReading|SDL_TryLockRWLockForWriting|SDL_TryWaitSemaphore|SDL_UnlockAudioStream|SDL_UpdateHapticEffect|SDL_UpdateNVTexture|SDL_UpdateTexture|SDL_UpdateWindowSurface|SDL_UpdateWindowSurfaceRects|SDL_UpdateYUVTexture|SDL_Vulkan_CreateSurface|SDL_Vulkan_LoadLibrary|SDL_WaitConditionTimeout|SDL_WaitSemaphoreTimeout|SDL_WarpMouseGlobal|SDL_WriteStorageFile|SDL_WriteSurfacePixel|SDL_WriteSurfacePixelFloat)$";
@@
(
  func(
  ...
  )
- == 0
|
- func(
+ !func(
  ...
  )
- < 0
|
- func(
+ !func(
  ...
  )
- != 0
|
- func(
+ !func(
  ...
  )
- == -1
)
2024-08-27 10:31:46 -07:00
Anonymous Maarten
c298d2024a Include SDL_build_config.h without a 'build_config/' prefix 2024-08-23 00:51:35 +00:00
Sam Lantinga
8f546bb3c9 Use C99 bool internally in SDL 2024-08-22 13:30:02 -07:00
Anonymous Maarten
b9ad5fc589 ci: build tvOs/iOs CMake project 2024-08-12 06:44:35 +02:00
Anonymous Maarten
6e6c2b8e7d cmake: build SDL with /W3 on MSVC
The Visual Studio projects also did this.
2024-08-08 10:11:39 +00:00
Anonymous Maarten
68fb07787b cmake: Remove HAVE_D3D12_H from sources and introduce SDL_RENDER_D3D(11|12) 2024-08-01 17:49:02 +00:00
Ryan C. Gordon
fbed34a645
cmake: Don't warn about lack of X11/Wayland backend on Emscripten. 2024-07-30 00:33:08 -04:00
Anonymous Maarten
da8aa84c1d ci: merge all workflows into one 2024-07-27 15:19:20 +00:00
Anonymous Maarten
8a5d1fc196 cmake: add swift test 2024-07-27 08:39:55 +02:00
Anonymous Maarten
37881b3150 cmake: use genex to link with Apple Frameworks 2024-07-27 08:37:21 +02:00
Anonymous Maarten
2aad26abb0 cmake: gate all preseeding behind SDL_PRESEED option 2024-07-25 16:42:11 +00:00
Ryan C. Gordon
546cd3ac83 cmake: Preseed CMake cache for Emscripten builds.
Makes a from-scratch build on this laptop go from 2 minutes 42 seconds to
28 seconds!
2024-07-25 16:42:11 +00:00
Anonymous Maarten
cc47969a79 cmake: actually check ARM64EC 2024-07-19 22:24:44 +02:00
Anonymous Maarten
2d1d3d9fb2 cmake: fix building UWP with non-MSVC generator 2024-07-19 10:21:34 +00:00
Anonymous Maarten
c59771d7fc cmake: detect ARM64EC 2024-07-19 10:21:34 +00:00
huanhuan-jiang
723c1cc5b3 Print message in summary when a X11 or wayland video driver is not found 2024-07-16 11:02:57 -07:00
Bruce Mitchener
e38f971f46 Fix typos in cmake 2024-07-15 15:24:00 -07:00
Anonymous Maarten
7277d69c0e cmake: verify no undefined versioned symbols exist 2024-07-12 18:45:38 +02:00
Sam Lantinga
2ba76dbe80 Simplified SDL_Surface
SDL_Surface has been simplified and internal details are no longer in the public structure.

The `format` member of SDL_Surface is now an enumerated pixel format value. You can get the full details of the pixel format by calling `SDL_GetPixelFormatDetails(surface->format)`. You can get the palette associated with the surface by calling SDL_GetSurfacePalette(). You can get the clip rectangle by calling SDL_GetSurfaceClipRect().

SDL_PixelFormat has been renamed SDL_PixelFormatDetails and just describes the pixel format, it does not include a palette for indexed pixel types.

SDL_PixelFormatEnum has been renamed SDL_PixelFormat and is used instead of Uint32 for API functions that refer to pixel format by enumerated value.

SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB(), and SDL_GetRGBA() take an optional palette parameter for indexed color lookups.
2024-07-10 00:48:18 -07:00
Isaac Aronson
0f351cd6af Remove ARM32 assembly/pixman blitters 2024-07-08 10:53:46 -07:00
Anonymous Maarten
d52ea20916 cmake: check for valid isinf/isinff/isnan/isnanf macros 2024-06-24 22:00:53 +02:00
Frank Praznik
974bbea20b x11: Add keymap support
XkbKeycodeToKeySym is replaced with XkbLookupKeySym, which can take the modifier states. The associated cmake check has been renamed for consistency.

Only the XKB path is currently handled. The deprecated XKeycodeToKeysym path is TODO.
2024-06-23 15:40:55 -04:00
Emmanuele Bassi
61dafb3b2f Add XSETTINGS support to x11 driver
Import the XSettingsClient implementation to handle the settings
selection.

Currently, we only care about the Gdk/WindowScalingFactor value used by
the windowing system to notify us of display-wide changes in the scaling
factor.
2024-06-14 08:54:17 -07:00
Anonymous Maarten
dd0bb25f66 cmake: remove SDL_STATIC_PIC cmake option.
Use CMAKE_POSITION_INDEPENDENT_CODE instead
2024-06-10 18:04:18 +02:00
Anonymous Maarten
a919774fe4
Build with -Wfloat-conversion + fix all warnings 2024-06-03 21:33:29 +00:00
Anonymous Maarten
4b0f52b04e cmake: fall back to per-cpu test when all-in-one test fails
The 'all-in-one' test fails for Emscripten because try_compile does not copy back the actual binary:
the wasm file contains the machine parseable strings, not the html or js file(s).
2024-05-31 18:53:21 +02:00
Anonymous Maarten
bba76859f5 cmake: detect CPU architecture in 1 compilation 2024-05-26 23:52:48 +02:00
Anonymous Maarten
86b2f441c0 release: create arm64 Visual Studio binaries
[skip ci]
2024-05-23 00:13:10 +02:00
Anonymous Maarten
3c00af1ac6 cmake: preseed CMake cache on MSVC to speed up configuration 2024-05-22 21:03:12 +02:00
Anonymous Maarten
e10207e831 cmake: disallow '#include "SDL.h"' 2024-05-22 20:17:13 +02:00
Wim Taymans
a340748c06 camera: add PipeWire camera support
The PipeWire camera will enumerate the pipewire Video/Source nodes with
their formats.

When capturing is started, a stream to the node will be created and
frames will be captured.
2024-05-09 13:19:27 -07:00
Frank Praznik
fb4c15319e pipewire: Raise minimum build version to 0.3.44 2024-04-19 12:34:22 -04:00
Anonymous Maarten
9f83647aec cmake: switch iOS and watchOS 2024-04-08 19:25:38 +02:00
Ravbug
2d640d0b59
ci: Add iOS and tvOS CMake GitHub Actions checks (#9465)
- Also add watchos support to CMake (SDL does not support this platform yet)

Co-authored-by: Ravbug <ravbug@users.noreply.github.com>
Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-04-08 19:18:28 +02:00
Robert Edmonds
e3395a7585 cmake: Fix ALSA "Unable to find..." warning
If cmake is invoked with -DSDL_ALSA=OFF, the misleading warning
message "Unable to find the alsa development library" is printed.
It's misleading because no attempt was actually made to find the ALSA
development library. It's always printed by the CheckALSA macro if
SDL_ALSA is false.

This commit moves this warning message in the CheckALSA macro to being
printed if ALSA_FOUND is false. However, I don't see an explicit warning
message like this for the other macros that search for development
libraries, so I wonder if the message shouldn't just be removed
entirely. It seems redundant with the "Could NOT find ALSA ..." message
generated by cmake.

Before this commit:

    $ cmake -B build -DSDL_ALSA=OFF
    [...]
    CMake Warning at cmake/sdlchecks.cmake:125 (message):
      Unable to find the alsa development library
    Call Stack (most recent call first):
      CMakeLists.txt:1530 (CheckALSA)
    [...]
    -- Options:
    --   SDL_ALSA                    (Wanted: OFF): OFF
    [...]

    $ cmake -B build -DSDL_ALSA=ON
    [...]
    -- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR)
    [...]
    -- Options:
    --   SDL_ALSA                    (Wanted: ON): OFF
    [...]

After this commit:

    $ cmake -B build -DSDL_ALSA=OFF
    [...]
    -- Options:
    --   SDL_ALSA                    (Wanted: OFF): OFF
    [...]

    $ cmake -B build -DSDL_ALSA=ON
    [...]
    -- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR)
    CMake Warning at cmake/sdlchecks.cmake:123 (message):
      Unable to find the alsa development library
    Call Stack (most recent call first):
      CMakeLists.txt:1530 (CheckALSA)
    [...]
    -- Options:
    --   SDL_ALSA                    (Wanted: ON): OFF
    [...]

All of the cmake invocations above were without the libasound2-dev
package installed.
2024-04-06 12:19:55 -04:00
Anonymous Maarten
2f26c58504 cmake: fix typo in cmake/sdlplatform.cmake 2024-04-02 23:44:15 +02:00
Anonymous Maarten
63cb541797 cmake: set SYSTEM property in SDL3Config.cmake for compatibility with older CMake versions 2024-04-01 20:09:51 +02:00
Anonymous Maarten
75a71bde4b cmake: build tests against installed SDL prefix 2024-03-23 21:41:20 +01:00
Anonymous Maarten
f59dbf6a12 cmake: add -Wimplicit-fallthrough warning 2024-03-18 20:34:50 +01:00
Anonymous Maarten
b5eb704fa8 cmake: we only need a C++ compiler for Android, Haiku and UWP
Our CMake script does (currently) not support NGage, Xbox One, or Xbox Series.
2024-03-11 00:27:54 +01:00
Anonymous Maarten
7341d5f361 cmake: allow hidapi to use libusb on Windows
When using SDL_HIDAPI_LIBUSB_SHARED=ON, extract the dll file name
from the import library.
2024-03-10 09:07:33 -07:00
Anonymous Maarten
0e6fcf947a cmake: find libusb through LibUSB cmake module 2024-03-10 09:07:33 -07:00
Anonymous Maarten
3cc4705dd2 cmake: build OBJC sources with warning & error flags, ignoring deprecated declarations 2024-03-07 01:58:28 +01:00
Anonymous Maarten
1f536a1e77 cmake: fix SDL_RENDER_VULKAN reporting
Also fix an error when configuring with `-DSDL_VULKAN=ON
-DSDL_RENDER_VULKAN=FALSE`: the vulkan renderer is now correctly
disabled.
2024-02-26 20:37:10 +01:00