Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements before Qt6 #1020

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion App/NatronApp_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <Python.h>
// ***** END PYTHON BLOCK *****

#include <QtCore/QtGlobal> // for Q_OS_*
#include <QtGlobal> // for Q_OS_*
#if defined(Q_OS_UNIX)
#include <sys/time.h> // for getrlimit on linux
#include <sys/resource.h> // for getrlimit
Expand Down
59 changes: 43 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ project(Natron

set(CMAKE_CXX_STANDARD 17)

include(GNUInstallDirs)

option(NATRON_QT6 "use Qt6" OFF)
option(NATRON_SYSTEM_LIBS "use system versions of dependencies instead of bundled ones" OFF)
option(NATRON_BUILD_TESTS "build the Natron test suite" ON)

Expand Down Expand Up @@ -55,29 +58,55 @@ if(WIN32)
set(Python3_FIND_REGISTRY NEVER)
endif()
find_package(Python3 COMPONENTS Interpreter Development)
find_package(Qt5 5.15 CONFIG REQUIRED COMPONENTS Core Gui Network Widgets Concurrent)

if(IS_DEBUG_BUILD AND WIN32)
# Explicitly setting SHIBOKEN_PYTHON_LIBRARIES variable to avoid PYTHON_DEBUG_LIBRARY-NOTFOUND
# link errors on Windows debug builds.
set(SHIBOKEN_PYTHON_LIBRARIES ${Python3_LIBRARIES})
endif()
find_package(Shiboken2 5.15 CONFIG REQUIRED COMPONENTS libshiboken2 shiboken2)

if(IS_DEBUG_BUILD AND WIN32)
# Remove NDEBUG from Shiboken2 INTERFACE_COMPILE_DEFINITIONS so it is not inherited in debug builds.
get_property(ShibokenInterfaceDefs TARGET Shiboken2::libshiboken PROPERTY INTERFACE_COMPILE_DEFINITIONS)
list(REMOVE_ITEM ShibokenInterfaceDefs NDEBUG)
set_property(TARGET Shiboken2::libshiboken PROPERTY INTERFACE_COMPILE_DEFINITIONS ShibokenInterfaceDefs)
set(QT_COMPONENTS Core Gui Network Widgets Concurrent)
if(NATRON_QT6)
list(APPEND QT_COMPONENTS OpenGLWidgets)
find_package(Qt6 6.3 CONFIG REQUIRED COMPONENTS ${QT_COMPONENTS})
find_package(Shiboken6 6.3 CONFIG REQUIRED COMPONENTS libshiboken6)
find_package(Shiboken6Tools 6.3 CONFIG REQUIRED COMPONENTS shiboken6)
find_package(PySide6 6.3 CONFIG REQUIRED COMPONENTS pyside6)
set(QT_VERSION_MAJOR 6)
set(PYSIDE_VERSION_MAJOR 6)

get_target_property(PYSIDE_INCLUDE_DIRS PySide6::pyside6 INTERFACE_INCLUDE_DIRECTORIES)
set(QTCORE_INCLUDE_DIRS ${Qt6Core_INCLUDE_DIRS})
set(QTGUI_INCLUDE_DIRS ${Qt6Gui_INCLUDE_DIRS})
set(QTWIDGETS_INCLUDE_DIRS ${Qt6Widgets_INCLUDE_DIRS})

set(SHIBOKEN_EXE Shiboken6::shiboken6)
set(SHIBOKEN_LIB Shiboken6::libshiboken)
set(PYSIDE_LIB PySide6::pyside6)
else()
find_package(Qt5 5.15 CONFIG REQUIRED COMPONENTS ${QT_COMPONENTS})
find_package(Shiboken2 5.15 CONFIG REQUIRED COMPONENTS libshiboken2 shiboken2)

find_package(PySide2 5.15 CONFIG REQUIRED COMPONENTS pyside2)
set(QT_VERSION_MAJOR 5)
set(PYSIDE_VERSION_MAJOR 2)

get_target_property(PYSIDE_INCLUDE_DIRS PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES)
set(QTCORE_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS})
set(QTGUI_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS})
set(QTWIDGETS_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS})

set(SHIBOKEN_EXE Shiboken2::shiboken2)
set(SHIBOKEN_LIB Shiboken2::libshiboken)
set(PYSIDE_LIB PySide2::pyside2)
endif()

