Skip to content

Commit 1783af7

Browse files
Adapt Shiboken generation for Qt6
1 parent 24fc376 commit 1783af7

12 files changed

+153
-262
lines changed

Engine/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ set(PYENGINE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Qt${QT_VERSION_MAJOR})
2828
set(PYENGINE_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIRS} ${PYSIDE_INCLUDE_DIRS}/QtCore)
2929
list(APPEND PYENGINE_INCLUDE_DIRS ${QTCORE_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
3030
list(TRANSFORM PYENGINE_INCLUDE_DIRS PREPEND "-I" OUTPUT_VARIABLE PYENGINE_INCS)
31-
set(PYENGINE_HEADER PySide2_Engine_Python.h)
32-
set(POST_SHIBOKEN ../tools/utils/runPostShiboken2.sh)
31+
32+
if(NATRON_QT6)
33+
set(PYENGINE_HEADER PySide6_Engine_Python.h)
34+
else()
35+
set(PYENGINE_HEADER PySide2_Engine_Python.h)
36+
endif()
3337

3438
set(shiboken_args
3539
"-std=c++17" "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero"
@@ -43,9 +47,9 @@ execute_process(COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceList.py types
4347
OUTPUT_VARIABLE PyEngine_SOURCES)
4448
set_property(SOURCE ${PyEngine_SOURCES} PROPERTY SKIP_AUTOGEN ON)
4549
add_custom_command(OUTPUT ${PyEngine_SOURCES}
46-
COMMAND Shiboken2::shiboken2 ${shiboken_args}
47-
COMMAND bash ${POST_SHIBOKEN} ${PYENGINE_OUT}/NatronEngine natronengine
48-
DEPENDS ${PYENGINE_HEADER} ${NatronEngine_HEADERS} ${POST_SHIBOKEN} typesystem_engine.xml
50+
COMMAND $<TARGET_FILE:${SHIBOKEN_EXE}> ${shiboken_args}
51+
COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceCleanup.py typesystem_engine.xml ${PYENGINE_OUT}
52+
DEPENDS ${SHIBOKEN_EXE} ${PYENGINE_HEADER} ${NatronEngine_HEADERS} ../tools/utils/sourceCleanup.py typesystem_engine.xml
4953
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
5054

5155
if(UNIX AND NOT APPLE)

Engine/PySide6_Engine_Python.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* ***** BEGIN LICENSE BLOCK *****
2+
* This file is part of Natron <https://natrongithub.github.io/>,
3+
* (C) 2018-2024 The Natron developers
4+
* (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat
5+
*
6+
* Natron is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation; either version 2 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Natron is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
18+
* ***** END LICENSE BLOCK ***** */
19+
20+
21+
#ifndef PYSIDE6_ENGINE_PYTHON_H
22+
#define PYSIDE6_ENGINE_PYTHON_H
23+
24+
// Defined for shiboken6-specific tweaks
25+
#define SBK6_RUN
26+
27+
#ifndef BOOST_SERIALIZATION_VERSION_HPP
28+
#define BOOST_SERIALIZATION_VERSION_HPP
29+
#define BOOST_CLASS_VERSION(T, N)
30+
#endif /* BOOST_SERIALIZATION_VERSION_HPP */
31+
32+
#ifndef BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
33+
#define BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
34+
#define BOOST_SERIALIZATION_SPLIT_MEMBER()
35+
#endif /* BOOST_SERIALIZATION_SPLIT_MEMBER_HPP */
36+
37+
#include "Pyside_Engine_Python.h"
38+
39+
#endif // PYSIDE6_ENGINE_PYTHON_H

Engine/Pyside_Engine_Python.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#ifdef SBK2_RUN
4040
#include <pyside2_global.h>
4141
#else
42-
#include <pyside_global.h>
42+
#include <pyside6_global.h>
4343
#endif
4444
#include <string>
4545
//Global

Engine/typesystem_engine.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,10 @@
18561856
</modify-function>
18571857
</object-type>
18581858

1859+
<inject-code class="target" position="declaration">
1860+
NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING
1861+
</inject-code>
1862+
18591863

18601864
</typesystem>
18611865

Gui/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ list(APPEND PYGUI_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIRS} ${PYSIDE_INCLUDE_DIRS}/QtC
2828
list(APPEND PYGUI_INCLUDE_DIRS ${QTCORE_INCLUDE_DIRS} ${QTGUI_INCLUDE_DIRS}
2929
${QTWIDGETS_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
3030
list(TRANSFORM PYGUI_INCLUDE_DIRS PREPEND "-I" OUTPUT_VARIABLE PYGUI_INCS)
31-
set(PYGUI_HEADER PySide2_Gui_Python.h)
32-
set(POST_SHIBOKEN ../tools/utils/runPostShiboken2.sh)
3331

3432
if(NATRON_QT6)
3533
set(QT_OPENGLWIDGETS Qt::OpenGLWidgets)
34+
set(PYGUI_HEADER PySide6_Gui_Python.h)
35+
else()
36+
set(PYGUI_HEADER PySide2_Gui_Python.h)
3637
endif()
3738

3839
set(shiboken_args
@@ -47,9 +48,9 @@ execute_process(COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceList.py types
4748
OUTPUT_VARIABLE PyGui_SOURCES)
4849
set_property(SOURCE ${PyGui_SOURCES} PROPERTY SKIP_AUTOGEN ON)
4950
add_custom_command(OUTPUT ${PyGui_SOURCES}
50-
COMMAND Shiboken2::shiboken2 ${shiboken_args}
51-
COMMAND bash ${POST_SHIBOKEN} ${PYGUI_OUT}/NatronGui natrongui
52-
DEPENDS ${PYGUI_HEADER} ${NatronEngine_HEADERS} ${NatronGui_HEADERS} ${POST_SHIBOKEN} typesystem_natronGui.xml
51+
COMMAND $<TARGET_FILE:${SHIBOKEN_EXE}> ${shiboken_args}
52+
COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceCleanup.py typesystem_natronGui.xml ${PYGUI_OUT}
53+
DEPENDS ${SHIBOKEN_EXE} ${PYGUI_HEADER} NatronEngine ${NatronGui_HEADERS} ../tools/utils/sourceCleanup.py typesystem_natronGui.xml
5354
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
5455

5556
if(APPLE)

Gui/PySide6_Gui_Python.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* ***** BEGIN LICENSE BLOCK *****
2+
* This file is part of Natron <https://natrongithub.github.io/>,
3+
* (C) 2018-2024 The Natron developers
4+
* (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat
5+
*
6+
* Natron is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation; either version 2 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Natron is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
18+
* ***** END LICENSE BLOCK ***** */
19+
20+
21+
#ifndef PYSIDE6_GUI_PYTHON_H
22+
#define PYSIDE6_GUI_PYTHON_H
23+
24+
// Defined for shiboken6-specific tweaks
25+
#define SBK6_RUN
26+
27+
#ifndef BOOST_SERIALIZATION_VERSION_HPP
28+
#define BOOST_SERIALIZATION_VERSION_HPP
29+
#define BOOST_CLASS_VERSION(T, N)
30+
#endif /* BOOST_SERIALIZATION_VERSION_HPP */
31+
32+
#ifndef BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
33+
#define BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
34+
#define BOOST_SERIALIZATION_SPLIT_MEMBER()
35+
#endif /* BOOST_SERIALIZATION_SPLIT_MEMBER_HPP */
36+
37+
#include "Pyside_Gui_Python.h"
38+
39+
#endif // PYSIDE6_GUI_PYTHON_H

Gui/Pyside_Gui_Python.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#ifdef SBK2_RUN
3535
#include <pyside2_global.h>
3636
#else
37-
#include <pyside_global.h>
37+
#include <pyside6_global.h>
3838
#endif
3939

4040
#include <QSize>

Gui/typesystem_natronGui.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,8 @@
211211
</inject-code>
212212
</modify-function>
213213
</object-type>
214+
215+
<inject-code class="target" position="declaration">
216+
NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING
217+
</inject-code>
214218
</typesystem>

tools/utils/runPostShiboken.bat

Lines changed: 0 additions & 31 deletions
This file was deleted.

tools/utils/runPostShiboken.sh

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)