diff --git a/CMakeLists.txt b/CMakeLists.txt index f0423dc52..47ac24840 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,13 +20,13 @@ cmake_minimum_required(VERSION 3.16.7) project(Natron - VERSION "2.5.0" + VERSION "2.6.0" DESCRIPTION "Open Source Compositing Software" HOMEPAGE_URL "https://natrongithub.github.io/" LANGUAGES CXX C ) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) option(NATRON_SYSTEM_LIBS "use system versions of dependencies instead of bundled ones" OFF) option(NATRON_BUILD_TESTS "build the Natron test suite" ON) diff --git a/Engine/CMakeLists.txt b/Engine/CMakeLists.txt index 2e023b763..dfd0ae1fc 100644 --- a/Engine/CMakeLists.txt +++ b/Engine/CMakeLists.txt @@ -32,7 +32,7 @@ set(PYENGINE_HEADER PySide2_Engine_Python.h) set(POST_SHIBOKEN ../tools/utils/runPostShiboken2.sh) set(shiboken_args - "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero" + "-std=c++17" "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero" "--avoid-protected-hack" "--enable-pyside-extensions" "-I." "-I.." "-I../Global" "-I../libs/OpenFX/include" ${PYENGINE_INCS} "-T${PYSIDE_TYPESYSTEMS}" "--output-directory=${PYENGINE_OUT}" diff --git a/Global/Macros.h b/Global/Macros.h index dc646239b..f0018890a 100644 --- a/Global/Macros.h +++ b/Global/Macros.h @@ -38,8 +38,8 @@ #endif #ifdef __cplusplus -#if __cplusplus < 201402L -#error "Natron 2.5+ requires C++14" +#if __cplusplus < 201703L +#error "Natron 2.6+ requires C++17" #endif // Establish the name space. namespace Natron { } diff --git a/Gui/CMakeLists.txt b/Gui/CMakeLists.txt index 86677df15..68c7e248e 100644 --- a/Gui/CMakeLists.txt +++ b/Gui/CMakeLists.txt @@ -32,7 +32,7 @@ set(PYGUI_HEADER PySide2_Gui_Python.h) set(POST_SHIBOKEN ../tools/utils/runPostShiboken2.sh) set(shiboken_args - "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero" + "-std=c++17" "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero" "--avoid-protected-hack" "--enable-pyside-extensions" ${PYGUI_INCS} "-T../Engine" "-T${PYSIDE_TYPESYSTEMS}" "--output-directory=${PYGUI_OUT}" diff --git a/global.pri b/global.pri index 4290f314b..642b51173 100644 --- a/global.pri +++ b/global.pri @@ -17,7 +17,7 @@ # along with Natron. If not, see # ***** END LICENSE BLOCK ***** -CONFIG += c++11 c++14 +CONFIG += c++17 # libs may modify the config (eg openmp), so it must be included before include(libs.pri) @@ -201,9 +201,6 @@ unix:LIBS += $$QMAKE_LIBS_DYNLOAD # see https://github.com/MrKepzie/Natron/issues/1659 # -fpermissive turns it into a warning QMAKE_CXXFLAGS += -fpermissive - # GCC 6 and later are C++14 by default, but Qt 4 is C++98 - # Note: disabled, because qmake should put the right flags anyway - #lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=gnu++98 # clear some Eigen3 warnings QMAKE_CFLAGS += -Wno-int-in-bool-context @@ -215,22 +212,6 @@ unix:LIBS += $$QMAKE_LIBS_DYNLOAD QMAKE_CXXFLAGS += -Wno-expansion-to-defined } } - c++11 { - # check for at least version 4.7 - contains(GCCVer,[0-3]\\.[0-9]+.*) { - error("At least GCC 4.6 is required.") - } else { - contains(GCCVer,4\\.[0-5].*) { - error("At least GCC 4.6 is required.") - } else { - contains(GCCVer,4\\.6.*) { - lessThan(QT_GCC_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++0x - } else { - lessThan(QT_GCC_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11 - } - } - } - } } # from https://github.com/qt/qtbase/blob/dev/mkspecs/features/qt_common.prf @@ -308,28 +289,14 @@ macx-clang-libc++ { # in Qt 4.8.7, objective-C misses the stdlib and macos version flags QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET QMAKE_OBJECTIVE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET - c++11 { - c++14 { - QMAKE_OBJECTIVE_CXXFLAGS += -std=c++14 - } - !c++14 { - QMAKE_OBJECTIVE_CXXFLAGS += -std=c++11 - } - } + QMAKE_OBJECTIVE_CXXFLAGS += -std=c++17 } macx-clang { # in Qt 4.8.7, objective-C misses the stdlib and macos version flags QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET QMAKE_OBJECTIVE_CXXFLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET - c++11 { - c++14 { - QMAKE_OBJECTIVE_CXXFLAGS += -std=c++14 - } - !c++14 { - QMAKE_OBJECTIVE_CXXFLAGS += -std=c++11 - } - } + QMAKE_OBJECTIVE_CXXFLAGS += -std=c++17 } CONFIG(debug) { @@ -344,11 +311,6 @@ CONFIG(debug) { } } -!macx { - # c++11 build fails on Snow Leopard 10.6 (see the macx section below) - #CONFIG += c++11 -} - win32 { #ofx needs WINDOWS def #microsoft compiler needs _MBCS to compile with the multi-byte character set. @@ -527,33 +489,16 @@ unix { symbols_hidden_by_default.name = GCC_SYMBOLS_PRIVATE_EXTERN symbols_hidden_by_default.value = YES QMAKE_MAC_XCODE_SETTINGS += symbols_hidden_by_default - c++11 { - c++14 { - QMAKE_CXXFLAGS += -std=c++14 - enable_cxx14.name = CLANG_CXX_LANGUAGE_STANDARD - enable_cxx14.value = c++14 - QMAKE_MAC_XCODE_SETTINGS += enable_cxx14 - } - !c++14 { - QMAKE_CXXFLAGS += -std=c++11 - enable_cxx11.name = CLANG_CXX_LANGUAGE_STANDARD - enable_cxx11.value = c++0x - QMAKE_MAC_XCODE_SETTINGS += enable_cxx11 - } - } + QMAKE_CXXFLAGS += -std=c++17 + enable_cxx17.name = CLANG_CXX_LANGUAGE_STANDARD + enable_cxx17.value = c++17 + QMAKE_MAC_XCODE_SETTINGS += enable_cxx17 } *clang* { QMAKE_CXXFLAGS += -ftemplate-depth-1024 QMAKE_CXXFLAGS_WARN_ON += -Wno-c++11-extensions - c++11 { - c++14 { - QMAKE_CXXFLAGS += -std=c++14 - } - !c++14 { - QMAKE_CXXFLAGS += -std=c++11 - } - } + QMAKE_CXXFLAGS += -std=c++17 } # see http://clang.llvm.org/docs/AddressSanitizer.html and http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ diff --git a/libs.pri b/libs.pri index 702102948..d8a90c027 100644 --- a/libs.pri +++ b/libs.pri @@ -49,16 +49,8 @@ DEFINES += OPENMVG_NO_SERIALIZATION # Use this to use OsiMskSolverInterface.cpp #DEFINES += OPENMVG_HAVE_MOSEK -c++11 { - DEFINES += OPENMVG_STD_UNORDERED_MAP - DEFINES += OPENMVG_STD_SHARED_PTR -} else { - # Use boost::shared_ptr and boost::unordered_map - CONFIG += boost - DEFINES += OPENMVG_BOOST_UNORDERED_MAP - DEFINES += OPENMVG_BOOST_SHARED_PTR - DEFINES += OPENMVG_NO_UNIQUE_PTR -} +DEFINES += OPENMVG_STD_UNORDERED_MAP +DEFINES += OPENMVG_STD_SHARED_PTR INCLUDEPATH += $$PWD/libs/openMVG/openMVG INCLUDEPATH += $$PWD/libs/openMVG @@ -85,15 +77,9 @@ openmp { #If undefined, make sure to add to sources all the files in ceres/internal/ceres/generated DEFINES += CERES_RESTRICT_SCHUR_SPECIALIZATION DEFINES += WITH_LIBMV_GUARDED_ALLOC GOOGLE_GLOG_DLL_DECL= LIBMV_NO_FAST_DETECTOR= -c++11 { - DEFINES += CERES_STD_UNORDERED_MAP - DEFINES += CERES_STD_SHARED_PTR -} else { - # Use boost::shared_ptr and boost::unordered_map - CONFIG += boost - DEFINES += CERES_BOOST_SHARED_PTR - DEFINES += CERES_BOOST_UNORDERED_MAP -} +DEFINES += CERES_STD_UNORDERED_MAP +DEFINES += CERES_STD_SHARED_PTR + INCLUDEPATH += $$PWD/libs/ceres/config INCLUDEPATH += $$PWD/libs/ceres/include INCLUDEPATH += $$PWD/libs/ceres/internal diff --git a/tools/jenkins/build-natron.sh b/tools/jenkins/build-natron.sh index b8a592a14..77f7c9f71 100755 --- a/tools/jenkins/build-natron.sh +++ b/tools/jenkins/build-natron.sh @@ -157,9 +157,9 @@ if [ "$QT_VERSION_MAJOR" = 5 ]; then rm Engine/Qt${QT_VERSION_MAJOR}/NatronEngine/* Gui/Qt${QT_VERSION_MAJOR}/NatronGui/* || true SHIBOKEN_INCLUDE_PATHS="-I. -I./Engine -I./Global -Ilibs/OpenFX/include -I${UNIX_SDK_HOME}/include -I${QTDIR}/include -I${UNIX_PYTHON_HOME}/include/python${PYVER} -I${UNIX_PYTHON_HOME}/include/PySide2 -I${UNIX_PYTHON_HOME}/lib/python${PYVER}/site-packages/PySide2/include" SHIBOKEN_TYPESYSTEM_PATHS="-T${UNIX_PYTHON_HOME}/share/PySide2/typesystems -T${UNIX_PYTHON_HOME}/lib/python${PYVER}/site-packages/PySide2/typesystems" - shiboken2 --avoid-protected-hack --enable-pyside-extensions ${SHIBOKEN_INCLUDE_PATHS} ${SHIBOKEN_TYPESYSTEM_PATHS} --output-directory=Engine/Qt${QT_VERSION_MAJOR} Engine/Pyside2_Engine_Python.h Engine/typesystem_engine.xml + shiboken2 -std=c++17 --avoid-protected-hack --enable-pyside-extensions ${SHIBOKEN_INCLUDE_PATHS} ${SHIBOKEN_TYPESYSTEM_PATHS} --output-directory=Engine/Qt${QT_VERSION_MAJOR} Engine/Pyside2_Engine_Python.h Engine/typesystem_engine.xml - shiboken2 --avoid-protected-hack --enable-pyside-extensions ${SHIBOKEN_INCLUDE_PATHS} -I${QTDIR}/include/QtWidgets -I${QTDIR}/include/QtCore ${SHIBOKEN_TYPESYSTEM_PATHS} -T./Engine -T./Shiboken --output-directory=Gui/Qt${QT_VERSION_MAJOR} Gui/Pyside2_Gui_Python.h Gui/typesystem_natronGui.xml + shiboken2 -std=c++17 --avoid-protected-hack --enable-pyside-extensions ${SHIBOKEN_INCLUDE_PATHS} -I${QTDIR}/include/QtWidgets -I${QTDIR}/include/QtCore ${SHIBOKEN_TYPESYSTEM_PATHS} -T./Engine -T./Shiboken --output-directory=Gui/Qt${QT_VERSION_MAJOR} Gui/Pyside2_Gui_Python.h Gui/typesystem_natronGui.xml tools/utils/runPostShiboken2.sh Engine/Qt${QT_VERSION_MAJOR}/NatronEngine natronengine tools/utils/runPostShiboken2.sh Gui/Qt${QT_VERSION_MAJOR}/NatronGui natrongui diff --git a/tools/jenkins/build-plugins.sh b/tools/jenkins/build-plugins.sh index 56c9ef0ee..e252dee94 100755 --- a/tools/jenkins/build-plugins.sh +++ b/tools/jenkins/build-plugins.sh @@ -351,17 +351,10 @@ if [ "$BUILD_ARENA" = "1" ] && [ -d "$TMP_PATH/openfx-arena" ]; then make -C Bundle lodepng.h fi - CXX_ARENA="$CXX17" - # poppler >= 21.12 requires C++17 - # https://github.com/NatronGitHub/openfx-arena/issues/23 - if version_gt 21.12 "$(pkg-config --modversion poppler)"; then - CXX_ARENA="$CXX" - fi env \ MINGW="${ISWIN:-}" \ LICENSE="$NATRON_LICENSE" \ ${ARENA_FLAGS:-} \ - CXX="$CXX_ARENA" \ CONFIG="${COMPILE_TYPE}" \ OPTFLAG="${OPTFLAG}" \ BITS="${BITS}" \ diff --git a/tools/jenkins/compiler-common.sh b/tools/jenkins/compiler-common.sh index 36d86318f..6aeea461e 100644 --- a/tools/jenkins/compiler-common.sh +++ b/tools/jenkins/compiler-common.sh @@ -4,12 +4,10 @@ set -e # Exit immediately if a command exits with a non-zero status set -u # Treat unset variables as an error when substituting. #set -x # Print commands and their arguments as they are executed. -STD14="c++14" STD17="c++17" # https://stackoverflow.com/a/42232124 if [ "$PKGOS" = "Windows" ]; then - STD14="gnu++14" STD17="gnu++17" fi @@ -46,10 +44,9 @@ if [ "$PKGOS" = "OSX" ]; then 9|10|11|12) # GXX should be an openmp-capable compiler (to compile CImg.ofx) - # older version, using clang-3.4 - CC=clang-mp-3.4 - CXX="clang++-mp-3.4 -std=c++14" - CXX17="clang++-mp-3.4 -std=c++1z" + # older version, using clang-5.0 + CC=clang-mp-5.0 + CXX="clang++-mp-5.0 -std=c++1z" GXX=g++-mp-4.9 OBJECTIVE_CC=$CC OBJECTIVE_CXX=$CXX @@ -57,35 +54,23 @@ if [ "$PKGOS" = "OSX" ]; then *) # newer OS X / macOS version link with libc++ and can use the system clang CC=clang - CXX="clang++ -std=c++14" - CXX17="clang++ -std=c++1z" + CXX="clang++ -std=c++1z" OBJECTIVE_CC=$CC OBJECTIVE_CXX=$CXX ;; esac elif [ "$COMPILER" = "clang-omp" ]; then - # newer version (testing) using clang-4.0 - CC=clang-mp-4.0 - CXX="clang++-mp-4.0 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-4.0 -stdlib=libc++ -std=c++1z" # newer version (testing) using clang # if a recent clang-mp is available if command -v clang-mp-6.0 >/dev/null 2>&1; then CC=clang-mp-6.0 - CXX="clang++-mp-6.0 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-6.0 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-6.0 -stdlib=libc++ -std=c++17" elif command -v clang-mp-5.0 >/dev/null 2>&1; then CC=clang-mp-5.0 - CXX="clang++-mp-5.0 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-5.0 -stdlib=libc++ -std=c++17" - elif command -v clang-mp-4.0 >/dev/null 2>&1; then - CC=clang-mp-4.0 - CXX="clang++-mp-4.0 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-4.0 -stdlib=libc++ -std=c++1z" + CXX="clang++-mp-5.0 -stdlib=libc++ -std=c++17" elif command -v /usr/local/opt/llvm@11/bin/clang >/dev/null 2>&1; then CC=/usr/local/opt/llvm@11/bin/clang - CXX="/usr/local/opt/llvm@11/bin/clang++ -std=c++14" - CXX17="/usr/local/opt/llvm@11/bin/clang++ -std=c++17" + CXX="/usr/local/opt/llvm@11/bin/clang++ -std=c++17" fi # clang > 7.0 sometimes chokes on building Universal CImg.ofx, probably because of #pragma omp atomic #Undefined symbols for architecture i386: @@ -98,40 +83,31 @@ if [ "$PKGOS" = "OSX" ]; then *) if command -v clang-mp-17 >/dev/null 2>&1; then CC=clang-mp-17 - CXX="clang++-mp-17 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-17 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-17 -stdlib=libc++ -std=c++17" elif command -v clang-mp-16 >/dev/null 2>&1; then CC=clang-mp-16 - CXX="clang++-mp-16 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-16 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-16 -stdlib=libc++ -std=c++17" elif command -v clang-mp-15 >/dev/null 2>&1; then CC=clang-mp-15 - CXX="clang++-mp-15 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-15 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-15 -stdlib=libc++ -std=c++17" elif command -v clang-mp-14 >/dev/null 2>&1; then CC=clang-mp-14 - CXX="clang++-mp-14 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-14 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-14 -stdlib=libc++ -std=c++17" elif command -v clang-mp-13 >/dev/null 2>&1; then CC=clang-mp-13 - CXX="clang++-mp-13 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-13 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-13 -stdlib=libc++ -std=c++17" elif command -v clang-mp-12 >/dev/null 2>&1; then CC=clang-mp-12 - CXX="clang++-mp-12 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-12 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-12 -stdlib=libc++ -std=c++17" elif command -v clang-mp-11 >/dev/null 2>&1; then CC=clang-mp-11 - CXX="clang++-mp-11 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-11 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-11 -stdlib=libc++ -std=c++17" elif command -v clang-mp-10 >/dev/null 2>&1; then CC=clang-mp-10 - CXX="clang++-mp-10 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-10 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-10 -stdlib=libc++ -std=c++17" elif command -v clang-mp-9.0 >/dev/null 2>&1; then CC=clang-mp-9.0 - CXX="clang++-mp-9.0 -stdlib=libc++ -std=c++14" - CXX17="clang++-mp-9.0 -stdlib=libc++ -std=c++17" + CXX="clang++-mp-9.0 -stdlib=libc++ -std=c++17" fi ;; esac @@ -152,7 +128,7 @@ if [ "$PKGOS" = "OSX" ]; then #GCC_VERSION=5 #GCC_VERSION=6 CC=gcc-mp-${GCC_VERSION} - CXX="g++-mp-${GCC_VERSION} -std=c++14" + CXX="g++-mp-${GCC_VERSION} -std=c++17" OBJECTIVE_CC=gcc-4.2 OBJECTIVE_CXX=g++-4.2 fi @@ -211,8 +187,7 @@ fi COMPILER=${COMPILER:-gcc} CC=${CC:-gcc} -CXX=${CXX:-g++ -std=${STD14}} -CXX17=${CXX17:-g++ -std=${STD17}} +CXX=${CXX:-g++ -std=${STD17}} OBJECTIVE_CC=${OBJECTIVE_CC:-${CC}} OBJECTIVE_CXX=${OBJECTIVE_CXX:-${CXX}}