Building PySide on macOS: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:


{| class="wikitable"
|-
| style="background: #ff6961;text-align: center;"| Attention
|-
| This is a page dedicated to PySide (Qt4). For recent development on PySide2 (Qt5) and PySide6 (Qt6) refer to [[Qt for Python]]
|}


[[Category:LanguageBindings::PySide]]
[[Category:PySide]]


'''English''' [http://qt-devnet.developpez.com/tutoriels/python/pyside/installer/?page=osx#VIII French]
'''English''' [http://qt-devnet.developpez.com/tutoriels/python/pyside/installer/?page=osx#VIII French]
Line 10: Line 16:
== Getting the source code ==
== Getting the source code ==


The latest source code tarballs for the PySide components can be acquired from [[PySideDownloads]]. Alternatively, if you are interested in the latest and greatest, you might want to clone our [http://qt.gitorious.org/pyside Gitorious repository].
The latest source code tarballs for the PySide components can be acquired from [[PySideDownloads]]. Alternatively, if you are interested in the latest and greatest, you might want to clone our [http://code.qt.io/pyside code.qt.io repository].


== Prerequisites ==
== Prerequisites ==
Line 18: Line 24:
** [http://www.cmake.org/files/v2.6/cmake-2.6.4-Darwin-universal.dmg CMake 2.6.4]
** [http://www.cmake.org/files/v2.6/cmake-2.6.4-Darwin-universal.dmg CMake 2.6.4]
* Qt libraries and development headers >= 4.6 (preferably the latest stable release)
* Qt libraries and development headers >= 4.6 (preferably the latest stable release)
** [http://qt.nokia.com/downloads/sdk-mac-os-cpp Qt 4.7]
** [http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-opensource-mac-4.8.7.dmg Qt 4.8.7]
* Python libraries and development headers >= 2.5 (for shiboken and pyside)
* Python libraries and development headers >= 2.5 (for shiboken and pyside)
** [http://www.python.org/ftp/python/2.7/python-2.7-macosx10.5.dmg Python 2.7]
** [http://www.python.org/ftp/python/2.7/python-2.7-macosx10.5.dmg Python 2.7]

Latest revision as of 10:34, 24 February 2022

Attention
This is a page dedicated to PySide (Qt4). For recent development on PySide2 (Qt5) and PySide6 (Qt6) refer to Qt for Python

English French


PySide uses the CMake build system to build the source code packages. If you are not familiar with CMake, have a look at our PySide_CMake_Primer before going further.

Getting the source code

The latest source code tarballs for the PySide components can be acquired from PySideDownloads. Alternatively, if you are interested in the latest and greatest, you might want to clone our code.qt.io repository.

Prerequisites

  • Xcode - Developer Tools Follow the instructions on the site to install
  • CMake >= 2.6.0 (OBS: cmake 2.8.2 does not work for me with python2.7)
  • Qt libraries and development headers >= 4.6 (preferably the latest stable release)
  • Python libraries and development headers >= 2.5 (for shiboken and pyside)
  • Optional
    • Git (necessary to get the source code)
    • (Documentation) libxml2 and development headers >= 2.6.32 (for apiextractor only)
    • (Documentation) libxslt and development headers >= 1.1.19 (for apiextractor only)

Building and installing

To build the components, follow the instructions in PySide_CMake_Primer for every source code package (apiextractor, generatorrunner, shiboken, pyside).

In the most basic case (building with default options, installing into the /usr/local tree), running the following commands in each directory should be sufficient:

mkdir build
cd build
cmake ..
make
sudo make install

Remember: If you are installing the libs in a non default system dir you need specify this new location using the var 'DYLD_LIBRARY_PATH':

export DYLD_LIBRARY_PATH=~/work/install/lib

Some flags you can use on cmake command

  • -DCMAKE_BUILD_TYPE=[Release|Debug]

This can be used to specify which kind of library do you want, if you are only using PySide use Release

  • -DCMAKE_INSTALL_PREFIX=[Prefix]

Used to specify a different install directory (Remember to export DYLD_LIBRARY_PATH to the same location)

  • -DALTERNATIVE_QT_INCLUDE_DIR=[Qt Include dir] (I use: /Library/Frameworks/)

In cmake 2.6 version there is a problem with QT_INCLUDE_DIR exported on OS X then is recommended use this flag with '/Library/Frameworks/' to avoid generation problems.

  • -DSITE_PACKAGE=[Site packages dir] (i.e., /Library/Python/2.6/site-packages)

Use this flag to specify the Python site-packages directory where 'make install' will install the packages.