From c86094e4dbaf758831e6b04081b597c042ac64b1 Mon Sep 17 00:00:00 2001 From: psi29a Date: Thu, 8 Oct 2020 18:25:01 +0000 Subject: [PATCH 1/3] Bump to C++17 --- CI/before_script.osx.sh | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/before_script.osx.sh b/CI/before_script.osx.sh index 0eeef60a4f..e11ef1b58b 100755 --- a/CI/before_script.osx.sh +++ b/CI/before_script.osx.sh @@ -13,7 +13,7 @@ cmake \ -D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH" \ -D CMAKE_C_COMPILER_LAUNCHER="$CCACHE_EXECUTABLE" \ -D CMAKE_CXX_COMPILER_LAUNCHER="$CCACHE_EXECUTABLE" \ --D CMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" \ +-D CMAKE_CXX_FLAGS="-stdlib=libc++" \ -D CMAKE_C_FLAGS_RELEASE="-g -O0" \ -D CMAKE_CXX_FLAGS_RELEASE="-g -O0" \ -D CMAKE_OSX_DEPLOYMENT_TARGET="10.12" \ diff --git a/CMakeLists.txt b/CMakeLists.txt index c4002ea500..7c4322d648 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,7 +416,7 @@ endif() if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++14 -pedantic -Wno-long-long") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++17 -pedantic -Wno-long-long") add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON ) if (APPLE) From c62546fb12e10d85d591eb13cadc2fa29c98c9d5 Mon Sep 17 00:00:00 2001 From: psi29a Date: Thu, 8 Oct 2020 18:43:55 +0000 Subject: [PATCH 2/3] make it count --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c4322d648..ac74f5f2c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -394,7 +394,7 @@ if (NOT WIN32 AND NOT APPLE) endif() # CXX Compiler settings -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) if(OPENMW_LTO_BUILD) if(NOT CMAKE_VERSION VERSION_LESS 3.9) From 82431b752d1b58ee39372f0cd48c6b94c800d104 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Fri, 9 Oct 2020 06:50:17 +0200 Subject: [PATCH 3/3] removed unnessary bits that cmake should be doing for us; replace Misc::gcd with std::gcd --- CMakeLists.txt | 2 +- apps/launcher/graphicspage.cpp | 5 +++-- apps/openmw/mwgui/settingswindow.cpp | 4 ++-- components/CMakeLists.txt | 2 +- components/misc/gcd.hpp | 13 ------------- 5 files changed, 7 insertions(+), 19 deletions(-) delete mode 100644 components/misc/gcd.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ac74f5f2c9..87551fe01d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,7 +416,7 @@ endif() if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++17 -pedantic -Wno-long-long") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -pedantic -Wno-long-long") add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON ) if (APPLE) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index c745332dc8..d7e7eabc50 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -13,12 +13,13 @@ #include +#include + #include -#include QString getAspect(int x, int y) { - int gcd = Misc::gcd (x, y); + int gcd = std::gcd (x, y); int xaspect = x / gcd; int yaspect = y / gcd; // special case: 8 : 5 is usually referred to as 16:10 diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index aec3396a18..c5fa17ca43 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -10,10 +10,10 @@ #include #include +#include #include #include -#include #include #include #include @@ -60,7 +60,7 @@ namespace std::string getAspect (int x, int y) { - int gcd = Misc::gcd (x, y); + int gcd = std::gcd (x, y); int xaspect = x / gcd; int yaspect = y / gcd; // special case: 8 : 5 is usually referred to as 16:10 diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index c399a70103..69d8145f09 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -86,7 +86,7 @@ add_component_dir (esmterrain ) add_component_dir (misc - gcd constants utf8stream stringops resourcehelpers rng messageformatparser weakcache + constants utf8stream stringops resourcehelpers rng messageformatparser weakcache ) add_component_dir (debug diff --git a/components/misc/gcd.hpp b/components/misc/gcd.hpp deleted file mode 100644 index fd9e972e7a..0000000000 --- a/components/misc/gcd.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef MISC_GCD_H -#define MISC_GCD_H - -namespace Misc -{ - // TODO: replace to the std::gcd() when the C++17 will be available. - int gcd(int a, int b) - { - return b == 0 ? a : gcd(b, a % b); - } -} - -#endif