Skip to content

Commit

Permalink
fix: detect sip ABI
Browse files Browse the repository at this point in the history
get build running for sip ABI < 13.9 with sip >= 6.9.
addresses #59995 (comment)
  • Loading branch information
t0b3 committed Dec 24, 2024
1 parent f168a4b commit e72d158
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmake/FindSIP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ELSE(SIP_VERSION)
STRING(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config})
STRING(REGEX REPLACE ".*\nsip_version_num:([^\n]+).*$" "\\1" SIP_VERSION_NUM ${sip_config})
STRING(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config})
STRING(REGEX REPLACE ".*\nsip_abi12_version_str:([^\n]+).*$" "\\1" SIP_ABI12_VERSION_STR ${sip_config})
STRING(REGEX REPLACE ".*\nsip_abi13_version_str:([^\n]+).*$" "\\1" SIP_ABI13_VERSION_STR ${sip_config})
STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config})
IF(NOT SIP_FIND_QUIETLY)
MESSAGE(STATUS "Found SIP version: ${SIP_VERSION_STR}")
Expand Down
2 changes: 2 additions & 0 deletions cmake/FindSIP.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
print("sip_version:%06.0x" % sipbuild.version.SIP_VERSION)
print("sip_version_num:%d" % sipbuild.version.SIP_VERSION)
print("sip_version_str:%s" % sipbuild.version.SIP_VERSION_STR)
print("sip_abi13_version_str:%s" % sipbuild.module.abi_version.get_sip_module_version('13'))
print("sip_abi12_version_str:%s" % sipbuild.module.abi_version.get_sip_module_version('12'))

import sysconfig

Expand Down
4 changes: 1 addition & 3 deletions cmake/SIPMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES
CONFIGURE_FILE(${_sip_file} ${_out_sip_file})

# Deprecated annotation supports message only since ABI >= 12.16 or ABI >= 13.9
# TODO: evaluate ABI version once it's available from upstream
# i.e. `if(${SIP_ABI_VERSION_STR} VERSION_LESS 13.9)`
if(TRUE)
if((BUILD_WITH_QT6 AND (${SIP_ABI13_VERSION_STR} VERSION_LESS 13.9)) OR (NOT BUILD_WITH_QT6 AND (${SIP_ABI12_VERSION_STR} VERSION_LESS 12.16)))
file(READ ${_out_sip_file} _content)
string(REGEX REPLACE "([/,])Deprecated=\"[^\"]*\"([/,])" "\\1Deprecated\\2" _content "${_content}")
file(GENERATE OUTPUT ${_out_sip_file} CONTENT "${_content}")
Expand Down

0 comments on commit e72d158

Please sign in to comment.