Skip to content

Commit

Permalink
Don't require Python 3 for Qt5.
Browse files Browse the repository at this point in the history
Use separate ENABLE_PYTHON3 option for Python 3.
  • Loading branch information
sebastic authored and m-kuhn committed Mar 16, 2016
1 parent f8175d3 commit 81c5f25
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -678,11 +678,12 @@ ENDIF (UNIX AND NOT APPLE)
#############################################################
# Python build dependency

IF(ENABLE_QT5)
SET (ENABLE_PYTHON3 ${ENABLE_QT5} CACHE BOOL "If enabled will try to find Python 3 before looking for Python 2")
IF(ENABLE_PYTHON3)
SET(PYTHON_VER 3 CACHE STRING "Python version")
ELSE(ENABLE_QT5)
ELSE(ENABLE_PYTHON3)
SET(PYTHON_VER 2.7 CACHE STRING "Python version")
ENDIF(ENABLE_QT5)
ENDIF(ENABLE_PYTHON3)

FIND_PACKAGE(PythonInterp ${PYTHON_VER} REQUIRED)

Expand Down Expand Up @@ -720,7 +721,11 @@ IF (WITH_BINDINGS)
ENDIF (NOT BINDINGS_GLOBAL_INSTALL)

IF (WITH_CUSTOM_WIDGETS)
SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT4_MOD_DIR}/uic/widget-plugins/)
IF(ENABLE_QT5)
SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT5_MOD_DIR}/uic/widget-plugins/)
ELSE(ENABLE_QT5)
SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT4_MOD_DIR}/uic/widget-plugins/)
ENDIF(ENABLE_QT5)
ENDIF (WITH_CUSTOM_WIDGETS)

ENDIF (WITH_BINDINGS)
Expand Down
1 change: 1 addition & 0 deletions ci/travis/linux/qt5/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ cmake \
-DWITH_ASTYLE=ON \
-DWITH_SERVER=ON \
-DENABLE_QT5=ON \
-DENABLE_PYTHON3=ON \
-DCXX_EXTRA_FLAGS="$CLANG_WARNINGS" \
-DPYTHON_LIBRARY=/usr/lib/libpython3.2mu.so \
..
2 changes: 1 addition & 1 deletion cmake/FindPyQt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'pyqt_version': PyQt5.QtCore.PYQT_VERSION,
'pyqt_version_str': PyQt5.QtCore.PYQT_VERSION_STR,
'pyqt_sip_flags': PyQt5.QtCore.PYQT_CONFIGURATION['sip_flags'],
'pyqt_mod_dir': cfg.default_mod_dir,
'pyqt_mod_dir': os.path.join(cfg.default_mod_dir, "PyQt5"),
'pyqt_sip_dir': sip_dir,
'pyqt_bin_dir': cfg.default_bin_dir,
}
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindPythonLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ else(EXISTS "${PYTHON_INCLUDE_PATH}" AND EXISTS "${PYTHON_LIBRARY}" AND EXISTS "
endif("${PYTHON_CUSTOM_FRAMEWORK}" MATCHES "Python\\.framework")
endif(APPLE AND PYTHON_CUSTOM_FRAMEWORK)

IF (ENABLE_QT5)
IF (ENABLE_PYTHON3)
FIND_PACKAGE(PythonInterp 3)
ELSE (ENABLE_QT5)
ELSE (ENABLE_PYTHON3)
FIND_PACKAGE(PythonInterp 2.7)
ENDIF (ENABLE_QT5)
ENDIF (ENABLE_PYTHON3)

if(PYTHONINTERP_FOUND)
FIND_FILE(_find_lib_python_py FindLibPython.py PATHS ${CMAKE_MODULE_PATH})
Expand Down

0 comments on commit 81c5f25

Please sign in to comment.