Commit Graph

348 Commits

Author SHA1 Message Date
Sam Lantinga d54b125a86 Fixed bug 5287 - Support building for UWP with CMake
Jan Niklas Hasse

Actually the SDL2-static target works, if I set SDL_SENSOR to OFF. Awesome!

See this patch: https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/0003-sdl2-fix-uwp-build.patch
2021-01-14 14:53:34 -08:00
Ozkan Sezer 8a32ee24db removed MSVC strtok_s use from SDL_strtokr().
no other ??_s are used elsewhere in SDL_stdinc. besides, C11 has a
strtok_s with a different signature.
2020-12-30 01:00:24 +03:00
Joel Linn 2443e51e0e Add optional suffix `_generic` to generic SDL_cond impl
Allows for runtime selectable implementation
2020-12-28 11:42:49 -08:00
Ozkan Sezer 471d3c363e fix bug #5415 -- fatal error: 'Cocoa/Cocoa.h' file not found in iOS build 2020-12-27 14:00:30 +03:00
Ozkan Sezer 9f6fddb40f CMake: don't check for --no-undefined linker flag for OpenBSD (bug #5174)
it now matches autotools.
2020-12-27 05:20:10 +03:00
Sam Lantinga 93ccdee8c1 Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
Cameron Cawley

stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf

The default implementation is based on the one used in the Windows RT video driver.
2020-12-23 13:47:49 -08:00
Ozkan Sezer b4b674dabb CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project 2020-12-22 22:10:50 +03:00
Sam Lantinga 350f1b0d16 Updated SDL to version 2.0.15 for development 2020-12-22 10:36:15 -08:00
Manuel Alfayate Corchete 13244de5c2 [Buildsystem] Only build KMSDRM support if EGL+OpenGL is detected by CMake. 2020-12-22 17:17:30 +01:00
Ozkan Sezer 22275b35e4 cmake: fix building for mac (bug #5407.) 2020-12-20 21:55:02 +03:00
Sam Lantinga 6bd4c717a1 Fixed bug 5402 - ARM support little update proposal
David Carlier

No fix but mostly an update for ARM architecture.
2020-12-17 21:41:23 -08:00
Ozkan Sezer b6e63625c8 fix bug #5395: handle old systems where inotify_init1 is not available 2020-12-13 15:32:24 +03:00
Sam Lantinga 45e3521d0d Backed out changes for 5366 - cmake build doesn't detect Metal on macOS
These changes introduce regressions for other build environments, so I'm backing them out until we sort out the correct fix.
2020-12-09 07:32:10 -08:00
Sam Lantinga 479db43058 Fixed bug 5250 - updaterev.sh failed using CMake Tools on VSCode Remote
Sebastian Vargas Vargas

Running CMake configure from a Windows Subsystem for Linux using Visual Studio Code Remote doesn't generate the header file with the current source revision, it throws "/home/sebva/SDL/build-scripts/updaterev.sh: 13: cannot create /mnt/c/Users/sebva/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.4/include/SDL_revision.h.new: Directory nonexistent".
2020-12-09 06:56:34 -08:00
Sam Lantinga 42c5b4acde Fixed bug 5366 - cmake build doesn't detect Metal on macOS
Tom Seddon

2nd time lucky, perhaps. patch 2 applies to current HEAD at time of writing - 4eb049c9bb1ca94efe3c40b57beda3169984d0cb from https://github.com/SDL-mirror/SDL.

This basically goes back to what was there originally, but now manually adding "-x objective-c" to the clang command line rather than "-ObjC". clang is then invoked without the "-x c" that was causing the problem, the snippet builds, and Metal is detected. (I had a quick trawl through the cmake code, but I couldn't see where this is handled.)

I was moved to try this after finding SDL's own CHECK_OBJC_SOURCE_COMPILES macro, and noting what it does: 4eb049c9bb/cmake/macros.cmake (L67)

An alternative fix of course would be to use CHECK_OBJC_SOURCE_COMPILES instead of cmake's check_objc_source_compiles - but that had the same problem of getting confused by "return 0;". (Maybe that's because it's a macro? I'll defer to a cmake expert on this one.)

I decided in the end to err on the side of leaving things looking basically the same as they were before my first patch.
2020-12-09 06:17:55 -08:00
Ozkan Sezer 475405e036 CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project 2020-12-09 12:03:24 +03:00
Ozkan Sezer 250a055727 fix bug #5384 -- define DLL_EXPORT in DLL builds and adjust begin_code.h 2020-12-09 12:01:10 +03:00
Sam Lantinga a2098a47b6 Updated SDL to 2.0.14 in preparation for release candidate 2020-12-08 18:56:06 -08:00
Sam Lantinga 2a9591a9ea Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/fix-space-in-path.patch 2020-12-08 09:16:34 -08:00
Sam Lantinga 7f1c6e82b9 Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/enable-winrt-cmake.patch 2020-12-08 09:13:08 -08:00
Sam Lantinga 7665f8870a Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/disable-wcslcpy-and-wcslcat-for-windows.patch 2020-12-08 09:07:21 -08:00
Sam Lantinga 695499ae6c Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/disable-hidapi-for-uwp.patch 2020-12-08 09:04:28 -08:00
Sam Lantinga 4b35a18d8b Fixed bug 5366 - cmake build doesn't detect Metal on macOS
Tom Seddon

This is as of commit 50d804ea729accf9e3a9ce83238d0a2976a17545 from https://github.com/SDL-mirror/SDL, which is HEAD as I write (apologies, not confident with Mercurial)

# Config

macOS: 10.14.6 (18G6042)
cmake --version: cmake version 3.16.20200101-g23e782c
clang --version: Apple clang version 11.0.0 (clang-1100.0.33.17)
Xcode version: Version 11.3.1 (11C504)

# Repro steps

Run the following commands in the shell.

 cd /tmp/
 git clone https://github.com/SDL-mirror/SDL
 mkdir build.SDL
 cd build.SDL
 cmake -G ../SDL/

Examine cmake output.

# Expected result

Metal is detected.

# Actual result

It appears that Metal is not detected! Note this line in the summary:

 --   RENDER_METAL           (Wanted: 0): OFF

# Fix

Change check_c_source_compiles to check_objc_source_compiles. The cmake script tries to add -ObjC to the clang command line, but, for whatever reason, this doesn't seem to work.

Change the test source to have an empty main. The "return 0;" line seems to confuse cmake somehow, causing it to crap out with an error about HAVE_FRAMEWORK_METAL being an unknown argument. (Maybe I'm just dense, but it's not obvious to me what the problem is here.)

With these two changes:

 --   RENDER_METAL           (Wanted: ON): ON

Patch attached.
2020-12-01 13:50:42 -08:00
Ozkan Sezer e5783e1179 cmake: add missing checks for wcscasecmp, _wcsicmp, wcsncasecmp, _wcsnicmp 2020-11-25 14:51:56 +03:00
Ozkan Sezer 711d409032 CMakeLists.txt: add src/joystick/iphoneos/*.m to Darwin joystick sources
.. so that there won't be missing symbols.
TODO: add checks for SDL_JOYSTICK_MFI ???
2020-11-24 14:10:30 +03:00
Ozkan Sezer 4c96faee57 remove non-existing tslib support from autofoo and cmake 2020-11-23 20:37:10 +03:00
Simon McVittie 8db3171b98 udev: Factor out SDL_EVDEV_GuessDeviceClass
This works on capability bitfields that can either come from udev or
from ioctls, so it is equally applicable to both udev and non-udev
input device detection.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-11 19:14:34 -08:00
Ozkan Sezer 2daa670ce8 cmake: look for iconv in libc, too (bug #5316.) 2020-10-13 15:20:03 +03:00
Ozkan Sezer 6756851836 cmake: run updaterev.sh if(NOT CMAKE_HOST_WIN32)
... not if(NOT WINDOWS OR CYGWIN)
This way, it generates SDL_revision.h in cross-build environments too.
2020-10-13 14:45:10 +03:00
Ozkan Sezer 665cfa4981 cmake: check for alloca() in stdlib.h and malloc.h, too (bug #5316) 2020-10-13 14:32:15 +03:00
Ozkan Sezer 48c03d9a75 cmake: reduce STDC_HEADER_NAMES list to only relevant headers,
i.e. stddef.h, stdarg.h, stdlib.h, string.h, stdio.h, wchar.h, float.h.
Fixes issue described at:
https://bugzilla.libsdl.org/show_bug.cgi?id=4885#c2
2020-10-12 02:40:00 +03:00
Ozkan Sezer 196cda69f2 build: fix / update sensors (windows) configuration
- SDL_config.h.in: add missing defines SDL_SENSOR_COREMOTION
  and SDL_SENSOR_WINDOWS (configure did set SDL_SENSOR_WINDOWS
  but it never went in SDL_config.h or Makefile.)
- SDL_config.h.cmake: remove duplicated SDL_SENSOR_XXX cmake
  defines.
- autofoo, cmake: check for sensorsapi.h header before enabling
  windows sensors.
2020-10-12 01:02:28 +03:00
Cameron Cawley 59022829f4 riscos: Implement SDL_OpenURL() 2020-10-11 17:32:32 +01:00
Ryan C. Gordon 77c9d73b63 Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
2020-10-05 11:30:33 -04:00
stfx b162629546 cmake: Fix building with -DSDL_HAPTIC=Off 2020-07-08 17:28:34 +02:00
Ryan C. Gordon e294639a6d cmake: Fix Metal detection on macOS/iOS.
Apparently the "-x objective-c" made it down to the linker, who then treats
the .o file as Objective-C source code.  Apparently the -ObjC argument does
the same thing but gets ignored by the linker.

Fixes Bugzilla #4988.
2020-06-27 02:00:58 -04:00
Ryan C. Gordon 363fd52b41 configure/cmake: Disable ARM SIMD and NEON by default.
It's buggy at the moment.
2020-06-26 23:30:59 -04:00
Ryan C. Gordon 21482c1582 cmake: Bump minimum required CMake to 3.0.0 and mark link libraries PRIVATE.
Fixes Bugzilla #2992.
2020-06-26 20:11:32 -04:00
stfx 718e1fb8b1 cmake: Fix building with -DSDL_SENSOR=Off 2020-06-26 22:45:15 +02:00
Ryan C. Gordon d955d63b03 cmake: Build Linux-specific files like the configure script does.
Otherwise we unconditionally compile things we shouldn't.

Fixes Bugzilla #5175.
2020-06-26 17:42:30 -04:00
Ryan C. Gordon dd753ce7e3 cmake: Fix building with -DSDL_POWER=Off
Fixes Bugzilla #5193.
2020-06-26 15:04:57 -04:00
stfx efe0935904 Fix compile without DIRECTX 2020-06-15 10:31:16 +02:00
Sam Lantinga a8400dc3bf Fixed bug 5105 - sndio support not working in dynamic mode (dlopen)
Giovanni Bajo

The CMake build system supports several audio frameworks for Linux: one of them is sndio.

All frameworks can be built with "runtime linking" (that is, using dlopen to load the library at runtime). In sdlchecks.cmake, there's code to do the same with sndio:

=================================================================
# Requires:
# - n/a
# Optional:
# - SNDIO_SHARED opt
# - HAVE_DLOPEN opt
macro(CheckSNDIO)
  if(SNDIO)
    # TODO: set include paths properly, so the sndio headers are found
    check_include_file(sndio.h HAVE_SNDIO_H)
    find_library(D_SNDIO_LIB sndio)
    if(HAVE_SNDIO_H AND D_SNDIO_LIB)
      set(HAVE_SNDIO TRUE)
      file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
      set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
      set(SDL_AUDIO_DRIVER_SNDIO 1)
      if(SNDIO_SHARED)
        if(NOT HAVE_DLOPEN)
          message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
        else()
          FindLibraryAndSONAME("sndio")
          set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
          set(HAVE_SNDIO_SHARED TRUE)
        endif()
      else()
        list(APPEND EXTRA_LIBS ${D_SNDIO_LIB})
      endif()
      set(HAVE_SDL_AUDIO TRUE)
    endif()
  endif()
endmacro()
=================================================================

The feature is gated by an option called SNDIO_SHARED. It is also fully implemented in SDL_sndioaudio.c

Unfortunately, it seems there is a missing line in CMakeLists.txt, so SNDIO_SHARED is not defined:

======================================================================
set_option(ALSA                "Support the ALSA audio API" ${UNIX_SYS})
dep_option(ALSA_SHARED         "Dynamically load ALSA audio support" ON "ALSA" OFF)
set_option(JACK                "Support the JACK audio API" ${UNIX_SYS})
dep_option(JACK_SHARED         "Dynamically load JACK audio support" ON "JACK" OFF)
set_option(ESD                 "Support the Enlightened Sound Daemon" ${UNIX_SYS})
dep_option(ESD_SHARED          "Dynamically load ESD audio support" ON "ESD" OFF)
set_option(PULSEAUDIO          "Use PulseAudio" ${UNIX_SYS})
dep_option(PULSEAUDIO_SHARED   "Dynamically load PulseAudio support" ON "PULSEAUDIO" OFF)
set_option(ARTS                "Support the Analog Real Time Synthesizer" ${UNIX_SYS})
dep_option(ARTS_SHARED         "Dynamically load aRts audio support" ON "ARTS" OFF)
set_option(NAS                 "Support the NAS audio API" ${UNIX_SYS})
set_option(NAS_SHARED          "Dynamically load NAS audio API" ${UNIX_SYS})
set_option(SNDIO               "Support the sndio audio API" ${UNIX_SYS})
set_option(FUSIONSOUND         "Use FusionSound audio driver" OFF)
dep_option(FUSIONSOUND_SHARED  "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF)
======================================================================

You can see that all frameworks define a "dep_option" NAME_SHARED, and SNDIO is the only one where the option is missing.

This means that runtime loading of sndio is never activated. If sndio is found at configuration time, it is always activated in "linked" mode, so that the final binary will have a load-time dependency with libsdnio. This is unfortunate.

To fix the problem, it is sufficient to add this line:

dep_option(SNDIO_SHARED        "Dynamically load the sndio audio API" ${UNIX_SYS} ON "SNDIO" OFF)

I've verified that this fixes the bug, and sndio can now be dynamically loaded as expected.
2020-05-29 16:31:05 -07:00
Sylvain Becker 5b65e0af01 Fixed bug 5100 - compilation CMake Android armeabi-v7a (Thanks Steve Robinson!)
fatal error: 'cpu-features.h' file not found on CMake Android armeabi-v7a
2020-05-15 21:12:23 +02:00
Sam Lantinga eadc8693dd Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5
wengxt

Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface.

The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
2020-05-11 14:31:04 -07:00
Ryan C. Gordon fa23e3d00b locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
2020-05-04 02:27:29 -04:00
Ryan C. Gordon 7ac827102a cmake: various Haiku settings were accidentally under "if(SDL_VIDEO)" 2020-04-24 02:06:53 -04:00
Ryan C. Gordon 952bac7c47 cmake: use check_symbol_exists, not check_function_exists (thanks, Manuel!)
This fixes the problem where we think iOS has fseeko64, etc, but doesn't.

Fixes Bugzilla #4885.
2020-04-13 15:22:09 -04:00
James Le Cuirot abcc6706fd build: Don't duplicate Libs in Libs.private in pkg-config file
pkg-config already prepends Libs to Libs.private when you specify
--static so there's no need to duplicate them. Most other projects
don't do this.
2020-04-12 13:24:36 +01:00
James Le Cuirot 99f87a7158 build: Merge pkg-config Libs.private into Libs for static-only builds
A project being built entirely statically will call pkg-config with
--static, which utilises the Libs.private field. Conversely it will
not use --static when not being built entirely statically, even if
there is only a static build of SDL available. This will most likely
cause the build to fail due to underlinking unless we merge the Libs
fields.

This is what the Meson build system does when it generates pkg-config
files. This also also follows the behaviour of sdl2-config.

At the same time, the runtime linker flags are not applicable to
static-only builds so only add them for shared builds.
2020-04-11 23:38:34 +01:00
Ryan C. Gordon d292f6bd4f stdlib: Add SDL_trunc and SDL_truncf 2020-04-10 12:17:14 -04:00
Sam Lantinga 3180ba81af First pass at Windows sensor implementation 2020-04-08 08:34:27 -07:00
Sam Lantinga 2be75c6a61 Fixed bug 5028 - Virtual Joysticks (new joystick backend)
David Ludwig

I have created a new driver for SDL's Joystick and Game-Controller subsystem: a Virtual driver.  This driver allows one to create a software-based joystick, which to SDL applications will look and react like a real joystick, but whose state can be set programmatically.  A primary use case for this is to help enable developers to add touch-screen joysticks to their apps.

The driver comes with a set of new, public APIs, with functions to attach and detach joysticks, set virtual-joystick state, and to determine if a joystick is a virtual-one.

Use of virtual joysticks goes as such:

1. Attach one or more virtual joysticks by calling SDL_JoystickAttachVirtual.  If successful, this returns the virtual-device's joystick-index.
2. Open the virtual joysticks (using indicies returned by SDL_JoystickAttachVirtual).
3. Call any of the SDL_JoystickSetVirtual* functions when joystick-state changes.  Please note that virtual-joystick state will only get applied on the next call to SDL_JoystickUpdate, or when pumping or polling for SDL events (via SDL_PumpEvents or SDL_PollEvent).


Here is a listing of the new, public APIs, at present and subject to change:

------------------------------------------------------------

/**
 * Attaches a new virtual joystick.
 * Returns the joystick's device index, or -1 if an error occurred.
 */
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nballs, int nbuttons, int nhats);

