Compile LMMS using C++17
This replaces `set(CMAKE_CXX_STANDARD 14)` by `set(CMAKE_CXX_STANDARD 17)` wherever it is required. Additionally: * raise `CMAKE_MINIMUM_REQUIRED(VERSION ...)` to `3.8` (the minimum that supports C++17) * `stdshims.h` is now unused and thus removed
This commit is contained in:
committed by
Johannes Lorenz
parent
fd18305fba
commit
8a9a2fae62
@@ -1,4 +1,4 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.3)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
|
||||
|
||||
PROJECT(lmms)
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
//! Shims for std:: functions that aren't available in the current C++ versions
|
||||
//! we target.
|
||||
|
||||
#ifndef STDSHIMS_H
|
||||
#define STDSHIMS_H
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if (__cplusplus >= 201703L || _MSC_VER >= 1914)
|
||||
#ifndef _MSC_VER
|
||||
#warning "This part of this file should now be removed! The functions it provides are part of the C++17 standard."
|
||||
#endif
|
||||
using std::as_const;
|
||||
|
||||
#else
|
||||
|
||||
/// Shim for http://en.cppreference.com/w/cpp/utility/as_const
|
||||
template <typename T>
|
||||
constexpr typename std::add_const<T>::type& as_const(T& t) noexcept
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void as_const(const T&&) = delete;
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -2,8 +2,8 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
SET(CMAKE_DEBUG_POSTFIX "")
|
||||
|
||||
# Enable C++14
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
# Enable C++17
|
||||
SET(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
IF(LMMS_BUILD_APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(RemoteVstPlugin
|
||||
LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
include(CheckCXXPreprocessor)
|
||||
include(CheckCXXSourceCompiles)
|
||||
@@ -55,7 +55,7 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(IS_MINGW)
|
||||
SET(CMAKE_REQUIRED_FLAGS "-std=c++14")
|
||||
SET(CMAKE_REQUIRED_FLAGS "-std=c++17")
|
||||
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <mutex>
|
||||
|
||||
@@ -9,8 +9,8 @@ SET(LMMS_UIS "")
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
# Enable C++14
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
# Enable C++17
|
||||
SET(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
IF(LMMS_BUILD_APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <QDomElement>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "stdshims.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -73,13 +73,12 @@
|
||||
|
||||
#include "ControlLayout.h"
|
||||
|
||||
#include "stdshims.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLayoutItem>
|
||||
#include <QLineEdit>
|
||||
#include <QRect>
|
||||
#include <QString>
|
||||
#include <utility>
|
||||
|
||||
constexpr const int ControlLayout::m_minWidth;
|
||||
|
||||
@@ -215,7 +214,7 @@ QSize ControlLayout::minimumSize() const
|
||||
// get maximum height and width for all children.
|
||||
// as Qt will later call heightForWidth, only the width here really matters
|
||||
QSize size;
|
||||
for (const QLayoutItem *item : as_const(m_itemMap))
|
||||
for (const QLayoutItem *item : std::as_const(m_itemMap))
|
||||
{
|
||||
size = size.expandedTo(item->minimumSize());
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "MainWindow.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "Song.h"
|
||||
#include "stdshims.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "TextFloat.h"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include")
|
||||
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}")
|
||||
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/src")
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
SET(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user