Skip to content

Commit 8f54ccd

Browse files
Adapt Shiboken generation for Qt6
1 parent 24fc376 commit 8f54ccd

13 files changed

+148
-262
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ if(NATRON_QT6)
7373
find_package(Shiboken6Tools 6.3 CONFIG REQUIRED COMPONENTS shiboken6)
7474
find_package(PySide6 6.3 CONFIG REQUIRED COMPONENTS pyside6)
7575
set(QT_VERSION_MAJOR 6)
76+
set(PYSIDE_VERSION_MAJOR 6)
7677

7778
get_target_property(PYSIDE_INCLUDE_DIRS PySide6::pyside6 INTERFACE_INCLUDE_DIRECTORIES)
7879
set(QTCORE_INCLUDE_DIRS ${Qt6Core_INCLUDE_DIRS})
@@ -88,6 +89,7 @@ else()
8889

8990
find_package(PySide2 5.15 CONFIG REQUIRED COMPONENTS pyside2)
9091
set(QT_VERSION_MAJOR 5)
92+
set(PYSIDE_VERSION_MAJOR 2)
9193

9294
get_target_property(PYSIDE_INCLUDE_DIRS PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES)
9395
set(QTCORE_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS})

Engine/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ 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+
set(PYENGINE_HEADER PySide${PYSIDE_VERSION_MAJOR}_Engine_Python.h)
3332

3433
set(shiboken_args
3534
"-std=c++17" "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero"
@@ -43,9 +42,9 @@ execute_process(COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceList.py types
4342
OUTPUT_VARIABLE PyEngine_SOURCES)
4443
set_property(SOURCE ${PyEngine_SOURCES} PROPERTY SKIP_AUTOGEN ON)
4544
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
45+
COMMAND $<TARGET_FILE:${SHIBOKEN_EXE}> ${shiboken_args}
46+
COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceCleanup.py typesystem_engine.xml ${PYENGINE_OUT}
47+
DEPENDS ${SHIBOKEN_EXE} ${PYENGINE_HEADER} ${NatronEngine_HEADERS} ../tools/utils/sourceCleanup.py typesystem_engine.xml
4948
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
5049

5150
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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ 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)
31+
set(PYGUI_HEADER PySide${PYSIDE_VERSION_MAJOR}_Gui_Python.h)
3332

3433
if(NATRON_QT6)
3534
set(QT_OPENGLWIDGETS Qt::OpenGLWidgets)
@@ -47,9 +46,9 @@ execute_process(COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceList.py types
4746
OUTPUT_VARIABLE PyGui_SOURCES)
4847
set_property(SOURCE ${PyGui_SOURCES} PROPERTY SKIP_AUTOGEN ON)
4948
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
49+
COMMAND $<TARGET_FILE:${SHIBOKEN_EXE}> ${shiboken_args}
50+
COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceCleanup.py typesystem_natronGui.xml ${PYGUI_OUT}
51+
DEPENDS ${SHIBOKEN_EXE} ${PYGUI_HEADER} NatronEngine ${NatronGui_HEADERS} ../tools/utils/sourceCleanup.py typesystem_natronGui.xml
5352
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
5453

5554
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)