aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/shibokenmodule/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/shibokenmodule/CMakeLists.txt')
-rw-r--r--sources/shiboken6/shibokenmodule/CMakeLists.txt81
1 files changed, 32 insertions, 49 deletions
diff --git a/sources/shiboken6/shibokenmodule/CMakeLists.txt b/sources/shiboken6/shibokenmodule/CMakeLists.txt
index 0431ba6f2..702750450 100644
--- a/sources/shiboken6/shibokenmodule/CMakeLists.txt
+++ b/sources/shiboken6/shibokenmodule/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
project(shibokenmodule)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shibokenmodule.txt.in"
@@ -7,24 +10,30 @@ set(sample_SRC ${CMAKE_CURRENT_BINARY_DIR}/Shiboken/shiboken_module_wrapper.cpp)
set(shibokenmodule_TYPESYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_shiboken.xml)
+shiboken_get_tool_shell_wrapper(shiboken tool_wrapper)
+
add_custom_command(
-OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log"
-BYPRODUCTS ${sample_SRC}
-# Note: shiboken6 is an executable target. By not specifying its explicit
-# path, CMAKE figures it out, itself!
-# This fixes an issue with Visual Studio, see https://github.com/PySide/shiboken6/pull/11
-COMMAND shiboken6 --project-file=${CMAKE_CURRENT_BINARY_DIR}/shibokenmodule.txt ${GENERATOR_EXTRA_FLAGS}
-DEPENDS ${shibokenmodule_TYPESYSTEM}
-WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-COMMENT "Running generator for 'Shiboken'..."
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log"
+ BYPRODUCTS ${sample_SRC}
+ COMMAND
+ ${tool_wrapper}
+ $<TARGET_FILE:Shiboken6::shiboken6>
+ --project-file=${CMAKE_CURRENT_BINARY_DIR}/shibokenmodule.txt
+ ${GENERATOR_EXTRA_FLAGS}
+ DEPENDS ${shibokenmodule_TYPESYSTEM}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Running generator for 'Shiboken'..."
)
add_library(shibokenmodule MODULE ${sample_SRC})
target_include_directories(shibokenmodule PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR})
-set_property(TARGET shibokenmodule PROPERTY PREFIX "")
-# PYSIDE-1497: This `..` is the crucial trick to unify the path location of `Shiboken`.
-set_property(TARGET shibokenmodule PROPERTY OUTPUT_NAME "../Shiboken${PYTHON_EXTENSION_SUFFIX}")
+
+set_target_properties(shibokenmodule PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "Shiboken${PYTHON_EXTENSION_SUFFIX}"
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/..")
if(WIN32)
set_property(TARGET shibokenmodule PROPERTY SUFFIX ".pyd")
@@ -33,6 +42,8 @@ target_link_libraries(shibokenmodule PUBLIC libshiboken)
create_generator_target(shibokenmodule)
+qfp_strip_library("shibokenmodule")
+
install(TARGETS shibokenmodule DESTINATION ${PYTHON_SITE_PACKAGES}/shiboken6)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_config.py.in"
@@ -40,22 +51,22 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_config.py.in"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_config.py"
DESTINATION "${PYTHON_SITE_PACKAGES}/shiboken6")
+if ("${MINIMUM_PYTHON_VERSION}" STREQUAL "")
+ set(MINIMUM_PYTHON_VERSION None)
+ set(MAXIMUM_PYTHON_VERSION None)
+endif()
+
# PYSIDE-1497: This `..` is the crucial trick to unify the path location of `Shiboken`.
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in"
"${CMAKE_CURRENT_BINARY_DIR}/../__init__.py" @ONLY)
# PYSIDE-1415: Copy Shiboken.pyi into the target.
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Shiboken.pyi"
"${CMAKE_CURRENT_BINARY_DIR}/../Shiboken.pyi" @ONLY)
+# typing support for mypy
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/py.typed.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../py.typed" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/../Shiboken.pyi"
- DESTINATION "${PYTHON_SITE_PACKAGES}/shiboken6")
-
-# Variable from enclosing scope.
-foreach(item IN LISTS shiboken_python_files)
- configure_file("${CMAKE_CURRENT_SOURCE_DIR}/files.dir/shibokensupport/${item}"
- "${CMAKE_CURRENT_BINARY_DIR}/files.dir/shibokensupport/${item}" COPYONLY)
-endforeach()
-
-install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/files.dir"
+ "${CMAKE_CURRENT_BINARY_DIR}/../py.typed"
DESTINATION "${PYTHON_SITE_PACKAGES}/shiboken6")
# PYSIDE-1497: This `..` is the crucial trick to unify the path location of `Shiboken`.
@@ -71,31 +82,3 @@ configure_file("${shiboken_version_path}"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_git_shiboken_module_version.py"
DESTINATION "${PYTHON_SITE_PACKAGES}/shiboken6")
-
-# Temporary copy of `Shiboken` to `shiboken6` until PySide 6.2
-# This code can (but need not) be removed after that.
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/copy_renamed_binary.py" "if True:
- import os, sys
- from shutil import copyfile
- fpath = sys.argv[-1]
- fname = os.path.basename(fpath).replace('Shiboken', 'shiboken6')
- # copying to `build`
- builddir = '${CMAKE_CURRENT_BINARY_DIR}'
- newname = os.path.join(builddir, '..', fname)
- version_info = (${shiboken_MAJOR_VERSION}, ${shiboken_MINOR_VERSION})
- if version_info < (6, 2):
- copyfile(fpath, newname)
- # PYSIDE-1541: copying to `install` will be handled by INSTAll below.
- # That solves the permission problems.
- ")
-
-add_custom_command(TARGET shibokenmodule POST_BUILD
- COMMAND ${PYTHON_EXECUTABLE}
- "${CMAKE_CURRENT_BINARY_DIR}/copy_renamed_binary.py"
- "$<TARGET_FILE:shibokenmodule>"
- COMMENT "running Python postprocess"
- )
-
-install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
- DESTINATION "${PYTHON_SITE_PACKAGES}/shiboken6/"
- FILES_MATCHING PATTERN "shiboken6.*")