1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Update the minimum C++ standard to C++14

This commit is contained in:
Tom Poole 2021-06-24 13:56:15 +01:00
parent 0c56fa8fa0
commit 78be43888e
32 changed files with 71 additions and 56 deletions

View file

@ -4,6 +4,26 @@ JUCE breaking changes
Develop
=======
Change
------
The minimum supported C++ standard is now C++14 and the oldest supported
compilers on macOS and Linux are now Xcode 9.2, GCC 5.0 and Clang 3.4.
Possible Issues
---------------
Older compilers will no longer be able to compile JUCE. People using Xcode 8.5
on OS X 10.11 will need to update the operating system to OS X 10.12 to be able
to use Xcode 9.2.
Workaround
----------
No workaround is available.
Rationale
---------
This compiler upgrade will allow the use of C++14 within the framework.
Change
------
Platform GL headers are no longer included in juce_opengl.h

View file

@ -58,9 +58,9 @@ of the target you wish to build.
#### Building JUCE Projects
- __macOS/iOS__: macOS 10.11 and Xcode 7.3.1
- __macOS/iOS__: Xcode 9.2 (macOS 10.12.6)
- __Windows__: Windows 8.1 and Visual Studio 2015 Update 3 64-bit
- __Linux__: GCC 4.8 (for a full list of dependencies, see
- __Linux__: g++ 5.0 or Clang 3.4 (for a full list of dependencies, see
[here](/docs/Linux%20Dependencies.md)).
- __Android__: Android Studio on Windows, macOS or Linux

View file

@ -51,7 +51,7 @@ function(_juce_create_atomic_target target_name)
try_compile(compile_result "${test_bindir}" "${test_file_name}"
OUTPUT_VARIABLE test_build_output_0
CXX_STANDARD 11
CXX_STANDARD 14
CXX_STANDARD_REQUIRED TRUE
CXX_EXTENSIONS FALSE)
@ -59,7 +59,7 @@ function(_juce_create_atomic_target target_name)
try_compile(compile_result "${test_bindir}" "${test_file_name}"
OUTPUT_VARIABLE test_build_output_1
LINK_LIBRARIES atomic
CXX_STANDARD 11
CXX_STANDARD 14
CXX_STANDARD_REQUIRED TRUE
CXX_EXTENSIONS FALSE)

View file

@ -501,7 +501,7 @@ function(_juce_add_plugin_wrapper_target format path out_path)
_juce_add_plugin_definitions("${target_name}" INTERFACE ${format})
_juce_add_standard_defs("${target_name}")
target_compile_features("${target_name}" INTERFACE cxx_std_11)
target_compile_features("${target_name}" INTERFACE cxx_std_14)
add_library("juce::${target_name}" ALIAS "${target_name}")
if(format STREQUAL "AUv3")
@ -922,7 +922,7 @@ function(juce_add_binary_data target)
target_sources(${target} PRIVATE "${binary_file_names}")
target_include_directories(${target} INTERFACE ${juce_binary_data_folder})
target_compile_features(${target} PRIVATE cxx_std_11)
target_compile_features(${target} PRIVATE cxx_std_14)
# This fixes an issue where Xcode is unable to find binary data during archive.
if(CMAKE_GENERATOR STREQUAL "Xcode")

View file

@ -40,7 +40,7 @@ ifeq ($(CONFIG),Debug)
JUCE_TARGET_APP := Projucer
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++11 $(CXXFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs freetype2) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS)
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
@ -61,7 +61,7 @@ ifeq ($(CONFIG),Release)
JUCE_TARGET_APP := Projucer
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++11 $(CXXFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs freetype2) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS)
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)

View file

