Compare commits

...

2 Commits

Author SHA1 Message Date
Renato Araujo Oliveira Filho
2b3ead1f01 Fix python bindings build on windows 2020-08-31 12:11:49 -03:00
Renato Araujo Oliveira Filho
4ebf60a9c8 Python/PySide2ModuleBuild.cmake - fix for Mac frameworks 2020-08-31 10:53:03 -04:00

View File

@@ -23,6 +23,19 @@ endif()
if (NOT CMAKE_CXX_STANDARD) if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
endif() endif()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK)
if (QtCore_is_framework)
# Get the path to the framework dir.
get_filename_component(QT_FRAMEWORK_INCLUDE_DIR "${QT_INCLUDE_DIR}/../" ABSOLUTE)
list(GET Qt5Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR)
# QT_INCLUDE_DIR points to the QtCore.framework directory, so we need to adjust this to point
# to the actual include directory, which has include files for non-framework parts of Qt.
get_filename_component(QT_INCLUDE_DIR "${QT_INCLUDE_DIR}/../../include" ABSOLUTE)
endif()
# Flags that we will pass to shiboken-generator # Flags that we will pass to shiboken-generator
# --generator-set=shiboken: tells the generator that we want to use shiboken to generate code, # --generator-set=shiboken: tells the generator that we want to use shiboken to generate code,
# a doc generator is also available # a doc generator is also available
@@ -41,6 +54,15 @@ set(GENERATOR_EXTRA_FLAGS --generator-set=shiboken
--enable-return-value-heuristic --enable-return-value-heuristic
--use-isnull-as-nb_nonzero --use-isnull-as-nb_nonzero
-std=c++${CMAKE_CXX_STANDARD}) -std=c++${CMAKE_CXX_STANDARD})
# 2017-04-24 The protected hack can unfortunately not be disabled, because
# Clang does produce linker errors when we disable the hack.
# But the ugly workaround in Python is replaced by a shiboken change.
if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
set(GENERATOR_EXTRA_FLAGS ${GENERATOR_EXTRA_FLAGS} --avoid-protected-hack)
add_definitions(-DAVOID_PROTECTED_HACK)
endif()
macro(make_path varname) macro(make_path varname)
# accepts any number of path variables # accepts any number of path variables
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}") string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")