texworks/texworks-cmake-find-python.patch
Martin Pluskal c3bf2766ce Accepting request 1146260 from home:badshah400:branches:Publishing
* Update to version 0.6.9.
* Switch over to Qt6 builds.
* Disable python bindings over compilation errors (gh#TeXworks/texworks#1038).
* Add texworks-cmake-find-python.patch: cmake has dropped support for PythonInterp and PythonLibs, use FindPython instead (gh#TeXworks/texworks#1039).

OBS-URL: https://build.opensuse.org/request/show/1146260
OBS-URL: https://build.opensuse.org/package/show/Publishing/texworks?expand=0&rev=26
2024-02-13 09:40:32 +00:00

101 lines
4.5 KiB
Diff

Index: texworks-release-0.6.9/CMakeLists.txt
===================================================================
--- texworks-release-0.6.9.orig/CMakeLists.txt
+++ texworks-release-0.6.9/CMakeLists.txt
@@ -326,17 +326,14 @@ ENDIF()
IF ( WITH_PYTHON )
IF ( USE_SYSTEM_PYTHON )
- SET(PYTHON_LIBRARIES "-F/System/Library/Frameworks -framework Python" CACHE PATH "Python library.")
- SET(PYTHON_INCLUDE_DIR "/System/Library/Framework/Python.framework/Headers" CACHE PATH "Python framework.")
- MARK_AS_ADVANCED(PYTHON_LIBRARIES)
- MARK_AS_ADVANCED(PYTHON_INCLUDE_DIR)
- SET(PYTHONLIBS_FOUND TRUE)
+ SET(Python_LIBRARIES "-F/System/Library/Frameworks -framework Python" CACHE PATH "Python library.")
+ SET(Python_INCLUDE_DIR "/System/Library/Framework/Python.framework/Headers" CACHE PATH "Python framework.")
+ MARK_AS_ADVANCED(Python_LIBRARIES)
+ MARK_AS_ADVANCED(Python_INCLUDE_DIR)
+ SET(Python_Interpreter_FOUND TRUE)
+ SET(Python_Development_FOUND TRUE)
ELSE ()
- # **NOTE**
- # In order to find the correct version of 'PythonLibs', it seems that we need to run 'FIND_PACKAGE(PythonInterp)' firstly.
- # In order to find the correct version of 'PythonInterp', we need to set 'PYTHONHOME' environment variable
- FIND_PACKAGE(PythonInterp)
- FIND_PACKAGE(PythonLibs)
+ FIND_PACKAGE(Python COMPONENTS Interpreter Development)
ENDIF ()
ENDIF()
@@ -344,7 +341,7 @@ IF ( LUA_FOUND AND WITH_LUA AND NOT ${BU
ADD_DEFINITIONS(-DQT_STATICPLUGIN -DSTATIC_LUA_SCRIPTING_PLUGIN)
ENDIF ()
-IF ( PYTHONLIBS_FOUND AND WITH_PYTHON AND NOT ${BUILD_SHARED_PLUGINS})
+IF ( Python_Interpreter_FOUND AND Python_Development_FOUND AND WITH_PYTHON AND NOT ${BUILD_SHARED_PLUGINS})
ADD_DEFINITIONS(-DQT_STATICPLUGIN -DSTATIC_PYTHON_SCRIPTING_PLUGIN)
ENDIF ()
@@ -406,7 +403,7 @@ IF ( LUA_FOUND AND WITH_LUA )
ADD_SUBDIRECTORY(${TeXworks_SOURCE_DIR}/plugins-src/TWLuaPlugin)
ENDIF ()
-IF ( PYTHONLIBS_FOUND AND WITH_PYTHON )
+IF ( Python_Interpreter_FOUND AND Python_Development_FOUND AND WITH_PYTHON )
ADD_SUBDIRECTORY(${TeXworks_SOURCE_DIR}/plugins-src/TWPythonPlugin)
ENDIF ()
@@ -509,7 +506,7 @@ IF ( WITH_LUA )
CONFIG_VERSION("Lua" "${LUA_VERSION_STRING}")
ENDIF()
if (WITH_PYTHON)
- CONFIG_VERSION("Python" "${PYTHON_VERSION_STRING}")
+ CONFIG_VERSION("Python" "${Python_VERSION}")
endif()
CONFIG_VERSION("Qt" ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH})
CONFIG_VERSION("SyncTeX" "${SYNCTEX_VERSION_STRING}")
@@ -520,7 +517,7 @@ message(" Scripting")
CONFIG_YESNO(" ECMA scripting" ON)
CONFIG_YESNO(" QtScript scripting" WITH_QTSCRIPT)
CONFIG_YESNO(" Lua scripting plugin" LUA_FOUND)
-CONFIG_YESNO(" Python scripting plugin" PYTHONLIBS_FOUND)
+CONFIG_YESNO(" Python scripting plugin" Python_Development_FOUND)
message("")
CONFIG_INFO("Build ID" ${TW_BUILD_ID})
Index: texworks-release-0.6.9/plugins-src/TWPythonPlugin/CMakeLists.txt
===================================================================
--- texworks-release-0.6.9.orig/plugins-src/TWPythonPlugin/CMakeLists.txt
+++ texworks-release-0.6.9/plugins-src/TWPythonPlugin/CMakeLists.txt
@@ -37,13 +37,13 @@ if (NOT MSVC)
target_compile_options(TWPythonPlugin PRIVATE -Wno-old-style-cast)
endif ()
-target_include_directories(TWPythonPlugin SYSTEM PRIVATE ${PYTHON_INCLUDE_DIRS})
+target_include_directories(TWPythonPlugin SYSTEM PRIVATE ${Python_INCLUDE_DIRS})
target_include_directories(TWPythonPlugin PRIVATE ${TeXworks_SOURCE_DIR}/src)
# Specify link libraries even if the plugin is built statically so all the
# interface properties of the Qt targets (include directories, lib directories,
# etc.) are available
-TARGET_LINK_LIBRARIES(TWPythonPlugin ${QT_LIBRARIES} ${PYTHON_LIBRARIES} ${TEXWORKS_ADDITIONAL_LIBS})
+TARGET_LINK_LIBRARIES(TWPythonPlugin ${QT_LIBRARIES} ${Python_LIBRARIES} ${TEXWORKS_ADDITIONAL_LIBS})
IF (${BUILD_SHARED_PLUGINS})
INSTALL(TARGETS TWPythonPlugin
LIBRARY DESTINATION ${TeXworks_PLUGIN_DIR}
Index: texworks-release-0.6.9/src/CMakeLists.txt
===================================================================
--- texworks-release-0.6.9.orig/src/CMakeLists.txt
+++ texworks-release-0.6.9/src/CMakeLists.txt
@@ -207,8 +207,8 @@ IF (NOT ${BUILD_SHARED_PLUGINS})
IF (WITH_LUA AND LUA_FOUND)
LIST(INSERT TeXworks_LIBS 0 TWLuaPlugin ${LUA_LIBRARIES})
ENDIF()
- IF (WITH_PYTHON AND PYTHONLIBS_FOUND)
- LIST(INSERT TeXworks_LIBS 0 TWPythonPlugin ${PYTHON_LIBRARIES})
+ IF (WITH_PYTHON AND Python_Development_FOUND)
+ LIST(INSERT TeXworks_LIBS 0 TWPythonPlugin ${Python_LIBRARIES})
ENDIF()
ENDIF()