build: fix link error on MSVC for SFML port

Change two `constexpr` declarations to `inline` to fix a link error on
MSVC.

Also remove the C++14 override that was used for testing on MSVC, the
project being defined as C++17 in CMake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Andy Vandijck 2025-05-03 23:51:32 +00:00 committed by Rafael Kitover
parent 0aecfb5d1b
commit 18c3c3bd51
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
3 changed files with 8 additions and 2 deletions

View File

@ -68,8 +68,6 @@ if(CMAKE_VERSION VERSION_LESS "3.25")
endif() endif()
endif() endif()
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/std:c++14>)
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "" FORCE) set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "" FORCE)
# We need to explicitly set all of these to override the CMake defaults. # We need to explicitly set all of these to override the CMake defaults.

View File

@ -266,6 +266,10 @@ constexpr Angle operator""_rad(unsigned long long angle)
// Note: the 'inline' keyword here is technically not required, but VS2019 fails // Note: the 'inline' keyword here is technically not required, but VS2019 fails
// to compile with a bogus "multiple definition" error if not explicitly used. // to compile with a bogus "multiple definition" error if not explicitly used.
#ifdef _MSC_VER
inline constexpr Angle Angle::Zero;
#else
constexpr Angle Angle::Zero; constexpr Angle Angle::Zero;
#endif
} // namespace sf } // namespace sf

View File

@ -279,6 +279,10 @@ constexpr Time& operator%=(Time& left, Time right)
// Note: the 'inline' keyword here is technically not required, but VS2019 fails // Note: the 'inline' keyword here is technically not required, but VS2019 fails
// to compile with a bogus "multiple definition" error if not explicitly used. // to compile with a bogus "multiple definition" error if not explicitly used.
#ifdef _MSC_VER
inline constexpr Time Time::Zero;
#else
constexpr Time Time::Zero; constexpr Time Time::Zero;
#endif
} // namespace sf } // namespace sf