Commit Graph

818 Commits

Author SHA1 Message Date
Dmitry Marakasov 0cd4fc7c87
Allow to enable vulkan support on FreeBSD (#10361) 2024-07-25 09:31:40 -07:00
Ryan C. Gordon 16535b7ee2
examples: Add CMake glue to optionally build examples, as we do for the tests.
In fact, most of the CMake code was stolen from the test directory.
2024-07-23 00:58:57 -04:00
Anonymous Maarten f8c1cd6622 ci: build MSVC workflows using Ninja generator 2024-07-19 10:21:34 +00:00
Anonymous Maarten 2d1d3d9fb2 cmake: fix building UWP with non-MSVC generator 2024-07-19 10:21:34 +00:00
Sam Lantinga 9af7a80767 OpenGL ES is still available on iOS 2024-07-18 09:27:16 -07:00
captain0xff 0506cf18ab android: enable vulkan renderer 2024-07-13 08:16:26 -07:00
Anonymous Maarten d1eab18de2 cmake: build ci and and release with static runtime library
(The Visual Studio projects do this as well)
2024-07-10 19:47:27 +02:00
Anonymous Maarten 001c1b29df cmake: remove SDL_STATIC_VCRT option
projects are expected to use CMAKE_MSVC_RUNTIME_LIBRARY to select the
runtime library.

With current CMake versions, this can be done with:

 -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=xxx

with xxx one of:
 "MultiThreaded"         -> -MT (static non-debug)
 "MultiThreadedDLL"      -> -MD (shared non-debug)
 "MultiThreadeDebug"     -> -MTd (static debug)
 "MultiThreadedDebugDLL" -> -MDd (shared debug)

See CMake documentation for more information:
https://cmake.org/cmake/help/latest/policy/CMP0091.html
https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
2024-07-10 18:34:34 +02:00
Isaac Aronson 0f351cd6af Remove ARM32 assembly/pixman blitters 2024-07-08 10:53:46 -07:00
Isaac Aronson 12d18c7497 Add back glob for src/video/*.c to CMakeLists.txt 2024-07-08 10:53:46 -07:00
Isaac Aronson 735cf5a6f9 Relocate intrinsic modules to src/video/ 2024-07-08 10:53:46 -07:00
Isaac Aronson 3e0581c625 Merge upstream and sdl3-blitters 2024-07-08 10:53:46 -07:00
Ryan C. Gordon 4b5309cd98 main: Move SDL_RunApp bits from src/core to src/main.
Fixes #10170.
2024-07-05 08:52:25 -07:00
Ryan C. Gordon f338fa20dd emscripten: Let SDL hints be set by URL parameters.
Any parameters (key/value pairs after the '?' in a URL) that have a keyname
that starts with `SDL_` will be put into Emscripten's environment variable
emulation table at startup, before SDL_main runs.

This lets users set hints the same way they might set them from a shell's
command line on a desktop platform:

For example:

`https://example.com/my_sdl3_application.html?SDL_RENDER_DRIVER=software`

Fixes #10154.
2024-07-04 11:09:42 -04:00
Anonymous Maarten d52ea20916 cmake: check for valid isinf/isinff/isnan/isnanf macros 2024-06-24 22:00:53 +02:00
Sam Lantinga d013ac80ef Don't check for isinf() and friends using CMake
These are often macros or defined for only doubles or only floats, so the current detection doesn't meet our needs
2024-06-24 11:49:15 -07:00
Sam Lantinga 89cdadf7c3 Added SDL_isinf(), SDL_isinff(), SDL_isnan(), and SDL_isnanf() 2024-06-24 11:49:15 -07:00
Ganael Laplanche f8ad4abe4e Fix joystick (/dev/input/xxx) support on FreeBSD
When switching to CMake, src/joystick/linux/SDL_sysjoystick.c file got
excluded from FreeBSD builds, losing support for /dev/input/xxx devices.

See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279907
2024-06-22 07:06:02 -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 fd2b9c0602 cmake: don't check c++ compiler flags for asan when CXX is not enabled 2024-06-01 10:18:15 +02:00
Sam Lantinga b1b4638cac Add basic vulkan support to offscreen video driver so it doesn't crash if you happen to get the offscreen driver and try to use vulkan.
Enable offscreen video driver in windows to make it easier to test.
Enable offscreen video driver in macos just to complete the desktop computer trio.
2024-05-28 20:02:55 -07:00
Ozkan Sezer 2b374e6c0f check dxgi1_6.h before enabling sdr/hdr code in SDL_windowsmodes.c
thanks @madebr
2024-05-28 22:11:56 +03:00
Ozkan Sezer 00a7b14ee7 cmake: check mfapi.h before enabling SDL_CAMERA_DRIVER_MEDIAFOUNDATION 2024-05-28 22:11:50 +03:00
Anonymous Maarten bba76859f5 cmake: detect CPU architecture in 1 compilation 2024-05-26 23:52:48 +02:00
Anonymous Maarten 3af4f120d0 cmake: direct3d12 renderer needs d3d12.h and d3d12sdklayers.h
Older MinGW releases don't ship d3d12sdklayers.h
2024-05-26 23:00:41 +02:00
Anonymous Maarten 89a4d9ae67 cmake+d3d12: d3d12 now builds succesfully on older Windows SDKs, so simplify the checks 2024-05-24 21:48:04 +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
Anonymous Maarten c7205ab6b5 cmake: don't generate SDL3 jar for CMake versions < 3.19 2024-05-15 18:31:37 +02:00
Anonymous Maarten 9aff68746f cmake: add khronos include directories with PRIVATE visibility 2024-05-07 17:37:21 +02:00
Miku AuahDark 86fada6faa Android: Implement open and save file dialog. 2024-05-06 09:33:48 -07:00
Ethan Lee 7327fd734c macOS: Do not use the system iconv by default.
macOS 14 changes the iconv implementation which causes things to break, so we may as well match macOS with all the other platforms now.
2024-05-02 17:42:36 -07:00
Anonymous Maarten a8526f5a19 cmake: disable documentation installation by default 2024-05-02 19:54:37 +02:00
Sam Lantinga d95f5bad24 Updated to version 3.1.2 for the preview release 2024-05-01 09:34:25 -07:00
Anonymous Maarten aab7caebf0
cmake: pass macho version information separately from so version 2024-04-15 18:36:27 +00: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
Semphris 6ad390fc50 File dialog improvements
- Add a globally-accessible function to handle the parsing of filter extensions
- Remove the ability of putting the wildcard ('*') among other patterns; it's either a list of patterns or a single '*' now
- Add a hint to select between portals and Zenity on Unix
2024-04-04 22:07:14 -07:00
Sam Lantinga 17d4f8d699 Updated to version 3.1.1 for the preview release 2024-04-01 17:03:46 -07:00
Sam Lantinga c10a3df552 Only add the UniformTypeIdentifiers framework if we're building the dialog subsystem
This framework isn't available on older SDKs
2024-04-01 14:13:31 -07: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 4eb0f10dda cmake: install SDL headers with SYSTEM property disabled
This causes the SDL include path to be added using -I instead of -isystem
2024-04-01 18:38:47 +02:00
Sean Ridenour 3448273be1 Weakly link UniformTypeIdentifiers.framework 2024-04-01 07:38:05 -07:00
Ryan C. Gordon a5c892d2c3 stdlib: Improve Unicode support and consistency in string comparison functions.
SDL_strcasecmp (even when calling into a C runtime) does not work with
Unicode chars, and depending on the user's locale, might not work with
even basic ASCII strings.

This implements the function from scratch, using "case-folding,"
which is a more robust method that deals with various languages. It
involves a hashtable of a few hundred codepoints that are "uppercase" and
how to map them to lowercase equivalents (possibly increasing the size of
the string in the process). The vast majority of human languages (and
Unicode) do not have letters with different cases, but still, this static
table takes about 10 kilobytes on a 64-bit machine.

Even this will fail in one known case: the Turkish 'i' folds differently
if you're writing in Turkish vs other languages. Generally this is seen as
unfortunate collateral damage in cases where you can't specify the language
in use.

In addition to case-folding the codepoints, the new functions also know how
to decode the various formats to turn them into codepoints in the first
place, instead of blindly stepping by one byte (or one wchar_t) per
character.

Also included is casefolding.txt from the Unicode Consortium and a perl
script to generate the hashtable from that text file, so we can trivially
update this if new languages are added in the future.

A simple test using the new function:

```c
 #include <SDL3/SDL.h>

 int main(void)
 {
     const char *a = "α ε η";
     const char *b = "Α Ε Η";
     SDL_Log("    strcasecmp(\"%s\", \"%s\") == %d\n", a, b, strcasecmp(a, b));
     SDL_Log("SDL_strcasecmp(\"%s\", \"%s\") == %d\n", a, b, SDL_strcasecmp(a, b));
     return 0;
 }
```

Produces:

```
INFO:     strcasecmp("α ε η", "Α Ε Η") == 32
INFO: SDL_strcasecmp("α ε η", "Α Ε Η") == 0
```

glibc strcasecmp() fails to compare a Greek lowercase string to its uppercase
equivalent, even with a UTF-8 locale, but SDL_strcasecmp() works.

Other SDL_stdinc.h functions are changed to be more consistent, which is to
say they now ignore any C runtime and often dictate that only English-based
low-ASCII works with them.

Fixes Issue #9313.
2024-03-29 15:01:40 -04:00
Sam Lantinga 36e73bdda4 Updated to version 3.1.0 for the preview release 2024-03-24 06:16:02 -07:00
Frank Praznik 4a7e3beeb9 filesystem: Use high-res file times on more platforms
Some POSIX platforms don't define macros to note the presence of the POSIX.1-2008 st_*tim timespec members of the stat struct, so check if this member exists during CMake configuration and conditionally enable it.

Apple platforms use st_*timespec naming, which is supported as of OSX 10.6. SDL3 requires 10.9+, so no fallback is needed.

Android only supports the POSIX.1-2008 semantics as of API version 26 or higher, so this has to be conditionally enabled in the makefile build via an API version definition check.

In other cases, file times fall back to the legacy path with second precision.
2024-03-20 11:39:42 -04:00
Sam Lantinga ed5d2bdda5 Fixed adding duplicate fsops files to CMakeLists.txt 2024-03-19 16:20:55 -07:00
Frank Praznik a6fbf0488c Add time and realtime clock functions
Adds functions to query the system's realtime clock, convert time intervals to/from a calendar date and time in either UTC or the local time, and perform time related calculations.

An SDL_Time type (a time interval represented in nanoseconds), and SDL_DateTime struct (broken down calendar date and time) were added to facilitate this functionality.

Querying the system time results in a value expressed in nanoseconds since the Unix epoch (Jan 1, 1970) in UTC +0000. Conversions to and from the various platform epochs and units are performed when required.

Any direct handling of timezones and DST were intentionally avoided. The offset from UTC is provided when converting from UTC to a local time by calculating the difference between the original UTC and the resulting local time, but no other timezone or DST information is used.

The preferred date formatting and 12/24 hour time for the system locale can be retrieved via global preferences.

Helper functions for obtaining the day of week or day or year for calendar date, and getting the number of days in a month in a given year are provided for convenience. These are simple, but useful for performing various time related calculations.

An automated test for time conversion is included, as is a simple standalone test to display the current system date and time onscreen along with a calendar, the rendering of which demonstrates the use of the utility functions (press up/down to increment or decrement the current month, and keys 1-5 to change the date and time formats).
2024-03-19 10:57:36 -07:00
Sam Lantinga db0c1d7aeb Added portable file and directory operations (thanks @icculus!) 2024-03-17 08:39:43 -07:00
Ethan Lee 744227e6ab Add SDL_storage 2024-03-16 07:19:50 -07:00
Semphris 70c2e15615 Add file dialogs 2024-03-14 15:40:25 -07:00