Commit Graph

210 Commits

Author SHA1 Message Date
Chris Thrasher
1dcaa9a396 Fix CMake error messages 2022-08-22 11:26:57 +08:00
Chris Thrasher
aa82ea132b Set warnings with target_compile_options
The use of target_compile_options makes it easy to append warnings
to a target. The use of generator expressions also more succinctly
handles a few edge cases for compiler bugs and platform-specific
oddities.

This should be easy to read and maintain than the variable-based
solution it replaces.
2022-08-14 14:00:00 +08:00
Chris Thrasher
142ccf57bd Enable compiler warnings for Android 2022-08-12 18:01:36 +02:00
Chris Thrasher
97537d36b3 Remove unnecessary CMake version checks
Now that the project requires CMake version 3.15, all of these
checks are guaranteed to eveluate one way or the other so they can
be removed.
2022-07-18 12:43:49 +02:00
Chris Thrasher
55a1a2a4c4 Format .m files 2022-07-14 21:47:49 +02:00
metaquarx
88e9f82bee Add '.clang-format' file, CI integration, and formatting exceptions
Co-authored-by: Vittorio Romeo <vittorio.romeo@outlook.com>
Co-authored-by: Chris Thrasher <chrisjthrasher@gmail.com>
Co-authored-by: kimci86 <kimci86@hotmail.fr>
2022-07-11 20:04:56 +02:00
Chris Thrasher
0812054e02 Remove trailing whitespace 2022-06-25 21:32:55 +02:00
Chris Thrasher
5fde1ca613 Hide symbols in cross platform manner 2022-05-21 21:35:35 +02:00
Chris Thrasher
3301c47755 Remove CompileOptionsOverride
These overrides existed to prevent MSVC errors related to duplicate
compiler warnings. Because we required a version of CMake older
3.15, CMake would add /W3 as a default compiler flag when using
MSVC. We then add /W4 in addition to that. Modern CMake versions
seem to deduplicate these warnings but older versions did not.

The easist fix is to raise the minimum CMake version to 3.15 which
changes the default behavior to no longer add /W3 without being
explicitly specified. See the below link for more information about
this behavior change.

https://cmake.org/cmake/help/latest/policy/CMP0092.html
2022-05-09 15:38:39 +02:00
Chris Thrasher
2a5ce3c989 Apply compiler warnings to tests 2022-05-02 08:39:02 +02:00
Chris Thrasher
8a4563361f Set compiler warnings on a per-target, not per-file basis
No 1st party SFML targets contain 3rd party source code so it's
safe and correct to apply warnings to the entire target.
2022-05-02 08:39:02 +02:00
Lukas Dürrenberger
9a6142bd22 Merge branch '2.6.x' 2022-04-27 08:12:25 +02:00
Radek Dutkiewicz
b6ca47e128 DRM Implementation
Ported sfml-pi DRM/KMS backend written by @mickelson 
Port co-authored by @substring

Co-authored-by: Andrew Mickelson <andrew.mickelson@gmail.com>
Co-authored-by: Gil Delescluse <frog2wah@gmail.com>
2022-04-26 07:44:14 +02:00
Chris Thrasher
4b93727413 Enable MSVC standards conformance 2022-04-19 08:33:27 +02:00
friendlyanon
9b3735c05f Honor OPTIONAL_COMPONENTS when finding SFML
The "main" component is not available everywhere, but passing it to the
find_package(SFML) call via the OPTIONAL_COMPONENTS still fails the call
on platforms like Linux.

This commit enables SFML to be used the same in a cross-platform fashion
without forcing consumers to put custom logic around importing SFML.
Example that works with this commit, but break before:

    find_package(SFML REQUIRED graphics OPTIONAL_COMPONENTS main)
    target_link_libraries(dummy PRIVATE SFML::graphics)
    if(SFML_MAIN_FOUND)
      target_link_libraries(dummy PRIVATE SFML::main)
    endif()
2022-03-29 00:30:04 +02:00
Chris Thrasher
a733e4cd7e Remove unused CMake variables 2022-02-17 23:24:02 +01:00
Chris Thrasher
5236513f16 Simplify how tests are built 2022-02-16 13:51:29 +00:00
binary1248
66339bc09c Added support for coverage reporting. 2022-02-10 08:08:47 +01:00
Chris Thrasher
8f1955af17 Don't add SFML:: namespace to external targets
The SFML target export set includes a number of external targets
which are not owned by the project itself. This includes targets
like Freetype and OpenGL. By specifying a namespace for the export
set, a SFML:: namespace was prepended to all targets. This is not
a problem when using shared libraries but when building and using
static libraries caused a problem where CMake was attempting and
failing to find targets with names like SFML::Freetype or
SFML::OpenGL which did not exist.

Luckily CMake allows you put namespaces in the EXPORT_NAME target
property so now we can just add the SFML:: namespace in the macro
which creates SFML targets and remove the `NAMESPACE SFML::` line
which was adding namespaces to all targets.
2022-01-28 08:11:53 +01:00
Chris Thrasher
a322d18e63 Use built-in CMake project version functionality 2022-01-21 21:09:20 +01:00
Chris Thrasher
4586db91a9 Add SFML:: namespace to targets
This removes the sfml- prefixed targets from the export set. The sfml-
prefixed targets are still available within the build tree but not to
downstream users thus making this an API breaking change when compared
to the 2.x releases. To keep things consistent, usage of the sfml-
targets were replaced with their namespaced counterparts.

