From 1e8c1476d55d6d3d5651b4ac060960c68f53899e Mon Sep 17 00:00:00 2001 From: John Zimmermann Date: Wed, 29 Dec 2021 12:54:31 +0100 Subject: [PATCH] fix boost python bindung with boost 1.67+ --- CMakeLists.txt | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index beed7bbb..ed94d104 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,18 @@ endif() include(KigConfigureChecks.cmake) -find_package(BoostPython) +find_package(Boost) +find_package(PythonLibs 3.12) + +if(Boost_FOUND AND PYTHONLIBS_FOUND) + if(${Boost_VERSION} GREATER 106699 OR ${Boost_VERSION} VERSION_GREATER_EQUAL 1.67) + message("Searching for python boost") + find_package(Boost COMPONENTS python312 REQUIRED) + set(Boost_PYTHON_LIBRARY ${Boost_PYTHON312_LIBRARY}) + else() + find_package(Boost COMPONENTS python) + endif() +endif(Boost_FOUND AND PYTHONLIBS_FOUND) add_subdirectory( doc ) add_subdirectory( icons ) @@ -61,10 +72,10 @@ add_subdirectory( macros ) add_subdirectory( data ) add_subdirectory( pykig ) -if(BoostPython_FOUND) +if(Boost_PYTHON312_FOUND AND PYTHONLIBS_FOUND) add_subdirectory( scripting ) add_definitions(-DKIG_ENABLE_PYTHON_SCRIPTING) -endif(BoostPython_FOUND) +endif(Boost_PYTHON312_FOUND AND PYTHONLIBS_FOUND) set_package_properties( BoostPython PROPERTIES @@ -85,9 +96,10 @@ set_package_properties( feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) include_directories( ${CMAKE_SOURCE_DIR}/modes ) -if(BoostPython_FOUND) - include_directories(${BoostPython_INCLUDE_DIRS}) -endif(BoostPython_FOUND) +if(Boost_PYTHON312_FOUND OR Boost_PYTHON_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + include_directories(${PYTHON_INCLUDE_PATH}) +endif(Boost_PYTHON312_FOUND OR Boost_PYTHON_FOUND) # kigpart @@ -225,7 +237,7 @@ ki18n_wrap_ui(kigpart_PART_SRCS misc/kigcoordinateprecisiondialog.ui ) -if(BoostPython_FOUND) +if(Boost_PYTHON312_FOUND OR Boost_PYTHON_FOUND) set(kigpart_PART_SRCS ${kigpart_PART_SRCS} modes/popup/scriptactionsprovider.cc scripting/newscriptwizard.cc @@ -236,7 +248,7 @@ if(BoostPython_FOUND) ) kde_source_files_enable_exceptions(scripting/python_scripter.cc) -endif(BoostPython_FOUND) +endif(Boost_PYTHON312_FOUND OR Boost_PYTHON_FOUND) add_library(kigpart MODULE ${kigpart_PART_SRCS}) @@ -258,9 +270,10 @@ target_link_libraries(kigpart ${KDE5_KUTILS_LIBS} ) -if(BoostPython_FOUND) - target_link_libraries(kigpart ${BoostPython_LIBRARIES} ${KDE5_KTEXTEDITOR_LIBS}) -endif(BoostPython_FOUND) +if(Boost_PYTHON312_FOUND OR Boost_PYTHON_FOUND) + message("testing") + target_link_libraries(kigpart ${PYTHON_LIBRARIES} ${Boost_PYTHON_LIBRARY} ${KDE5_KTEXTEDITOR_LIBS}) +endif(Boost_PYTHON312_FOUND OR Boost_PYTHON_FOUND) if (Qt5XmlPatterns_FOUND) target_link_libraries(kigpart Qt5::XmlPatterns) -- 2.34.1