Commit graph

93 commits

Author SHA1 Message Date
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