This has a number of benefits:

  1. It's more idiomatic. Modern CMake libraries are expected to
     have namespaced targets.

  2. Namespaced targets are less likely to collide with user-defined
     targets. No one will accidentally define a SFML:: target.

  3. If a namespaced target is not found by CMake, configuration
     will immediately stop.
2022-01-11 22:27:39 +01:00
Lukas Dürrenberger
3a402f241a Merge branch '2.6.x' into feature/back_merge 2022-01-08 12:28:34 +01:00
Chris Thrasher
ff4fc05b18 Stop configuration when GCC is detected on macOS 2022-01-02 23:15:05 +01:00
Chris Thrasher
dafdacfa20 Let tests and examples inherit language requirement from upstream targets
It's not necessary to re-specify cxx_std_17 since any example or test
which depends on a core target (which should be all of them) will pick
up this language requirement that should be a public property of those
targets. If that changes, these examples and tests will possibly fail
to compile and correctly catch the bug that was introduced in the core
library targets.
2021-12-28 15:53:08 +01:00
Vittorio Romeo
46639ed277 Manipulate library names on Windows + Clang 2021-12-22 08:53:03 +01:00
Lukas Dürrenberger
3cd45a283b Merge branch '2.6.x' into feature/backmerge 2021-12-20 13:44:56 +01:00
Pawel Paruzel
c824d3d57a Fix all macOS clang warnings
Co-authored-by: binary1248 <binary1248@hotmail.com>
2021-12-20 00:10:55 +01:00
Pawel Paruzel
aae00e9002 Fix cmake -DWARNINGS_AS_ERRORS=1 for clang 2021-12-20 00:10:55 +01:00
Vittorio Romeo
4a189d6602 Remove build logic for unsupported compilers 2021-12-19 21:51:53 +01:00
Vittorio Romeo
d12a2cd319 Use 'override' whenever possible instead of 'virtual' 2021-12-09 09:07:03 +01:00
Vittorio Romeo
9a0cc4b7dc Use alias declarations instead of 'typedef' 2021-12-08 17:58:13 +00:00
Vittorio Romeo
dd14d7c57f Use '[[fallthrough]]' attribute and enable relevant warning 2021-12-04 12:42:09 +01:00
Vittorio Romeo
bd12438916 Enable and require C++17 support for all targets 2021-12-02 20:13:04 +01:00
Lukas Dürrenberger
1aa2b7cd0d Update SFML version to 3.0.0
Unlike with SFML 2.x and earlier the version numbers are updated as soon
as work on the new release starts. This especially helps with version
checks, which until now caused issues with in-development version
matching the previous release.
2021-12-02 20:02:15 +01:00
Vittorio Romeo
6cf124db66 Fix remaining warnings
- Fixes in examples
- Fixes across all the modules
2021-11-30 11:25:58 +01:00
Lukas Dürrenberger
01836ccea4 Fix conversion warnings for the Graphics module
- Fix conversion and shadowing warnings
- Add SYSTEM indicator for stb_*, FreeType and other headers
2021-11-30 11:25:58 +01:00
binary1248
a759ccd5db Enable compiler warnings. 2021-11-30 11:25:58 +01:00
Chris Ohk
eeeda74ec1 Add support for Visual Studio 2022
- References: https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html
2021-08-23 22:34:04 +02:00
Lukas Dürrenberger
9e27096c37 Fix configuration conflicts with Clang
- On Windows you can use Clang with both MSVC and MinGW
- When using Clang with MSVC all the MSVC conditions should be fulfilled
- When using Clang with MinGW all the MSVC steps should not be run
2021-05-10 12:20:48 +02:00
Marty E. Plummer
6ad96cf9b7 windows: add resource.rc files to dll builds
Windows uses a mechanism known as 'resource files' which provides, among
other things, metadata to a given executable/dll/driver/etc, and add a
layer of polish to a project which it would otherwise lack.
2021-04-11 16:02:51 +02:00
David Carlier
4cbb34ddb4 NetBSD support proposal. 2020-12-07 16:08:00 +01:00
Corentin Schreiber
0d82b99c7d Added missing dependency on Xcursor in SFMLConfigDependencies.cmake.in 2020-09-13 20:35:48 +02:00
Jan Hahlganß
1d20edebc7 SFMLConfigDependencies.cmake.in: Vorbis uppercase 2020-01-24 08:56:13 +01:00
Jan Haller
110fb75513 Rename FindVorbis -> FindVORBIS, for consistency with exported variables (e.g. VORBIS_FOUND)
Fixes #1626
2020-01-02 15:28:31 +01:00
kimci86
80c3bdc23c Fix CMake scripts to install and find doxygen's generated SFML.tag file 2019-11-19 09:26:49 +01:00
Jonny
27a4c83ebc Use GnuInstallDirs module for cmake install paths 2019-09-01 21:48:10 +02:00
Lukas Dürrenberger
7e7216f598 Renamed test targets to test-sfml-module structure 2019-02-19 10:16:38 +01:00
=
53972ed5f2 Use sfml_add_test macro for unit tests and copy dlls to output directory if required 2019-02-19 10:16:38 +01:00
Jonny Paton
d53858afb1 Removed incompatible cmake/catch functionality, replaced with vanilla cmake 2019-02-19 10:16:38 +01:00
Jonny Paton
d3a072fb63 Use modern cmake testing functionality including catch integration 2019-02-19 10:16:38 +01:00