Switch over to C++14, drop support for MSVC 2015

The main reason is that the current development version of Eigen requires C++14 to be enabled, so otherwise we can't compile with the latest Eigen.

If really needed, we can keep support for MSVC 2015 (please make your voice heard) but that would lock us out of a few features of C++14.
This commit is contained in:
rdb
2024-10-17 12:32:33 +02:00
parent 61f8df2d7d
commit 3be1dfa4b4
5 changed files with 14 additions and 16 deletions

View File

@@ -52,7 +52,7 @@ Building Panda3D
Windows
-------
You can build Panda3D with the Microsoft Visual C++ 2015, 2017, 2019 or 2022
You can build Panda3D with the Microsoft Visual C++ 2017, 2019 or 2022
compiler, which can be downloaded for free from the [Visual Studio site](https://visualstudio.microsoft.com/downloads/).
You will also need to install the [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk),
and if you intend to target Windows Vista, you will also need the

View File

@@ -184,7 +184,7 @@ Try to group logically-similar lines, separating them with a single blank line.
Modern language features
------------------------
Panda3D is a C++11 project. The use of the following modern language features
Panda3D is a C++14 project. The use of the following modern language features
is greatly encouraged:
1. `nullptr` over `NULL`
@@ -197,4 +197,4 @@ creating a typedef for the container type instead.
Avoid using `std::function` in cases where a lambda can be accepted directly
(using a template function), since it has extra overhead over lambdas.
C++14 and C++17 features should be avoided for now.
C++17 features should be avoided for now.

View File

@@ -51,8 +51,8 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GCC")
endif()
# Panda3D is now a C++11 project.
set(CMAKE_CXX_STANDARD 11)
# Panda3D is now a C++14 project.
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set certain CMake flags we expect

View File

@@ -110,9 +110,9 @@ typedef std::ios::seekdir ios_seekdir;
#define INLINE inline
#endif
// Determine the availability of C++11 features.
#if defined(_MSC_VER) && _MSC_VER < 1900 // Visual Studio 2015
#error Microsoft Visual C++ 2015 or later is required to compile Panda3D.
// Determine the availability of C++14 features.
#if defined(_MSC_VER) && _MSC_VER < 1910 // Visual Studio 2017
#error Microsoft Visual C++ 2017 or later is required to compile Panda3D.
#endif
// This is just to support code generated with older versions of interrogate.

View File

@@ -156,7 +156,7 @@ def usage(problem):
print(" --everything (enable every third-party lib)")
print(" --directx-sdk=X (specify version of DirectX SDK to use: jun2010, aug2009)")
print(" --windows-sdk=X (specify Windows SDK version, eg. 7.1, 8.1, 10 or 11. Default is 8.1)")
print(" --msvc-version=X (specify Visual C++ version, eg. 10, 11, 12, 14, 14.1, 14.2, 14.3. Default is 14)")
print(" --msvc-version=X (specify Visual C++ version, 14.1, 14.2, 14.3. Default is 14.1)")
print(" --use-icl (experimental setting to use an intel compiler instead of MSVC on Windows)")
print("")
print("The simplest way to compile panda is to just type:")
@@ -309,8 +309,8 @@ def parseopts(args):
if GetTarget() == 'windows':
if not MSVC_VERSION:
print("No MSVC version specified. Defaulting to 14 (Visual Studio 2015).")
MSVC_VERSION = (14, 0)
print("No MSVC version specified. Defaulting to 14.1 (Visual Studio 2017).")
MSVC_VERSION = (14, 1)
else:
try:
MSVC_VERSION = tuple(int(d) for d in MSVC_VERSION.split('.'))[:2]
@@ -319,12 +319,10 @@ def parseopts(args):
except:
usage("Invalid setting for --msvc-version")
if MSVC_VERSION < (14, 0):
if MSVC_VERSION < (14, 1):
warn_prefix = "%sERROR:%s " % (GetColor("red"), GetColor())
print("=========================================================================")
print(warn_prefix + "Support for MSVC versions before 2015 has been discontinued.")
print(warn_prefix + "For more information, or any questions, please visit:")
print(warn_prefix + " https://github.com/panda3d/panda3d/issues/288")
print(warn_prefix + "Support for MSVC versions before 2017 has been discontinued.")
print("=========================================================================")
sys.stdout.flush()
time.sleep(1.0)
@@ -1313,7 +1311,7 @@ def CompileCxx(obj,src,opts):
if (COMPILER=="GCC"):
if (src.endswith(".c")): cmd = GetCC() +' -fPIC -c -o ' + obj
else: cmd = GetCXX()+' -std=gnu++11 -ftemplate-depth-70 -fPIC -c -o ' + obj
else: cmd = GetCXX()+' -std=gnu++14 -ftemplate-depth-70 -fPIC -c -o ' + obj
for (opt, dir) in INCDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts): cmd += ' -I' + BracketNameWithQuotes(dir)
for (opt, dir) in FRAMEWORKDIRECTORIES: