Commit Graph

231 Commits

Author SHA1 Message Date
kimci86
205794eb3f Explicitly specify required X11 components 2023-02-07 17:21:34 -07:00
Chris Thrasher
eb162df723 Use X11's find module
Added in CMake 3.14 so this wasn't accessible in prior versions of
SFML
2023-02-06 15:12:58 -07:00
Chris Thrasher
ab34b9f9bf Invoke run-clang-tidy with Python executable
This is required since Windows can't support she-bang scripts like
macOS and Linux were taking advantange of. This is more verbose but
ultimately the same as before.
2023-01-14 15:13:02 -07:00
Chris Thrasher
8a5e0f6933 Fix bug where clang-tidy CI job always passes 2023-01-06 17:17:57 -07:00
Chris Thrasher
3b6db4d18c Enforce variable case 2022-12-12 16:10:03 -07:00
Chris Thrasher
ad416ab531 Check for minimum required clang-tidy version 2022-12-12 16:10:03 -07:00
Chris Thrasher
75642ef7aa Enable warnings as errors for clang-cl.exe 2022-12-11 13:51:15 -07:00
Chris Thrasher
e54bf87e9b Enable MSVC deprecation warning 2022-12-11 13:51:15 -07:00
Chris Thrasher
8c6b578012 Disallow clang-format version 15 and newer 2022-11-27 13:39:40 -06:00
Chris Thrasher
a5dbe59f07
Merge branch '2.6.x' 2022-10-13 14:33:11 -06:00
Chris Thrasher
88f9a33479 Use PROJECT_ variables 2022-10-12 00:23:35 +02:00
Chris Thrasher
b848a7b29a Only reference the project's directories, not parent directories 2022-10-12 00:23:35 +02:00
Chris Thrasher
fc0bd0bfc8 Don't specify standard library on macOS
libc++ is already the default and GCC can't even be used so there's
no circumstance where we'd need to explicitly tell Clang to use
libc++. I confirmed that even with this removed, libc++ headers are
still being used and found.
2022-10-12 00:23:35 +02:00
Vittorio Romeo
fd5c358c98 Add PCH builds via 'SFML_ENABLE_PCH' CMake option 2022-10-09 14:21:11 +02:00
Vittorio Romeo
753644a5bd Fix CMake formatting inconsistencies 2022-10-06 20:33:40 +02:00
Lukas Dürrenberger
4970af8999 Use CMake property to drive static linking
Using a newer CMake version allows us to make use of the
MSVC_RUNTIME_LIBRARY added in CMake 3.15, which handles static linking
of the runtime library with MSVC a lot simpler
2022-09-30 22:17:03 +02:00
Chris Thrasher
50cec7d2ed Treat each test case as a unique test 2022-09-10 20:03:25 +03:00
Chris Thrasher
40b175adf4 Remove check for old macOS versions
There is no need to check for macOS 10.6 or lower. Snow Leopard came
out in 2009. Because it's nearly 13 years old, it's safe to say
nobody will be trying to build SFML 3 on Snow Leopard.

This was added in de70f691e way back in 2011 when Snow Leopard was
a mere cub.
2022-08-22 11:26:57 +08:00
Chris Thrasher
b7510fd09e Fix formatting and style
Use all lower_case commands with no space between the command name
and the open parentheses. Don't repeat conditional in else() and
endif() calls.
2022-08-22 11:26:57 +08:00
Chris Thrasher
8384139983 Remove unnecessary variable assignment
This same code already exists in src/CMakeLists.txt
2022-08-22 11:26:57 +08:00
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
Bambo-Borris
12c091e0ce Disable /WX for clang-cl 2022-06-12 17:40:01 +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