/**
 * Detaches a virtual joystick
 * Returns 0 on success, or -1 if an error occurred.
 */
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);

/**
 * Indicates whether or not a virtual-joystick is at a given device index.
 */
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);

/**
 * Set values on an opened, virtual-joystick's controls.
 * Returns 0 on success, -1 on error.
 */
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualBall(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value);

------------------------------------------------------------

Miscellaneous notes on the initial patch, which are also subject to change:

1. no test code is present in SDL, yet.  This should, perhaps, change.  Initial development was done with an ImGui-based app, which potentially is too thick for use in SDL-official.  If tests are to be added, what kind of tests?  Automated?  Graphical?

2. virtual game controllers can be created by calling SDL_JoystickAttachVirtual with a joystick-type of SDL_JOYSTICK_TYPE_GAME_CONTROLLER, with naxes (num axes) set to SDL_CONTROLLER_AXIS_MAX, and with nbuttons (num buttons) set to SDL_CONTROLLER_BUTTON_MAX.  When updating their state, values of type SDL_GameControllerAxis or SDL_GameControllerButton can be casted to an int and used for the control-index (in calls to SDL_JoystickSetVirtual* functions).

3. virtual joysticks' guids are mostly all-zeros with the exception of the last two bytes, the first of which is a 'v', to indicate that the guid is a virtual one, and the second of which is a SDL_JoystickType that has been converted into a Uint8.

4. virtual joysticks are ONLY turned into virtual game-controllers if and when their joystick-type is set to SDL_JOYSTICK_TYPE_GAMECONTROLLER.  This is controlled by having SDL's default list of game-controllers have a single entry for a virtual game controller (of guid, "00000000000000000000000000007601", which is subject to the guid-encoding described above).

5. regarding having to call SDL_JoystickUpdate, either directly or indirectly via SDL_PumpEvents or SDL_PollEvents, before new virtual-joystick state becomes active (as specified via SDL_JoystickSetVirtual* function-calls), this was done to match behavior found in SDL's other joystick drivers, almost all of which will only update SDL-state during SDL_JoystickUpdate.

6. the initial patch is based off of SDL 2.0.12

7. the virtual joystick subsystem is disabled by default.  It should be possible to enable it by building with SDL_JOYSTICK_VIRTUAL=1



Questions, comments, suggestions, or bug reports very welcome!
2020-03-13 19:08:45 -07:00
Sam Lantinga 93ed3c8baf Updated SDL to version 2.0.13 for development builds 2020-03-10 18:25:47 -07:00
Sam Lantinga 983bbf9ef3 Backed out changeset 51622f74dc85 2020-03-10 18:35:31 -07:00
Sam Lantinga 4fb06a2a38 Updated SDL to version 2.0.13 for development builds 2020-03-10 18:25:47 -07:00
Sam Lantinga 74ed215618 Updated version to 2.0.12 for release candidate build 2020-03-01 14:58:16 -08:00
Sam Lantinga 1d624aa573 Further improvements for bug 4128 - CMAKE: Generated target import file contains incorrect include path
Mohamed

It would be useful to be able to do either `#include "SDL2/SDL.h"` or `#include "SDL.h"`. This patch allows that and adds compatibility with other build systems. It also allows differentiating between SDL1 and SDL2.
2020-02-16 00:08:36 -08:00
Cameron Cawley 8f1a916ac5 Add basic support for compiling on RISC OS 2020-02-13 20:50:47 +00:00
Sam Lantinga 598bcfc5f6 Fixed bug 4928 - CMakeLists.txt: put cmake package helpers in proper libdir
Tiago O.

Use LIB_SUFFIX variable to determine the correct path.
2020-01-06 07:06:58 -08:00
Ryan C. Gordon 183929bd29 cmake: ${SDL_CMAKE_DEBUG_POSTFIX} needs to be wrapped in quotes.
Otherwise, if it's an empty string, it causes problems.

Fixes Bugzilla #4117.
2019-12-03 02:42:53 -05:00
Ozkan Sezer 0d0ec5fe52 CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project 2019-11-26 20:41:00 +03:00
Ozkan Sezer 8cdb4526d9 CMakeLists.txt: add several missing function checks for unix case. 2019-11-21 10:33:56 +03:00
Sam Lantinga 650964461e Improved XInput VID/PID detection and added SDL_wcsstr() and SDL_wcsncmp() 2019-11-20 16:42:50 -08:00
Ozkan Sezer eb8f14bb6a added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
Ryan C. Gordon b7df26037b cmake: added support for enabling the ARM SIMD/NEON code. 2019-10-24 23:17:19 -04:00
Ozkan Sezer ffc7d09197 endpointvolume.h checks not needed since changeset 13078:8ab094a9df6b . 2019-10-01 14:00:02 +03:00
Brandon Schaefer 68985371a0 offscreen: Add new video driver backend Offscreen
The Offscreen video driver is intended to be used for headless rendering
  as well as allows for multiple GPUs to be used for headless rendering