find_package(PySide2 5.15 CONFIG REQUIRED COMPONENTS pyside2)
set(QT_VERSION_MAJOR 5)
get_target_property(PYSIDE_INCLUDE_DIRS PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES)
string(REGEX REPLACE "(.*)QtCore$" "\\1" Qt5_INCLUDE_DIR ${Qt5Core_INCLUDE_DIRS})
set(QTCORE_INCLUDE_DIRS ${Qt5_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS})
set(QTGUI_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS})
set(QTWIDGETS_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS})
if(IS_DEBUG_BUILD AND WIN32)
# Remove NDEBUG from Shiboken INTERFACE_COMPILE_DEFINITIONS so it is not inherited in debug builds.
get_property(SHIBOKEN_DEFS TARGET ${SHIBOKEN_LIB} PROPERTY INTERFACE_COMPILE_DEFINITIONS)
list(REMOVE_ITEM SHIBOKEN_DEFS NDEBUG)
set_property(TARGET ${SHIBOKEN_LIB} PROPERTY INTERFACE_COMPILE_DEFINITIONS SHIBOKEN_DEFS)
endif()

#Since in Natron and OpenFX all strings are supposed UTF-8 and that the constructor
#for QString(const char*) assumes ASCII strings, we may run into troubles
Expand Down Expand Up @@ -120,8 +149,6 @@ elseif(WIN32)
endif()
endif()

include(GNUInstallDirs)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

Expand Down
8 changes: 4 additions & 4 deletions Engine/AbortableRenderInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
#include <string>
#include <cassert>

#include <QtCore/QMutex>
#include <QtCore/QAtomicInt>
#include <QtCore/QTimer>
#include <QtCore/QDebug>
#include <QMutex>
#include <QAtomicInt>
#include <QTimer>
#include <QDebug>

#include "Engine/AppManager.h"
#include "Engine/EffectInstance.h"
Expand Down
2 changes: 1 addition & 1 deletion Engine/AbortableRenderInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "Global/GlobalDefines.h"

#include <QtCore/QObject>
#include <QObject>

#include "Engine/EngineFwd.h"

Expand Down
16 changes: 8 additions & 8 deletions Engine/AppInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
#include <stdexcept>
#include <sstream> // stringstream

#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtCore/QTextStream>
#include <QCoreApplication>
#include <QDir>
#include <QTextStream>
#include <QtConcurrentMap> // QtCore on Qt4, QtConcurrent on Qt5
#include <QtCore/QUrl>
#include <QtCore/QFileInfo>
#include <QtCore/QEventLoop>
#include <QtCore/QSettings>
#include <QtNetwork/QNetworkReply>
#include <QUrl>
#include <QFileInfo>
#include <QEventLoop>
#include <QSettings>
#include <QNetworkReply>

// ofxhPropertySuite.h:565:37: warning: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to true [-Wtautological-undefined-compare]
// clang-format off
Expand Down
22 changes: 11 additions & 11 deletions Engine/AppInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
#include <limits>
#include <cstddef> // for NULL

#include <QtCore/QtGlobal> // for Q_UNUSED
#include <QtCore/QObject> // for Q_OBJECT, Q_SIGNALS, Q_SLOTS
#include <QtCore/QMutex>
#include <QtGlobal> // for Q_UNUSED
#include <QObject> // for Q_OBJECT, Q_SIGNALS, Q_SLOTS
#include <QMutex>

#include "Global/GlobalDefines.h"
#include "Engine/RectD.h"
Expand Down Expand Up @@ -193,22 +193,22 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
virtual void warningDialog(const std::string & title, const std::string & message, bool* stopAsking, bool useHtml) const;
virtual void informationDialog(const std::string & title, const std::string & message, bool useHtml) const;
virtual void informationDialog(const std::string & title, const std::string & message, bool* stopAsking, bool useHtml) const;
virtual NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & title,
virtual Natron::StandardButtonEnum questionDialog(const std::string & title,
const std::string & message,
bool useHtml,
NATRON_ENUM::StandardButtons buttons =
NATRON_ENUM::StandardButtons(NATRON_ENUM::eStandardButtonYes | NATRON_ENUM::eStandardButtonNo),
NATRON_ENUM::StandardButtonEnum defaultButton = NATRON_ENUM::eStandardButtonNoButton) const WARN_UNUSED_RETURN;
Natron::StandardButtons buttons =
Natron::StandardButtons(Natron::StandardButtonEnum::eStandardButtonYes | Natron::StandardButtonEnum::eStandardButtonNo),
YakoYakoYokuYoku marked this conversation as resolved.
Show resolved Hide resolved
Natron::StandardButtonEnum defaultButton = Natron::StandardButtonEnum::eStandardButtonNoButton) const WARN_UNUSED_RETURN;

