Commit Graph

401 Commits

Author SHA1 Message Date
Sam Lantinga d3cc5764c0 Modern CMake doesn't need "LANGUAGE C" for Objective-C
CMake 3.19 fails to compile Objective-C with that property set

Fixes https://github.com/libsdl-org/SDL/issues/5418
2022-03-18 07:36:16 -07:00
pionere 85dff3e453 emscripten: obey enable-misc/SDL_MISC settings 2022-03-16 14:55:28 +03:00
Ozkan Sezer 61a93d3c46 minor whitespace cleanup. 2022-03-15 23:10:02 +03:00
Ryan C. Gordon 3ab739afff
cmake: Make test code use proper C main functions.
Fixes #5021.
2022-03-13 12:10:52 -04:00
Ozkan Sezer 4a43321c81 cmake: Fix bug #5361.
src/joystick/*.c wasn't unconditionally added to source list even though
joystick is an SDL subsystem. Also removed the `SDL_JOYSTICK AND NOT APPLE`
condition from src/joystick/dummy/*.c source addition: the OSX unresolved
symbols issue, if it really is there, should be fixed separately.

Fixes https://github.com/libsdl-org/SDL/issues/5361, i.e. build failures
when SDL_JOYSTICK and SDL_HAPTIC are disabled.
2022-02-23 18:10:02 +03:00
Ozkan Sezer b5614d0c6e cmake: fix UWP joystick.
from: https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/0005-Fix-uwp-joystick.patch
2022-02-04 20:05:14 +03:00
pionere ff2d62d89f dlopen is not a subsystem 2022-01-28 20:40:19 -05:00
pionere fa8075c4fc add audio/video dummies if nothing else available 2022-01-28 20:40:19 -05:00
pionere 39c723fc9c fix HAVE_SDL_VIDEO flag of CMakeLists.txt [IOS OR TVOS] 2022-01-28 20:40:19 -05:00
pionere 3dba2a73f1 fix HAVE_SDL_AUDIO flag of CMakeLists.txt II. 2022-01-28 20:40:19 -05:00
pionere 3936af99d8 fix HAVE_SDL_AUDIO flag of CMakeLists.txt 2022-01-28 20:40:19 -05:00
pionere 21510387cf fix CMakeLists.txt vs. configure inconsistencies
- atomic subsystem is disabled by default (changed in configure)
- SDL_WAYLAND_LIBDECOR is disabled by default if SDL_WAYLAND is not set (changed in CMakeLists.txt)
2022-01-28 20:40:19 -05:00
pionere 11cdde01f3 fix MacOS build with disabled SDL_SENSOR
+ get rid of the double-check (SDL_HAPTIC depends on SDL_JOYSTICK)
2022-01-28 20:40:19 -05:00
pionere 176941a4fb allow MacOS build without SDL_FILE 2022-01-28 20:40:19 -05:00
pionere eb80f2c65a sync handling of subsystems II. 2022-01-28 20:40:19 -05:00
pionere 65e9415b98 sync handling of subsystems
- add DUMMY-define in case the subsystem is enabled but not available (filesystem/misc/locale)
- add missing PSP/VITA-filesystem defines
- sync the order of filesystems in SDL_config.h.cmake/in
- add option to disable locale subsystem in configure
2022-01-28 20:40:19 -05:00
pionere 118de86202 more conform vulkan/metal configuration 2022-01-28 20:40:19 -05:00
pionere 606d2ea87f bugfix for "add 'Misc' subsystem" 2022-01-28 20:40:19 -05:00
pionere 998117b3ff add 'Misc' subsystem 2022-01-28 20:40:19 -05:00
Eric Wasylishen 71e06a536a cmake: fix Metal detection
Confirmed to work on:
macOS 10.15.7
XCode Version 12.4 (12D4e)
2022-01-26 12:33:16 -05:00
Charlie Birks 15ebad6e7d emscripten: Implement SDL_OpenURL 2022-01-22 13:31:11 +00:00
Sam Lantinga a0e3c884d4 Updated to version 2.0.21 for development 2022-01-17 15:32:27 -08:00
Ozkan Sezer a575e2cf5e Enable alloca on mingw/cygwin builds:
This effectively reverts commit 391d73e37b26614e2e343ca8e9d4334e07380896
Fixes https://github.com/libsdl-org/SDL/issues/5234
2022-01-17 20:56:24 +03:00
Ozkan Sezer 407d4e470a cmake: simplify after the previous os/2 commit. 2022-01-12 20:32:00 +03:00
Ozkan Sezer f199f832e9 cmake: added target_properties for os/2. 2022-01-12 20:22:28 +03:00
ulatekh bb9ebad74b Optionally disable generation of SDL2main and uninstall projects.
Mostly meant to allow SDL2 to be incorporated as a sub-project of
external CMake projects.
2022-01-11 15:56:37 -08:00
Khem Raj fcf0e524bb cmake: Remove libunwind-generic as hard dependency
when using alternate unwind implementations like LLVM libunwind
this library is not provided yet the libunwind features are fully
implemented in main libunwind, making this hard dependency assumes
a particular libunwind implementation, this patch makes it optional
which makes the builds to work with llvm libunwind

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2022-01-11 11:00:20 -08:00
Ozkan Sezer b265677610 cmake: initial attempt at adding os/2 support. 2022-01-11 11:33:02 +03:00
Neal Gompa 0696fc0134 cmake: Split SDL2-static and SDL2main into their own target exports
This makes it so that the generated targets are not interdependent,
which allows Linux distributions to split libraries into the
appropriate subpackages as needed.
2022-01-08 09:50:14 -08:00
Sam Lantinga 9294634840 Updated to version 2.0.20 for release 2022-01-07 18:29:40 -08:00
Ozkan Sezer 75ac944b9c check for tpcshrd.h and define HAVE_TPCSHRD_H if it's available. 2022-01-06 22:24:00 +03:00
ulatekh 3ea82eaaff Under MSVC, build project-sources in parallel. 2022-01-04 15:24:31 -08:00
Wouter Wijsman cd1f24a998 Add forgotten psppower library to link 2022-01-03 10:39:15 -08:00
Francisco Javier Trujillo Mata 13a9cd4797 Adding sysfilesystem driver to PSP 2022-01-02 08:06:04 -08:00
Cameron Gutman 83583dc49d cmake: Fix WGI detection with older SDKs 2021-12-19 15:07:37 -06:00
Sam Lantinga 881feca1f2 CMAKE: fixed cflags check for build type
Martin Gerhardy wrote:

If there is a variable named test, then cmake does variable-value comparison:
if (test STREQUAL "")
is equivalent to:
if ("${test}" STREQUAL "")

If there is no variable named test, then cmake does string literal comparison:
if (test STREQUAL "")
is equivalent to:
if ("test" STREQUAL "")

That means basically - the current stuff works - but is not how it should be done.

Fixes https://github.com/libsdl-org/SDL/issues/2100
2021-12-17 19:14:34 -08:00
Ivan Epifanov 60c3ca49b4 Vita: disable arm asm blitters and add missing pvr dep 2021-12-15 01:32:56 +03:00
Ozkan Sezer 493d45f00f minor tidy-up in cmake script. 2021-12-07 14:24:32 +03:00
Wouter Wijsman 897c7cfa8b Make sure SDL_VIDEO_RENDER_PSP is set 2021-12-07 14:03:00 +03:00
Wouter Wijsman 21fd0047e3 Initial for building PSP version with CMake 2021-12-07 14:03:00 +03:00
Anders Jenbo d68b429cfb [ios] Fix failing to link iconv when build using CMake 2021-12-03 04:30:53 -08:00
Sam Lantinga 5fc901d4f3 Updated to version 2.0.19 for development 2021-11-30 09:58:21 -08:00
Ozkan Sezer 5a0ea7fb17 Check for O_CLOEXEC definition in fcntl.h at configuration time,
If not available, define it internally as 0 (in SDL_internal.h).
Define it as available for macOS >= 10.7 in SDL_config_macosx.h.
2021-11-27 19:23:10 +03:00
Ozkan Sezer cb2f3bedf5 tidy-up a comment in cmake script 2021-11-26 21:20:50 +03:00
Ozkan Sezer 22e59cd106 CMakeLists.txt: update DYLIB_CURRENT_VERSION too 2.0.18 for release 2021-11-26 19:15:28 +03:00
Sam Lantinga 7242075b2b Updated version to 2.0.18 for release 2021-11-26 08:12:45 -08:00
Cameron Gutman 2fa35757a9 cmake: Weak link to GameController.framework to handle older OSes 2021-11-25 16:01:56 +03:00
Cameron Gutman bc409163a8 cmake: Detect SDL_JOYSTICK_MFI for macOS 2021-11-25 16:01:56 +03:00
Ozkan Sezer d9f70878f9 don't use CMAKE_COMPILER_IS_MINGW
Fixes https://github.com/libsdl-org/SDL/issues/5002
2021-11-24 18:10:00 +03:00
Ozkan Sezer b7f9c2089a cmake: handle warning flags properly (thanks to hgs3 for pointers.)
fixes https://github.com/libsdl-org/SDL/issues/4983
2021-11-23 18:56:50 +03:00
Ozkan Sezer f8900583e5 removed windows winmm joystick driver 2021-11-23 17:04:40 +03:00
Ozkan Sezer 35b7ce1893 cmake: final report fixes for mmx, ssemath, dummyvideo, wasapi, xinput.
also moved CoreVideo framework out of if(SDL_FILE) block, and removed a
now-irrelevant mingw related fixme.
2021-11-22 14:10:02 +03:00
hgs3 6b66542e7b Fixing compilation errors for VS2019 Clang toolset (fixes #4702) 2021-11-18 03:28:00 +03:00
Cameron Gutman 43d1b42a5a cmake: Sync build config options with autotools
- SDL_CLOCK_GETTIME now defaults to ON to match autotools build
- Add detection of float.h and Xdbe
- Fix detection of pthread_setname_np() (requires _GNU_SOURCE)
- Move SDL_USE_IME definition into SDL_config.h.cmake
2021-11-16 16:51:38 -08:00
Sam Lantinga a0f8afb599 Separated the HIDAPI subsystem from HIDAPI joysticks
You can now disable HIDAPI joysticks while retaining the HIDAPI SDL API
2021-11-11 09:16:44 -08:00
Ryan C. Gordon 8f63e9ff68
cmake: use generated SDL_config.h to build SDLmain static lib
Thanks to @toazz for the patch!

Fixes #4829.
2021-11-09 11:13:52 -05:00
Ryan C. Gordon 3a82e432f0
cmake: Moved back to requiring merely CMake 3.0.0.
This means it now works with any CMake released since 2014 instead of 2018.

This was mostly just readding some special cases, and requiring 3.11.0 only
for Windows Stores apps, which isn't unreasonable. The biggest concern is
a Linux distribution not having a recent CMake; most other places will be
manually downloading and installing their own CMake.

Fixes #4930.
2021-11-09 11:06:33 -05:00
Ethan Lee 4b42c05ba1 video: Add SDL_SetWindowMouseRect.
This API and implementation comes from the Unreal Engine branch of SDL, which
originally called this "SDL_ConfineCursor".

Some minor cleanup and changes for consistency with the rest of SDL_video, but
there are two major changes:

1. The coordinate system has been changed so that `rect` is _window_ relative
   and not _screen_ relative, making it easier to implement without having
   global access to the display.
2. The UE version unset all rects when passing `NULL` as a parameter for
   `window`, this has been removed as it was an unused feature anyhow.

Currently this is only implemented for X, but can be supported on Wayland and
Windows at minimum too.
2021-11-08 14:16:54 -08:00
Ozkan Sezer 2636d839e3 cmake: add hidapi to 'SDL_SUBSYSTEMS' 2021-11-08 22:25:32 +03:00
Ozkan Sezer 36067fa129 cmake: include hid.cpp in android sources 2021-11-08 21:35:24 +03:00
Ozkan Sezer 001aa4dab8 cmake: more hidapi fixes. 2021-11-08 21:12:02 +03:00
Sam Lantinga 4bbbe5f84c Fixed CMake build by adding hidapi files
This needs more work to remove the hidapi shared library build, but at least Linux builds are unblocked
2021-11-08 09:28:36 -08:00
Cameron Gutman 7f308abb55 cmake: Only prevent MSVC codegen using the CRT if SDL_LIBC=OFF 2021-11-04 01:02:48 -05:00
Cameron Gutman 16845eef29 cmake: Add SDL include path when building tests
The tests can't find any of the SDL includes otherwise
2021-10-31 17:57:40 -07:00
Cameron Gutman 7e8469d196 cmake: Fix MinGW build break in WGI joystick driver
Just look for windows.gaming.input.h rather than assuming its presence
or absence based on other CMake variables.

Fixes MinGW builds in CI
2021-10-31 09:34:34 -05:00
Cameron Cawley 25c71748ad Add a barebones RISC OS video driver 2021-10-30 21:25:01 -07:00
Ybalrid (Arthur Brainville) 81fe2ccb9c cmake: Add missing SDL_JOYSTICK_WGI in config step
SDL_config.h *can* define SDL_JOYSTICK_WGI. On builds with the Windows
10 SDK available, this allow implementing trigger rumbling on Xbox One
controllers. The files included in the Visual Studio Solution in
VisualC\SDL.sln *do* have this define set.

fix #4859
2021-10-30 21:21:54 -07:00
Joel Winarske 378c5d7ffe make aclocal install relative 2021-10-26 22:37:53 -04:00
Cameron Cawley 3db898c5b6 riscos: Implement SDL_GetPrefPath() 2021-10-12 13:07:52 -07:00
Ryan C. Gordon ab7910facf
cmake: Move the old, global add_definitions (etc) to an interface library.
Fixes #4150.
2021-10-05 12:34:29 -04:00
Ryan C. Gordon 25fdba39bb
cmake: fix indentation. 2021-10-05 11:19:14 -04:00
Ryan C. Gordon f306662544
cmake: Correctly set IOS variable.
Fixes #4635.
2021-10-05 11:13:41 -04:00
Ryan C. Gordon 60d59aeb61
cmake: Calculate padding for dislaying options automatically. 2021-10-05 10:54:06 -04:00
Ryan C. Gordon 7850d0cf6f
cmake: Prefix all options with "SDL_"
This makes it clear which options came from SDL's CMake project when
building SDL as a subdirectory of a parent CMake project.

Fixes #4139.
2021-10-05 10:45:26 -04:00
Ryan C. Gordon ab09f3dae5
cmake: Remove warning about CFLAGS environment variable.
CMake 3.11.0 respects this environment var.

Fixes #4681.
2021-09-30 10:02:54 -04:00
Ryan C. Gordon cd6f96dede
cmake: bump minimum CMake allowed to 3.11.0.
This cmake is 3 years old, but it removes confusion about the CFLAGS
environment variable (as of CMake 3.10.0, reference PR #4681) and also
consolidates resolves the need to have a separate requirement for Windows
Store apps (which requires CMake 3.11.0).
2021-09-30 10:02:53 -04:00
Ryan C. Gordon f79ac6a8de
cmake: Don't use the CFLAGS environment variable.
CMake has standard means of setting compiler flags, such as the
-DCMAKE_C_FLAGS command line for general-purpose flags, and
-DCMAKE_BUILD_TYPE for letting it choose reasonable release/debug/etc
defaults. Trying to emulate the configure script is incorrect and confusing
here.

Fixes #1819.
2021-09-27 23:31:23 -04:00
Cameron Gutman 5dccffd7e4 Allow usage of the new Condition Variable code with Critical Sections
Vista and later provide the SleepConditionVariableCS() function for this.

Since SDL_syscond_srw.c doesn't require SRW locks anymore, rename it to
SDL_syscond_cv.c which better reflects the implementation of condition
variables rather than the implementation of mutexes.

Fixes #4051.
2021-09-17 19:38:09 -04:00
Ivan Epifanov 8d1e0ca324 Vita: add support for disabling 'screensaver' (screen dimming and suspend) 2021-09-16 09:03:17 -07:00
Cameron Cawley 67aacfe5c0 cmake: Retrieve the git revision on platforms without bash 2021-09-09 22:34:42 -04:00
Cameron Cawley 6301cfda95 cmake: Use the correct directory structure for MinGW builds 2021-09-09 22:34:42 -04:00
Ivan Epifanov 134dd46819 Add pvr gles/gles2 context support 2021-09-09 07:22:01 -07:00
Yao Wei Tjong 姚伟忠 76d50d2871 Force color diagnostics when applicable
Although GCC and Clang automatically generate color diagnostics on
terminal output, they do not do so when the compiler output is piped
through another process, like in the case for ninja-build and ccache.

Similarly, it would also be nice to be able to see the color diagnostics
on the CI build log in the web interface provided by the CI providers.
2021-08-24 07:44:38 -10:00
Ryan C. Gordon 374b0b9aaf
cmake: Don't support Vulkan if LOADSO is disabled.
Fixes #4373.
2021-08-24 00:01:46 -04:00
Sam Lantinga f5794f9eeb Added SDL_SetTextureUserData() and SDL_GetTextureUserData() to associate a user-specified pointer with an SDL texture 2021-08-10 15:17:59 -07:00
Sam Lantinga 3f6ebffff4 Updated to version 2.0.17 for development 2021-08-10 15:02:36 -07:00
Sam Lantinga 6810399352 Enable AAUDIO driver for Android
I thought this was already enabled for 2.0.16, but apparently not.

Fixes https://github.com/libsdl-org/SDL/issues/3710
2021-08-10 14:50:43 -07:00
Ozkan Sezer 77c8d11137 configuration updates for dlopen:
- cmake, configure (CheckDLOPEN): --enable-sdl-dlopen is now history..
  detach the dl api discovery from SDL_LOADSO_DLOPEN functionality.
  define HAVE_DLOPEN. also define DYNAPI_NEEDS_DLOPEN (CheckDLOPEN is
  called only for relevant platforms.)
- update SDL_config.in and SDL_config.cmake accordingly.
- SDL_dynapi.h: set SDL_DYNAMIC_API to 0 if DYNAPI_NEEDS_DLOPEN is
  defined, but HAVE_DLOPEN is not.
- pthread/SDL_systhread.c: conditionalize dl api use to HAVE_DLOPEN
- SDL_x11opengl.c, SDL_DirectFB_opengl.c, SDL_naclopengles.c: rely
  on HAVE_DLOPEN, not SDL_LOADSO_DLOPEN.
- SDL_config_android.h, SDL_config_iphoneos.h, SDL_config_macosx.h,
  SDL_config_pandora.h, and SDL_config_wiz.h: define HAVE_DLOPEN.

Closes: https://github.com/libsdl-org/SDL/pull/4351
2021-08-10 12:07:32 -07:00
Tomasz Kłoczko ea9bece5ed Fix breaking GNUInstallDirs cmake module $CMAKE_INSTALL_LIBDIR directory. Fix #4621
According to https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html
`${CMAKE_INSTALL_LIBDIR} ` is only variable which should be used as base
directory. Without that patch on 64 bit archs libraries, cmake modules and
pkgconfig file are installed for example in /usr/lib6464 base directory.
This patch fixes #4621.

Signed-off-by: Tomasz Kłoczko <koczek@github.com>
2021-08-10 14:47:53 -04:00
Sam Lantinga a91ab883e9 Fixed building on Windows with cmake, ninja, and clang 2021-08-06 12:28:24 -07:00
Sam Lantinga cdac61fffa Fixed typo 2021-08-06 12:00:53 -07:00
Sam Lantinga eec41d25de Add info on how to avoid the "Prevented in-tree build" message with CMake 2021-08-06 11:30:22 -07:00
Ryan C. Gordon b83a019d68
cmake: Force linker to treat input as a C++ program on Haiku.
Reference issue #4590.
2021-08-04 19:22:40 -04:00
Ozkan Sezer 5b18ae29b7 improvements to libdecor support in cmake
this makes it consistent with wayland support, and makes cmake side
in line with autotools' libdecor support.
2021-08-03 14:01:02 +03:00
Ozkan Sezer a15ec36547 attempt to fix cmake builds with libdecor 2021-08-03 11:33:50 +03:00
Ryan C. Gordon c308453952 cmake: Use CMAKE_INSTALL_FULL_* for libdir,bindir,etc.
This makes sure sdl2.pc gets the full paths, matching what the
configure script will generate.

Fixes #4569.
2021-08-03 02:49:08 -04:00
Ozkan Sezer d373af044b CMakeLists.txt: update DYLIB_CURRENT_VERSION too 2.0.16 for release 2021-08-01 01:39:20 +03:00
Sam Lantinga cb1fd30e9a Updated to version 2.0.16 for release 2021-07-31 13:28:54 -07:00
Sam Lantinga 1a9253f752 Removed unused IOS_DYLIB definition 2021-07-31 12:37:28 -07:00
Christian Rauch 9e6fcbe72c wayland: client-side decoration 2021-07-25 14:54:12 -07:00