@ -1118,7 +1118,7 @@
0BC15DC2E5FE5ECFFB398D49 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++11";
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_LINK_OBJC_RUNTIME = NO;
CODE_SIGN_IDENTITY = "";
@ -1171,7 +1171,7 @@
INFOPLIST_FILE = Info-App.plist;
INFOPLIST_PREPROCESS = NO;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../Build $(SRCROOT)/../../../../modules";
OTHER_CPLUSPLUSFLAGS = "-Wall -Wshadow-all -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion -Wconditional-uninitialized -Woverloaded-virtual -Wreorder -Wconstant-conversion -Wsign-conversion -Wunused-private-field -Wbool-conversion -Wextra-semi -Wunreachable-code -Wzero-as-null-pointer-constant -Wcast-align -Winconsistent-missing-destructor-override -Wshift-sign-overflow -Wnullable-to-nonnull-conversion -Wno-missing-field-initializers -Wno-ignored-qualifiers -Wswitch-enum";
PRODUCT_BUNDLE_IDENTIFIER = com.juce.theprojucer;
@ -1185,7 +1185,7 @@
0CC6C439D038EDA0D7F10DF0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++11";
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_LINK_OBJC_RUNTIME = NO;
CODE_SIGN_IDENTITY = "";
@ -1238,7 +1238,7 @@
INFOPLIST_FILE = Info-App.plist;
INFOPLIST_PREPROCESS = NO;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../Build $(SRCROOT)/../../../../modules";
OTHER_CPLUSPLUSFLAGS = "-Wall -Wshadow-all -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion -Wconditional-uninitialized -Woverloaded-virtual -Wreorder -Wconstant-conversion -Wsign-conversion -Wunused-private-field -Wbool-conversion -Wextra-semi -Wunreachable-code -Wzero-as-null-pointer-constant -Wcast-align -Winconsistent-missing-destructor-override -Wshift-sign-overflow -Wnullable-to-nonnull-conversion -Wno-missing-field-initializers -Wno-ignored-qualifiers -Wswitch-enum";
PRODUCT_BUNDLE_IDENTIFIER = com.juce.theprojucer;

View file

@ -3,8 +3,8 @@
<JUCERPROJECT id="M70qfTRRk" name="Projucer" projectType="guiapp" juceFolder="../../juce"
version="6.0.8" bundleIdentifier="com.juce.theprojucer" splashScreenColour="Dark"
displaySplashScreen="0" reportAppUsage="0" companyName="Raw Material Software Limited"
companyCopyright="Raw Material Software Limited" cppLanguageStandard="11"
useAppConfig="0" addUsingNamespaceToJuceHeader="1" jucerFormatVersion="1">
companyCopyright="Raw Material Software Limited" useAppConfig="0"
addUsingNamespaceToJuceHeader="1" jucerFormatVersion="1">
<EXPORTFORMATS>
<XCODE_MAC targetFolder="Builds/MacOSX" vstFolder="~/SDKs/vstsdk2.4" rtasFolder="~/SDKs/PT_80_SDK"
documentExtensions=".jucer" objCExtraSuffix="zkVtji" bigIcon="Zrx1Gl"
@ -13,9 +13,9 @@
applicationCategory="public.app-category.developer-tools">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" targetName="Projucer" cppLibType="libc++"
recommendedWarnings="LLVM"/>
recommendedWarnings="LLVM" macOSDeploymentTarget="10.12"/>
<CONFIGURATION name="Release" isDebug="0" targetName="Projucer" cppLibType="libc++"
linkTimeOptimisation="0" recommendedWarnings="LLVM"/>
linkTimeOptimisation="0" recommendedWarnings="LLVM" macOSDeploymentTarget="10.12"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_gui_extra" path="../../modules"/>

View file

