diff options
23 files changed, 170 insertions, 128 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f61a4f256..c470ab9f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,11 +15,12 @@ endif() # Used to prevent overriding message function in both shiboken6 and pyside6. set(is_pyside6_superproject_build 1) +add_subdirectory(sources/shiboken6_generator) add_subdirectory(sources/shiboken6) # Ensure Shiboken6 and Shiboken6Tools packags are found during super-build list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/sources/shiboken6/data") -list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/sources/shiboken6/generator") +list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/sources/shiboken6_generator/generator") add_subdirectory(sources/pyside6) add_subdirectory(sources/pyside-tools) diff --git a/build_scripts/__init__.py b/build_scripts/__init__.py index 17975e34d..3df279dec 100644 --- a/build_scripts/__init__.py +++ b/build_scripts/__init__.py @@ -6,6 +6,7 @@ from pathlib import Path PYSIDE = 'pyside6' PYSIDE_MODULE = 'PySide6' SHIBOKEN = 'shiboken6' +SHIBOKEN_GENERATOR = 'shiboken6_generator' PYSIDE_PYTHON_TOOLS = ["metaobjectdump", "deploy", diff --git a/build_scripts/config.py b/build_scripts/config.py index efafc7688..47dd28b7c 100644 --- a/build_scripts/config.py +++ b/build_scripts/config.py @@ -7,7 +7,7 @@ import sys from pathlib import Path from typing import Any -from . import PYPROJECT_PATH, PYSIDE, PYSIDE_MODULE, SHIBOKEN +from . import PYPROJECT_PATH, PYSIDE, PYSIDE_MODULE, SHIBOKEN, SHIBOKEN_GENERATOR from .log import LogLevel, log from .utils import available_pyside_tools, Singleton @@ -240,7 +240,7 @@ class Config(metaclass=Singleton): if self.is_internal_shiboken_module_build(): return SHIBOKEN elif self.is_internal_shiboken_generator_build(): - return f"{SHIBOKEN}_generator" + return SHIBOKEN_GENERATOR elif self.is_internal_pyside_build(): return PYSIDE_MODULE else: @@ -299,7 +299,9 @@ class Config(metaclass=Singleton): Used by PysideBuild.run to build the CMake projects. :return: A list of directory names under the sources directory. """ - if self.is_internal_shiboken_module_build() or self.is_internal_shiboken_generator_build(): + if self.is_internal_shiboken_generator_build(): + return [SHIBOKEN_GENERATOR] + if self.is_internal_shiboken_module_build(): return [SHIBOKEN] elif self.is_internal_pyside_build(): return [PYSIDE, 'pyside-tools'] diff --git a/build_scripts/main.py b/build_scripts/main.py index cdaa439ff..c98390cf1 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -42,7 +42,7 @@ from .utils import (copydir, copyfile, detect_clang, linux_fix_rpaths_for_library, macos_fix_rpaths_for_library, parse_modules, platform_cmake_options, remove_tree, run_process, run_process_output, update_env_path, which) -from . import PYSIDE, PYSIDE_MODULE, SHIBOKEN +from . import PYSIDE, PYSIDE_MODULE, SHIBOKEN, SHIBOKEN_GENERATOR from .wheel_override import get_bdist_wheel_override, wheel_module_exists from .wheel_utils import (get_package_timestamp, get_package_version, macos_plat_name, macos_pyside_min_deployment_target) @@ -380,9 +380,9 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): self.build_tests = OPTION["BUILDTESTS"] - # Save the shiboken build dir path for clang deployment + # Save the shiboken generator build dir path for clang deployment # purposes. - self.shiboken_build_dir = self.build_dir / SHIBOKEN + self.shiboken_generator_build_dir = self.build_dir / SHIBOKEN_GENERATOR self.log_pre_build_info() @@ -404,8 +404,7 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): with open(self.internal_cmake_install_dir_query_file_path, 'w') as f: f.write(os.fspath(self.install_dir)) - if (not OPTION["ONLYPACKAGE"] - and not config.is_internal_shiboken_generator_build_and_part_of_top_level_all()): + if not OPTION["ONLYPACKAGE"]: # Build extensions for ext in config.get_buildable_extensions(): self.build_extension(ext) @@ -994,7 +993,7 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): "-L", # Lists variables "-N", # Just inspects the cache (faster) "-B", # Specifies the build dir - str(self.shiboken_build_dir) + str(self.shiboken_generator_build_dir) ] out = run_process_output(cmake_cmd) lines = [s.strip() for s in out] diff --git a/build_scripts/platforms/windows_desktop.py b/build_scripts/platforms/windows_desktop.py index e023ff003..55b92873a 100644 --- a/build_scripts/platforms/windows_desktop.py +++ b/build_scripts/platforms/windows_desktop.py @@ -12,9 +12,11 @@ from pathlib import Path from ..log import log from ..config import config from ..options import OPTION -from ..utils import (copydir, copyfile, copy_qt_metatypes, download_and_extract_7z, - filter_match, makefile, in_coin, coin_job_id, copy_cmake_config_dirs) -from .. import PYSIDE, SHIBOKEN, PYSIDE_WINDOWS_BIN_TOOLS, PYSIDE_MULTIMEDIA_LIBS +from ..utils import (copydir, copyfile, copy_qt_metatypes, + download_and_extract_7z, filter_match, makefile, in_coin, coin_job_id, + copy_cmake_config_dirs) +from .. import (PYSIDE, SHIBOKEN, PYSIDE_WINDOWS_BIN_TOOLS, PYSIDE_MULTIMEDIA_LIBS, + SHIBOKEN_GENERATOR) def prepare_packages_win32(pyside_build, _vars): @@ -90,7 +92,7 @@ def prepare_packages_win32(pyside_build, _vars): # {shibokenmodule}.pdb file. # Task-number: PYSIDE-615 copydir( - f"{{build_dir}}/{SHIBOKEN}/generator", destination_dir, + f"{{build_dir}}/{SHIBOKEN_GENERATOR}/generator", destination_dir, _filter=pdbs, recursive=False, _vars=_vars) @@ -370,12 +372,12 @@ def copy_qt_artifacts(pyside_build, destination_qt_dir, copy_pdbs, _vars): file_filter_function=qt_dll_filter, recursive=False, _vars=_vars) + pdb_pattern = "*{}.pdb" if copy_plugins: is_pypy = "pypy" in pyside_build.build_classifiers # <qt>/plugins/* -> <setup>/{st_package_name}/plugins plugins_target = f"{destination_qt_dir}/plugins" plugin_dll_patterns = ["*{}.dll"] - pdb_pattern = "*{}.pdb" if copy_pdbs: plugin_dll_patterns += [pdb_pattern] plugin_dll_filter = functools.partial(qt_build_config_filter, plugin_dll_patterns) diff --git a/build_scripts/setup_runner.py b/build_scripts/setup_runner.py index ec679801e..116ab4a72 100644 --- a/build_scripts/setup_runner.py +++ b/build_scripts/setup_runner.py @@ -126,7 +126,7 @@ class SetupRunner: # instead of shiboken_generator_option_name, but it will # actually build the generator. host_cmd = self.new_setup_internal_invocation( - initialized_config.shiboken_module_option_name, + initialized_config.shiboken_generator_option_name, extra_args=extra_host_args, replace_command_with="build") @@ -228,19 +228,14 @@ class SetupRunner: # target invocations. if config.is_cross_compile(): extra_args = self.add_host_tools_setup_internal_invocation(config) + else: + self.add_setup_internal_invocation( + config.shiboken_generator_option_name) self.add_setup_internal_invocation( config.shiboken_module_option_name, extra_args=extra_args) - # Reuse the shiboken build for the generator package instead - # of rebuilding it again. - # Don't build it in a cross-build though. - if not config.is_cross_compile(): - self.add_setup_internal_invocation( - config.shiboken_generator_option_name, - reuse_build=True) - self.add_setup_internal_invocation(config.pyside_option_name, extra_args=extra_args) diff --git a/create_wheels.py b/create_wheels.py index 6f8d8812e..d9d900fb4 100644 --- a/create_wheels.py +++ b/create_wheels.py @@ -185,8 +185,6 @@ def generate_pyproject_toml(artifacts: Path, setup: SetupData) -> str: elif _name == "PySide6_Addons": _dependencies.append(f"shiboken6=={setup.version[0]}") _dependencies.append(f"PySide6_Essentials=={setup.version[0]}") - elif _name == "shiboken6_generator": - _dependencies.append(f"shiboken6=={setup.version[0]}") with open(artifacts / "pyproject.toml.base") as f: content = ( diff --git a/examples/utils/pyside_config.py b/examples/utils/pyside_config.py index ea021030f..ec4cb61d1 100644 --- a/examples/utils/pyside_config.py +++ b/examples/utils/pyside_config.py @@ -53,6 +53,10 @@ options.append(("--shiboken-include-path", lambda: get_package_include_path(Package.SHIBOKEN_MODULE), pyside_error, "Print shiboken module include paths")) +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, diff --git a/sources/shiboken6/CMakeLists.txt b/sources/shiboken6/CMakeLists.txt index efc2ec7cf..5efa9633e 100644 --- a/sources/shiboken6/CMakeLists.txt +++ b/sources/shiboken6/CMakeLists.txt @@ -10,22 +10,16 @@ set(CMAKE_BUILD_TYPE Release CACHE STRING "Build Type") include(".cmake.conf") project(shiboken6) + include(cmake/ShibokenSetup.cmake) get_rpath_base_token(base) set(CMAKE_INSTALL_RPATH ${base}/) -if(SHIBOKEN_BUILD_TOOLS) - add_subdirectory(ApiExtractor) # Uses libclang - add_subdirectory(generator) # Uses ApiExtractor And QtCore -endif() - -if(SHIBOKEN_BUILD_LIBS) - add_subdirectory(libshiboken) # Uses Python - add_subdirectory(shibokenmodule) # Uses libshiboken - add_subdirectory(data) -endif() +add_subdirectory(libshiboken) # Uses Python +add_subdirectory(shibokenmodule) # Uses libshiboken +add_subdirectory(data) add_subdirectory(doc) diff --git a/sources/shiboken6/cmake/ShibokenHelpers.cmake b/sources/shiboken6/cmake/ShibokenHelpers.cmake index 0e993fadb..571ae6656 100644 --- a/sources/shiboken6/cmake/ShibokenHelpers.cmake +++ b/sources/shiboken6/cmake/ShibokenHelpers.cmake @@ -180,41 +180,6 @@ macro(set_python_config_suffix) endif() endmacro() -macro(setup_clang) - # Find libclang using the environment variables LLVM_INSTALL_DIR, - # CLANG_INSTALL_DIR using standard cmake. - # Use CLANG_INCLUDE_DIRS and link to libclang. - if(DEFINED ENV{LLVM_INSTALL_DIR}) - list(PREPEND CMAKE_PREFIX_PATH "$ENV{LLVM_INSTALL_DIR}") - list(PREPEND CMAKE_FIND_ROOT_PATH "$ENV{LLVM_INSTALL_DIR}") - elseif(DEFINED ENV{CLANG_INSTALL_DIR}) - list(PREPEND CMAKE_PREFIX_PATH "$ENV{CLANG_INSTALL_DIR}") - list(PREPEND CMAKE_FIND_ROOT_PATH "$ENV{CLANG_INSTALL_DIR}") - endif() - - find_package(Clang CONFIG REQUIRED) - # Need to explicitly handle the version check, because the Clang package doesn't. - set(REQUIRED_LLVM "18.0") - - if (LLVM_PACKAGE_VERSION AND LLVM_PACKAGE_VERSION VERSION_LESS "${REQUIRED_LLVM}") - message(WARNING "You need LLVM version ${REQUIRED_LLVM} or greater to build PySide " - "without issues, and ${LLVM_PACKAGE_VERSION} was found. " - "A lower version might case problems, specially on Windows.") - # Exception to enable Yocto builds (Kirkstone) - 6.8.x - set(REQUIRED_LLVM "14.0") - if (LLVM_PACKAGE_VERSION AND LLVM_PACKAGE_VERSION VERSION_LESS "${REQUIRED_LLVM}") - message(FATAL_ERROR "Using a LLVM version ${REQUIRED_LLVM} is the minimum allowed " - "to work pyside in some systems, however ${LLVM_PACKAGE_VERSION} was found.") - endif() - endif() - - # CLANG_LIBRARY is read out from the cmake cache to deploy libclang - get_target_property(CLANG_BUILD_TYPE libclang IMPORTED_CONFIGURATIONS) - get_target_property(CLANG_LIBRARY_NAME libclang IMPORTED_LOCATION_${CLANG_BUILD_TYPE}) - set(CLANG_LIBRARY "${CLANG_LIBRARY_NAME}" CACHE FILEPATH "libclang") - message(STATUS "CLANG: ${Clang_DIR}, ${CLANG_LIBRARY} detected") -endmacro() - macro(set_quiet_build) # Don't display "up-to-date / install" messages when installing, to reduce visual clutter. set(CMAKE_INSTALL_MESSAGE NEVER) @@ -551,18 +516,6 @@ function(shiboken_internal_detect_if_cross_building) endfunction() function(shiboken_internal_decide_parts_to_build) - set(build_libs_default ON) - option(SHIBOKEN_BUILD_LIBS "Build shiboken libraries" ${build_libs_default}) - message(STATUS "SHIBOKEN_BUILD_LIBS: ${SHIBOKEN_BUILD_LIBS}") - - if(SHIBOKEN_IS_CROSS_BUILD) - set(build_tools_default OFF) - else() - set(build_tools_default ON) - endif() - option(SHIBOKEN_BUILD_TOOLS "Build shiboken tools" ${build_tools_default}) - message(STATUS "SHIBOKEN_BUILD_TOOLS: ${SHIBOKEN_BUILD_TOOLS}") - if(SHIBOKEN_IS_CROSS_BUILD) set(_shiboken_build_tests_default OFF) elseif(SHIBOKEN_BUILD_LIBS) @@ -573,23 +526,22 @@ function(shiboken_internal_decide_parts_to_build) endfunction() function(shiboken_internal_find_host_shiboken_tools) - if(SHIBOKEN_IS_CROSS_BUILD) - set(find_package_extra_args) - if(QFP_SHIBOKEN_HOST_PATH) - list(APPEND find_package_extra_args PATHS "${QFP_SHIBOKEN_HOST_PATH}/lib/cmake") - list(PREPEND CMAKE_FIND_ROOT_PATH "${QFP_SHIBOKEN_HOST_PATH}") - endif() - find_package( - Shiboken6Tools 6 CONFIG - ${find_package_extra_args} - ) + set(find_package_extra_args) + if(QFP_SHIBOKEN_HOST_PATH) + list(APPEND find_package_extra_args PATHS "${QFP_SHIBOKEN_HOST_PATH}/lib/cmake") + list(PREPEND CMAKE_FIND_ROOT_PATH "${QFP_SHIBOKEN_HOST_PATH}") + endif() + set(SHIBOKEN6TOOLS_SKIP_FIND_DEPENDENCIES TRUE) + find_package( + Shiboken6Tools 6 CONFIG + ${find_package_extra_args} + ) - if(NOT Shiboken6Tools_DIR) - message(FATAL_ERROR - "Shiboken6Tools package was not found. " - "Please set QFP_SHIBOKEN_HOST_PATH to the location where the Shiboken6Tools CMake " - "package is installed.") - endif() + if(NOT Shiboken6Tools_DIR AND QFP_SHIBOKEN_HOST_PATH) + message(FATAL_ERROR + "Shiboken6Tools package was not found. " + "Please set QFP_SHIBOKEN_HOST_PATH to the location where the Shiboken6Tools CMake " + "package is installed.") endif() endfunction() diff --git a/sources/shiboken6/cmake/ShibokenSetup.cmake b/sources/shiboken6/cmake/ShibokenSetup.cmake index 32823d9fa..73030bc90 100644 --- a/sources/shiboken6/cmake/ShibokenSetup.cmake +++ b/sources/shiboken6/cmake/ShibokenSetup.cmake @@ -33,10 +33,6 @@ else() shiboken_find_required_python() endif() -if(SHIBOKEN_BUILD_TOOLS) - setup_clang() -endif() - set(shiboken6_VERSION "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}.${shiboken_MICRO_VERSION}") set(shiboken6_library_so_version "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}") diff --git a/sources/shiboken6/libshiboken/CMakeLists.txt b/sources/shiboken6/libshiboken/CMakeLists.txt index dc8a73156..9290256f8 100644 --- a/sources/shiboken6/libshiboken/CMakeLists.txt +++ b/sources/shiboken6/libshiboken/CMakeLists.txt @@ -106,7 +106,6 @@ signature/signature_helper.cpp set_property(SOURCE "pep384impl.cpp" PROPERTY SKIP_UNITY_BUILD_INCLUSION ON) add_library(libshiboken SHARED ${libshiboken_SRC}) -add_library(Shiboken6::libshiboken ALIAS libshiboken) target_include_directories(libshiboken PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> diff --git a/sources/shiboken6/tests/CMakeLists.txt b/sources/shiboken6/tests/CMakeLists.txt index 6de8199ef..c9277d0dc 100644 --- a/sources/shiboken6/tests/CMakeLists.txt +++ b/sources/shiboken6/tests/CMakeLists.txt @@ -83,15 +83,3 @@ foreach(test_file ${TEST_FILES}) set_tests_properties(${test_name} PROPERTIES WILL_FAIL TRUE) endif() endforeach() - -# dumpcodemodel depends on apiextractor which is not cross-built. -if(SHIBOKEN_BUILD_TOOLS) - add_subdirectory(dumpcodemodel) -endif() - -# FIXME Skipped until add an option to choose the generator -# add_subdirectory(test_generator) - -if (NOT APIEXTRACTOR_DOCSTRINGS_DISABLED) - add_subdirectory(qtxmltosphinxtest) -endif() diff --git a/sources/shiboken6_generator/ApiExtractor/CMakeLists.txt b/sources/shiboken6_generator/ApiExtractor/CMakeLists.txt index 5385eccf1..b0ce14bef 100644 --- a/sources/shiboken6_generator/ApiExtractor/CMakeLists.txt +++ b/sources/shiboken6_generator/ApiExtractor/CMakeLists.txt @@ -131,8 +131,6 @@ target_compile_definitions(apiextractor PRIVATE CMAKE_CXX_COMPILER="${CMAKE_CXX_COMPILER}" PRIVATE QT_LEAN_HEADERS=1) -set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) - if (BUILD_TESTS) find_package(Qt6 REQUIRED COMPONENTS Test) set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/tests) diff --git a/sources/shiboken6_generator/CMakeLists.txt b/sources/shiboken6_generator/CMakeLists.txt new file mode 100644 index 000000000..24fb91c57 --- /dev/null +++ b/sources/shiboken6_generator/CMakeLists.txt @@ -0,0 +1,23 @@ +include(../shiboken6/icecc.cmake) +include(../shiboken6/.cmake.conf) + +cmake_minimum_required(VERSION 3.18) +cmake_policy(VERSION 3.18) + +project(shiboken_generator) + +include(cmake/ShibokenGeneratorSetup.cmake) + +get_rpath_base_token(base) + +set(CMAKE_INSTALL_RPATH ${base}/) + +set(CMAKE_BUILD_TYPE Release CACHE STRING "Build Type") + +add_subdirectory(ApiExtractor) # Uses libclang +add_subdirectory(generator) # Uses ApiExtractor And QtCore + +if(BUILD_TESTS) + enable_testing() + add_subdirectory(tests) +endif() diff --git a/sources/shiboken6_generator/cmake/ShibokenGeneratorHelpers.cmake b/sources/shiboken6_generator/cmake/ShibokenGeneratorHelpers.cmake new file mode 100644 index 000000000..90d43c15e --- /dev/null +++ b/sources/shiboken6_generator/cmake/ShibokenGeneratorHelpers.cmake @@ -0,0 +1,26 @@ +option(BUILD_TESTS "Build tests." ON) + +macro(setup_clang) + # Find libclang using the environment variables LLVM_INSTALL_DIR, + # CLANG_INSTALL_DIR using standard cmake. + # Use CLANG_INCLUDE_DIRS and link to libclang. + if(DEFINED ENV{LLVM_INSTALL_DIR}) + list(PREPEND CMAKE_PREFIX_PATH "$ENV{LLVM_INSTALL_DIR}") + list(PREPEND CMAKE_FIND_ROOT_PATH "$ENV{LLVM_INSTALL_DIR}") + elseif(DEFINED ENV{CLANG_INSTALL_DIR}) + list(PREPEND CMAKE_PREFIX_PATH "$ENV{CLANG_INSTALL_DIR}") + list(PREPEND CMAKE_FIND_ROOT_PATH "$ENV{CLANG_INSTALL_DIR}") + endif() + + find_package(Clang CONFIG REQUIRED) + # Need to explicitly handle the version check, because the Clang package doesn't. + if (LLVM_PACKAGE_VERSION AND LLVM_PACKAGE_VERSION VERSION_LESS "9.0") + message(FATAL_ERROR "You need LLVM version 9.0 or greater to build.") + endif() + + # CLANG_LIBRARY is read out from the cmake cache to deploy libclang + get_target_property(CLANG_BUILD_TYPE libclang IMPORTED_CONFIGURATIONS) + get_target_property(CLANG_LIBRARY_NAME libclang IMPORTED_LOCATION_${CLANG_BUILD_TYPE}) + set(CLANG_LIBRARY "${CLANG_LIBRARY_NAME}" CACHE FILEPATH "libclang") + message(STATUS "CLANG: ${Clang_DIR}, ${CLANG_LIBRARY} detected") +endmacro() diff --git a/sources/shiboken6_generator/cmake/ShibokenGeneratorSetup.cmake b/sources/shiboken6_generator/cmake/ShibokenGeneratorSetup.cmake new file mode 100644 index 000000000..137824d15 --- /dev/null +++ b/sources/shiboken6_generator/cmake/ShibokenGeneratorSetup.cmake @@ -0,0 +1,50 @@ +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" + "${CMAKE_CURRENT_LIST_DIR}/../../shiboken6/cmake") + +include(ShibokenHelpers) +include(ShibokenGeneratorHelpers) + +shiboken_internal_disable_pkg_config_if_needed() +shiboken_internal_detect_if_cross_building() + +# Note: For cross building, we rely on FindPython shipped with CMake 3.17+ to +# provide the value of Python_SOABI. + +shiboken_internal_decide_parts_to_build() +shiboken_internal_set_up_extra_dependency_paths() + +set(QT_MAJOR_VERSION 6) +message(STATUS "Using Qt ${QT_MAJOR_VERSION}") +find_package(Qt6 REQUIRED COMPONENTS Core) + +if(QUIET_BUILD) + set_quiet_build() +endif() + +if(USE_PYTHON_VERSION) + shiboken_find_required_python(${USE_PYTHON_VERSION}) +else() + shiboken_find_required_python() +endif() + +setup_clang() + +# from cmake.conf +set(shiboken6_VERSION "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}.${shiboken_MICRO_VERSION}") + +compute_config_py_values(shiboken6_VERSION) + +shiboken_internal_set_python_site_packages() + +set_cmake_cxx_flags() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_TO_ASCII") + +# Force usage of the C++17 standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) +set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install \ + prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) +set(BIN_INSTALL_DIR "bin" CACHE PATH "The subdirectory relative to the install prefix where \ + dlls will be installed (default is /bin)" FORCE) diff --git a/sources/shiboken6/data/Shiboken6ToolsMacros.cmake b/sources/shiboken6_generator/data/Shiboken6ToolsMacros.cmake index 2c1a8c786..2c1a8c786 100644 --- a/sources/shiboken6/data/Shiboken6ToolsMacros.cmake +++ b/sources/shiboken6_generator/data/Shiboken6ToolsMacros.cmake diff --git a/sources/shiboken6_generator/generator/CMakeLists.txt b/sources/shiboken6_generator/generator/CMakeLists.txt index 997468f02..33bb41321 100644 --- a/sources/shiboken6_generator/generator/CMakeLists.txt +++ b/sources/shiboken6_generator/generator/CMakeLists.txt @@ -6,11 +6,6 @@ set(package_name "Shiboken6Tools") set(CMAKE_AUTOMOC ON) -if(NOT (Qt${QT_MAJOR_VERSION}Core_FOUND AND Python_Interpreter_FOUND)) - message(WARNING "Some dependencies were not found: shiboken6 generator compilation disabled!") - return() -endif() - set(shiboken6_SRC defaultvalue.cpp defaultvalue.h generator.cpp generator.h @@ -60,6 +55,10 @@ if (NOT DISABLE_DOCSTRINGS) target_compile_definitions(shiboken6 PUBLIC DOCSTRINGS_ENABLED QT_LEAN_HEADERS=1) endif() +# TODO: We are not actually using the tool_wrapper, but we need to make sure +# the properties for the tool are properly set +shiboken_get_tool_shell_wrapper(shiboken tool_wrapper) + configure_file(shibokenconfig.h.in "${CMAKE_CURRENT_BINARY_DIR}/shibokenconfig.h" @ONLY) install(TARGETS shiboken6 @@ -103,7 +102,7 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shiboken_tool.py # Use absolute path instead of relative path, to avoid ninja build errors due to # duplicate file dependency inconsistency. -set(shiboken_version_relative_path "${CMAKE_CURRENT_SOURCE_DIR}/../shiboken_version.py") +set(shiboken_version_relative_path "${CMAKE_CURRENT_SOURCE_DIR}/../../shiboken6/shiboken_version.py") get_filename_component(shiboken_version_path ${shiboken_version_relative_path} ABSOLUTE) configure_file("${shiboken_version_path}" "${CMAKE_CURRENT_BINARY_DIR}/_git_shiboken_generator_version.py" @ONLY) diff --git a/sources/shiboken6_generator/tests/CMakeLists.txt b/sources/shiboken6_generator/tests/CMakeLists.txt new file mode 100644 index 000000000..f71467c87 --- /dev/null +++ b/sources/shiboken6_generator/tests/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.18) + +# dumpcodemodel depends on apiextractor which is not cross-built. +add_subdirectory(dumpcodemodel) + +# FIXME Skipped until add an option to choose the generator +# add_subdirectory(test_generator) + +if (NOT APIEXTRACTOR_DOCSTRINGS_DISABLED) + add_subdirectory(qtxmltosphinxtest) +endif() diff --git a/sources/shiboken6_generator/tests/dumpcodemodel/CMakeLists.txt b/sources/shiboken6_generator/tests/dumpcodemodel/CMakeLists.txt index e7dbef961..8b71389f1 100644 --- a/sources/shiboken6_generator/tests/dumpcodemodel/CMakeLists.txt +++ b/sources/shiboken6_generator/tests/dumpcodemodel/CMakeLists.txt @@ -3,6 +3,8 @@ add_executable(dumpcodemodel main.cpp) +find_package(Qt6 COMPONENTS Core) + target_include_directories(dumpcodemodel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/sources/shiboken6_generator/tests/qtxmltosphinx/CMakeLists.txt b/sources/shiboken6_generator/tests/qtxmltosphinx/CMakeLists.txt index 4a200becd..489fbebfa 100644 --- a/sources/shiboken6_generator/tests/qtxmltosphinx/CMakeLists.txt +++ b/sources/shiboken6_generator/tests/qtxmltosphinx/CMakeLists.txt @@ -11,8 +11,9 @@ set(CMAKE_AUTOMOC ON) find_package(Qt6 COMPONENTS Core) -set(generator_src_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../generator) -set(api_extractor_src_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../ApiExtractor) +set(shiboken_generator_src_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../shiboken6_generator) +set(generator_src_dir ${shiboken_generator_src_dir}/generator) +set(api_extractor_src_dir ${shiboken_generator_src_dir}/ApiExtractor) set(qtxmltosphinx_SRC ${generator_src_dir}/qtdoc/qtxmltosphinx.cpp diff --git a/sources/shiboken6_generator/tests/qtxmltosphinxtest/CMakeLists.txt b/sources/shiboken6_generator/tests/qtxmltosphinxtest/CMakeLists.txt index 109ab288e..cb170efe6 100644 --- a/sources/shiboken6_generator/tests/qtxmltosphinxtest/CMakeLists.txt +++ b/sources/shiboken6_generator/tests/qtxmltosphinxtest/CMakeLists.txt @@ -10,8 +10,9 @@ set(CMAKE_AUTOMOC ON) find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Test) -set(generator_src_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../generator) -set(api_extractor_src_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../ApiExtractor) +set(shiboken_generator_src_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../shiboken6_generator) +set(generator_src_dir ${shiboken_generator_src_dir}/generator) +set(api_extractor_src_dir ${shiboken_generator_src_dir}/ApiExtractor) set(qtxmltosphinxtest_SRC ${generator_src_dir}/qtdoc/qtxmltosphinx.cpp |
