aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2023-10-13 18:06:08 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-11-01 20:14:17 +0000
commit8ff850831087dee3c5e050a1e4303b2ac3a168bf (patch)
treeb0387a71e51d084eca809503afb103176447e1a2
parent82fac9e79b5534aaab365109c30f91969916cb74 (diff)
CMake: Allow specifying a shiboken debug-level from the build system
The SHIBOKEN_DEBUG_LEVEL CMake or env var variables can now be set so that the build system passes that value to --debug-level of each shiboken invocation. The possible values are the ones that shiboken's command line parser expects: sparse, medium, full. This is useful for getting shiboken debug output in the CI. Change-Id: I62d99e8f67884638449a69b10803aca3b1230e7b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 669560b5042f141e189abad3f283ab3989253e5a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/pyside6/cmake/PySideSetup.cmake3
-rw-r--r--sources/shiboken6/cmake/ShibokenHelpers.cmake12
-rw-r--r--sources/shiboken6/tests/CMakeLists.txt4
3 files changed, 18 insertions, 1 deletions
diff --git a/sources/pyside6/cmake/PySideSetup.cmake b/sources/pyside6/cmake/PySideSetup.cmake
index 577a3fc7a..87a91cfd9 100644
--- a/sources/pyside6/cmake/PySideSetup.cmake
+++ b/sources/pyside6/cmake/PySideSetup.cmake
@@ -218,8 +218,11 @@ if(NOT PYTHON_SITE_PACKAGES)
shiboken_internal_set_python_site_packages()
endif()
+shiboken_get_debug_level(debug_level)
+
set(GENERATOR_EXTRA_FLAGS
${SHIBOKEN_GENERATOR_EXTRA_FLAGS}
+ ${debug_level}
--generator-set=shiboken
--enable-parent-ctor-heuristic
--enable-pyside-extensions
diff --git a/sources/shiboken6/cmake/ShibokenHelpers.cmake b/sources/shiboken6/cmake/ShibokenHelpers.cmake
index 4fdfe3648..b71f01eb0 100644
--- a/sources/shiboken6/cmake/ShibokenHelpers.cmake
+++ b/sources/shiboken6/cmake/ShibokenHelpers.cmake
@@ -828,3 +828,15 @@ macro(find_libclang)
"You will likely need to add it manually to PATH to ensure the build succeeds.")
endif()
endmacro()
+
+# Allow setting a shiboken debug level from the the build system or from the environment
+# to all shiboken invocations.
+function(shiboken_get_debug_level out_var)
+ set(debug_level "")
+ if(SHIBOKEN_DEBUG_LEVEL)
+ set(debug_level "--debug-level=${SHIBOKEN_DEBUG_LEVEL}")
+ elseif(DEFINED $ENV{SHIBOKEN_DEBUG_LEVEL})
+ set(debug_level "--debug-level=$ENV{SHIBOKEN_DEBUG_LEVEL}")
+ endif()
+ set(${out_var} "${debug_level}" PARENT_SCOPE)
+endfunction()
diff --git a/sources/shiboken6/tests/CMakeLists.txt b/sources/shiboken6/tests/CMakeLists.txt
index 3c82d766e..f3b096588 100644
--- a/sources/shiboken6/tests/CMakeLists.txt
+++ b/sources/shiboken6/tests/CMakeLists.txt
@@ -14,6 +14,8 @@ if(NOT DEFINED MINIMAL_TESTS)
add_subdirectory(libother)
endif()
+shiboken_get_debug_level(debug_level)
+
if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
message(STATUS "Tests will be generated avoiding the protected hack!")
set(GENERATOR_EXTRA_FLAGS --avoid-protected-hack)
@@ -21,7 +23,7 @@ else()
message(STATUS "Tests will be generated using the protected hack!")
set(GENERATOR_EXTRA_FLAGS )
endif()
-list(APPEND GENERATOR_EXTRA_FLAGS ${SHIBOKEN_GENERATOR_EXTRA_FLAGS})
+list(APPEND GENERATOR_EXTRA_FLAGS ${SHIBOKEN_GENERATOR_EXTRA_FLAGS} ${debug_level})
add_subdirectory(minimalbinding)
if(NOT DEFINED MINIMAL_TESTS)