@ -214,7 +214,7 @@ bool Project::setCppVersionFromOldExporterSettings()
}
}
if (highestLanguageStandard != -1 && highestLanguageStandard >= 11)
if (highestLanguageStandard >= 14)
{
cppStandardValue = highestLanguageStandard;
return true;
@ -225,6 +225,9 @@ bool Project::setCppVersionFromOldExporterSettings()
void Project::updateDeprecatedProjectSettings()
{
if (cppStandardValue.get().toString() == "11")
cppStandardValue.resetToDefault();
for (ExporterIterator exporter (*this); exporter.next();)
exporter->updateDeprecatedSettings();
}

View file

@ -205,8 +205,8 @@ public:
bool shouldDisplaySplashScreen() const { return displaySplashScreenValue.get(); }
String getSplashScreenColourString() const { return splashScreenColourValue.get(); }
static StringArray getCppStandardStrings() { return { "C++11", "C++14", "C++17", "Use Latest" }; }
static Array<var> getCppStandardVars() { return { "11", "14", "17", "latest" }; }
static StringArray getCppStandardStrings() { return { "C++14", "C++17", "Use Latest" }; }
static Array<var> getCppStandardVars() { return { "14", "17", "latest" }; }
String getCppStandardString() const { return cppStandardValue.get(); }

View file

@ -576,10 +576,6 @@ public:
cl->createNewChildElement ("TreatWarningAsError")->addTextElement ("true");
auto cppStandard = owner.project.getCppStandardString();
if (cppStandard == "11") // VS doesn't support the C++11 flag so we have to bump it to C++14
cppStandard = "14";
cl->createNewChildElement ("LanguageStandard")->addTextElement ("stdcpp" + cppStandard);
}

View file

@ -40,6 +40,7 @@
description: Classes to collect analytics and send to destinations
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_gui_basics

View file

@ -37,6 +37,7 @@
description: Classes for audio buffer manipulation, midi message handling, synthesis, etc.
website: http://www.juce.com/juce
license: ISC
minimumCppStandard: 14
dependencies: juce_core
OSXFrameworks: Accelerate

View file

@ -37,6 +37,7 @@
description: Classes to play and record from audio and MIDI I/O devices
website: http://www.juce.com/juce
license: ISC
minimumCppStandard: 14
dependencies: juce_audio_basics, juce_events
OSXFrameworks: CoreAudio CoreMIDI AudioToolbox

View file

@ -40,6 +40,7 @@
description: Classes for reading and writing various audio file formats.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_audio_basics
OSXFrameworks: CoreAudio CoreMIDI QuartzCore AudioToolbox

View file

@ -40,6 +40,7 @@
description: Classes for building VST, VST3, AudioUnit, AAX and RTAS plugins.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_audio_processors

View file

@ -40,6 +40,7 @@
description: Classes for loading and playing VST, AU, LADSPA, or internally-generated audio processors.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_gui_extra, juce_audio_basics
OSXFrameworks: CoreAudio CoreMIDI AudioToolbox

View file

@ -40,6 +40,7 @@
description: Classes for audio-related GUI and miscellaneous tasks.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_audio_processors, juce_audio_formats, juce_audio_devices
OSXFrameworks: CoreAudioKit DiscRecording

View file

@ -40,6 +40,7 @@
description: The Box2D physics engine and some utility classes.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_graphics

View file

@ -37,6 +37,7 @@
description: The essential set of basic JUCE classes, as required by all the other JUCE modules. Includes text, container, memory, threading and i/o functionality.
website: http://www.juce.com/juce
license: ISC
minimumCppStandard: 14
dependencies:
OSXFrameworks: Cocoa Foundation IOKit

View file

