mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 10:56:11 +00:00
Simplify python binding include handling (#3268)
* Simplify python binding include handling * remove duplicate code introduced in #2952 * specify include path using multiple include-path lines instead instead of single line with with directories separated by ; or : * Fix macoS qt6 python bindings build
This commit is contained in:
parent
653435cb14
commit
a6af2911dc
@ -429,33 +429,7 @@ if(CUTTER_ENABLE_PYTHON_BINDINGS)
|
||||
|
||||
include_directories("${BINDINGS_BUILD_DIR}/CutterBindings")
|
||||
|
||||
set(SHIBOKEN_INCLUDE_DIRS "")
|
||||
if(APPLE AND _qt6Core_install_prefix)
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt6Core_install_prefix}/include")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt6Core_install_prefix}/include/QtCore")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt6Core_install_prefix}/include/QtGui")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt6Core_install_prefix}/include/QtWidgets")
|
||||
endif()
|
||||
|
||||
if (CUTTER_QT6)
|
||||
list(APPEND SHIBOKEN_INCLUDE_DIRS ${Qt6Core_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Gui_INCLUDE_DIRS})
|
||||
else()
|
||||
list(APPEND SHIBOKEN_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
foreach(_dir ${CUTTER_INCLUDE_DIRECTORIES})
|
||||
list(APPEND SHIBOKEN_INCLUDE_DIRS
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${_dir}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/cutter/${_dir}>
|
||||
)
|
||||
endforeach()
|
||||
list(APPEND SHIBOKEN_INCLUDE_DIRS ${Rizin_INCLUDE_DIRS})
|
||||
if (NOT WIN32)
|
||||
string(REPLACE ";" ":" SHIBOKEN_INCLUDE_DIRS "${SHIBOKEN_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
set(SHIBOKEN_OPTIONS)
|
||||
list(APPEND SHIBOKEN_OPTIONS --include-paths="${SHIBOKEN_INCLUDE_DIRS}")
|
||||
if (WIN32)
|
||||
list(APPEND SHIBOKEN_OPTIONS --avoid-protected-hack)
|
||||
endif()
|
||||
@ -558,11 +532,16 @@ if(CUTTER_ENABLE_PYTHON)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(APPLE AND _qt5Core_install_prefix)
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtCore")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtGui")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtWidgets")
|
||||
set(BINDINGS_INCLUDE_DIR_LINES "")
|
||||
if(APPLE)
|
||||
if (_qt5Core_install_prefix)
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtCore")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtGui")
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtWidgets")
|
||||
elseif(CUTTER_QT6)
|
||||
string(APPEND BINDINGS_INCLUDE_DIR_LINES "framework-include-path=${QT6_INSTALL_PREFIX}/${QT6_INSTALL_LIBS}\n")
|
||||
endif()
|
||||
endif()
|
||||
if (CUTTER_QT6)
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS ${Qt6Core_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Gui_INCLUDE_DIRS})
|
||||
@ -571,9 +550,12 @@ if(CUTTER_ENABLE_PYTHON)
|
||||
endif()
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS ${Rizin_INCLUDE_DIRS})
|
||||
list(APPEND BINDINGS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
if (NOT WIN32)
|
||||
string(REPLACE ";" ":" BINDINGS_INCLUDE_DIRS "${BINDINGS_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
foreach(_dir ${BINDINGS_INCLUDE_DIRS})
|
||||
if (NOT "${_dir}" STREQUAL "")
|
||||
string(APPEND BINDINGS_INCLUDE_DIR_LINES "include-path = ${_dir}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
configure_file("${BINDINGS_SRC_DIR}/bindings.txt.in" "${BINDINGS_BUILD_DIR}/bindings.txt")
|
||||
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
||||
|
@ -7,7 +7,7 @@ typesystem-file = ${BINDINGS_BUILD_DIR}/bindings.xml
|
||||
|
||||
output-directory = ${BINDINGS_BUILD_DIR}
|
||||
|
||||
include-path = ${BINDINGS_INCLUDE_DIRS}
|
||||
${BINDINGS_INCLUDE_DIR_LINES}
|
||||
|
||||
typesystem-paths = ${PYSIDE_TYPESYSTEMS}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user