Currently only supports EGL (OpenGL / ES) or Framebuffers
Adds a hint to specifiy which EGL device to use: SDL_HINT_EGL_DEVICE
Adds testoffscreen.c which can be used to test the backend out
Disabled by default for now
2019-09-24 16:36:48 -04:00
David Ludwig 6398abe588 CMake: bug-fix for tvOS support
tvOS Device support wasn't working, at least not with the current-latest tvOS release (13.0), with CMake failing during its configuration stage.
2019-09-23 18:24:03 -04:00
David Ludwig ec65a34b8e CMake: tvOS support/fixes
To use, set the following CMake variables when running CMake's configuration stage:
- CMAKE_SYSTEM_NAME=tvOS
- CMAKE_OSX_SYSROOT=<SDK>  (examples: appletvos, appletvsimulator, appletvos12.4, /full/path/to/AppleTVOS.sdk, etc.)
- CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures> (example: "arm64;x86_64")
2019-08-27 12:30:20 -04:00
David Ludwig b13c951cca CMake: iOS support added
When using a recent version of CMake (3.14+), this should make it possible to:
- build SDL for iOS, both static and dynamic
- build SDL test apps (as iOS .app bundles)
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)

To use, set the following CMake variables when running CMake's configuration stage:
- CMAKE_SYSTEM_NAME=iOS
- CMAKE_OSX_SYSROOT=<SDK>  (examples: iphoneos, iphonesimulator, iphoneos12.4, /full/path/to/iPhoneOS.sdk, etc.)
- CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures> (example: "arm64;armv7s")

Examples:
- for Simulator, using the latest, installed SDK:
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64

- for Device, using the latest, installed SDK, 64-bit only
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64

- for Device, using the latest, installed SDK, mixed 32/64 bit
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"

- for Device, using a specific SDK revision (iOS 12.4, in this example):
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64

- for Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
    cmake path/to/SDL -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
2019-08-27 11:07:43 -04:00
Sam Lantinga 3fe2d8368c Updated SDL development builds to version 2.0.11 2019-09-22 10:37:16 -07:00
Sylvain Becker 0a9c74aa9a Fixed bug 3918 - HIDAPI, CMake support for android project 2019-08-27 11:38:43 +02:00
Sylvain Becker 155087d106 Fixed bug 3918 - CMake support for android project 2019-08-11 15:23:37 +02:00
Sam Lantinga e9ec7d41b3 Fixed bug 4354 - CMake builds do not correctly enable IME on Linux
Callum McGing

While the CMake build checks for ibus and does enable the ibus backend with set(HAVE_IBUS_IBUS_H TRUE), this does not define SDL_USE_IME, thus CMake built SDL2 (as in Arch Linux) cannot use IME at all.

The attached patch fixes this behaviour when building against ibus. IME support will still fail when only fcitx is available on the build system.
2019-08-05 23:46:09 -07:00
Alex Szpakowski aebaa316c7 Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h. 2019-08-05 12:35:32 -03:00
Ethan Lee f7d82e5616 hidapi: Add SDL_hidapi.c, allows support for multiple hidapi backends.
This is currently supported on Linux and macOS. iOS and Android are not
supported at all, Windows support could be added with some changes to the libusb
backend. The Visual Studio and Xcode projects do not use this feature.

Based on Valve Software's hid.cpp, written in collaboration with Andrew Eikum.
2019-07-31 12:20:55 -04:00
Andrew Eikum e149f4c4b0 cmake: Fix locating libusb header at configure-time
Removing the CheckUSBHID call is necessary to avoid caching the failed header
check result before we find libusb via pkg-config.
2019-07-31 11:34:00 -05:00
Ryan C. Gordon 70f0b093ff cmake: Add setupapi library to Windows build dependencies (hidapi needs it).
Fixes Bugzilla #4719.
2019-07-12 13:40:58 -04:00
Ryan C. Gordon 66d4d8e25d cmake: Added HIDAPI support. 2019-07-08 16:46:52 -04:00
Sam Lantinga 7f78d0f0d3 Fixed bug 4684 - GLES1 variables missing under Android with CMake
Braden Obrzut

https://hg.libsdl.org/SDL/file/7dc39b047055/CMakeLists.txt#l911

I believe the following should also be specified there:

set(SDL_VIDEO_OPENGL_ES 1)
set(SDL_VIDEO_RENDER_OGL_ES 1)

As it is now GLES1 support is missing when building for Android despite it linking to the library.
2019-06-21 22:01:27 -07:00
Sam Lantinga 67c67f3a6b Updated version to 2.0.10 2019-06-17 10:13:28 -07:00
Sam Lantinga 1b73d578f3 Temporary fix for bug 4254 - a _lot_ of strict aliasing warnings
Ozkan Sezer

A horde of strict aliasing violation warnings are emitted from joystick
layer, and also from a few other places. This happens with gcc-4.4.7 on
Linux CentOS 6.10.  Some other sysjoystick would possibly have the same
warnings.

Attached my full log here. Example entry:
src/joystick/SDL_joystick.c: In function 'SDL_GetJoystickGUIDInfo':
src/joystick/SDL_joystick.c:1094: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules
2019-06-08 18:32:29 -07:00
Sam Lantinga 59483c6446 Fixed bug 4593 - Respect CMake's BUILD_SHARED_LIBS default behavior
tschwinger

Respect the BUILD_SHARED_LIBS variable when defined, and build either shared or static libs, which is CMake's default behavior (See https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html).

If the variable is not defined, the current behavior remains unchanged and both variants are built where the platform supports it. This way, it remains possible to build both in one shot, which seems convenient for distro builds and useful to promote some consistency between them.
2019-06-08 14:36:03 -07:00
Sam Lantinga 68bb8d6c13 Fixed bug 4594 - Fix install location of CMake targets on Apple platforms
tschwinger

Followup to #3651

As already noted by Ryan, no framework is being built, so we better install to lib/cmake.

That code was originally part of a patch submitted by David Demelier, whose credit BTW got lost (I combined his patch for #3572 with fixes for #2576 and #3613 resulting in #3651 because things started to depend on another).

I tested that the configuration files are found correctly in the new location on MacOS X based on a hint to the root (see https://cmake.org/cmake/help/latest/command/find_package.html#search-procedure).
2019-06-08 14:34:38 -07:00
Sam Lantinga 50aab19877 Fixed bug 4639 - CMake build does not generate libhidapi.so for Android
Manuel Sabogal

I noticed that the current Android.mk builds a libhidapi.so library for Android but the CMake build hasn't been updated to do so. I'll attach a patch that fixes this issue.
2019-05-21 17:33:31 -07:00
Serhii Charykov 510b01f5fc Fix WORKING_DIR parameter 2018-12-03 20:14:35 +02:00
Sam Lantinga f79190f407 Use _Exit() when available 2019-04-23 07:59:31 -07:00
Hugh McMaster af4bbb3064 configure.in: Rename to configure.ac to fix an 'aclocal' warning
Also rename references in related files.
2019-03-25 23:01:32 +11:00
Ryan C. Gordon 8a5a05c168 events: Let arbitrary signals to simulate iOS/Android backgrounding events.
This lets you build a custom embedded device that roughly offers the "this
process is going to the background NOW" semantics of SDL on a mobile device.
2019-03-15 15:51:05 -04:00
Ryan C. Gordon d4a21f54b8 cmake: Comment out some debug logging that can upset build environments.
Something about the dashes, colons, numbers makes some builders believe this
is an error message.
2018-12-02 02:43:32 -05:00
Ryan C. Gordon bc57ac27f9 mir: Removed mir client support.
Fixes Bugzilla #4288.
2018-11-02 21:34:17 -04:00
Ozkan Sezer 04761d7d6b CMakeLists.txt: set dylib version numbers properly. (bug #2915.) 2018-10-25 11:11:02 +03:00
Sam Lantinga c17d62996f Mark a subsystem as dummy, not disabled, if it was intended to be compiled in.
From Tom Black:

I'm having problems initializing the sensor module. I'm compiling with a standard ./configure && make && sudo make install, and the module says it's enabled, but SDL_Init(SDL_INIT_EVERYTHING) is failing with SDL_GetError() returning "SDL not built with sensor support".
2018-09-28 21:19:27 -07:00
Sam Lantinga 14d2ec80e7 commit 8f4dedc039190f5e734c47dcc4fc021b5793b659
Author: Micha? Janiszewski <janisozaur+signed@gmail.com>
Date:   Fri Sep 28 20:38:04 2018 +0200

    CMake: fix building tests on Linux

    In case where libunwind.h has been found, it will be used by compiler,
    but linker wasn't updated to reflect use of this new library.
2018-09-28 21:03:39 -07:00
Ozkan Sezer b11c75e9f4 configury, cmake: add check for endpointvolume.h :
add HAVE_ENDPOINTVOLUME_H, HAVE_MMDEVICEAPI_H and HAVE_AUDIOCLIENT_H
in SDL_config.h.in, SDL_config.h.cmake, SDL_config_windows.h, and in
SDL_config_winrt.h.
2018-09-28 13:41:04 +03:00
Ozkan Sezer cf7460e477 configury, cmake: make wasapi option independent of directx. 2018-09-28 11:30:50 +03:00
Sam Lantinga bc6c199790 Updated version to 2.0.9 2018-09-26 10:08:14 -07:00
Drew Pirrone-Brusse 58021b3834 Correct the name of the SDL shared library in CMake for Mac OS 2018-08-18 17:23:40 -04:00
Sam Lantinga 8aaef4b914 Fixed bug 3166 - It would be nice, if SDL would support including SDL project as a subdirectory into another CMake project
Wayde Reitsma

After attempting to use SDL2 in the way described in this bug, I found the main issue was the includes not being added to the compiler command.

I found the issue was that the target_include_directories commands for the SDL2, SDL2-static and SDL2main targets only sets the public includes for installations using the INSTALL_INTERFACE generator expression.

I have written a patch to CMakeLists.txt that fixes this issue by adding another item to the target_include_directories commands, utilizing the BUILD_INTERFACE generator expression to correctly add the include directory during builds.
2018-09-24 08:41:59 -07:00
Ryan C. Gordon c19516b50c cmake: correctly report Vulkan support at configure time (thanks, Tiago!).
Fixes Bugzilla #4262.
2018-09-18 11:49:42 -04:00
Ozkan Sezer 9753b9cc46 CMakeLists.txt: fix typo SDL_SENSORS_DISABLED -> SDL_SENSOR_DISABLED 2018-09-02 23:57:06 +03:00
Ryan C. Gordon df5d565f48 cmake: add sensor subsystem to the build. 2018-08-23 14:32:30 -04:00
Sam Lantinga 7c3040e08a First pass on the new SDL sensor API 2018-08-21 12:11:34 -07:00
Ethan Lee b4fe7412f9 SDL_exp 2018-08-04 11:52:46 -04:00
Ryan C. Gordon 4d4bb2b0ed cmake: use WINDOWS instead of WIN32. 2018-08-02 16:21:43 -04:00
Vitaly Novichkov 3a11bba267 Remove "lib" prefix from DLL file on MinGW builds
closes bug #4209.
2018-06-29 18:29:17 +03:00
Ozkan Sezer 8857791627 make WASAPI configurable in autofoo and cmake (default is on.)
closes bug #3798.
2018-07-01 17:01:04 +03:00
Sam Lantinga 5e8c81673f Fixed bug 4135 - Broken symlink libSDL2.so since rev11940
Tiago O.

Symlink points to the wrong folder, and target will always have debug postfix, so it'll be broken for other build types.
2018-04-15 09:37:51 -07:00
Bastien Bouclet 9856d96777 Fix the include path in the installed CMake target import file
Previously the include path was {INSTALL_PREFIX}/include,
it is now {INSTALL_PREFIX}/include/SDL2 to be consistent with
the other build and package configuration systems.

Fixes #4128.
2018-04-11 06:16:23 +02:00
Saad Khattak 6b5ed0fd49 Added debug postfix to install command and fixed library path 2018-04-10 08:03:54 -07:00
Micha? Janiszewski 0a5c10654c Fix ARM builds with MSVC 2018-03-10 21:16:14 -08:00
Olli Kallioinen 5cbb90da02 cmake: Set debug library name suffix per target instead of setting it globally. Don't add a suffix on android 2018-02-25 19:22:47 +02:00
Sam Lantinga 6cf4d0e43b Fixed bug 4092 - CMake support for building everything in the "test" directory
Eric Wasylishen

Patch to support building the tests with cmake.
Disabled by default, use: "cmake .. -DSDL_TEST=YES" to enable the tests.

Tested on macOS 10.13 with the ninja, makefile, and Xcode generators, and Windows 10 with the Visual Studio 2017 generator.
2018-02-24 08:59:58 -08:00
Ethan Lee 11c348b4d7 SDL_log10 2018-01-17 11:53:09 -05:00
Sam Lantinga c329381f4c Description: fix installation of shared library for Android
Author: Boris Pek <tehnick-8@yandex.ru>
Last-Update: 2018-01-10
2018-02-07 14:03:24 -08:00
Sam Lantinga f1ec8a5f4c Check for immintrin.h before using it in SDL_cpuinfo.h 2017-12-11 12:00:12 -08:00
Ryan C. Gordon 351d6d4784 audio: Port WASAPI to WinRT, remove XAudio2 backend.
XAudio2 doesn't have capture support, so WASAPI was to replace it; the holdout
was WinRT, which still needed it as its primary audio target until the WASAPI
code code be made to work.

The support matrix now looks like:

WinXP: directsound by default, winmm as a fallback for buggy drivers.
Vista+: WASAPI (directsound and winmm as fallbacks for debugging).
WinRT: WASAPI
2017-12-06 12:24:32 -05:00
Sam Lantinga 57ebc72714 Fixed bug 3975 - Add GLES2 support for macOS via ANGLE library
Andrey

Seems latest google angle library successfully built & tested under macOS'es.

https://github.com/google/angle

We need to use GLES2 to implement true cross-platform code.
2017-12-04 20:35:01 -08:00
Sam Lantinga a4b33d7451 Fixed bug 3959 - cmake build broken by commit 11702 (7fdbffd47c0e) due to typo
Mate Nagy
There is a typo in CMakeLists.txt that makes CMake exit with failure.

Change that causes the problem: (Notice the double ending brackets)
   ${SDL2_SOURCE_DIR}/src/video/*.c)
+  ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c)

Fix:
Just remove the first ending bracket resulting in:
   ${SDL2_SOURCE_DIR}/src/video/*.c
   ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c)
2017-11-20 00:03:23 -08:00
Sam Lantinga a6a4e27ae8 Updated SDL's YUV support, many thanks to Adrien Descamps
New functions get and set the YUV colorspace conversion mode:
	SDL_SetYUVConversionMode()
	SDL_GetYUVConversionMode()
	SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Sam Lantinga 2c5724ef5d Updated version to 2.0.8 since SDL_image depends on it 2017-11-04 21:58:48 -07:00
Sam Lantinga bcdf8b916b Added SDL_fmod() and SDL_fmodf() 2017-11-04 17:35:03 -07:00
Sam Lantinga 34502143d9 Added float versions of SDL's math functions 2017-11-04 15:34:14 -07:00
Sam Lantinga f658a737f6 Fixed bug 3882 - cmake fix for osx
Ozkan Sezer

In my cross-build environment with cmake-2.8.12.1, cmake does not add
SDL_coreaudio.m to its makefiles and the result is a failure. The fix
is simple: set the language to C for it as it is done at other places
in CMakeLists.txt.
2017-10-15 21:07:01 -07:00
Sam Lantinga 9c580e14c9 Added functions to query and set the SDL memory allocation functions:
SDL_GetMemoryFunctions()
    SDL_SetMemoryFunctions()
    SDL_GetNumAllocations()
2017-10-12 13:44:28 -07:00
Sam Lantinga f4cd68a537 Fixed bug 3866 - CMake error when trying to make the 'uninstall' target when it already exists
Steve Robinson

In my project, the 'uninstall' target is already created by the glew library.  I get this error when SDL2 tries to create it:

CMake Error at _build/3rdparty/SDL2/SDL2-2.0.6/CMakeLists.txt:1816 (add_custom_target):
  add_custom_target cannot create target "uninstall" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory
  "D:/Code/sdl2-tutorial/_build/3rdparty/glew/glew-2.1.0/build/cmake".  See
  documentation for policy CMP0002 for more details.

To fix it, go to the bottom of the SDL2 CMakeLists.txt file.  Add an if statement to check for the existence of the target before creating it.  The end result looks like this:

if(NOT TARGET uninstall)
  configure_file(
      "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
      "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
      IMMEDIATE @ONLY)

  add_custom_target(uninstall
      COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

This is how the glew library deals with this possibility in their CMakeLists.txt file.
2017-10-12 08:47:02 -07:00
Sam Lantinga 0ce23a5498 Updated version to 2.0.7 2017-10-12 08:08:04 -07:00
Sam Lantinga 827e985041 Fixed bug 3862 - Install is broken when adding SDL2 to an existing CMake project
Steve Robinson

In my existing CMake project, I use add_subdirectory to add the source for SDL2.  This worked fine in 2.0.5, but now in 2.0.6 when I build the INSTALL CMake target, I get this error:

file INSTALL cannot find "D:/path/to/SDL2Config.cmake".
Call Stack (most recent call first):
  3rdparty/SDL2/cmake_install.cmake:32 (include)
  3rdparty/cmake_install.cmake:36 (include)
  cmake_install.cmake:32 (include)

To fix this, I changed line 1770 from this:
${CMAKE_SOURCE_DIR}/SDL2Config.cmake

To this:
${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake
2017-10-06 16:42:43 -07:00
Sam Lantinga 260db92cbb Added stub Steam Controller sources to Android and iOS command line builds 2017-09-22 16:33:34 -07:00
Sam Lantinga 2cdb967435 Fixed the include path for khronos with Visual Studio 2017-09-10 10:25:36 -07:00
Sam Lantinga f465f24d73 Fixed bug 3760 - RWops doesn't check for integer overflow when stdio_fseek only supports 32 bits
Simon Hug

When RWops seeks with fseek or fseeko it uses the types long or off_t which can be 32 bits on some platforms. stdio_seek does not check if the 64-bit integer for the offset fits into a 32-bit integer. Offsets equal or larger than 2 GiB will have implementation-defined behavior and failure states would be very confusing to debug.

The attached patch adds range checking by using the macros from limits.h for long type and some bit shifting for off_t because POSIX couldn't be bothered to specify min and max macros.

It also defines HAVE_FSEEKI64 in SDL_config_windows.h so that the Windows function gets picked up automatically with the default config.

And there's an additional error message for when ftell fails.
2017-09-09 08:36:37 -07:00
Sam Lantinga 347fe70432 Fixed bug 3789 - Android : small clean up
Sylvain

Since https://hg.libsdl.org/SDL/rev/6546daa45a02
SDL_android_main.c is empty and then produce a warning
nativeInit does not exist and dont need to be mark undefined
2017-08-30 14:25:01 -07:00
Sam Lantinga e53c5c5c50 Fix QNX build - prioritize system EGL headers over the Khronos ones 2017-08-30 00:40:06 -07:00
Sam Lantinga 92bf608527 Fixed bug 3616 - SDL_GL_CreateContext fails with SDL_GL_CONTEXT_DEBUG_FLAG and ANGLE/GLES 2.0
Colin Barrett

Using the pre-built x86 devel libs from here:
https://www.libsdl.org/release/SDL2-devel-2.0.5-VC.zip

If I have:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);

and I'm using ANGLE/(a GL driver that doesn't provide an ES2 context) such that SDL_EGL_CreateContext is called by SDL_GL_CreateContext, I get the error "Could not create EGL context (context attributes are not supported)" and no context is created.

Looking at the code in SDL_EGL_CreateContext - if gl_config.flags is non-zero, it looks like the code in the section guarded with "#ifdef EGL_KHR_create_context" should be executed - but it apparently isn't.

Is it possible this section hasn't been compiled into the pre-built libraries? If I build SDL2.dll myself using the Visual C++ solution (VS2015 Community Update 3) then the call succeeds as I expect
2017-08-29 22:04:43 -07:00
Sam Lantinga c0530bcdf3 We removed QuartzCore link dependency in commit 5be6badaf7e1 2017-08-28 22:42:41 -07:00
Sam Lantinga ce2b16445e Be clear that disabling Vulkan surface support disables the entire SDL Vulkan integration 2017-08-28 00:11:38 -07:00
Sam Lantinga ea91908e95 Fixed Android ABI check to match vulkan/vk_platform.h 2017-08-27 23:39:38 -07:00
Ryan C. Gordon c722e58d1f vulkan: Include a copy of vulkan.h and vk_platform.h.
Now we can provide Vulkan support in the build even if the build box doesn't
have a Vulkan SDK, since we dynamically link to the library anyhow.
2017-08-27 23:25:12 -04:00
Ryan C. Gordon 25e3a1ec90 vulkan: Initial Vulkan support!
This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.
2017-08-27 22:15:57 -04:00
Sam Lantinga 5ca0152218 Fixed bug 3774 - Cmake build fails for Android
sfalexrog

Android haptic code was not added to CMakeLists.txt, leading to build failures when targeting Android platform.

Attached patch adds Android haptic driver to source sets and adds configuration parameter to SDL_config.h.cmake.
2017-08-26 21:17:12 -07:00
Sam Lantinga f807655b7d Fixed bug 3761 - Windows non-MinGW cmake build defines HAVE_WCSLCPY and HAVE_WCSLCAT
Tom Seddon

0f0ad62237 (git head at the time of writing); Visual Studio 2015, toolset v140, Platform 10.0.14393.0, building for x64

Windows non-MinGW cmake build sets defines implying wcslcpy and wcslcat are available, but Windows doesn't have these functions.

Ryan C. Gordon

That's weird, these are the exact two functions that Emscripten incorrectly believed it had until we upgraded the buildbot's emsdk install.

Not sure what's up with this, but it's possibly not a MingW-specific thing!
2017-08-21 11:25:04 -07:00
Sam Lantinga a78c20ae19 configury: check mmdeviceapi.h and audioclient.h before enabling wasapi. 2017-08-21 11:17:38 -07:00
Sam Lantinga 2dc5d32fab Updated version to 2.0.6 2017-08-18 18:16:37 -07:00
Ryan C. Gordon 5c4a45f1cc cmake: some iOS fixes (don't link to Cocoa or Carbon frameworks).
Fixes Bugzilla #3625.
2017-08-18 20:25:14 -04:00
Ryan C. Gordon f4011bf081 cmake: added a FIXME for later.
Have to figure out what cmake version fixed this and bump the minimum to that.
2017-08-18 20:00:29 -04:00
Ryan C. Gordon f75caa2ff6 cmake: Fix building for macOS with Xcode generator (thanks, dungaipara!).
Fixes Bugzilla #3625.
2017-08-18 18:52:25 -04:00
Ryan C. Gordon 47beda9767 cmake: add core/unix sources to the build.
Fixes Bugzilla #3757.
2017-08-17 15:44:47 -04:00
Sam Lantinga fb835f9e3b Fixed bug 2330 - Debian bug report: SDL2 X11 driver buffer overflow with large X11 file descriptor
manuel.montezelo

Original bug report (note that it was against 2.0.0, it might have been fixed in between):  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733015

--------------------------------------------------------
Package: libsdl2-2.0-0
Version: 2.0.0+dfsg1-3
Severity: normal
Tags: patch

I have occasional crashes here caused by the X11 backend of SDL2. It seems to
be caused by the X11_Pending function trying to add a high number (> 1024)
file descriptor to a fd_set before doing a select on it to avoid busy waiting
on X11 events. This causes a buffer overflow because the file descriptor is
larger (or equal) than the limit FD_SETSIZE.

Attached is a possible workaround patch.

Please also keep in mind that fd_set are also used in following files which
may have similar problems.

src/audio/bsd/SDL_bsdaudio.c
src/audio/paudio/SDL_paudio.c
src/audio/qsa/SDL_qsa_audio.c
src/audio/sun/SDL_sunaudio.c
src/joystick/linux/SDL_sysjoystick.c


--------------------------------------------------------

On Tuesday 24 December 2013 00:43:13 Sven Eckelmann wrote:
> I have occasional crashes here caused by the X11 backend of SDL2. It seems
> to be caused by the X11_Pending function trying to add a high number (>
> 1024) file descriptor to a fd_set before doing a select on it to avoid busy
> waiting on X11 events. This causes a buffer overflow because the file
> descriptor is larger (or equal) than the limit FD_SETSIZE.


I personally experienced this problem while hacking on the python bindings
package for SDL2 [1] (while doing make runtest). But it easier to reproduce in
a smaller, synthetic testcase.
2017-08-14 20:22:19 -07:00
Sam Lantinga f8de064c0a Added wchar.h to fix build on some platforms with new wcs* functions 2017-08-13 22:26:44 -07:00
Sam Lantinga f1829d956f Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
Sam Lantinga 75d5f34398 Forgot to add function check for fopen64 to CMake build 2017-08-11 21:17:10 -07:00
Ryan C. Gordon 73c6cebb80 cmake: Pacify warning about Policy CMP0042 not being set. 2017-08-09 22:43:16 -04:00
Sam Lantinga 496337b3cf Fixed bug 3651 - CMake build does not install CMake package configuration
tschwinger@elitemail.org

Most ironically, although autoconf/automake-based builds install (pretty half-assed) CMake package configuration files, they're missing in installations resulting from CMake-based builds entirely.

A proper configuration file typically also loads target exports (implemented in patch 3572, also fixing this issue - see my comment on that issue for details).

I believe it would be best to let the dinosaurs go extinct and redirect all build efforts to the CMake end for two reasons:

1. It potentially provides the best user experience, but you'd have to give it some love and ship with less quirky buildfiles.

2. It would force distros to build SDL via CMake and thus would ensure target exports are actually available everywhere.

Various CMake patches I submitted today in summary (directly converted from the HG commits and `am`d onto a fork of a git mirror that happened to be on `tip`).

    https://github.com/tschw/SDL/commits/patched

Fixing #2576 #3572, #3613, and this fresh ticket, which is almost entirely advertisement ;).

These already do to make SDL much less of a quirky fella to have in your dependency tree...
2017-08-09 19:03:10 -07:00
Olli Kallioinen 2b5a5c510b Android build fixes
-Enabling checking for GCC_ATOMICS also on clang by default. This way all Android ABIs build successfully
 -Android cmake: Threading was not enabled correctly
 -Android cmake: Timers and dynamic lib loading were not included in the sources
2017-06-08 22:07:55 +03:00
Sam Lantinga 56363ebf61 Fixed bug 3690 - SDL2 KMS/DRM render context support
Manuel

The attached patch adds support for KMS/DRM context graphics.

It builds with no problem on X86_64 GNU/Linux systems, provided the needed libraries are present, and on ARM GNU/Linux systems that have KMS/DRM support and a GLES2 implementation.
Tested on Raspberry Pi: KMS/DRM is what the Raspberry Pi will use as default in the near future, once the propietary DispmanX API by Broadcom is overtaken by open graphics stack, it's possible to boot current Raspbian system in KMS mode by adding "dtoverlay=vc4-kms-v3d" to config.txt on Raspbian's boot partition.
X86 systems use KMS right away in every current GNU/Linux system.

Simple build instructions:

$./autogen.sh
$./configure --enable-video-kmsdrm
$make
2017-08-02 10:22:48 -07:00
Sam Lantinga 3c09265daf Fixed bug 3609 - Windows build fails due to conflicting types for 'XINPUT_GAMEPAD_EX'
Ozkan Sezer

(In reply to Ryan C. Gordon from comment #9)
> I've put this patch in as https://hg.libsdl.org/SDL/rev/7213ae46e870 ...can
> you verify this works on the latest MinGW?
>
> Thanks,
> --ryan.


This patch is wrong: the structure in question has nothing to do with any
gcc version in use.  I suggest reverting this adding a conigury check for
it, instead.  Something like the following should do it: (configure needs
regenerating.)
2017-07-10 18:31:28 -07:00
Sam Lantinga c1cd93e562 Fixed bug 3670 - CMake IOS haptic error 2017-06-12 16:35:34 -07:00
Ryan C. Gordon e5f4a71f1a cmake: iOS haptic section was referencing power source code (thanks, Martin!).
Fixes Bugzilla #3670.
2017-06-11 16:00:45 -04:00
Ryan C. Gordon d9039f2396 jack: Initial shot at a JACK audio target.
http://jackaudio.org/

Fixes Bugzilla #2163.
(with several more commits following to improve this code.)
2017-06-08 13:27:58 -04:00
Olli Kallioinen 11289b766f Android cmake build fixed to work with the official android gradle plugin 2017-06-04 21:25:57 +03:00
Ryan C. Gordon dc8a22cd9c cmake: don't use /NODEFAULTLIB if we are using the C runtime (thanks, Rob!).
Fixes Bugzilla #3640.
2017-06-06 13:39:29 -04:00
Ryan C. Gordon a7fc2822d4 audio: rename bsd target to netbsd.
Apparently this is no longer a generic BSD audio target, and hasn't been for
years, so rename it for NetBSD.
2017-05-24 19:56:59 -04:00
Ryan C. Gordon 0e7530b057 cmake: add WASAPI audio target to the build (thanks, Martin!).
Fixes Bugzilla #3588.
2017-02-23 22:38:04 -05:00
Ryan C. Gordon 5ea0c893cd CMake: fixed logic error in setting -mfpmath=387.
Fixes Bugzilla #3565.
2017-01-24 12:20:41 -05:00
Ryan C. Gordon 3594bf8eeb audio: Wired up new SSE code to build system. 2017-01-23 01:05:44 -05:00
Sam Lantinga df25258a1e Added configure and cmake support for libsamplerate 2017-01-06 20:43:53 -08:00
Ryan C. Gordon 35430a73f2 cpuinfo: first attempt at SDL_HasNEON() implementation. 2016-11-17 01:15:16 -05:00
Sam Lantinga f3502c3c53 Fixed building with cmake when fcitx isn't installed 2016-10-14 01:04:21 -07:00
Sam Lantinga 34eebfba9b Fixed setting the version info in the shared library when using CMake
Ray Molenkamp

When building sdl as shared lib, the version info is lacking in the final binary.

CMake gathers the right resource files into ${VERSION_SOURCES} but then doesn't do anything with them.
2016-10-03 03:42:10 -07:00
Sam Lantinga c9be93c65b Fixed bug 3078 - cmake: fix sdl2.m4 install location on cross hosts
Timo Gurr

On cross hosts running autotools for SDL2_gfx-1.0.1 fails to find sdl2.m4:

eautoreconf: running in /var/tmp/paludis/build/media-libs-SDL2_gfx-1.0.1/work/SDL2_gfx-1.0.1 ...
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
libtoolize --copy --force --automake
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
autoconf
configure.in:128: error: possibly undefined macro: AM_PATH_SDL2
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
 * Failed Running autoconf !

SDL2 installs it to /usr/x86_64-pc-linux-gnu/share/aclocal on cross hosts, attached patch makes use of CMAKE_INSTALL_FULL_DATAROOTDIR to support correctly installing to the arch independent location /usr/share/aclocal.
2016-10-01 15:11:18 -07:00
Alex Szpakowski 571f4ce8a6 Fix CMake setting an incorrect video backend on iOS 2016-10-01 17:05:29 -03:00
Sam Lantinga 671f2a4914 Fixed bug 3268 - CMAKE: ios fixes
Martin Gerhardy

ios is not properly handled in the cmake file.

this patch is a start to do so - it properly builds for me with it.
2016-10-01 12:54:48 -07:00
Sam Lantinga bb24662c79 Fixed bug 3301 - IBus support on Linux with CMake
joe.gsoc16

I recently looked into Unicode support in SDL2 and realized that
SDL_TEXTEDITING doesn't get triggered at all (Japanese IME).
According to others on IRC it works fine on Windows/Mac but not
for me on (arch)Linux.
When compiling SDL with autotools, IBus support is enabled by
default but not so with CMake.
I never used CMake before but got it working and also included
that pkg-config determines flags for dbus (FIXME in CMakeLists).
2016-10-01 12:48:08 -07:00
Sam Lantinga e45698d218 Updated version to 2.0.5 in preparation for release 2016-09-28 22:24:01 -07:00
Sam Lantinga e5070d20ee Fixed set of libraries needed to build on Mac OS X 2016-09-15 08:57:56 -07:00
Sam Lantinga 93d42e2d3e Hopefully fixed the cmake build on Mac OS X 2016-09-15 08:46:14 -07:00
Jukka Jyl?nki 264e996e0f Fix CMake CMAKE_REQUIRED_FLAGS handling to preserve existing CMake flags required by Emscripten toolchain. 2016-09-13 00:03:50 -07:00
Charlie Birks 42feccea37 Include timers when using cmake (#29) 2016-09-13 00:03:40 -07:00
Ryan C. Gordon 6188c33420 mac: Patched to compile with CMake project. 2016-09-04 01:42:46 -04:00
Alex Szpakowski 2c3bf6658a Windows CMake: don't try to link dxguid, it's unavailable when using Visual Studio's XP-compatible toolset. 2016-03-18 22:15:53 -03:00
Sam Lantinga e5d575b933 Expose the EGL display and window for Vivante SDL windows 2016-01-16 21:58:49 -08:00
Ryan C. Gordon 1615b2e29d CMake: only set "-O3 -g" defaults if CMAKE_BUILD_TYPE wasn't set at all. 2016-01-08 07:32:51 -05:00
Sam Lantinga 757e994eaa Fixed --enable-new-dtags check with cmake 2016-01-07 17:21:50 -08:00
Sam Lantinga dc5f05bb99 Use --enable-new-dtags to set RUNPATH rather than RPATH so that LD_LIBRARY_PATH is not overridden by the application. 2016-01-07 16:42:30 -08:00
Ryan C. Gordon bb1e2bd0b5 CMake: Turned off Mac OS X rpath warning kludge.
Apparently CMake errors out if it doesn't know this policy, and we don't
otherwise require CMake 3.0 yet. Sigh.
2016-01-05 05:44:32 -05:00
Ryan C. Gordon e6e62bee71 CMake: Let static libraries optionally be built with Position Independent Code. 2016-01-05 01:26:32 -05:00
Ryan C. Gordon 008a6abd04 CMake: use the old MACOSX_RPATH behavior (for now), silence the warning. 2016-01-05 01:25:54 -05:00
Ryan C. Gordon 1373e8909a Try to build with GCC's -Wdeclaration-after-statement.
This will help catch things that'll cause issues on C89 compilers before we
send them on to fail on Buildbot.
2016-01-04 22:58:38 -05:00
Ryan C. Gordon 1240f8e0a6 CMake: Don't make a libSDL2.so symlink on Mac OS X (do .dylib instead). 2016-01-03 20:52:44 -05:00
Alex Szpakowski b0d8dfcd8a CMake: Fixed building for Windows with VS2015 (bug #3080).
- Don't try to link with the Visual C runtime.

- Avoid code generation that would use functions from the VC runtime.
2015-12-31 15:26:40 -04:00
Ryan C. Gordon 61518bce6b CMake: Changes to get CMake project to work with Android (thanks, Martin!).
Fixes Bugzilla #3194.

(but note that Bugzilla #3200 still needs to be resolved to get this really
going on Android, at a minimum.)
2015-12-29 00:57:24 -05:00
Ryan C. Gordon 7e679ed2c1 CMake: fixed a failure to reset CMAKE_REQUIRED_FLAGS (thanks, Martin!).
This would break Emscripten builds with the CMake project files (etc).

Fixes Bugzilla #3197.
2015-12-29 00:36:03 -05:00
Ryan C. Gordon c9927bbb17 CMake: don't try to use the Linux joystick code on Android (thanks, Martin!).
Fixes Bugzilla #3201.
2015-12-29 00:24:37 -05:00
Ryan C. Gordon 7ca3b27064 CMake: Fixed to work on Windows 8 SDK (thanks, Martin!).
Fixes Bugzilla #3207.
2015-12-29 00:02:43 -05:00
Alex Szpakowski 42f282cc1b Fix bug 3081: CMake configuration auto-disables OpenGL ES support on Windows.
Thanks to EntranceJew for the patch.
2015-08-28 19:10:46 -03:00
Alex Szpakowski d154e6c6e3 Fixed bug 3098: CMake project never enables xinput support on Windows.
Thanks to EntranceJew for debugging the issue.
2015-08-28 19:05:24 -03:00
Philipp Wiesemann 0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00