@ -65,8 +65,6 @@ void operator delete[] (void* p) noexcept
std::free (p);
}
#if JUCE_CXX14_IS_AVAILABLE
void operator delete (void* p, size_t) noexcept
{
juce::notifyAllocationHooksForThread();
@ -79,8 +77,6 @@ void operator delete[] (void* p, size_t) noexcept
std::free (p);
}
#endif
namespace juce
{

View file

@ -30,12 +30,8 @@
// GCC
#if JUCE_GCC
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 407
#error "JUCE requires GCC 4.7 or later"
#endif
#if ! (__cplusplus >= 201103L || defined (__GXX_EXPERIMENTAL_CXX0X__))
#error "JUCE requires that GCC has C++11 compatibility enabled"
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 500
#error "JUCE requires GCC 5.0 or later"
#endif
#ifndef JUCE_EXCEPTIONS_DISABLED
@ -44,7 +40,7 @@
#endif
#endif
#define JUCE_CXX14_IS_AVAILABLE ((__cplusplus >= 201402L) || ((__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && (__cplusplus >= 201300L)))
#define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L)
#define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L)
#endif
@ -53,8 +49,8 @@
// Clang
#if JUCE_CLANG
#if (__clang_major__ < 3) || (__clang_major__ == 3 && __clang_minor__ < 3)
#error "JUCE requires Clang 3.3 or later"
#if (__clang_major__ < 3) || (__clang_major__ == 3 && __clang_minor__ < 4)
#error "JUCE requires Clang 3.4 or later"
#endif
#ifndef JUCE_COMPILER_SUPPORTS_ARC
@ -95,21 +91,8 @@
#endif
//==============================================================================
// C++ library
#if (defined (__GLIBCXX__) && __GLIBCXX__ < 20130322) || (defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 3700))
#error "JUCE requires a C++ library containing std::atomic"
#endif
//==============================================================================
#if (! JUCE_MSVC) && (! JUCE_CXX14_IS_AVAILABLE)
namespace std
{
template <typename T, typename... Args>
unique_ptr<T> make_unique (Args&&... args)
{
return unique_ptr<T> (new T (std::forward<Args> (args)...));
}
}
#if ! JUCE_CXX14_IS_AVAILABLE
#error "JUCE requires C++14 or later"
#endif
//==============================================================================

View file

@ -40,6 +40,7 @@
description: Classes for various basic cryptography functions, including RSA, Blowfish, MD5, SHA, etc.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_core

View file

@ -40,6 +40,7 @@
description: Classes for undo/redo management, and smart data structures.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_events

View file

@ -37,6 +37,7 @@
description: Classes for running an application's main event loop and sending/receiving messages, timers, etc.
website: http://www.juce.com/juce
license: ISC
minimumCppStandard: 14
dependencies: juce_core

View file

@ -40,6 +40,7 @@
description: Classes for 2D vector graphics, image loading/saving, font handling, etc.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_events
OSXFrameworks: Cocoa QuartzCore

View file

@ -40,6 +40,7 @@
description: Basic user-interface components and related classes.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_graphics juce_data_structures
OSXFrameworks: Cocoa Carbon QuartzCore

View file

@ -110,17 +110,15 @@
//==============================================================================
#elif (JUCE_LINUX || JUCE_BSD) && JUCE_WEB_BROWSER
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant", "-Wparentheses")
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant", "-Wparentheses", "-Wdeprecated-declarations")
// If you're missing this header, you need to install the webkit2gtk-4.0 package
#include <gtk/gtk.h>
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
// If you're missing these headers, you need to install the webkit2gtk-4.0 package
#include <gtk/gtkx.h>
#include <glib-unix.h>
#include <webkit2/webkit2.h>
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#endif
//==============================================================================

View file

@ -40,6 +40,7 @@
description: Miscellaneous GUI classes for specialised tasks.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_gui_basics
OSXFrameworks: WebKit

View file

@ -40,6 +40,7 @@
description: Classes for rendering OpenGL in a JUCE window.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_gui_extra
OSXFrameworks: OpenGL

View file

@ -40,6 +40,7 @@
description: Open Sound Control implementation.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_events

View file

@ -40,6 +40,7 @@
description: Classes for online product authentication
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_cryptography

View file

@ -40,6 +40,7 @@
description: Classes for playing video and capturing camera input.
website: http://www.juce.com/juce
license: GPL/Commercial
minimumCppStandard: 14
dependencies: juce_gui_extra
OSXFrameworks: AVKit AVFoundation CoreMedia