aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-02 09:52:19 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-02 11:03:05 +0000
commit4544a943ca2df4e6f0ac24914f0c0f844dc6f748 (patch)
tree140904c3265894dbdd3ed7f864cbdb2ddc04a7c9 /examples
parent559c56b140410bcfa0ce6f19b47d1ba0daa9a201 (diff)
Binding Example helpers: Remove version numbers
- Rename the scripts - Introduce variables for the versions in pyside_config.py Change-Id: I1dcb8ca7eee259f25af0db7c09abd30484c7e99c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/samplebinding/CMakeLists.txt26
-rw-r--r--examples/samplebinding/README.md16
-rw-r--r--examples/scriptableapplication/CMakeLists.txt52
-rw-r--r--examples/scriptableapplication/README.md31
-rw-r--r--examples/scriptableapplication/pyside.pri52
-rw-r--r--examples/scriptableapplication/pyside2.pri52
-rw-r--r--examples/scriptableapplication/scriptableapplication.pro14
-rw-r--r--examples/utils/pyside_config.py (renamed from examples/utils/pyside2_config.py)132
-rw-r--r--examples/widgetbinding/CMakeLists.txt52
-rw-r--r--examples/widgetbinding/README.md2
10 files changed, 219 insertions, 210 deletions
diff --git a/examples/samplebinding/CMakeLists.txt b/examples/samplebinding/CMakeLists.txt
index aefc775fe..fcad47b28 100644
--- a/examples/samplebinding/CMakeLists.txt
+++ b/examples/samplebinding/CMakeLists.txt
@@ -47,8 +47,8 @@ endif()
message(STATUS "Using python interpreter: ${python_interpreter}")
# Macro to get various pyside / python include / link flags and paths.
-# Uses the not entirely supported utils/pyside2_config.py file.
-macro(pyside2_config option output_var)
+# Uses the not entirely supported utils/pyside_config.py file.
+macro(pyside_config option output_var)
if(${ARGC} GREATER 2)
set(is_list ${ARGV2})
else()
@@ -56,13 +56,13 @@ macro(pyside2_config option output_var)
endif()
execute_process(
- COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside2_config.py"
+ COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside_config.py"
${option}
OUTPUT_VARIABLE ${output_var}
OUTPUT_STRIP_TRAILING_WHITESPACE)
if ("${${output_var}}" STREQUAL "")
- message(FATAL_ERROR "Error: Calling pyside2_config.py ${option} returned no output.")
+ message(FATAL_ERROR "Error: Calling pyside_config.py ${option} returned no output.")
endif()
if(is_list)
string (REPLACE " " ";" ${output_var} "${${output_var}}")
@@ -70,14 +70,14 @@ macro(pyside2_config option output_var)
endmacro()
# Query for the shiboken generator path, Python path, include paths and linker flags.
-pyside2_config(--shiboken6-module-path shiboken6_module_path)
-pyside2_config(--shiboken6-generator-path shiboken6_generator_path)
-pyside2_config(--python-include-path python_include_dir)
-pyside2_config(--shiboken6-generator-include-path shiboken_include_dir 1)
-pyside2_config(--shiboken6-module-shared-libraries-cmake shiboken_shared_libraries 0)
-pyside2_config(--python-link-flags-cmake python_linking_data 0)
-
-set(shiboken_path "${shiboken6_generator_path}/shiboken6${CMAKE_EXECUTABLE_SUFFIX}")
+pyside_config(--shiboken-module-path shiboken_module_path)
+pyside_config(--shiboken-generator-path shiboken_generator_path)
+pyside_config(--python-include-path python_include_dir)
+pyside_config(--shiboken-generator-include-path shiboken_include_dir 1)
+pyside_config(--shiboken-module-shared-libraries-cmake shiboken_shared_libraries 0)
+pyside_config(--python-link-flags-cmake python_linking_data 0)
+
+set(shiboken_path "${shiboken_generator_path}/shiboken6${CMAKE_EXECUTABLE_SUFFIX}")
if(NOT EXISTS ${shiboken_path})
message(FATAL_ERROR "Shiboken executable not found at path: ${shiboken_path}")
endif()
@@ -93,7 +93,7 @@ endif()
# Enable rpaths so that the built shared libraries find their dependencies.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-set(CMAKE_INSTALL_RPATH ${shiboken6_module_path} ${CMAKE_CURRENT_SOURCE_DIR})
+set(CMAKE_INSTALL_RPATH ${shiboken_module_path} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# =============================================================================================
# !!! End of dubious section.
diff --git a/examples/samplebinding/README.md b/examples/samplebinding/README.md
index 34f3568f2..93d56f5bd 100644
--- a/examples/samplebinding/README.md
+++ b/examples/samplebinding/README.md
@@ -127,7 +127,7 @@ rules for those interested in the build process.
This example can only be built using **CMake**.
The following requirements need to be met:
-* A PySide2 package is installed into the current active Python
+* A PySide package is installed into the current active Python
environment (system or virtualenv)
* A new enough version of CMake (**3.1+**).
@@ -138,8 +138,8 @@ For Windows you will also need:
configuration is the same (all Release, which is more likely,
or all Debug).
-The build uses the `pyside2_config.py` file to configure the project
-using the current PySide2/Shiboken6 installation.
+The build uses the `pyside_config.py` file to configure the project
+using the current PySide/Shiboken installation.
### Using CMake
@@ -215,18 +215,18 @@ no clean solution to include symbolic links in a wheel package
## Windows Notes
The build config of the bindings (Debug or Release) should match
-the PySide2 build config, otherwise the application will not properly
+the PySide build config, otherwise the application will not properly
work.
In practice this means the only supported configurations are:
1. release config build of the bindings +
- PySide2 `setup.py` without `--debug` flag + `python.exe` for the
- PySide2 build process + `python36.dll` for the linked in shared
+ PySide `setup.py` without `--debug` flag + `python.exe` for the
+ PySide build process + `python36.dll` for the linked in shared
library.
2. debug config build of the application +
- PySide2 `setup.py` **with** `--debug` flag + `python_d.exe` for the
- PySide2 build process + `python36_d.dll` for the linked in shared
+ PySide `setup.py` **with** `--debug` flag + `python_d.exe` for the
+ PySide build process + `python36_d.dll` for the linked in shared
library.
This is necessary because all the shared libraries in question have to
diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt
index 2ccb9897d..63a4afd35 100644
--- a/examples/scriptableapplication/CMakeLists.txt
+++ b/examples/scriptableapplication/CMakeLists.txt
@@ -23,7 +23,7 @@ endif()
message(STATUS "Using python interpreter: ${python_interpreter}")
# Macro to get various pyside / python include / link flags.
-macro(pyside2_config option output_var)
+macro(pyside_config option output_var)
if(${ARGC} GREATER 2)
set(is_list ${ARGV2})
else()
@@ -31,13 +31,13 @@ macro(pyside2_config option output_var)
endif()
execute_process(
- COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside2_config.py"
+ COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside_config.py"
${option}
OUTPUT_VARIABLE ${output_var}
OUTPUT_STRIP_TRAILING_WHITESPACE)
if ("${${output_var}}" STREQUAL "")
- message(FATAL_ERROR "Error: Calling pyside2_config.py ${option} returned no output.")
+ message(FATAL_ERROR "Error: Calling pyside_config.py ${option} returned no output.")
endif()
if(is_list)
string (REPLACE " " ";" ${output_var} "${${output_var}}")
@@ -45,19 +45,19 @@ macro(pyside2_config option output_var)
endmacro()
# Query for the shiboken6-generator path, PySide2 path, Python path, include paths and linker flags.
-pyside2_config(--shiboken6-module-path SHIBOKEN6_MODULE_PATH)
-pyside2_config(--shiboken6-generator-path SHIBOKEN6_GENERATOR_PATH)
-pyside2_config(--pyside2-path PYSIDE2_PATH)
+pyside_config(--shiboken-module-path SHIBOKEN_MODULE_PATH)
+pyside_config(--shiboken-generator-path SHIBOKEN_GENERATOR_PATH)
+pyside_config(--pyside-path PYSIDE_PATH)
-pyside2_config(--python-include-path PYTHON_INCLUDE_DIR)
-pyside2_config(--shiboken6-generator-include-path SHIBOKEN6_GENERATOR_INCLUDE_DIR 1)
-pyside2_config(--pyside2-include-path PYSIDE2_INCLUDE_DIR 1)
+pyside_config(--python-include-path PYTHON_INCLUDE_DIR)
+pyside_config(--shiboken-generator-include-path SHIBOKEN_GENERATOR_INCLUDE_DIR 1)
+pyside_config(--pyside-include-path PYSIDE_INCLUDE_DIR 1)
-pyside2_config(--python-link-flags-cmake PYTHON_LINKING_DATA 0)
-pyside2_config(--shiboken6-module-shared-libraries-cmake SHIBOKEN6_MODULE_SHARED_LIBRARIES 0)
-pyside2_config(--pyside2-shared-libraries-cmake PYSIDE2_SHARED_LIBRARIES 0)
+pyside_config(--python-link-flags-cmake PYTHON_LINKING_DATA 0)
+pyside_config(--shiboken-module-shared-libraries-cmake SHIBOKEN_MODULE_SHARED_LIBRARIES 0)
+pyside_config(--pyside-shared-libraries-cmake PYSIDE_SHARED_LIBRARIES 0)
-set(SHIBOKEN_PATH "${SHIBOKEN6_GENERATOR_PATH}/shiboken6${CMAKE_EXECUTABLE_SUFFIX}")
+set(SHIBOKEN_PATH "${SHIBOKEN_GENERATOR_PATH}/shiboken6${CMAKE_EXECUTABLE_SUFFIX}")
if(NOT EXISTS ${SHIBOKEN_PATH})
message(FATAL_ERROR "Shiboken executable not found at path: ${SHIBOKEN_PATH}")
@@ -93,7 +93,7 @@ set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic
${INCLUDES}
-I${CMAKE_SOURCE_DIR}
-T${CMAKE_SOURCE_DIR}
- -T${PYSIDE2_PATH}/typesystems
+ -T${PYSIDE_PATH}/typesystems
--output-directory=${CMAKE_CURRENT_BINARY_DIR}
)
@@ -123,11 +123,11 @@ set(SOURCES
)
# We need to include the headers for the module bindings that we use.
-set(PYSIDE2_ADDITIONAL_INCLUDES "")
-foreach(INCLUDE_DIR ${PYSIDE2_INCLUDE_DIR})
- list(APPEND PYSIDE2_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtCore")
- list(APPEND PYSIDE2_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtGui")
- list(APPEND PYSIDE2_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtWidgets")
+set(PYSIDE_ADDITIONAL_INCLUDES "")
+foreach(INCLUDE_DIR ${PYSIDE_INCLUDE_DIR})
+ list(APPEND PYSIDE_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtCore")
+ list(APPEND PYSIDE_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtGui")
+ list(APPEND PYSIDE_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtWidgets")
endforeach()
# =============================================================================================
@@ -137,7 +137,7 @@ endforeach()
# Enable rpaths so that the example can be executed from the build dir.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-set(CMAKE_INSTALL_RPATH ${PYSIDE2_PATH} ${SHIBOKEN6_MODULE_PATH})
+set(CMAKE_INSTALL_RPATH ${PYSIDE_PATH} ${SHIBOKEN_MODULE_PATH})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# =============================================================================================
# !!! End of dubious section.
@@ -154,14 +154,14 @@ target_sources(${PROJECT_NAME} PUBLIC ${SOURCES})
# Apply relevant include and link flags.
target_include_directories(${PROJECT_NAME} PRIVATE ${PYTHON_INCLUDE_DIR})
-target_include_directories(${PROJECT_NAME} PRIVATE ${SHIBOKEN6_GENERATOR_INCLUDE_DIR})
-target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE2_INCLUDE_DIR})
-target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE2_ADDITIONAL_INCLUDES})
+target_include_directories(${PROJECT_NAME} PRIVATE ${SHIBOKEN_GENERATOR_INCLUDE_DIR})
+target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE_INCLUDE_DIR})
+target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE_ADDITIONAL_INCLUDES})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets)
-target_link_libraries(${PROJECT_NAME} PRIVATE ${SHIBOKEN6_MODULE_SHARED_LIBRARIES})
-target_link_libraries(${PROJECT_NAME} PRIVATE ${PYSIDE2_SHARED_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} PRIVATE ${SHIBOKEN_MODULE_SHARED_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} PRIVATE ${PYSIDE_SHARED_LIBRARIES})
# Find and link to the python library.
list(GET PYTHON_LINKING_DATA 0 PYTHON_LIBDIR)
@@ -193,7 +193,7 @@ if(WIN32)
# Add custom target to hard link PySide2 shared libraries (just like in qmake example), so you
# don't have to set PATH manually to point to the PySide2 package.
- set(shared_libraries ${SHIBOKEN6_MODULE_SHARED_LIBRARIES} ${PYSIDE2_SHARED_LIBRARIES})
+ set(shared_libraries ${SHIBOKEN_MODULE_SHARED_LIBRARIES} ${PYSIDE_SHARED_LIBRARIES})
foreach(LIBRARY_PATH ${shared_libraries})
string(REGEX REPLACE ".lib$" ".dll" LIBRARY_PATH ${LIBRARY_PATH})
get_filename_component(BASE_NAME ${LIBRARY_PATH} NAME)
diff --git a/examples/scriptableapplication/README.md b/examples/scriptableapplication/README.md
index c388f61de..908cac36b 100644
--- a/examples/scriptableapplication/README.md
+++ b/examples/scriptableapplication/README.md
@@ -26,31 +26,30 @@ This example can be built using *CMake* or *QMake*,
but there are common requirements that you need to take into
consideration:
-* Make sure that a --standalone PySide2 package (bundled with Qt libraries)
+* Make sure that a --standalone PySide package (bundled with Qt libraries)
is installed into the current active Python environment
(system or virtualenv)
* qmake has to be in your PATH:
- * so that CMake find_package(Qt5) works (used for include headers),
+ * so that CMake find_package(Qt6 COMPONENTS Core) works (used for include
+ headers),
* used for building the application with qmake instead of CMake
* use the same Qt version for building the example application, as was used
- for building PySide2, this is to ensure binary compatibility between the
- newly generated bindings libraries, the PySide2 libraries and the
+ for building PySide, this is to ensure binary compatibility between the
+ newly generated bindings libraries, the PySide libraries and the
Qt libraries.
For Windows you will also need:
* a Visual Studio environment to be active in your terminal
* Correct visual studio architecture chosen (32 vs 64 bit)
-* Make sure that your Qt + Python + PySide2 package + app build configuration
+* Make sure that your Qt + Python + PySide package + app build configuration
is the same (all Release, which is more likely, or all Debug).
-* Make sure that your Qt + Python + PySide2 package + app are built with the
+* Make sure that your Qt + Python + PySide package + app are built with the
same version of MSVC, to avoid mixing of C++ runtime libraries.
In principle this means that if you use the python.org provided Python
- interpreters, you need to use MSVC2015 for Python 3 projects, and MSVC2008
- for Python 2 projects. Which also means that you can't use official Qt
- packages, because none of the supported ones are built with MSVC2008.
+ interpreters, you need to use MSVC2015 for Python 3 projects.
-Both build options will use the `pyside2_config.py` file to configure the project
-using the current PySide2/Shiboken6 installation (for qmake via pyside2.pri,
+Both build options will use the `pyside_config.py` file to configure the project
+using the current PySide/Shiboken installation (for qmake via pyside.pri,
and for CMake via the project CMakeLists.txt).
@@ -136,7 +135,7 @@ virtual environment, that environment's packages will be used for the
python module import process.
In this case, make sure that the application was built while the
`virtualenv` was active, so that the build system picks up the correct
-python shared library and PySide2 package.
+python shared library and PySide package.
## Linux Shared Libraries Notes
@@ -155,12 +154,12 @@ work.
In practice this means the only supported configurations are:
1. release config build of the application +
- PySide2 `setup.py` without `--debug` flag + `python.exe` for the
- PySide2 build process + `python36.dll` for the linked in shared
+ PySide `setup.py` without `--debug` flag + `python.exe` for the
+ PySide build process + `python36.dll` for the linked in shared
library + release build of Qt.
2. debug config build of the application +
- PySide2 `setup.py` **with** `--debug` flag + `python_d.exe` for the
- PySide2 build process + `python36_d.dll` for the linked in shared
+ PySide `setup.py` **with** `--debug` flag + `python_d.exe` for the
+ PySide build process + `python36_d.dll` for the linked in shared
library + debug build of Qt.
This is necessary because all the shared libraries in question have to
diff --git a/examples/scriptableapplication/pyside.pri b/examples/scriptableapplication/pyside.pri
new file mode 100644
index 000000000..39c8a674d
--- /dev/null
+++ b/examples/scriptableapplication/pyside.pri
@@ -0,0 +1,52 @@
+PYSIDE_CONFIG = $$PWD/../utils/pyside_config.py
+
+# Use provided python interpreter if given.
+isEmpty(python_interpreter) {
+ python_interpreter = python
+}
+message(Using python interpreter: $$python_interpreter)
+
+SHIBOKEN_GENERATOR = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken-generator-path)
+isEmpty(SHIBOKEN_GENERATOR): error(Unable to locate the shiboken-generator package location)
+
+SHIBOKEN_MODULE = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken-module-path)
+isEmpty(SHIBOKEN_MODULE): error(Unable to locate the shiboken package location)
+
+PYSIDE = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside-path)
+isEmpty(PYSIDE): error(Unable to locate the PySide package location)
+
+PYTHON_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --python-include-path)
+isEmpty(PYTHON_INCLUDE): error(Unable to locate the Python include headers directory)
+
+PYTHON_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --python-link-flags-qmake)
+isEmpty(PYTHON_LFLAGS): error(Unable to locate the Python library for linking)
+
+SHIBOKEN_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken-generator-include-path)
+isEmpty(SHIBOKEN_INCLUDE): error(Unable to locate the shiboken include headers directory)
+
+PYSIDE_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside-include-path)
+isEmpty(PYSIDE_INCLUDE): error(Unable to locate PySide include headers directory)
+
+SHIBOKEN_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken-module-qmake-lflags)
+isEmpty(SHIBOKEN_LFLAGS): error(Unable to locate the shiboken libraries for linking)
+
+PYSIDE_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside-qmake-lflags)
+isEmpty(PYSIDE_LFLAGS): error(Unable to locate the PySide libraries for linking)
+
+SHIBOKEN_SHARED_LIBRARIES = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken-module-shared-libraries-qmake)
+isEmpty(SHIBOKEN_SHARED_LIBRARIES): error(Unable to locate the used shiboken module shared libraries)
+
+PYSIDE_SHARED_LIBRARIES = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside-shared-libraries-qmake)
+isEmpty(PYSIDE_SHARED_LIBRARIES): error(Unable to locate the used PySide shared libraries)
+
+INCLUDEPATH += "$$PYTHON_INCLUDE" $$PYSIDE_INCLUDE $$SHIBOKEN_INCLUDE
+LIBS += $$PYTHON_LFLAGS $$PYSIDE_LFLAGS $$SHIBOKEN_LFLAGS
+!build_pass:message(INCLUDEPATH is $$INCLUDEPATH)
+!build_pass:message(LIBS are $$LIBS)
+
+!build_pass:message(Using $$PYSIDE)
+
+!win32 {
+ !build_pass:message(RPATH will include $$PYSIDE and $$SHIBOKEN_MODULE)
+ QMAKE_RPATHDIR += $$PYSIDE $$SHIBOKEN_MODULE
+}
diff --git a/examples/scriptableapplication/pyside2.pri b/examples/scriptableapplication/pyside2.pri
deleted file mode 100644
index d97ad229a..000000000
--- a/examples/scriptableapplication/pyside2.pri
+++ /dev/null
@@ -1,52 +0,0 @@
-PYSIDE_CONFIG = $$PWD/../utils/pyside2_config.py
-
-# Use provided python interpreter if given.
-isEmpty(python_interpreter) {
- python_interpreter = python
-}
-message(Using python interpreter: $$python_interpreter)
-
-SHIBOKEN6_GENERATOR = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken6-generator-path)
-isEmpty(SHIBOKEN6_GENERATOR): error(Unable to locate the shiboken6-generator package location)
-
-SHIBOKEN6_MODULE = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken6-module-path)
-isEmpty(SHIBOKEN6_MODULE): error(Unable to locate the shiboken6 package location)
-
-PYSIDE2 = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside2-path)
-isEmpty(PYSIDE2): error(Unable to locate the PySide2 package location)
-
-PYTHON_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --python-include-path)
-isEmpty(PYTHON_INCLUDE): error(Unable to locate the Python include headers directory)
-
-PYTHON_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --python-link-flags-qmake)
-isEmpty(PYTHON_LFLAGS): error(Unable to locate the Python library for linking)
-
-SHIBOKEN6_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken6-generator-include-path)
-isEmpty(SHIBOKEN6_INCLUDE): error(Unable to locate the shiboken include headers directory)
-
-PYSIDE2_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside2-include-path)
-isEmpty(PYSIDE2_INCLUDE): error(Unable to locate the PySide2 include headers directory)
-
-SHIBOKEN6_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken6-module-qmake-lflags)
-isEmpty(SHIBOKEN6_LFLAGS): error(Unable to locate the shiboken libraries for linking)
-
-PYSIDE2_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside2-qmake-lflags)
-isEmpty(PYSIDE2_LFLAGS): error(Unable to locate the PySide2 libraries for linking)
-
-SHIBOKEN6_SHARED_LIBRARIES = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken6-module-shared-libraries-qmake)
-isEmpty(SHIBOKEN6_SHARED_LIBRARIES): error(Unable to locate the used shiboken6 module shared libraries)
-
-PYSIDE2_SHARED_LIBRARIES = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside2-shared-libraries-qmake)
-isEmpty(PYSIDE2_SHARED_LIBRARIES): error(Unable to locate the used PySide2 shared libraries)
-
-INCLUDEPATH += "$$PYTHON_INCLUDE" $$PYSIDE2_INCLUDE $$SHIBOKEN6_INCLUDE
-LIBS += $$PYTHON_LFLAGS $$PYSIDE2_LFLAGS $$SHIBOKEN6_LFLAGS
-!build_pass:message(INCLUDEPATH is $$INCLUDEPATH)
-!build_pass:message(LIBS are $$LIBS)
-
-!build_pass:message(Using $$PYSIDE2)
-
-!win32 {
- !build_pass:message(RPATH will include $$PYSIDE2 and $$SHIBOKEN6_MODULE)
- QMAKE_RPATHDIR += $$PYSIDE2 $$SHIBOKEN6_MODULE
-}
diff --git a/examples/scriptableapplication/scriptableapplication.pro b/examples/scriptableapplication/scriptableapplication.pro
index 067d9141f..148a22546 100644
--- a/examples/scriptableapplication/scriptableapplication.pro
+++ b/examples/scriptableapplication/scriptableapplication.pro
@@ -3,7 +3,7 @@ CONFIG += no_keywords # avoid clash with slots in Python.h
CONFIG += console force_debug_info
QT += widgets
-include(pyside2.pri)
+include(pyside.pri)
WRAPPED_HEADER = wrappedclasses.h
WRAPPER_DIR = $$OUT_PWD/AppLib
@@ -17,13 +17,13 @@ qtConfig(framework): QT_INCLUDEPATHS += --framework-include-paths=$$[QT_INSTALL_
SHIBOKEN_OPTIONS = --generator-set=shiboken --enable-parent-ctor-heuristic \
--enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero \
- $$QT_INCLUDEPATHS -I$$PWD -T$$PWD -T$$PYSIDE2/typesystems --output-directory=$$OUT_PWD
+ $$QT_INCLUDEPATHS -I$$PWD -T$$PWD -T$$PYSIDE/typesystems --output-directory=$$OUT_PWD
# MSVC does not honor #define protected public...
win32:SHIBOKEN_OPTIONS += --avoid-protected-hack
# Prepare the shiboken tool
-QT_TOOL.shiboken.binary = $$system_path($$SHIBOKEN6_GENERATOR/shiboken6)
+QT_TOOL.shiboken.binary = $$system_path($$SHIBOKEN_GENERATOR/shiboken6)
qtPrepareTool(SHIBOKEN, shiboken)
# Shiboken run that adds the module wrapper to GENERATED_SOURCES
@@ -51,7 +51,7 @@ defineReplace(getOutDir) {
return($$out_dir)
}
-# Create hardlinks to the PySide2 shared libraries, so the example can be executed without manually
+# Create hardlinks to the PySide shared libraries, so the example can be executed without manually
# setting the PATH.
win32 {
out_dir = $$getOutDir()
@@ -61,7 +61,7 @@ win32 {
hard_link_libraries.CONFIG = no_link target_predeps explicit_dependencies
hard_link_libraries.output = $$out_dir/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
hard_link_libraries.commands = mklink /H $$shell_path($$out_dir/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}) $$shell_path(${QMAKE_FILE_IN})
- hard_link_libraries.input = PYSIDE2_SHARED_LIBRARIES SHIBOKEN6_SHARED_LIBRARIES
+ hard_link_libraries.input = PYSIDE_SHARED_LIBRARIES SHIBOKEN6_SHARED_LIBRARIES
}
QMAKE_EXTRA_COMPILERS += shiboken module_wrapper_dummy_command
@@ -69,7 +69,7 @@ win32:QMAKE_EXTRA_COMPILERS += hard_link_libraries
INCLUDEPATH += $$WRAPPER_DIR
-for(i, PYSIDE2_INCLUDE) {
+for(i, PYSIDE_INCLUDE) {
INCLUDEPATH += $$i/QtWidgets $$i/QtGui $$i/QtCore
}
@@ -82,4 +82,4 @@ HEADERS += \
mainwindow.h \
pythonutils.h
-OTHER_FILES += $$TYPESYSTEM_FILE $$WRAPPED_HEADER pyside2_config.py README.md
+OTHER_FILES += $$TYPESYSTEM_FILE $$WRAPPED_HEADER pyside_config.py README.md
diff --git a/examples/utils/pyside2_config.py b/examples/utils/pyside_config.py
index 135be79d4..da71073a0 100644
--- a/examples/utils/pyside2_config.py
+++ b/examples/utils/pyside_config.py
@@ -38,44 +38,60 @@
##
#############################################################################
-import os, glob, re, sys
from distutils import sysconfig
+from enum import Enum
+import glob
+import os
+import re
+import sys
-generic_error = (' Did you forget to activate your virtualenv? Or perhaps'
- ' you forgot to build / install PySide2 into your currently active Python'
+
+PYSIDE = 'pyside2'
+PYSIDE_MODULE = 'PySide2'
+SHIBOKEN = 'shiboken6'
+
+
+class Package(Enum):
+ SHIBOKEN_MODULE = 1
+ SHIBOKEN_GENERATOR = 2
+ PYSIDE_MODULE = 3
+
+
+generic_error = ('Did you forget to activate your virtualenv? Or perhaps'
+ f' you forgot to build / install {PYSIDE_MODULE} into your currently active Python'
' environment?')
-pyside2_error = 'Unable to locate PySide2.' + generic_error
-shiboken6_module_error = 'Unable to locate shiboken6-module.' + generic_error
-shiboken6_generator_error = 'Unable to locate shiboken6-generator.' + generic_error
-pyside2_libs_error = 'Unable to locate the PySide2 shared libraries.' + generic_error
+pyside_error = f'Unable to locate {PYSIDE_MODULE}. {generic_error}'
+shiboken_module_error = f'Unable to locate {SHIBOKEN}-module. {generic_error}'
+shiboken_generator_error = f'Unable to locate shiboken-generator. {generic_error}'
+pyside_libs_error = f'Unable to locate the PySide shared libraries. {generic_error}'
python_link_error = 'Unable to locate the Python library for linking.'
python_include_error = 'Unable to locate the Python include headers directory.'
options = []
# option, function, error, description
-options.append(("--shiboken6-module-path",
- lambda: find_shiboken6_module(),
- shiboken6_module_error,
- "Print shiboken6 module location"))
-options.append(("--shiboken6-generator-path",
- lambda: find_shiboken6_generator(),
- shiboken6_generator_error,
- "Print shiboken6 generator location"))
-options.append(("--pyside2-path", lambda: find_pyside2(), pyside2_error,
- "Print PySide2 location"))
+options.append(("--shiboken-module-path",
+ lambda: find_shiboken_module(),
+ shiboken_module_error,
+ "Print shiboken module location"))
+options.append(("--shiboken-generator-path",
+ lambda: find_shiboken_generator(),
+ shiboken_generator_error,
+ "Print shiboken generator location"))
+options.append(("--pyside-path", lambda: find_pyside(), pyside_error,
+ f"Print {PYSIDE_MODULE} location"))
options.append(("--python-include-path",
lambda: get_python_include_path(),
python_include_error,
"Print Python include path"))
-options.append(("--shiboken6-generator-include-path",
- lambda: get_package_include_path(Package.shiboken6_generator),
- pyside2_error,
- "Print shiboken6 generator include paths"))
-options.append(("--pyside2-include-path",
- lambda: get_package_include_path(Package.pyside2),
- pyside2_error,
+options.append(("--shiboken-generator-include-path",
+ lambda: get_package_include_path(Package.SHIBOKEN_GENERATOR),
+ pyside_error,
+ "Print shiboken generator include paths"))
+options.append(("--pyside-include-path",
+ lambda: get_package_include_path(Package.PYSIDE_MODULE),
+ pyside_error,
"Print PySide2 include paths"))
options.append(("--python-link-flags-qmake", lambda: python_link_flags_qmake(), python_link_error,
@@ -83,26 +99,26 @@ options.append(("--python-link-flags-qmake", lambda: python_link_flags_qmake(),
options.append(("--python-link-flags-cmake", lambda: python_link_flags_cmake(), python_link_error,
"Print python link flags for cmake"))
-options.append(("--shiboken6-module-qmake-lflags",
- lambda: get_package_qmake_lflags(Package.shiboken6_module), pyside2_error,
+options.append(("--shiboken-module-qmake-lflags",
+ lambda: get_package_qmake_lflags(Package.SHIBOKEN_MODULE), pyside_error,
"Print shiboken6 shared library link flags for qmake"))
-options.append(("--pyside2-qmake-lflags",
- lambda: get_package_qmake_lflags(Package.pyside2), pyside2_error,
+options.append(("--pyside-qmake-lflags",
+ lambda: get_package_qmake_lflags(Package.PYSIDE_MODULE), pyside_error,
"Print PySide2 shared library link flags for qmake"))
-options.append(("--shiboken6-module-shared-libraries-qmake",
- lambda: get_shared_libraries_qmake(Package.shiboken6_module), pyside2_libs_error,
- "Print paths of shiboken6 shared libraries (.so's, .dylib's, .dll's) for qmake"))
-options.append(("--shiboken6-module-shared-libraries-cmake",
- lambda: get_shared_libraries_cmake(Package.shiboken6_module), pyside2_libs_error,
- "Print paths of shiboken6 shared libraries (.so's, .dylib's, .dll's) for cmake"))
+options.append(("--shiboken-module-shared-libraries-qmake",
+ lambda: get_shared_libraries_qmake(Package.SHIBOKEN_MODULE), pyside_libs_error,
+ "Print paths of shiboken shared libraries (.so's, .dylib's, .dll's) for qmake"))
+options.append(("--shiboken-module-shared-libraries-cmake",
+ lambda: get_shared_libraries_cmake(Package.SHIBOKEN_MODULE), pyside_libs_error,
+ "Print paths of shiboken shared libraries (.so's, .dylib's, .dll's) for cmake"))
-options.append(("--pyside2-shared-libraries-qmake",
- lambda: get_shared_libraries_qmake(Package.pyside2), pyside2_libs_error,
- "Print paths of PySide2 shared libraries (.so's, .dylib's, .dll's) for qmake"))
-options.append(("--pyside2-shared-libraries-cmake",
- lambda: get_shared_libraries_cmake(Package.pyside2), pyside2_libs_error,
- "Print paths of PySide2 shared libraries (.so's, .dylib's, .dll's) for cmake"))
+options.append(("--pyside-shared-libraries-qmake",
+ lambda: get_shared_libraries_qmake(Package.PYSIDE_MODULE), pyside_libs_error,
+ "Print paths of f{PYSIDE_MODULE} shared libraries (.so's, .dylib's, .dll's) for qmake"))
+options.append(("--pyside-shared-libraries-cmake",
+ lambda: get_shared_libraries_cmake(Package.PYSIDE_MODULE), pyside_libs_error,
+ f"Print paths of {PYSIDE_MODULE} shared libraries (.so's, .dylib's, .dll's) for cmake"))
options_usage = ''
for i, (flag, _, _, description) in enumerate(options):
@@ -111,10 +127,10 @@ for i, (flag, _, _, description) in enumerate(options):
options_usage += '\n'
usage = """
-Utility to determine include/link options of shiboken6/PySide2 and Python for qmake/CMake projects
-that would like to embed or build custom shiboken6/PySide2 bindings.
+Utility to determine include/link options of shiboken/PySide and Python for qmake/CMake projects
+that would like to embed or build custom shiboken/PySide bindings.
-Usage: pyside2_config.py [option]
+Usage: pyside_config.py [option]
Options:
{}
-a Print all options and their values
@@ -127,12 +143,6 @@ if option == '-h' or option == '--help':
sys.exit(0)
-class Package(object):
- shiboken6_module = 1
- shiboken6_generator = 2
- pyside2 = 3
-
-
def clean_path(path):
return path if sys.platform != 'win32' else path.replace('\\', '/')
@@ -190,25 +200,25 @@ def link_option(lib):
# Locate PySide2 via sys.path package path.
-def find_pyside2():
- return find_package_path("PySide2")
+def find_pyside():
+ return find_package_path(PYSIDE_MODULE)
-def find_shiboken6_module():
- return find_package_path("shiboken6")
+def find_shiboken_module():
+ return find_package_path(SHIBOKEN)
-def find_shiboken6_generator():
- return find_package_path("shiboken6_generator")
+def find_shiboken_generator():
+ return find_package_path(f"{SHIBOKEN}_generator")
def find_package(which_package):
- if which_package == Package.shiboken6_module:
- return find_shiboken6_module()
- if which_package == Package.shiboken6_generator:
- return find_shiboken6_generator()
- if which_package == Package.pyside2:
- return find_pyside2()
+ if which_package == Package.SHIBOKEN_MODULE:
+ return find_shiboken_module()
+ if which_package == Package.SHIBOKEN_GENERATOR:
+ return find_shiboken_generator()
+ if which_package == Package.PYSIDE_MODULE:
+ return find_pyside()
return None
diff --git a/examples/widgetbinding/CMakeLists.txt b/examples/widgetbinding/CMakeLists.txt
index bc43fc154..76f5bd112 100644
--- a/examples/widgetbinding/CMakeLists.txt
+++ b/examples/widgetbinding/CMakeLists.txt
@@ -57,8 +57,8 @@ endif()
message(STATUS "Using python interpreter: ${python_interpreter}")
# Macro to get various pyside / python include / link flags and paths.
-# Uses the not entirely supported utils/pyside2_config.py file.
-macro(pyside2_config option output_var)
+# Uses the not entirely supported utils/pyside_config.py file.
+macro(pyside_config option output_var)
if(${ARGC} GREATER 2)
set(is_list ${ARGV2})
else()
@@ -66,13 +66,13 @@ macro(pyside2_config option output_var)
endif()
execute_process(
- COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside2_config.py"
+ COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside_config.py"
${option}
OUTPUT_VARIABLE ${output_var}
OUTPUT_STRIP_TRAILING_WHITESPACE)
if ("${${output_var}}" STREQUAL "")
- message(FATAL_ERROR "Error: Calling pyside2_config.py ${option} returned no output.")
+ message(FATAL_ERROR "Error: Calling pyside_config.py ${option} returned no output.")
endif()
if(is_list)
string (REPLACE " " ";" ${output_var} "${${output_var}}")
@@ -80,17 +80,17 @@ macro(pyside2_config option output_var)
endmacro()
# Query for the shiboken generator path, Python path, include paths and linker flags.
-pyside2_config(--shiboken6-module-path shiboken6_module_path)
-pyside2_config(--shiboken6-generator-path shiboken6_generator_path)
-pyside2_config(--pyside2-path pyside2_path)
-pyside2_config(--pyside2-include-path pyside2_include_dir 1)
-pyside2_config(--python-include-path python_include_dir)
-pyside2_config(--shiboken6-generator-include-path shiboken_include_dir 1)
-pyside2_config(--shiboken6-module-shared-libraries-cmake shiboken_shared_libraries 0)
-pyside2_config(--python-link-flags-cmake python_linking_data 0)
-pyside2_config(--pyside2-shared-libraries-cmake pyside2_shared_libraries 0)
-
-set(shiboken_path "${shiboken6_generator_path}/shiboken6${CMAKE_EXECUTABLE_SUFFIX}")
+pyside_config(--shiboken-module-path shiboken_module_path)
+pyside_config(--shiboken-generator-path shiboken_generator_path)
+pyside_config(--pyside-path pyside_path)
+pyside_config(--pyside-include-path pyside_include_dir 1)
+pyside_config(--python-include-path python_include_dir)
+pyside_config(--shiboken-generator-include-path shiboken_include_dir 1)
+pyside_config(--shiboken-module-shared-libraries-cmake shiboken_shared_libraries 0)
+pyside_config(--python-link-flags-cmake python_linking_data 0)
+pyside_config(--pyside-shared-libraries-cmake pyside_shared_libraries 0)
+
+set(shiboken_path "${shiboken_generator_path}/shiboken6${CMAKE_EXECUTABLE_SUFFIX}")
if(NOT EXISTS ${shiboken_path})
message(FATAL_ERROR "Shiboken executable not found at path: ${shiboken_path}")
endif()
@@ -106,7 +106,7 @@ endif()
# Enable rpaths so that the built shared libraries find their dependencies.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-set(CMAKE_INSTALL_RPATH ${shiboken6_module_path} ${CMAKE_CURRENT_SOURCE_DIR})
+set(CMAKE_INSTALL_RPATH ${shiboken_module_path} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# =============================================================================================
# !!! End of dubious section.
@@ -136,11 +136,11 @@ if (QtCore_is_framework)
endif()
# We need to include the headers for the module bindings that we use.
-set(pyside2_additional_includes "")
-foreach(INCLUDE_DIR ${pyside2_include_dir})
- list(APPEND pyside2_additional_includes "${INCLUDE_DIR}/QtCore")
- list(APPEND pyside2_additional_includes "${INCLUDE_DIR}/QtGui")
- list(APPEND pyside2_additional_includes "${INCLUDE_DIR}/QtWidgets")
+set(pyside_additional_includes "")
+foreach(INCLUDE_DIR ${pyside_include_dir})
+ list(APPEND pyside_additional_includes "${INCLUDE_DIR}/QtCore")
+ list(APPEND pyside_additional_includes "${INCLUDE_DIR}/QtGui")
+ list(APPEND pyside_additional_includes "${INCLUDE_DIR}/QtWidgets")
endforeach()
@@ -164,7 +164,7 @@ set(shiboken_options --generator-set=shiboken --enable-parent-ctor-heuristic
${INCLUDES}
-I${CMAKE_SOURCE_DIR}
-T${CMAKE_SOURCE_DIR}
- -T${pyside2_path}/typesystems
+ -T${pyside_path}/typesystems
--output-directory=${CMAKE_CURRENT_BINARY_DIR}
)
@@ -191,15 +191,15 @@ add_library(${bindings_library} SHARED ${${bindings_library}_sources})
# Apply relevant include and link flags.
-target_include_directories(${bindings_library} PRIVATE ${pyside2_additional_includes})
-target_include_directories(${bindings_library} PRIVATE ${pyside2_include_dir})
+target_include_directories(${bindings_library} PRIVATE ${pyside_additional_includes})
+target_include_directories(${bindings_library} PRIVATE ${pyside_include_dir})
target_include_directories(${bindings_library} PRIVATE ${python_include_dir})
target_include_directories(${bindings_library} PRIVATE ${shiboken_include_dir})
target_link_libraries(${wiggly_library} PRIVATE Qt6::Widgets)
target_link_libraries(${bindings_library} PRIVATE Qt6::Widgets)
target_link_libraries(${bindings_library} PRIVATE ${wiggly_library})
-target_link_libraries(${bindings_library} PRIVATE ${pyside2_shared_libraries})
+target_link_libraries(${bindings_library} PRIVATE ${pyside_shared_libraries})
target_link_libraries(${bindings_library} PRIVATE ${shiboken_shared_libraries})
# Adjust the name of generated module.
@@ -251,7 +251,7 @@ if(WIN32)
PROPERTIES LINK_FLAGS "${python_additional_link_flags}")
# Compile a list of shiboken shared libraries to be installed, so that
- # the user doesn't have to set the PATH manually to point to the PySide2 package.
+ # the user doesn't have to set the PATH manually to point to the PySide package.
foreach(library_path ${shiboken_shared_libraries})
string(REGEX REPLACE ".lib$" ".dll" library_path ${library_path})
file(TO_CMAKE_PATH ${library_path} library_path)
diff --git a/examples/widgetbinding/README.md b/examples/widgetbinding/README.md
index f58a49627..cf68fe98f 100644
--- a/examples/widgetbinding/README.md
+++ b/examples/widgetbinding/README.md
@@ -36,7 +36,7 @@ The most important files are:
* `bindings.h` to include the header of the classes we want to expose
* `CMakeList.txt`, with all the instructions to build the shared libraries
(DLL, or dylib)
- * `pyside2_config.py` which is located in the utils directory, one level
+ * `pyside_config.py` which is located in the utils directory, one level
up, to get the path for Shiboken and PySide.
Now create a `build/` directory, and from inside run `cmake ..` to use