Commit Graph

721 Commits (843873626c88c8cc4a9d23e01beb6512f5978dee)

Author SHA1 Message Date
Anonymous Maarten bfecd78159 cmake: use check_symbol_exists to check dlopen + need for dl library 2022-09-27 03:47:20 +03:00
Ozkan Sezer f6c9b06562 cmake: output libSDL2-2.0.0.dylib like autotools, not libSDL2-2.0.dylib.
libSDL2-2.0.dylib is now installed as a symlink to libSDL2-2.0.0.dylib :

$ ls -l *.dylib
-rwxr-xr-x. 1 ozkan ozkan 1755488 Sep 23 23:53 libSDL2-2.0.0.dylib
lrwxrwxrwx. 1 ozkan ozkan      19 Sep 23 23:53 libSDL2-2.0.dylib -> libSDL2-2.0.0.dylib
lrwxrwxrwx. 1 ozkan ozkan      17 Sep 23 23:53 libSDL2.dylib -> libSDL2-2.0.dylib

Reference issue: https://github.com/libsdl-org/sdl12-compat/issues/217
2022-09-23 23:56:04 +03:00
Anonymous Maarten 3b20e0ecef cmake: only add -Wl,--undefined=WinMain when building an executable 2022-09-19 05:00:24 +03:00
Ivan Epifanov 202dfea502 Vita: drop memory defines 2022-09-17 10:12:46 -07:00
Ivan Epifanov 7115ceb775 Vita: restore sceClibMemcmp 2022-09-17 10:12:46 -07:00
quyykk 37effc7700 Build the offscreen video driver by default. 2022-09-15 10:59:37 -07:00
Rinnegatamante eb0bf2c29d vita: Drop memcmp redirect to sceClibMemcmp. 2022-09-12 13:32:48 -07:00
Ozkan Sezer 5b2884cb02 apply commit d0a3570300 to cmake side too. 2022-09-12 20:28:00 +03:00
Sam Lantinga 181265ba71 Removed unused variable 2022-09-05 11:36:20 -07:00
Sam Lantinga acf397b4df Actually, DYLIB_COMPATIBILITY_VERSION shouldn't be updated for a stable point release
@smcv
2022-09-05 11:21:13 -07:00
Cameron Cawley fd93f817ba Assume that stdint.h is available on Windows with compilers other than MSVC <= 2008 2022-09-05 09:01:31 -07:00
Sam Lantinga ef988fe184 Only use CETCOMPAT on x86/x64 platforms
Fixes https://github.com/libsdl-org/SDL/issues/6173
2022-09-05 08:59:17 -07:00
Sam Lantinga 4e98ba612b Set DYLIB_COMPATIBILITY_VERSION to DYLIB_CURRENT_VERSION to match autotools
Autotools sets both versions to the same value, so Xcode and CMake need to match for the libraries to be compatible between the different builds.

