project(pyside2) # Configure include based on platform configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_config.py.in" "${CMAKE_CURRENT_BINARY_DIR}/_config.py" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../pyside_version.py" "${CMAKE_CURRENT_BINARY_DIR}/_git_pyside_version.py" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/support/__init__.py" COPYONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/__init__.py" COPYONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/loader.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/loader.py" COPYONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/mapping.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/mapping.py" COPYONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/parser.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/parser.py" COPYONLY) if (PYTHON_VERSION_MAJOR EQUAL 3) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/inspect.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/inspect.py" COPYONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/typing36.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/typing.py" COPYONLY) else() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/backport_inspect.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/backport_inspect.py" COPYONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/typing27.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/typing.py" COPYONLY) endif() # now compile all modules. file(READ "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" pyside2_global_contents) foreach(shortname IN LISTS all_module_shortnames) set(name "Qt5${shortname}") HAS_QT_MODULE(${name}_FOUND Qt${shortname}) # Create a module header consisting of pyside2_global.h and the module # include. Note: The contents of pyside2_global.h must be copied instead of # just #including it since shiboken will otherwise generate an # #include for the the type entries originating from it # (cf AbstractMetaBuilderPrivate::setInclude()). set(module_header "${CMAKE_CURRENT_BINARY_DIR}/Qt${shortname}_global.h") set(module_header_content "") set(pre_header "${CMAKE_CURRENT_BINARY_DIR}/Qt${shortname}/Qt${shortname}_global.pre.h") if(EXISTS "${pre_header}") file(READ "${pre_header}" pre_header_content) set(module_header_content "${pre_header_content}") endif() set(module_header_content "${module_header_content}\n${pyside2_global_contents}") # AxContainer/AxServer from Active Qt do not have module headers if(NOT "${shortname}" STREQUAL "AxContainer") set(module_header_content "${module_header_content}\n#include ") endif() set(post_header "${CMAKE_CURRENT_BINARY_DIR}/Qt${shortname}/Qt${shortname}_global.post.h") if(EXISTS "${post_header}") file(READ "${post_header}" post_header_content) set(module_header_content "${module_header_content}\n${post_header_content}") endif() file(WRITE ${module_header} "${module_header_content}") endforeach() # install install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_config.py" DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_git_pyside_version.py" DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_templates.xml DESTINATION share/PySide2${pyside_SUFFIX}/typesystems) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h DESTINATION include/${BINDING_NAME}${pyside2_SUFFIX})