/**
* @brief Asks a question to the user and returns the reply.
* @param stopAsking Set to true if the user do not want Natron to ask the question again.
**/
virtual NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & /*title*/,
virtual Natron::StandardButtonEnum questionDialog(const std::string & /*title*/,
const std::string & /*message*/,
bool /*useHtml*/,
NATRON_ENUM::StandardButtons /*buttons*/,
NATRON_ENUM::StandardButtonEnum /*defaultButton*/,
Natron::StandardButtons /*buttons*/,
Natron::StandardButtonEnum /*defaultButton*/,
bool* /*stopAsking*/)
{
return eStandardButtonYes;
Expand Down Expand Up @@ -281,7 +281,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
{
}

NATRON_ENUM::ViewerColorSpaceEnum getDefaultColorSpaceForBitDepth(NATRON_ENUM::ImageBitDepthEnum bitdepth) const;
Natron::ViewerColorSpaceEnum getDefaultColorSpaceForBitDepth(Natron::ImageBitDepthEnum bitdepth) const;

double getProjectFrameRate() const;

Expand Down
24 changes: 12 additions & 12 deletions Engine/AppManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include <sstream> // stringstream
#include <locale>

#include <QtCore/QtGlobal> // for Q_OS_*
#include <QtGlobal> // for Q_OS_*
#if defined(Q_OS_LINUX)
#include <sys/signal.h>
#ifndef __USE_GNU
Expand Down Expand Up @@ -85,17 +85,17 @@
#include <ceres/version.h>
#include <openMVG/version.hpp>

#include <QtCore/QDateTime>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QTextCodec>
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
#include <QtCore/QThreadPool>
#include <QtCore/QTextStream>
#include <QtNetwork/QAbstractSocket>
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QTextCodec>
#include <QCoreApplication>
#include <QSettings>
#include <QThreadPool>
#include <QTextStream>
#include <QAbstractSocket>
#include <QLocalServer>
#include <QLocalSocket>


#include "Global/ProcInfo.h"
Expand Down
30 changes: 15 additions & 15 deletions Engine/AppManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
#include "Global/GlobalDefines.h"

CLANG_DIAG_OFF(deprecated)
#include <QtCore/QtGlobal> // for Q_OS_*
#include <QtGlobal> // for Q_OS_*
// /usr/include/qt5/QtCore/qgenericatomic.h:177:13: warning: 'register' storage class specifier is deprecated [-Wdeprecated]
#include <QtCore/QObject>
#include <QObject>
CLANG_DIAG_ON(deprecated)
#include <QtCore/QStringList>
#include <QtCore/QString>
#include <QtCore/QProcess>
#include <QtCore/QMap>
#include <QStringList>
#include <QString>
#include <QProcess>
#include <QMap>

#include "Engine/AfterQuitProcessingI.h"
#include "Engine/Plugin.h"
Expand Down Expand Up @@ -494,7 +494,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
void setOFXHostHandle(void* handle);

OFX::Host::ImageEffect::Descriptor* getPluginContextAndDescribe(OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
NATRON_ENUM::ContextEnum* ctx);
Natron::ContextEnum* ctx);
AppTLS* getAppTLS() const;
const OfxHost* getOFXHost() const;
GPUContextPool* getGPUContextPool() const;
Expand Down Expand Up @@ -567,7 +567,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON

bool isTextureFloatSupported() const;

bool hasOpenGLForRequirements(NATRON_ENUM::OpenGLRequirementsTypeEnum type, QString* missingOpenGLError = 0) const;
bool hasOpenGLForRequirements(Natron::OpenGLRequirementsTypeEnum type, QString* missingOpenGLError = 0) const;

virtual void updateAboutWindowLibrariesVersion() {}