See these for details:
https://github.com/libsdl-org/sdl12-compat/pull/207
https://github.com/libsdl-org/SDL/issues/2934
https://stackoverflow.com/questions/67055770/usage-of-current-version-and-compatibility-version-on-macos
2022-09-05 08:28:06 -07:00
Gleb Mazovetskiy 803924b223 CMake: Make SDL_SHARED/STATIC/TEST options
This makes it easier to set these options when SDL is used as a subprojects.
Since CMake v3.13+, one can simply `set(SDL_TEST OFF)` before include the SDL2 subproject because options do not override existing variables. (https://cmake.org/cmake/help/latest/policy/CMP0077.html#policy:CMP0077)
This is also true for `set(CACHE)` commands but only in CMake v3.21+ (https://cmake.org/cmake/help/latest/policy/CMP0126.html).
2022-08-29 17:47:32 -07:00
Ludovico de Nittis e8cb4da71f Add utility function to detect if SDL is inside a sandbox
Refactor the previous sandbox check in a standalone function that also
includes Snap support.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2022-08-29 06:30:40 -07:00
Anonymous Maarten 32c4996c04 cmake: add SDL_IBUS option to enable/disable DBUS + test sys/inotify.h 2022-08-25 18:12:16 -07:00
Anonymous Maarten c8b56ee5e6 cmake: add SDL_DBUS option to enable/disable DBUS 2022-08-25 18:12:16 -07:00
Anonymous Maarten 032ff64041 cmake: OpenIndiana announces SunOS, which is the former name of Solaris 2022-08-25 18:12:16 -07:00
Anonymous Maarten 711846c1f4 cmake: fix build with SDL_WAYLAND_SHARED=OFF 2022-08-25 17:15:54 -07:00
Cameron Gutman 2ceea46061 cmake: Enable CET compatibility for x86/x64 targets using VS 16.7+ 2022-08-24 11:29:36 -07:00
Sam Lantinga 6e9c14e550 Updated to version 2.25.0 for development 2022-08-19 09:38:42 -07:00
Sam Lantinga 8c9beb0c87 Updated to version Updated to version 2.24.0 for release 2022-08-19 08:44:09 -07:00
Sam Lantinga f1416ef2ba Updated to version 2.23.2 for release candidate 2022-08-12 20:27:22 -07:00
Aaron Barany 3f19e36d12 Disable declaration-after-statement warning on Android
External .c files are brought in that don't adhere to this requirement for
pre-C99 code and causes the build to break with the latest NDK.

Fixes #6019
2022-08-08 08:31:40 -07:00
Anonymous Maarten 17b329d199 cmake: enable disabing hidapi 2022-08-05 13:06:51 -07:00
Anonymous Maarten a4e6f3ca9d cmake: when there are alternatives, don't use libusb by default 2022-08-05 13:06:51 -07:00
Francisco Javier Trujillo Mata 4564e89825 put files at the same line 2022-08-02 11:40:31 -07:00
Daniel Santos 147a71b976 Finish dummy driver 2022-08-02 11:40:31 -07:00
Daniel Santos 2660449c6c Add dummy driver 2022-08-02 11:40:31 -07:00
Daniel Santos a81aa99298 Add prim video support 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata 46f95a7a5f Create dummy PS2 Video driver 2022-08-02 11:40:31 -07:00
Sam Lantinga 954bbdf3ae Allow emscripten platform to build without threads 2022-08-01 09:51:21 -07:00
Sam Lantinga e4cc076a79 Threads are used by many SDL subsystems and may not be disabled.
Fixes https://github.com/libsdl-org/SDL/issues/5095
2022-08-01 09:17:05 -07:00
Anonymous Maarten 83f5bbdf25 cmake: define SDL_STATIC_LIB for static SDL2 library 2022-07-29 15:05:19 +02:00
Anonymous Maarten bdd1d035b7 cmake: Don't add /NODEFAULTLIB to link flags when building SDL-static 2022-07-29 15:05:19 +02:00
Anonymous Maarten 02c8747176 math.h does not always provide M_PI
This fixes the following error when building with SDL_LIBC:
SDL\test\testautomation_math.c(1965): error C2065: 'M_PI': undeclared identifier
2022-07-27 09:10:18 -07:00
Anonymous Maarten 5da85376b9 stdlib: move all mslibc functions to SDL_mslibc.c
This allows disabling LTO on them by only specifying a single file.
2022-07-27 09:07:56 -07:00
Anonymous Maarten 5c70e45c53 cmake: don't use result of 'find_library' for Android libraries 2022-07-26 14:24:36 -07:00
Anonymous Maarten 4690689a4c cmake: on Apple, don't use find_library for frameworks + use EXTRA_LDFLAGS 2022-07-26 14:24:36 -07:00
Anonymous Maarten fc2497b109 Revert "cmake: don't add -mwindows to link flags in sdl2.pc"
This reverts commit d211aaddc1.
2022-07-23 18:05:35 +02:00
Anonymous Maarten d211aaddc1 cmake: don't add -mwindows to link flags in sdl2.pc 2022-07-23 15:29:39 +02:00
Anonymous Maarten d63a699e01 cmake: by default, disable install target when building SDL as a subproject 2022-07-23 15:29:13 +02:00
Ivan Epifanov 0a1641635d VIta: enable arm neon/simd optimisations 2022-07-21 10:45:45 -07:00
Anonymous Maarten 8f33de8462 cmake: set CMP0054 policy to NEW 2022-07-21 14:08:23 +02:00
Francisco Javier Trujillo Mata e4a8087551 Initial Audio driver 2022-06-27 15:18:48 -07:00
Francisco Javier Trujillo Mata 7fd46ec581 Initial PS2_Joystick implementation 2022-06-27 00:32:43 -07:00
Francisco Javier Trujillo Mata 84d69da4e1 Initial SDL_ps2_main implementation 2022-06-27 00:32:43 -07:00
Anonymous Maarten fa39f73552
cmake: add generated files to a custom target (#5851)
This way, headers are only generated once .
2022-06-26 23:34:30 +02:00
Anonymous Maarten 76f40e2b3b cmake: remove stray debug line 2022-06-24 19:12:39 +02:00
Anonymous Maarten ca30936314 cmake: check and use clock_gettime by default on android 2022-06-24 19:12:15 +02:00
hsdk123 bd49696133
cmake: use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR (#5834)
* Update install directory to match generated

https://github.com/libsdl-org/SDL/blob/main/CMakeLists.txt#L3122
Sets `SDL2Config.cmake` to `CMAKE_BINARY_DIR`, whereas the install file tries to find it from a different location.

* cmake: use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR

* ci: test SDL included as a cmake subproject

Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
2022-06-23 14:18:44 +02:00
Anonymous Maarten 78a3751659 cmake+ci: fix+test sdl2-config + sdl2.pc for all supported platforms 2022-06-23 14:17:38 +02:00
Anonymous Maarten c61367c273 cmake: do list(APPEND SDLMAIN_SOURCES) 2022-06-23 14:17:38 +02:00
Anonymous Maarten 3617691fe0 cmake: install Android.mk files for ndk-build
This allows including SDL2 with ndk-build using
NDK_MODULE_PATH + import-module

An install tree looks like:
```
`-- share
    |-- aclocal
    |   `-- sdl2.m4
    |-- licenses
    |   `-- SDL2
    |       `-- LICENSE.txt
    `-- ndk-modules
        |-- SDL2
        |   `-- Android.mk
        |-- SDL2-static
        |   `-- Android.mk
        |-- SDL2main
        |   `-- Android.mk
        `-- SDL2test
            `-- Android.mk
```

The generated `/share/ndk-modules/SDL2/Android.mk` contains:
```
LOCAL_PATH := $(call my-dir)
_IMPORT_PREFIX := $(LOCAL_PATH)/../../..

include $(CLEAR_VARS)
LOCAL_MODULE := SDL2
LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/lib/libSDL2.so
LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_EXPORT_C_INCLUDES := ${_IMPORT_PREFIX}/include\
${_IMPORT_PREFIX}/include/SDL2
include $(PREBUILT_SHARED_LIBRARY)`
```
2022-06-23 14:17:38 +02:00
Anonymous Maarten b3159714db cmake: set HAVE_STATIC_PIC for correct summary 2022-06-23 14:17:38 +02:00
Anonymous Maarten de409d2a81 cmake: remove spurious UNIX_SYS in dep_option 2022-06-23 14:17:38 +02:00
Anonymous Maarten 2f321fb73c cmake: disable UNIX_SYS by default for Android
This force disables SDL_OSS, SDL_ALSA, SDL_JACK, SDL_ESD,
SDL_PIPEWIRE, SDL_ARTS, SDL_NAS, SDL_SNDIO, SDL_LIBSAMPLERATE,
SDL_RPATH, SDL_CLOCK_GETTIME and SDL_X11.
2022-06-23 14:17:38 +02:00
Anonymous Maarten 5f4e9fb9b3 cmake: use add_custom_command to copy include files
Otherwise, the make program would not rebuild when a header got changed
2022-06-22 17:04:58 +02:00
Anonymous Maarten 485b1037b0 cmake: copy all headers to the build directory and exclusively use that 2022-06-22 17:04:58 +02:00
Anonymous Maarten 3e1021239a cmake: also add the recently-added include folder to the public interface 2022-06-22 17:04:58 +02:00
Anonymous Maarten 4ad4fe67c7 cmake: install generated SDL_config.h
The generated SDL_config.h recently changed location, so update the install.
2022-06-22 17:04:58 +02:00
Anonymous Maarten d460000b45 cmake: use add_definitions for compatibility with cmake 3.0 2022-06-20 19:29:13 +02:00
Ozkan Sezer bdcdbfc757 Enable D3D12 detection when using mingw-w64 with cmake too
c.f.: autotools commit 59fb7acbf7
2022-06-19 11:04:24 +03:00
Ozkan Sezer a8d41b3b45 check for shellscalingapi.h presence instead of WINVER >= 0x0603 2022-06-18 13:00:44 -07:00
Anonymous Maarten b19099d557 cmake: use find_package(SampleRate) to find samplerate + allow targets 2022-06-16 16:47:19 -07:00
Sam Lantinga b004133f08 Updated to version 2.23.1 for pre-release checkpoint 2022-06-16 12:50:19 -07:00
Francisco Javier Trujillo Mata fc78d0ff39 Fix Compilation CI 2022-06-16 02:04:32 +03:00
Francisco Javier Trujillo Mata 6b03c1adf6 Add filesystem driver 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata 52f00833b0 Add Thread drivers 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata 217d3a6dab Add systimer support 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata 580416d3c8 Initial CMake configuration 2022-06-15 15:15:26 -07:00
Alex Richardson cd8f57ee4e cmake: freebsd: Don't REQUIRE libunwind.pc on FreeBSD
FreeBSD includes the libunwind APIs in in the base system libgcc_s and
does not install a .pc file for it.
This change fixes the build on FreeBSD for me.
2022-06-15 14:18:27 -07:00
Anonymous Maarten ae7446a959 stlib: Extract SDL_memcpy and SDL_memset to its own file respectively
This is done such that we can disable LTO for these 2 functions when
building with MSVC.

This is due to a limitation of Link Time Code Generation (LTCG).
Code generation might generate a new reference to memset after linking
has started. The LTCG must make assumptions about where memset is
defined which is normally the C runtime.
2022-06-15 14:17:35 -07:00
Anonymous Maarten 18206446bf cmake: collect SDL_LIBS as list + export PKG_DIRECTFB_LDFLAGS 2022-06-15 11:11:49 -07:00
Anonymous Maarten b5f1fe5004 cmake: Allow integers for SDL_ASSERTIONS + fix -DSDL_ASSERTIONS=0 2022-06-15 11:11:49 -07:00
Yao Wei Tjong 姚伟忠 c90e1ec3ef Remove redundant sizeof "size_t" check
The result variables: HAVE_${VARIABLE}, ${VARIABLE}, ${VARIABLE}_CODE,
etc. do not seem to be referenced anywhere in the CMake build script.
2022-06-15 13:50:34 -04:00
Anonymous Maarten 6d1dfc8322 cmake: make sure SDL2::SDL2 is always available 2022-06-14 20:15:34 -07:00
Anonymous Maarten 8a2c6b604c cmake: don't link to libibus (not needed, I think) 2022-06-15 05:33:40 +03:00
Anonymous Maarten c950018fe0 cmake: don't link to libdbus (see note in SDL_dbus.c) 2022-06-15 05:33:40 +03:00
Anonymous Maarten fb7c03ebb5 cmake: install LICENSE.txt 2022-06-15 05:33:40 +03:00
Anonymous Maarten afc350eeff cmake: do 's#set(SOURCE_FILES #list(APPEND SOURCE_FILES #g' 2022-06-15 05:33:40 +03:00
Anonymous Maarten 6606ab8b56 Introduce EXTRA_TEST_LIBS variable for test-only libraries 2022-06-13 10:05:30 -07:00
Anonymous Maarten 851eecdf40 Don't add extra build linker flags to SDL2_static
These leak to users, when SDL2 is vendored.
2022-06-13 10:05:30 -07:00
Cameron Cawley 25367efcba Add missing library needed for locale functions on PS Vita 2022-06-09 11:07:06 -07:00
chalonverse b9c2ad8395 Added additional check for HAVE_D3D12_H and missing SDL_VIDEO_RENDER_D3D12 in SDL_config.h.cmake 2022-06-07 22:36:06 -07:00
Anonymous Maarten 298ad937c0 cmake: wrap SDL_STATIC_PIC in double quotes (aka never trust user input)
Suggested by @Wohlstand
2022-06-07 18:44:47 -07:00
Anonymous Maarten ad272ac690 Set POSITION_INDEPENDENT_CODE property on SDL2 for CMake 3.0 2022-06-07 18:44:47 -07:00
chalonverse 7a335df9cf Updated CMakeLists.txt and configure.asc/script so that it checks for the required Windows SDK version before it enables the d3d12 renderer. Also fixed reported warnings in some builds. 2022-06-07 17:07:33 -07:00
Anonymous Maarten 5abd676917 Allow empty default values to the dep_option macro 2022-06-07 09:17:44 -07:00
chalonverse 4082821822
DirectX 12 Renderer (#5761)
* DirectX 12 Renderer (27 squashed commits)

* Add missing SDL_hidapi.h of merge of SDL.vcxproj.filters

* Fixed OpenWatcom build failure

* Dynapi fix

Co-authored-by: Ryan C. Gordon <icculus@icculus.org>
2022-06-06 17:42:30 -07:00
Anonymous Maarten fd3f381021 Initialize SDL_STATIC_PIC from CMAKE_POSITION_INDEPENDENT_CODE 2022-06-03 21:05:04 -07:00
Simon McVittie 65a3453b7f build: Compile with large inode number support where possible
On filesystems with large inode numbers, such as overlayfs, attempting
to stat() a file on a 32-bit system using legacy syscalls can fail
with EOVERFLOW. If we opt-in to more modern "large file support"
syscalls, then source code references to functions like stat() are
transparently replaced with ABIs that support large file sizes and
inode numbers, such as stat64().

This cannot safely be done globally by Linux distributions, because
some libraries expose types like `off_t` or `struct stat` in their
ABI, meaning that enabling large file support would be an incompatible
change that would cause crashes. However, SDL appears to be careful to
avoid these types in header files, so it should be OK to enable this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-03 21:03:50 -07:00
Anonymous Maarten 799d39a302 Make the sdl2-config script relocatable 2022-06-03 16:27:13 -07:00
Anonymous Maarten 5ec2d46f47 cmake: make SDL2Config.cmake compatible with autotools' sdl2-config.cmake 2022-06-03 12:41:36 -07:00
Anonymous Maarten 8e13cc309e cmake: add 'compatible interface properties' to allow enforcing SDL2 sharedness 2022-06-03 12:41:36 -07:00
Anonymous Maarten 1087eaad7e cmake: install SDL2::SDL2test when configuring with SDL2_TEST enabled 2022-06-03 12:41:36 -07:00
Tim Schumacher 12cc636c8f Make sdl2-config prefixes configurable again
The installation prefix ended up being hard-coded into the
`sdl2-config` script after the placeholders were accidentally removed
in 6956f4aa19.
2022-05-22 17:30:04 +03:00
Sam Lantinga 6da6a6cba2 Make sure Objective C files are built with the same flags as C files.
Fixes https://github.com/libsdl-org/SDL/issues/5707
2022-05-21 13:51:21 -07:00
Cameron Cawley e0f3da497f Remove unused SDL_ASSEMBLY_ROUTINES define 2022-05-12 14:37:00 +03:00
Alex Szpakowski ec8fa57750 macOS: always use Objective-C ARC (automatic ref counting).
Change Cocoa SDL_VideoData and SDL_WindowData implementations from C structs to Objective-C objects, since bridging between C and ObjC is easier that way.
2022-05-09 21:53:40 -07:00
Cameron Cawley 9ef6885743 Fix MSVC ARM32 builds 2022-05-08 18:21:02 +03:00
Sam Lantinga 0c19602118 Applied 0004-Define-crt-macros.patch.txt from vcpkg ports 2022-05-06 07:59:36 -07:00
Simon McVittie 38ef678990 test: Add a `make install` target for the tests
This makes it more convenient to compile them alongside SDL, install
them in an optional package and use them as smoke-tests or diagnostic
tools. The default installation directory is taken from GNOME's
installed-tests, which seems as good a convention as any other:
https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie 7d2808e30b test: Run selected noninteractive tests at build-time
In Autotools, these are run by `make -C ${builddir}/test check`.
In CMake, they're run by `make -C ${builddir} test` or
`ninja -C ${builddir} test` or `ctest --test-dir ${builddir}`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie fff97c95eb build: Mechanically generate ABI versions from version number
If we're strict about applying something resembling semantic versioning
to the "marketing" version number, then we can mechanically generate
the ABI version from it.

This limits the range of valid micro versions (patchlevels) to 0-99.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie cd7c2f1de7 Switch versioning scheme to be the same as GLib and Flatpak
For stable releases, this gives us the ability to make bugfix-only point
releases such as 2.24.1 if we want to, and distinguish between them
programmatically. For example, this ability could have been useful after
2.0.16 to fix Xwayland regressions, and after 2.0.18 to fix event loop
regressions.

For development releases, this gives us the ability to make multiple
prereleases during the same feature cycle, and distinguish between them
programmatically. For example, this would have been useful during 2.0.22
development, which went through three prereleases before reaching the
final release.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie 63814ec767 Add static assertions that the version number is consistent
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie 22002d9155 docs/release_checklist.md: Document how/where to bump version numbers
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie 2021a10927 cmake: Defer test subproject until after defining install/uninstall
It looks as though something in the test subproject "leaks" into the
main build system, causing us to try to install ${builddir}/test/sdl2.pc
instead of the correct ${builddir}/sdl2.pc. Moving the tests subproject
further down avoids this.

Resolves: https://github.com/libsdl-org/SDL/issues/5604
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:36:21 -07:00
Ryan C. Gordon 7d7ec9c951
x11: Remove XVidMode and Xinerama support.
Fixes #1782.
2022-04-26 23:17:13 -04:00
Ozkan Sezer e9ff4fdd49 add SDL_bsearch 2022-04-26 04:03:25 +03:00
Sam Lantinga fa29e2d7f7 Updated to version 2.0.23 for development 2022-04-25 13:45:51 -07:00
Ryan C. Gordon 634b9edc7f
cmake: Fixed indenting and some oldschool `endif(TEXT)` things. 2022-04-15 20:50:55 -04:00
Semphris dc5bc5237c Added CMake option to disable the installer 2022-04-15 20:48:40 -04:00
Ivan Epifanov b75996138a Vita: fix VIDEO_VITA_PVR flag 2022-04-11 17:16:22 -04:00
Sam Lantinga 505d6a4a05 Update version to 2.0.22 for release 2022-04-08 18:18:56 -07:00
Ozkan Sezer c0bb39e5e9 check for HAVE_ROAPI_H in cmake and autotools, and
update SDL_config_windows.h and SDL_config_winrt.h
2022-04-02 02:50:02 +03:00
Jaylon Gowie 8c542a3591 Desktop OpenGL 1.X/2.X PSVita Support 2022-03-31 00:02:56 -04:00
Ivan Epifanov cbdb67b4f6 Vita: add SDL_GetPreferredLocales support 2022-03-29 15:02:21 -07:00
Ivan Epifanov 178ac19615 Vita: add audio capture support 2022-03-29 14:12:37 -07:00
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
Joel Linn 20eea021c6 Windows: set HAVE_IMMINTRIN_H for AVX intrinsics 2021-07-24 15:39:17 -04:00
Ryan C. Gordon 6956f4aa19
cmake: use CMAKE_INSTALL_LIBDIR instead of hardcoding "lib", etc.
These came from HaikuPorts, specifically this patchset:

462947dd4f/media-libs/libsdl2/patches/libsdl2-2.0.14.patchset

This is just the part that is _not_ Haiku-specific. I wanted this in a
separate commit though, since I'm not really a CMake expert; if this causes
problems and we need to bisect to it, we won't be confused about it being a
Haiku issue when we get here.

Fixes #4092.
(and probably others.)
2021-07-24 11:06:40 -04:00
Ryan C. Gordon 403afdb558
cmake: Haiku fixes.
These came from HaikuPorts, specifically this patchset:

462947dd4f/media-libs/libsdl2/patches/libsdl2-2.0.14.patchset

This is just the Haiku-specific bits; the more general parts about install
dirs will be split into a different commit here.

Reference issue #4092.
2021-07-24 11:02:27 -04:00
Ozkan Sezer 5ac81c75fe fixed typo in previous commit 2021-07-10 10:05:40 +03:00
Ozkan Sezer a809d62605 cmake: set SDL_JOYSTICK_RAWINPUT for windows builds
Fixes: https://github.com/libsdl-org/SDL/issues/4412
2021-07-10 10:01:40 +03:00
h5p9sl e52733af8d Use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR
This allows for building with cmake's add_subdirectory() function.
2021-07-09 16:11:40 -07:00
Daniel Gibson e2234ee97c CMake: Fix SOVERSION/SONAME of non-release versions
When building SDL2 from git with CMake, you got libSDL2-2.0.so.1
instead of .0 (as it's the case when building with autotools).
This was caused by using LT_REVISION instead of LT_MAJOR for SOVERSION.

fixes #4310
2021-07-08 14:55:33 -07:00
Ozkan Sezer be41cf2dfe CMake: don't blacklist TARGET_OS_SIMULATOR for Metal configuration
7fa5e95b62 enabled it.
2021-07-08 21:20:02 +03:00
Croydon 3433f3c4cc CMake: Small improvement for MinGW
This is currently a small patch we have in our Conan package for SDL 4dc894cc2c/recipes/sdl2/all/conanfile.py (L184)

Introduced in 9fb93a6044
2021-07-07 16:55:17 -07:00
Ivan Epifanov 6460151c84 Vita: add missing stub 2021-07-01 15:14:49 -07:00
Ivan Epifanov 2465444fba Add missing dependencies 2021-06-14 11:53:19 -07:00
Ivan Epifanov bbdd08e0b2 Build without PIB support by default and add flag to enable it 2021-06-11 13:21:07 -04:00
Nicolas Caramelli 6a2af48ad7 CMake: Generic check for desktop GL and EGL on Linux systems 2021-06-01 16:50:28 -07:00
Cacodemon345 ded023870d Make CMake script more accurate to autoconf script
DBus, IBus and inotify is now able to be used outside Linux like in configure.
KMSDRM input is now working on FreeBSD with CMake compilation.
2021-06-01 15:34:52 -07:00
Ivan Epifanov ca969eb2be Remove gles2 vita render 2021-04-24 14:13:09 -07:00
Sylvain d4e96e1153
Android: enable audio driver OpenSLES when building with CMake 2021-04-16 09:44:07 +02:00
Sylvain 02b1ebc9e0
Android: add openslES and AAudio compilation to CMakeLists 2021-04-15 21:13:17 +02:00
Ozkan Sezer 69203851dc rename PKG_CONFIG_LIBS_PRIV to PKGCONFIG_LIBS_PRIV
i.e.: do not steal PKG_CONFIG namespace.
2021-04-14 21:40:50 +03:00
okuoku 401f485490 cmake: Weak link with CoreHaptics
Add link to CoreHaptics so we can compile against latest iOS SDKs.
2021-04-13 16:04:04 -07:00
Kyle Schaefer dbedaeceb3 Adding checks to see if any ASAN flags are set, if so then we set(HAVE_ASAN ON) so the infomartion output will properly list ASAN as on. 2021-04-13 16:03:37 -07:00
Kyle Schaefer 70bd205bb1 Adding messages to output CMAKE_C_FLAGS_DEBUG and CMAKE_CXX_FLAGS_DEBUG, this way when using Debug builds you can see which debug flags are set 2021-04-13 16:03:37 -07:00
Kyle Schaefer 320666044e Moving ASAN macros and calls to macros above the information output section so we can display ASAN information properly. 2021-04-13 16:03:37 -07:00
okuoku 732cc8ed5b cmake: Fix UWP DLL build by removing /NODEFAUTLIB
On UWP, we need default C runtime for C++ sources.
2021-04-09 22:28:51 -07:00
Vladislav Dmitrievich Turbanov 50db4a59b8 * Support for intrinsics in MSW + Clang scenario.
Utility polyfill is provided, removed the no-longer-needed
conditionals.
2021-04-09 22:28:07 -07:00
okuoku 7b8c750954 CMake: Enable WASAPI on WinRT
WASAPI backend on WinRT was implemented with 2.0.8
351d6d4784
but CMake source here was written for 2.0.7 in vcpkg
e6c65b93b1
2021-04-04 09:20:04 -04:00
Ryan C. Gordon a81fe27271
configure/cmake: Hook up Emscripten threads (disabled by default).
Fixes #3795.
2021-04-04 00:16:30 -04:00
vanfanel e213f37a45 [KMSDRM] Enable full OpenGL detection (MESA/libglvnd) on both the make and cmake buildsystems. 2021-03-15 18:47:22 -07:00
Ivan Epifanov e58a955e68 Deprecate dolcesdk 2021-03-08 09:07:12 -08:00
Ivan Epifanov 4708c6bb96 Remove pkg-config prefix hack 2021-03-08 09:07:12 -08:00
uyjulian b52e9459ba Add support for open URL 2021-03-08 09:07:12 -08:00
Ivan Epifanov a43f488920 Don't search for pthread 2021-03-08 09:07:12 -08:00
Ivan Epifanov 54134fddd5 Use Clib mem funcs 2021-03-08 09:07:12 -08:00
Ivan Epifanov e928b92f1a CMake support 2021-03-08 09:07:12 -08:00
Ozkan Sezer 34ecd71e80 CMake: don't add -Wl,--no-undefined to LDFLAGS for clang+windows cases
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:44:04 +03:00
Ozkan Sezer 3880174a9f CMake: set OPT_DEF_LIBC to ON for clang case, too.
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:40:56 +03:00
Ozkan Sezer 05cc9e3764 CMake: move GCC check after CLANG, so that CLANG is properly recognized
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:40:50 +03:00
Ozkan Sezer 0a68322170 add missing PIPEWIRE defines to SDL_config.h.in
also specify 'audio' in Pipepire configuration enable messages.
2021-03-01 15:11:50 +03:00
Frank Praznik 2f0b99a774 audio: Add Pipewire playback/capture sink 2021-02-28 19:40:09 -08:00
Joshua Saxby fe6f62e6ce Add ALIAS targets to all installed SDL2 targets
This provides a linking interface that matches the one available when `find_package()` is used, by aliasing all of SDL's public targets into the SDL2:: namespace. Thus, dependees link to the same-named targets regardless of how SDL was acquired.
This approach permits the use of wrappers around CMake's FetchContent API such as https://github.com/cpm-cmake/CPM.cmake
2021-02-13 11:43:35 -08:00
Christian Rauch 2170c7bfde make AddressSanitizer optional and disabled by default 2021-02-10 10:22:20 -05:00
Christian Rauch 5045d299a6 enable AddressSanitizer only for GCC 5 onwards (bug #5533) 2021-02-10 10:22:20 -05:00
Christian Rauch 066960c207 add '-shared-libasan' to debug flags (bug #5533) 2021-02-10 10:22:20 -05:00
Ozkan Sezer bb9e049d1d minor updates to libc function checks 2021-02-10 10:22:19 -05:00
Sam Lantinga 2426949a18 Removed support for clock_gettime_nsec_np()
SDL_GetTicks() was broken and it's not adding any real value here.
2021-02-10 10:22:19 -05:00
Christian Rauch 42798cec8b cmake: enable AddressSanitizer in Debug builds if supported 2021-02-10 10:22:19 -05:00
Sam Lantinga b7f711cd76 Don't enable address sanitize flags without checking compiler first 2021-02-10 10:22:18 -05:00
Christian Rauch f8b4a6e25a cmake: enable AddressSanitizer in Debug builds 2021-02-10 10:22:18 -05:00
Ozkan Sezer 091a4649e8 added --enable-xinput switch for windows builds 2021-02-10 10:22:18 -05:00
Sam Lantinga de1c19b3f5 Fixed bug 5481 - iOS-specific main sources not used for CMake build.
Aaron Barany

The CMake build for SDL doesn't set SDLMAIN_SOURCES on iOS to the sources in src/main/ios. As a result, SDL fails to initialize since it falls back to the dummy main. Adding the line file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) fixes the issue.
2021-02-10 10:22:16 -05:00
Ozkan Sezer aa4a6b0b88 better check for clock_gettime_nsec_np() -- cf. bug #5467. 2021-02-10 10:22:16 -05:00
Ozkan Sezer d327bbfbfd CMakeLists.txt: fix check_symbol_exists() for clock_gettime_nsec_np 2021-02-10 10:22:16 -05:00
Sam Lantinga 96cfb81232 Fixed bug 5467 - SDL sys timer Mac OS update proposal
David Carlier

Change of api from 2016 which reduce code complexity a bit.
2021-01-24 00:51:25 -05:00
Ozkan Sezer f3835702d3 fix build with --disable-directx 2021-01-24 00:51:24 -05:00
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