mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 03:09:57 +01:00
Link Clementine against SIP and PyQt on Windows, and add the modules to python's inittab
This commit is contained in:
parent
6d98f24f30
commit
e4d9d54414
@ -42,7 +42,6 @@ find_package(OpenGL REQUIRED)
|
||||
find_package(Boost REQUIRED)
|
||||
find_package(Gettext REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(PythonLibs)
|
||||
|
||||
pkg_check_modules(TAGLIB REQUIRED taglib>=1.6)
|
||||
pkg_check_modules(GSTREAMER gstreamer-0.10)
|
||||
@ -65,6 +64,27 @@ if (WIN32)
|
||||
find_library(MSWMDM_LIBRARIES mswmdm)
|
||||
find_library(SAC_SHIM_LIBRARIES sac_shim)
|
||||
find_library(QTSPARKLE_LIBRARIES qtsparkle)
|
||||
|
||||
# FindPythonLibs.cmake doesn't look for 2.7 on lucid
|
||||
find_library(PYTHON_LIBRARIES python2.7)
|
||||
find_path(PYTHON_INCLUDE_DIRS Python.h PATH_SUFFIXES python2.7)
|
||||
if (PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS)
|
||||
set(PYTHONLIBS_FOUND ON)
|
||||
endif (PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS)
|
||||
|
||||
add_definitions(-DPy_NO_ENABLE_SHARED)
|
||||
|
||||
# Find the SIP and PyQt libraries
|
||||
find_library(SIP_LIBRARY sip)
|
||||
set(PYQT_LIB_DIR /share/python2.7/dist-packages/PyQt4)
|
||||
find_library(PYQT_QPYCORE_LIBRARY qpycore NO_DEFAULT_PATH PATHS ${PYQT_LIB_DIR})
|
||||
find_library(PYQT_QPYGUI_LIBRARY qpygui NO_DEFAULT_PATH PATHS ${PYQT_LIB_DIR})
|
||||
find_library(PYQT_QT_LIBRARY Qt NO_DEFAULT_PATH PATHS ${PYQT_LIB_DIR})
|
||||
find_library(PYQT_QTCORE_LIBRARY QtCore NO_DEFAULT_PATH PATHS ${PYQT_LIB_DIR})
|
||||
find_library(PYQT_QTGUI_LIBRARY QtGui NO_DEFAULT_PATH PATHS ${PYQT_LIB_DIR})
|
||||
find_library(PYQT_QTNETWORK_LIBRARY QtNetwork NO_DEFAULT_PATH PATHS ${PYQT_LIB_DIR})
|
||||
else (WIN32)
|
||||
find_package(PythonLibs)
|
||||
endif (WIN32)
|
||||
|
||||
if (APPLE)
|
||||
|
@ -1,10 +1,12 @@
|
||||
find_path(PYQT_SIP_DIR QtCore/qstring.sip
|
||||
PATHS /System/Library/Frameworks/Python.framework/Versions/2.6
|
||||
PATH_SUFFIXES share/sip/PyQt4
|
||||
PATH_SUFFIXES share/sip/PyQt4 share/sip ../share/sip
|
||||
)
|
||||
|
||||
find_program(SIP_BINARY "sip"
|
||||
PATHS /System/Library/Frameworks/Python.framework/Versions/2.6/bin)
|
||||
PATHS /System/Library/Frameworks/Python.framework/Versions/2.6/bin
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
)
|
||||
|
||||
macro(add_sip_binding outputvar source)
|
||||
# Work out what the SIP flags should be for PyQt4. These would normally be
|
||||
|
@ -945,6 +945,18 @@ if(HAVE_LIBINDICATE)
|
||||
endif(HAVE_LIBINDICATE)
|
||||
|
||||
if(HAVE_SCRIPTING_PYTHON)
|
||||
if(WIN32)
|
||||
target_link_libraries(clementine_lib
|
||||
${PYQT_QTCORE_LIBRARY}
|
||||
${PYQT_QTGUI_LIBRARY}
|
||||
${PYQT_QTNETWORK_LIBRARY}
|
||||
${PYQT_QT_LIBRARY}
|
||||
${PYQT_QPYGUI_LIBRARY}
|
||||
${PYQT_QPYCORE_LIBRARY}
|
||||
${SIP_LIBRARY}
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
target_link_libraries(clementine_lib ${PYTHON_LIBRARIES})
|
||||
endif(HAVE_SCRIPTING_PYTHON)
|
||||
|
||||
|
@ -32,6 +32,14 @@ PythonEngine* PythonEngine::sInstance = NULL;
|
||||
|
||||
extern "C" {
|
||||
void initclementine();
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
void initsip();
|
||||
void initQt();
|
||||
void initQtCore();
|
||||
void initQtGui();
|
||||
void initQtNetwork();
|
||||
#endif
|
||||
}
|
||||
|
||||
PythonEngine::PythonEngine(ScriptManager* manager)
|
||||
@ -90,6 +98,16 @@ Script* PythonEngine::CreateScript(const ScriptInfo& info) {
|
||||
if (!initialised_) {
|
||||
AddLogLine("Initialising python...", false);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
// On Windows we statically link against SIP and PyQt, so add those modules
|
||||
// to Python's inittab here.
|
||||
PyImport_AppendInittab(const_cast<char*>("sip"), initsip);
|
||||
PyImport_AppendInittab(const_cast<char*>("PyQt4.Qt"), initQt);
|
||||
PyImport_AppendInittab(const_cast<char*>("PyQt4.QtCore"), initQtCore);
|
||||
PyImport_AppendInittab(const_cast<char*>("PyQt4.QtGui"), initQtGui);
|
||||
PyImport_AppendInittab(const_cast<char*>("PyQt4.QtNetwork"), initQtNetwork);
|
||||
#endif
|
||||
|
||||
// Add the Clementine builtin module
|
||||
PyImport_AppendInittab(const_cast<char*>("clementine"), initclementine);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user