Commit graph

591 commits

Author SHA1 Message Date
Anonymous Maarten 373a6464c8 cmake: collect cflags in sdl-build-options and sdl-global-options 2023-01-08 15:57:51 +01:00
Anonymous Maarten fb80608fff cmake: use cmake <LANG>_VISIBILITY_PRESET property to pass -fvisibility=hidden 2023-01-08 15:57:51 +01:00
Anonymous Maarten 87af5cfc9f cmake: HAVE_GCC_PREFERRED_STACK_BOUNDARY is not used anymore 2023-01-08 15:57:51 +01:00
Anonymous Maarten d73b9fec1e cmake: target_compile_definitions does not need -D prefix 2023-01-08 15:57:51 +01:00
Ozkan Sezer ca541789ea cmake: check for math library functions even in the absence of libm
(Reference issue: https://github.com/libsdl-org/SDL/issues/7011)
2023-01-07 14:25:04 +03:00
Ozkan Sezer 5ea06f487d cmake: fix detection of library functions when -Werror is enabled.
(Reference issue: https://github.com/libsdl-org/SDL/issues/7011)
2023-01-07 14:25:04 +03:00
Ozkan Sezer 0f9b923ff4 cmake: fix detection of math library functions.
Fixes https://github.com/libsdl-org/SDL/issues/7011
2023-01-07 14:25:04 +03:00
Sam Lantinga 39852241ef Added -Wdocumentation to CMake clang build 2023-01-03 15:58:48 -08:00
Sam Lantinga 7f23d71b6a Added SDL_modf() and SDL_modff()
This function is useful for accumulating relative mouse motion if you want to only handle whole pixel movement.
e.g.
static float dx_frac, dy_frac;
float dx, dy;

/* Accumulate new motion with previous sub-pixel motion */
dx = event.motion.xrel + dx_frac;
dy = event.motion.yrel + dy_frac;

/* Split the integral and fractional motion, dx and dy will contain whole pixel deltas */
dx_frac = SDL_modff(dx, &dx);
dy_frac = SDL_modff(dy, &dy);
if (dx != 0.0f || dy != 0.0f) {
    ...
}
2022-12-29 23:12:19 -08:00
Anonymous Maarten 7150d6b05a cmake: add SDL3 to include path
This reverts parts of 9f2ca87
2022-12-29 09:01:56 -08:00
avafinger 12e0e6d130 SDL3 with Hardware Acceleration for ROCKCHIP platform (mali blob) 2022-12-26 08:50:51 -08:00
Ryan C. Gordon 1cf2b566af cpu: Removed 3DNow! support and SDL_Has3DNow().
Reference Issue #6636.
2022-12-23 09:30:56 -08:00
Anonymous Maarten 19d4d64cfe cmake: disable precompiled header for SDL_spinlock.c when targeting Android
This fixes the following error:
error: PCH file was compiled for the target 'thumbv7-none-linux-android16' but the current translation unit is being compiled for target 'armv7-none-linux-android16'
2022-12-21 09:39:22 -08:00
Anonymous Maarten 8f9227e4be cmake: use CMakePushCheckState to handle check states 2022-12-19 09:19:45 -08:00
Anonymous Maarten fab33545fa cmake: remove outdated fixme 2022-12-19 09:19:45 -08:00
Anonymous Maarten fe8291e09a cmake: only install SDL_test*.h headers when building SDL_test library 2022-12-19 09:19:45 -08:00
Anonymous Maarten 653893f188 cmake: declutter root + remove obsolete variables 2022-12-19 09:19:45 -08:00
Anonymous Maarten 289b024715 cmake: add function to print dict list 2022-12-19 09:19:45 -08:00
Anonymous Maarten a787b1c0b7 cmake: LINKER_LANGUAGE is a target property, not a cmake variable
LINKER_LANGUAGE needs to be used as following:
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>
  cmake [options] -S <path-to-source> -B <path-to-build>

Specify a source directory to (re-)generate a build system for it in the
current working directory.  Specify an existing build directory to
re-generate its build system.

Run 'cmake --help' for more information.

Haiku does not not this property explicitly set because CMake knows .cc files are c++
2022-12-19 09:19:45 -08:00
Anonymous Maarten 69812678cf cmake: cache cmake config installation folder in SDL_INSTALL_CMAKEDIR_ROOT
Make sure SDLx is not part of the cached variable such that it can be re-used by SDL2 and SDL3
2022-12-19 09:19:45 -08:00
Daniel Gibson c3bf253b09 Remove SDL3_main from build systems, remove most of src/main/*
XCode is still missing, and src/main/winrt/SDL3-WinRTResource*
still need to find a new home
2022-12-15 08:01:01 -08:00
Daniel Gibson 63d3fb469d Move src/main/haiku/ to src/core/
turns out that this wasn't even built as a static libSDLmain,
but as part of the (possibly dynamic) libSDL3
2022-12-15 08:01:01 -08:00
Daniel Gibson 989a8ca90e Port PSP SDL_main to header-only + SDL_RunApp() 2022-12-15 08:01:01 -08:00
Daniel Gibson b1b3bd654d Port PS2 SDL_main to header-only + SDL_RunApp() 2022-12-15 08:01:01 -08:00
Daniel Gibson 7bfc41db3c Unify all the SDL_*RunApp() functions into just SDL_RunApp()
makes the SDL_main code shorter

Also added a generic SDL_RunApp() implementation for platforms that
don't really need it.

Some platforms (that use SDL_main but haven't been ported yet) are
still missing, but are added in the following commits.
2022-12-15 08:01:01 -08:00
Daniel Gibson 1de559248e PortNintendo 3DS SDL_main to header-only + SDL_N3DSRunApp()
and move the #undef main and #define main SDL_main to the start/end of
SDL_main_impl.h instead of repeating it in every platform implementation

Thanks to SDL_N3DSRunApp we don't need the #include <3ds.h> in
SDL_main_impl.h - that caused conflicts with testthread.c, because both
have (different) ThreadFunc typedefs.
2022-12-15 08:01:01 -08:00
Daniel Gibson 2aee3e654d Remove SDL_main from VS Solutions in VisualC/ and VisualC-GDK/
and update README-visualc.md and README-gdk.md accordingly

Also moved src/main/windows/version.rc to src/core/windows/
and adjusted VS solutions, CMakeLists.txt and versioning scripts
in build-scripts/ accordingly.

This will eventually allow us to remove all of src/main/

# Conflicts:
#	VisualC/tests/testgesture/testgesture.vcxproj
2022-12-15 08:01:01 -08:00
Anonymous Maarten 9eb4d1f020 cmake: use FindALSA.cmake to find ALSA libraries
Co-authored-by: nfarid <54642193+nfarid@users.noreply.github.com>
2022-12-12 01:37:01 +01:00
Jan Engelhardt 1878674477 build: add symbol versioning for SDL
If a program built against one version of SDL is run in an
environment where there is an earlier version of the SDL .so library
installed, the result varies depending on platform configuration; in
the best case, it won't start at all, at worst it aborts in the
middle of the user doing "something important" (systems implementing
lazy symbol resolution). verdefs on the other hand are always checked
on startup.

The dependency information present in programs and shared libraries
is not only of value to the dynamic linker, but also to a
distribution's package management. If the dynamic linker is able to
tell that a program is not runnable per the above, a package manager
is able to come to the same conclusion — and block the installation
of a nonfunctional program+library ensemble.

Because there are a lot more symbols than there are libraries (I am
going to throw in "10^4 to 1 or worse"), package managers generally
do not evaluate symbols, but only e.g. the SONAME, NEEDED and VERNEED
fields/blocks. Because the SONAME is the same between two SDL
versions like 2.0.24, and 2.0.26, everything rests on having verdefs.

This patch proposes the addition of verdefs.
2022-12-02 13:05:37 -08:00
Sam Lantinga e2432bbd3b How did PS2 build without a condition variable implementation? 2022-12-02 12:37:41 -08:00
Anonymous Maarten 14ffaba399 cmake: build with rpath's, they are removed on install
This allows to build and run tests (on Linux) linked against the shared library
2022-12-01 20:32:47 +01:00
Sam Lantinga 1e2dfdb019 Removed the OpenGL ES 1.0 2D render implementation
In SDL3 we plan to make more use of shaders in the 2D render API, and this minimizes the number of platforms we have to consider for new features. OpenGL ES 2.0 or newer is supported on all modern iOS and Android devices.
2022-11-30 13:39:37 -08:00
Sam Lantinga c5790359fd
Added precompiled header support for Visual Studio and Xcode (#6710)
Fixes https://github.com/libsdl-org/SDL/issues/6704
2022-11-29 18:34:15 -08:00
Anonymous Maarten a52327f6b8 cmake: add support for precompiled headers 2022-11-29 14:23:42 -08:00
Sam Lantinga 71d5f510c6 Fixed dylib generation on macOS
We just build libSDL3.dylib instead of libSDL3.0.0.0.dylib with symlinks

Fixed the compatiblity vs current version, e.g.

SDL 3.20.87
    @rpath/libSDL3.0.dylib (compatibility version 2001.0.0, current version 2001.87.0)

SDL 3.21.5
    @rpath/libSDL3.dylib (compatibility version 2106.0.0, current version 2106.0.0)
2022-11-29 11:57:19 -08:00
Anonymous Maarten 6f20d990ad cmake: swap VERSION and SOVERSION 2022-11-29 20:36:46 +01:00
Anonymous Maarten ba19d3c048 cmake: remove SDL_CMAKE_DEBUG_POSTFIX option
Use CMAKE_DEBUG_POSTFIX instead
2022-11-29 11:29:03 -08:00
Anonymous Maarten 2d89c4680f cmake: simplify .so and .dylib versioning 2022-11-29 11:29:03 -08:00
Anonymous Maarten 7e7a8e76a5 cmake: move platform detection to cmake/sdl/paltform.cmake for re-use by SDL2-compat 2022-11-29 21:10:56 +03:00
Anonymous Maarten e2060de714 cmake: use target_link_libraries to pass -Wl,--undefined=WinMain 2022-11-29 21:10:56 +03:00
Sam Lantinga c2432f8d0d Rename SDLmain to SDL_main and SDLtest to SDL_test for consistency with other SDL libraries 2022-11-28 10:57:59 -08:00
Anonymous Maarten 3acd1ad25f cmake: only MSVC understands -nodefaultlib:MSVCRT 2022-11-28 00:20:22 +01:00
Anonymous Maarten 5151cbf4d1 cmake: check essential headers even when building with SDL_LIBC=OFF 2022-11-28 00:20:22 +01:00
Anonymous Maarten 9d7e4a7d6e cmake: don't cache HAVE_xxx variables for checking libc features 2022-11-28 00:20:22 +01:00
Anonymous Maarten b2e428626b cmake: disable system iconv by default on Windows
This is a different default then current CMake and autotools, but matches the released SDLx.dll's.
2022-11-28 00:20:22 +01:00
Anonymous Maarten 27707755c1 cmake: use SDL_LIBC_DEFAULT for default SDL_LIBC value 2022-11-28 00:20:22 +01:00
Anonymous Maarten 3fad16cc2b cmake: use SDL_CPU_X86 to enable MMX/SSE on x86 2022-11-28 00:20:01 +01:00
Anonymous Maarten 21f8e3ce04 cmake: use CMakePushCheckState while testing ARM NEON support 2022-11-28 00:20:01 +01:00
Anonymous Maarten 46d85fd5a4 cmake: don't cache HAVE_3DNOW value 2022-11-28 00:20:01 +01:00
Anonymous Maarten 82360b3175 cmake: don't cache HAVE_SSE value 2022-11-28 00:20:01 +01:00