Expand Down Expand Up @@ -736,14 +736,14 @@ void warningDialog(const std::string & title, const std::string & message, bool*
void informationDialog(const std::string & title, const std::string & message, bool useHtml = false);
void informationDialog(const std::string & title, const std::string & message, bool* stopAsking, bool useHtml = false);

NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & title, const std::string & message, bool useHtml,
NATRON_ENUM::StandardButtons buttons =
NATRON_ENUM::StandardButtons(NATRON_ENUM::eStandardButtonYes | NATRON_ENUM::eStandardButtonNo),
NATRON_ENUM::StandardButtonEnum defaultButton = NATRON_ENUM::eStandardButtonNoButton);
Natron::StandardButtonEnum questionDialog(const std::string & title, const std::string & message, bool useHtml,
Natron::StandardButtons buttons =
Natron::StandardButtons(Natron::StandardButtonEnum::eStandardButtonYes | Natron::StandardButtonEnum::eStandardButtonNo),
Natron::StandardButtonEnum defaultButton = Natron::StandardButtonEnum::eStandardButtonNoButton);

NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & title, const std::string & message, bool useHtml,
NATRON_ENUM::StandardButtons buttons,
NATRON_ENUM::StandardButtonEnum defaultButton,
Natron::StandardButtonEnum questionDialog(const std::string & title, const std::string & message, bool useHtml,
Natron::StandardButtons buttons,
Natron::StandardButtonEnum defaultButton,
bool* stopAsking);
} // namespace Dialogs

Expand Down
14 changes: 7 additions & 7 deletions Engine/AppManagerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "AppManagerPrivate.h"

#include <QtCore/QtGlobal> // for Q_OS_*
#include <QtGlobal> // for Q_OS_*
#if defined(Q_OS_UNIX)
#include <sys/time.h> // for getrlimit on linux
#include <sys/resource.h> // for getrlimit
Expand All @@ -48,12 +48,12 @@ GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_ON
GCC_DIAG_ON(unused-parameter)
// clang-format on

#include <QtCore/QDebug>
#include <QtCore/QProcess>
#include <QtCore/QTemporaryFile>
#include <QtCore/QCoreApplication>
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
#include <QDebug>
#include <QProcess>
#include <QTemporaryFile>
#include <QCoreApplication>
#include <QLocalServer>
#include <QLocalSocket>

#include "Global/QtCompat.h" // for removeRecursively
#include "Global/GlobalDefines.h"
Expand Down
10 changes: 5 additions & 5 deletions Engine/AppManagerPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
#include <vector>
#include <map>

#include <QtCore/QtGlobal> // for Q_OS_*
#include <QtCore/QMutex>
#include <QtCore/QString>
#include <QtCore/QAtomicInt>
#include <QtCore/QCoreApplication>
#include <QtGlobal> // for Q_OS_*
#include <QMutex>
#include <QString>
#include <QAtomicInt>
#include <QCoreApplication>


#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
Expand Down
4 changes: 2 additions & 2 deletions Engine/Bezier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include <cassert>
#include <stdexcept>

#include <QtCore/QLineF>
#include <QtCore/QDebug>
#include <QLineF>
#include <QDebug>

#include "Engine/RotoContextPrivate.h"

Expand Down
2 changes: 1 addition & 1 deletion Engine/Bezier.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

// clang-format off
CLANG_DIAG_OFF(deprecated-declarations)
#include <QtCore/QObject>
#include <QObject>
CLANG_DIAG_ON(deprecated-declarations)
// clang-format on

Expand Down
6 changes: 3 additions & 3 deletions Engine/BezierCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
#include <cassert>
#include <stdexcept>

#include <QtCore/QThread>
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QThread>
#include <QCoreApplication>
#include <QDebug>

#include "Engine/Bezier.h"
#include "Engine/KnobTypes.h"
Expand Down
4 changes: 2 additions & 2 deletions Engine/BezierCPPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

#include "Global/Macros.h"

#include <QtCore/QMutex>
#include <QtCore/QReadWriteLock>
#include <QMutex>
#include <QReadWriteLock>

#include "Engine/Curve.h"
#include "Engine/EngineFwd.h"
Expand Down
2 changes: 1 addition & 1 deletion Engine/BlockingBackgroundRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "Global/Macros.h"
// clang-format off
CLANG_DIAG_OFF(deprecated-register) //'register' storage class specifier is deprecated
#include <QtCore/QDebug>
#include <QDebug>
CLANG_DIAG_ON(deprecated-register)
// clang-format on

Expand Down
Loading
Loading