Skip to content

Commit

Permalink
Compile LMMS using C++17
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JohannesLorenz committed Sep 17, 2021
1 parent fd18305 commit 8a9a2fa
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 44 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.3)
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)

PROJECT(lmms)

Expand Down
30 changes: 0 additions & 30 deletions include/stdshims.h

This file was deleted.

4 changes: 2 additions & 2 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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++")
Expand Down
6 changes: 3 additions & 3 deletions plugins/vst_base/RemoteVstPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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++")
Expand Down
1 change: 0 additions & 1 deletion src/core/LinkedModelGroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <QDomElement>

#include "AutomatableModel.h"
#include "stdshims.h"



Expand Down
5 changes: 2 additions & 3 deletions src/gui/widgets/ControlLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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());
}
Expand Down
1 change: 0 additions & 1 deletion src/gui/widgets/Knob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include "MainWindow.h"
#include "ProjectJournal.h"
#include "Song.h"
#include "stdshims.h"
#include "StringPairDrag.h"
#include "TextFloat.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 8a9a2fa

Please sign in to comment.