From c02990e2f80286c83f9c45127e344ad80c539b15 Mon Sep 17 00:00:00 2001 From: Martin Reboredo Date: Wed, 8 Jun 2022 19:27:02 -0300 Subject: [PATCH] Shiboken generation in QMake --- Engine/Engine.pro | 93 ++++++++++++++------------------- Gui/Gui.pro | 49 +++++++++++++++-- global.pri | 10 ++++ tools/utils/runPostShiboken.sh | 61 +++++++++++---------- tools/utils/runPostShiboken2.sh | 50 +++++++++--------- 5 files changed, 154 insertions(+), 109 deletions(-) mode change 100755 => 100644 tools/utils/runPostShiboken.sh diff --git a/Engine/Engine.pro b/Engine/Engine.pro index e91bdaf943..4ca0ab63e2 100644 --- a/Engine/Engine.pro +++ b/Engine/Engine.pro @@ -210,7 +210,6 @@ SOURCES += \ ../Global/PythonUtils.cpp \ ../Global/StrUtils.cpp \ ../libs/SequenceParsing/SequenceParsing.cpp \ - $${ENGINE_WRAPPER_DIR}/natronengine_module_wrapper.cpp \ HEADERS += \ AbortableRenderInfo.h \ @@ -427,7 +426,9 @@ HEADERS += \ ../libs/OpenFX/include/nuke/fnPublicOfxExtensions.h \ ../libs/OpenFX/include/tuttle/ofxReadWrite.h \ ../libs/OpenFX_extensions/ofxhParametricParam.h \ - $${ENGINE_WRAPPER_DIR}/natronengine_python.h \ + +GENERATED_SOURCES += $${ENGINE_WRAPPER_DIR}/natronengine_module_wrapper.cpp +GENERATED_HEADERS += $${ENGINE_WRAPPER_DIR}/natronengine_python.h ENGINE_GENERATED_SOURCES = \ animatedparam_wrapper \ @@ -480,67 +481,53 @@ ENGINE_GENERATED_SOURCES = \ userparamholder_wrapper \ for(name, ENGINE_GENERATED_SOURCES) { - SOURCES += $${ENGINE_WRAPPER_DIR}/$${name}.cpp - HEADERS += $${ENGINE_WRAPPER_DIR}/$${name}.h + GENERATED_SOURCES += $${ENGINE_WRAPPER_DIR}/$${name}.cpp + GENERATED_HEADERS += $${ENGINE_WRAPPER_DIR}/$${name}.h } OTHER_FILES += \ typesystem_engine.xml -# GENERATED_SOURCES = \ -# NatronEngine/animatedparam_wrapper.cpp \ -# NatronEngine/app_wrapper.cpp \ -# NatronEngine/beziercurve_wrapper.cpp \ -# NatronEngine/booleanparam_wrapper.cpp \ -# NatronEngine/buttonparam_wrapper.cpp \ -# NatronEngine/choiceparam_wrapper.cpp \ -# NatronEngine/colorparam_wrapper.cpp \ -# NatronEngine/colortuple_wrapper.cpp \ -# NatronEngine/double2dparam_wrapper.cpp \ -# NatronEngine/double2dtuple_wrapper.cpp \ -# NatronEngine/double3dparam_wrapper.cpp \ -# NatronEngine/double3dtuple_wrapper.cpp \ -# NatronEngine/doubleparam_wrapper.cpp \ -# NatronEngine/effect_wrapper.cpp \ -# NatronEngine/fileparam_wrapper.cpp \ -# NatronEngine/group_wrapper.cpp \ -# NatronEngine/groupparam_wrapper.cpp \ -# NatronEngine/int2dparam_wrapper.cpp \ -# NatronEngine/int2dtuple_wrapper.cpp \ -# NatronEngine/int3dparam_wrapper.cpp \ -# NatronEngine/int3dtuple_wrapper.cpp \ -# NatronEngine/intparam_wrapper.cpp \ -# NatronEngine/itembase_wrapper.cpp \ -# NatronEngine/layer_wrapper.cpp \ -# NatronEngine/natron_wrapper.cpp \ -# NatronEngine/natronengine_module_wrapper.cpp \ -# NatronEngine/outputfileparam_wrapper.cpp \ -# NatronEngine/pageparam_wrapper.cpp \ -# NatronEngine/param_wrapper.cpp \ -# NatronEngine/parametricparam_wrapper.cpp \ -# NatronEngine/pathparam_wrapper.cpp \ -# NatronEngine/roto_wrapper.cpp \ -# NatronEngine/stringparam_wrapper.cpp \ -# NatronEngine/stringparambase_wrapper.cpp +defineReplace(shibokenEngine) { + SOURCES += $$GENERATED_SOURCES + HEADERS += $$GENERATED_HEADERS + return("%_wrapper.cpp") +} -# defineReplace(shibokenWorkaround) { -# SOURCES += $$GENERATED_SOURCES -# return("%_wrapper.cpp") -# } +QT_INCLUDEPATH = $$PYTHON_INCLUDEPATH $$PYSIDE_INCLUDEDIR +for(dep, QT) { + QT_INCLUDEPATH += $$eval(QT.$${dep}.includes) + QT_INCLUDEPATH += $$absolute_path($$eval(QT.$${dep}.name), $$PYSIDE_INCLUDEDIR) +} + +equals(QT_MAJOR_VERSION, 5) { + PYENGINE_HEADER = PySide2_Engine_Python.h + POST_SHIBOKEN = bash $$shell_path(../tools/utils/runPostShiboken2.sh) +} else:equals(QT_MAJOR_VERSION, 4) { + PYENGINE_HEADER = Pyside_Engine_Python.h + POST_SHIBOKEN = bash $$shell_path(../tools/utils/runPostShiboken.sh) +} -# isEmpty(SHIBOKEN) { -# SHIBOKEN = shiboken -# } +SRC_PATH = $$relative_path($$PWD, $$OUT_PWD)/ +DEP_GROUP = $$PYENGINE_HEADER typesystem_engine.xml $$HEADERS +enginesbk.input = $$PYENGINE_HEADER typesystem_engine.xml +enginesbk.depends = $$eval($$list($$join(DEP_GROUP, " "$$SRC_PATH, $$SRC_PATH))) +enginesbk.target = enginesbk +enginesbk.commands = cd $$PWD && $$SHIBOKEN \ + --enable-parent-ctor-heuristic --use-isnull-as-nb_nonzero \ + --avoid-protected-hack --enable-pyside-extensions \ + -I.:..:../Global:../libs/OpenFX/include $$join(QT_INCLUDEPATH, ":", "-I") \ + -T$$TYPESYSTEMPATH --output-directory=$$OUT_PWD/Qt$$QT_MAJOR_VERSION \ + $$PYENGINE_HEADER typesystem_engine.xml && \ + $$POST_SHIBOKEN $$OUT_PWD/Qt$$QT_MAJOR_VERSION/NatronEngine natronengine +pyengine.depends = enginesbk +pyengine.target = $$shell_path($$ENGINE_WRAPPER_DIR/%_wrapper.cpp) +pyengine.output_function = shibokenEngine +pyengine.commands = bash -c 'true' -# SHIBOKEN_FILE = . # Need to give some bogus input -# SHIBOKEN.input = SHIBOKEN_FILE -# SHIBOKEN.output_function = shibokenWorkaround -# SHIBOKEN.commands = $$SHIBOKEN --include-paths=..:$$system(pkg-config --variable=includedir pyside) --typesystem-paths=$$system(pkg-config --variable=typesystemdir pyside) Pyside_Engine_Python.h typesystem_engine.xml -# SHIBOKEN.CONFIG = no_link # don't add the .cpp target file to OBJECTS -# SHIBOKEN.clean = dummy # don't remove the %_wrapper.cpp file by "make clean" +QMAKE_EXTRA_TARGETS += enginesbk pyengine -# QMAKE_EXTRA_COMPILERS += SHIBOKEN macx { OBJECTIVE_SOURCES += \ diff --git a/Gui/Gui.pro b/Gui/Gui.pro index ec30c66aba..1259fe0365 100644 --- a/Gui/Gui.pro +++ b/Gui/Gui.pro @@ -227,7 +227,6 @@ SOURCES += \ ViewerTabPrivate.cpp \ ViewerToolButton.cpp \ ticks.cpp \ - $${GUI_WRAPPER_DIR}/natrongui_module_wrapper.cpp \ HEADERS += \ AboutWindow.h \ @@ -384,7 +383,9 @@ HEADERS += \ ../libs/OpenFX/include/nuke/fnPublicOfxExtensions.h \ ../libs/OpenFX/include/tuttle/ofxReadWrite.h \ ../libs/OpenFX_extensions/ofxhParametricParam.h \ - $${GUI_WRAPPER_DIR}/natrongui_python.h \ + +GENERATED_SOURCES += $${GUI_WRAPPER_DIR}/natrongui_module_wrapper.cpp +GENERATED_HEADERS += $${GUI_WRAPPER_DIR}/natrongui_python.h GUI_GENERATED_SOURCES = \ guiapp_wrapper \ @@ -395,8 +396,8 @@ GUI_GENERATED_SOURCES = \ pyviewer_wrapper for(name, GUI_GENERATED_SOURCES) { - SOURCES += $${GUI_WRAPPER_DIR}/$${name}.cpp - HEADERS += $${GUI_WRAPPER_DIR}/$${name}.h + GENERATED_SOURCES += $${GUI_WRAPPER_DIR}/$${name}.cpp + GENERATED_HEADERS += $${GUI_WRAPPER_DIR}/$${name}.h } RESOURCES += \ @@ -420,6 +421,46 @@ OTHER_FILES += \ Resources/Images/searchSize.png \ Resources/Images/splashscreen.svg +defineReplace(shibokenGui) { + SOURCES += $$GENERATED_SOURCES + HEADERS += $$GENERATED_HEADERS + return("%_wrapper.cpp") +} + +QT_INCLUDEPATH = $$PYTHON_INCLUDEPATH $$PYSIDE_INCLUDEDIR +for(dep, QT) { + QT_INCLUDEPATH += $$eval(QT.$${dep}.includes) + QT_INCLUDEPATH += $$absolute_path($$eval(QT.$${dep}.name), $$PYSIDE_INCLUDEDIR) +} + +equals(QT_MAJOR_VERSION, 5) { + PYGUI_HEADER = PySide2_Gui_Python.h + POST_SHIBOKEN = bash $$shell_path($$PWD/../tools/utils/runPostShiboken2.sh) +} else:equals(QT_MAJOR_VERSION, 4) { + PYGUI_HEADER = Pyside_Gui_Python.h + POST_SHIBOKEN = bash $$shell_path($$PWD/../tools/utils/runPostShiboken.sh) +} + + +SRC_PATH = $$relative_path($$PWD, $$OUT_PWD)/ +DEP_GROUP = $$PYGUI_HEADER typesystem_natronGui.xml $$HEADERS +guisbk.input = $$PYGUI_HEADER typesystem_natronGui.xml +guisbk.depends = $$eval($$list($$join(DEP_GROUP, " "$$SRC_PATH, $$SRC_PATH))) +guisbk.target = guisbk +guisbk.commands = cd $$PWD && $$SHIBOKEN \ + --enable-parent-ctor-heuristic --use-isnull-as-nb_nonzero \ + --avoid-protected-hack --enable-pyside-extensions \ + -I.:..:../Global:../Engine:../libs/OpenFX/include $$join(QT_INCLUDEPATH, ":", "-I") \ + -T../Engine:$$TYPESYSTEMPATH --output-directory=$$OUT_PWD/Qt$$QT_MAJOR_VERSION \ + $$PYGUI_HEADER typesystem_natronGui.xml && \ + $$POST_SHIBOKEN $$OUT_PWD/Qt$$QT_MAJOR_VERSION/NatronGui natrongui +pygui.depends = guisbk +pygui.target = $$shell_path($$GUI_WRAPPER_DIR/%_wrapper.cpp) +pygui.output_function = shibokenGui +pygui.commands = bash -c 'true' + +QMAKE_EXTRA_TARGETS += guisbk pygui + macx { HEADERS += TaskBarMac.h OBJECTIVE_SOURCES += \ diff --git a/global.pri b/global.pri index 78a2cbb21a..c8b9cd2081 100644 --- a/global.pri +++ b/global.pri @@ -33,6 +33,8 @@ DEFINES += OFX_SUPPORTS_DIALOG #for QString(const char*) assumes ASCII strings, we may run into troubles DEFINES += QT_NO_CAST_FROM_ASCII +greaterThan(QT_MAJOR_VERSION, 4): CONFIG += python3 + # To run Natron without Python functionnalities (for debug purposes) run-without-python { message("Natron will run (not build) without Python") @@ -402,17 +404,21 @@ win32-g++ { cairo: PKGCONFIG += cairo fontconfig equals(QT_MAJOR_VERSION, 5) { shiboken: INCLUDEPATH += $$PYTHON_SITE_PACKAGES/PySide2/include/shiboken2 + shiboken: SHIBOKEN = $$system(pkg-config --variable=generator_location shiboken2) pyside: INCLUDEPATH += $$PYTHON_SITE_PACKAGES/PySide2/include/PySide2 pyside: INCLUDEPATH += $$PYTHON_SITE_PACKAGES/PySide2/include/PySide2/QtCore pyside: INCLUDEPATH += $$PYTHON_SITE_PACKAGES/PySide2/include/PySide2/QtGui pyside: INCLUDEPATH += $$PYTHON_SITE_PACKAGES/PySide2/include/PySide2/QtWidgets + pyside: TYPESYSTEMPATH *= $$system(pkg-config --variable=typesystemdir pyside2) } equals(QT_MAJOR_VERSION, 4) { shiboken: PKGCONFIG += shiboken-py$$PYV + shiboken: SHIBOKEN = $$system(pkg-config --variable=generator_location shiboken) pyside: PKGCONFIG += pyside-py$$PYV PYSIDE_INCLUDEDIR = $$system(pkg-config --variable=includedir pyside-py$$PYV) pyside: INCLUDEPATH += $$PYSIDE_INCLUDEDIR/QtCore pyside: INCLUDEPATH += $$PYSIDE_INCLUDEDIR/QtGui + pyside: TYPESYSTEMPATH *= $$system(pkg-config --variable=typesystemdir pyside) } python: PKGCONFIG += python-$$PYVER$$PY_PKG_SUFFIX boost: LIBS += -lboost_serialization-mt @@ -454,12 +460,14 @@ unix { equals(QT_MAJOR_VERSION, 5) { system(pkg-config --exists pyside2) { shiboken: PKGCONFIG += shiboken2 + shiboken: SHIBOKEN = $$system(pkg-config --variable=generator_location shiboken2) pyside: PKGCONFIG += pyside2 # add QtCore to includes PYSIDE_INCLUDEDIR = $$system(pkg-config --variable=includedir pyside2) pyside: INCLUDEPATH += $$PYSIDE_INCLUDEDIR/QtCore pyside: INCLUDEPATH += $$PYSIDE_INCLUDEDIR/QtGui pyside: INCLUDEPATH += $$PYSIDE_INCLUDEDIR/QtWidgets + pyside: TYPESYSTEMPATH *= $$system(pkg-config --variable=typesystemdir pyside2) } } @@ -469,7 +477,9 @@ unix { # See for example tools/travis/install_dependencies.sh for a solution that works on Linux, # using a custom config.pri shiboken: PKGCONFIG += shiboken + shiboken: SHIBOKEN = $$system(pkg-config --variable=generator_location shiboken) pyside: PKGCONFIG += pyside + pyside: TYPESYSTEMPATH *= $$system(pkg-config --variable=typesystemdir pyside) # The following hack also works with Homebrew if pyside is installed with option --with-python3 macx { QMAKE_LFLAGS += '-Wl,-rpath,\'@loader_path/../Frameworks\'' diff --git a/tools/utils/runPostShiboken.sh b/tools/utils/runPostShiboken.sh old mode 100755 new mode 100644 index 11f3e59874..aeb848e675 --- a/tools/utils/runPostShiboken.sh +++ b/tools/utils/runPostShiboken.sh @@ -20,23 +20,30 @@ # exit if a command returns an error status set -e +wrapper_dir=$1 +wrapper_name=$2 +wrapper_source=${wrapper_name}_module_wrapper.cpp +wrapper_header=${wrapper_name}_python.h + # PySide version override, add 2 for Qt5/PySide2 -PYV="$1" +PYV="$PYV" # To be run after shiboken to fix errors -sed -e '//d' -i'.bak' Engine/NatronEngine/*.cpp -sed -e '//d' -i'.bak' Gui/NatronGui/*.cpp -sed -e "/SbkPySide${PYV}_QtCoreTypes;/d" -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e "/SbkPySide${PYV}_QtCoreTypeConverters;/d" -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e '/SbkNatronEngineTypes;/d' -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Engine/NatronEngine/*.cpp -sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Gui/NatronGui/*.cpp -sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Engine/NatronEngine/*.cpp -sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Gui/NatronGui/*.cpp - +sed -e '//d' -i'.bak' $wrapper_dir/*.cpp +sed -e '//d' -i'.bak' $wrapper_dir/*.cpp +sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' $wrapper_dir/*.cpp +sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' $wrapper_dir/*.cpp +sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' $wrapper_dir/*.cpp +sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' $wrapper_dir/*.cpp +if [ $wrapper_name = "natrongui" ]; then + $SED -e "/SbkPySide${PYV}_QtCoreTypes;/d" -i'.bak' $wrapper_dir/$wrapper_source + $SED -e "/SbkPySide${PYV}_QtCoreTypeConverters;/d" -i'.bak' $wrapper_dir/$wrapper_source + $SED -e '/SbkNatronEngineTypes;/d' -i'.bak' $wrapper_dir/$wrapper_source + $SED -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' $wrapper_dir/$wrapper_source + $SED -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' $wrapper_dir/$wrapper_source +fi + # fix warnings sed -e 's@^#include $@#include "Global/Macros.h"\ CLANG_DIAG_OFF(mismatched-tags)\ @@ -45,32 +52,32 @@ GCC_DIAG_OFF(missing-field-initializers)\ GCC_DIAG_OFF(missing-declarations)\ GCC_DIAG_OFF(uninitialized)\ GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF\ -#include // produces many warnings@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp +#include // produces many warnings@' -i'.bak' $wrapper_dir/*.cpp sed -e 's@// Extra includes@// Extra includes\ -NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp +NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' $wrapper_dir/*.cpp # replace NATRON_NAMESPACE with Natron for enums with flags (e.g. StandardButtonEnum) -sed -e 's@"NatronEngine\.NATRON_NAMESPACE@"NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' Engine/NatronEngine/*_wrapper.cpp +sed -e 's@"NatronEngine\.NATRON_NAMESPACE@"NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' $wrapper_dir/*_wrapper.cpp # re-add the Natron namespace #sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/NatronEngine/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.cpp Gui/NatronGui/*.h -sed -e 's@SbkType< ::@SbkType$@CLANG_DIAG_OFF(header-guard)\ -#include // has wrong header guards in pyside 1.2.2@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp +#include // has wrong header guards in pyside 1.2.2@' -i'.bak' $wrapper_dir/*.cpp sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ CLANG_DIAG_OFF(uninitialized)\ @@ -78,7 +85,7 @@ CLANG_DIAG_OFF(keyword-macro)\ #include // produces warnings\ CLANG_DIAG_ON(deprecated)\ CLANG_DIAG_ON(uninitialized)\ -CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.h +CLANG_DIAG_ON(keyword-macro)@' -i'.bak' $wrapper_dir/*.cpp $wrapper_dir/*.h sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ CLANG_DIAG_OFF(uninitialized)\ @@ -86,7 +93,7 @@ CLANG_DIAG_OFF(keyword-macro)\ #include // produces warnings\ CLANG_DIAG_ON(deprecated)\ CLANG_DIAG_ON(uninitialized)\ -CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.h +CLANG_DIAG_ON(keyword-macro)@' -i'.bak' $wrapper_dir/*.cpp $wrapper_dir/*.h # clean up -rm Gui/NatronGui/*.bak Engine/NatronEngine/*.bak +rm $wrapper_dir/*.bak diff --git a/tools/utils/runPostShiboken2.sh b/tools/utils/runPostShiboken2.sh index 2434c71f58..eea69aad9b 100755 --- a/tools/utils/runPostShiboken2.sh +++ b/tools/utils/runPostShiboken2.sh @@ -20,8 +20,13 @@ # exit if a command returns an error status set -e +wrapper_dir=$1 +wrapper_name=$2 +wrapper_source=${wrapper_name}_module_wrapper.cpp +wrapper_header=${wrapper_name}_python.h + # PySide version override, add 2 for Qt5/PySide2 -PYV="${1:-2}" +PYV="${PYV:-2}" SED=sed if [ `uname` = "Darwin" ]; then @@ -38,17 +43,13 @@ fi # To be run after shiboken to fix errors -$SED -e '//d' -i'.bak' Engine/Qt5/NatronEngine/*.cpp -$SED -e '//d' -i'.bak' Gui/Qt5/NatronGui/*.cpp -$SED -e "/SbkPySide${PYV}_QtCoreTypes;/d" -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp -$SED -e "/SbkPySide${PYV}_QtCoreTypeConverters;/d" -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp -$SED -e '/SbkNatronEngineTypes;/d' -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp -$SED -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp -$SED -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp -$SED -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Engine/Qt5/NatronEngine/*.cpp -$SED -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Gui/Qt5/NatronGui/*.cpp -$SED -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Engine/Qt5/NatronEngine/*.cpp -$SED -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Gui/Qt5/NatronGui/*.cpp +if [ $wrapper_name = "natrongui" ]; then + $SED -e "/SbkPySide${PYV}_QtCoreTypes;/d" -i'.bak' $wrapper_dir/$wrapper_source + $SED -e "/SbkPySide${PYV}_QtCoreTypeConverters;/d" -i'.bak' $wrapper_dir/$wrapper_source + $SED -e '/SbkNatronEngineTypes;/d' -i'.bak' $wrapper_dir/$wrapper_source + $SED -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' $wrapper_dir/$wrapper_source + $SED -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' $wrapper_dir/$wrapper_source +fi # fix warnings $SED -e 's@^#include $@#include "Global/Macros.h"\ @@ -59,31 +60,30 @@ GCC_DIAG_OFF(missing-declarations)\ GCC_DIAG_OFF(uninitialized)\ GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF\ #include \ -#include // produces many warnings@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp +#include // produces many warnings@' -i'.bak' $wrapper_dir/*.cpp $SED -e 's@// inner classes@// inner classes\ -NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp +NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' $wrapper_dir/*.cpp $SED -e 's@// Extra includes@// Extra includes\ -NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/Qt5/NatronEngine/natronengine_module_wrapper.cpp Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp +NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' $wrapper_dir/$wrapper_source # replace NATRON_NAMESPACE with Natron for enums with flags (e.g. StandardButtonEnum) -$SED -e 's@"1:NatronEngine\.NATRON_NAMESPACE@"1:NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"1:NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' Engine/Qt5/NatronEngine/*_wrapper.cpp +$SED -e 's@"1:NatronEngine\.NATRON_NAMESPACE@"1:NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"1:NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' $wrapper_dir/*_wrapper.cpp # re-add the Natron namespace #sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Engine/Qt5/NatronEngine/*.h Gui/Qt5/NatronGui/*.cpp Gui/Qt5/NatronGui/*.h -# sed -e 's@SbkType< ::\(\(QFlags<\)\?Natron::.*\) >@SbkType< \1 >@g' -i Engine/Qt5/NatronEngine/natronengine_python.h -$SED -e 's@SbkType< ::@SbkType$@CLANG_DIAG_OFF(header-guard)\ -#include // has wrong header guards in pyside 1.2.2@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp +#include // has wrong header guards in pyside 1.2.2@' -i'.bak' $wrapper_dir/*.cpp $SED -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ CLANG_DIAG_OFF(uninitialized)\ @@ -91,7 +91,7 @@ CLANG_DIAG_OFF(keyword-macro)\ #include // produces warnings\ CLANG_DIAG_ON(deprecated)\ CLANG_DIAG_ON(uninitialized)\ -CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp Engine/Qt5/NatronEngine/*.h Gui/Qt5/NatronGui/*.h +CLANG_DIAG_ON(keyword-macro)@' -i'.bak' $wrapper_dir/*.cpp $wrapper_dir/*.h $SED -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ CLANG_DIAG_OFF(uninitialized)\ @@ -99,7 +99,7 @@ CLANG_DIAG_OFF(keyword-macro)\ #include // produces warnings\ CLANG_DIAG_ON(deprecated)\ CLANG_DIAG_ON(uninitialized)\ -CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp Engine/Qt5/NatronEngine/*.h Gui/Qt5/NatronGui/*.h +CLANG_DIAG_ON(keyword-macro)@' -i'.bak' $wrapper_dir/*.cpp $wrapper_dir/*.h # clean up -rm Gui/Qt5/NatronGui/*.bak Engine/Qt5/NatronEngine/*.bak +rm $wrapper_dir/*.bak