Building PySide on macOS: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
'''English''' [http://qt-devnet.developpez.com/tutoriels/python/pyside/installer/?page=osx#VIII French] ''[qt-devnet.developpez.com]''
[[Category:LanguageBindings::PySide]]


=Building PySide on OS X=
'''English''' "French":http://qt-devnet.developpez.com/tutoriels/python/pyside/installer/?page=osx#VIII


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|PySide_CMake_Primer]] before going further.
= Building PySide on OS X =


==Getting the source code==
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.


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] ''[qt.gitorious.org]''.
== Getting the source code ==


==Prerequisites==
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 "Gitorious repository":http://qt.gitorious.org/pyside.


* [http://developer.apple.com/technologies/tools/xcode.html Xcode – Developer Tools] ''[developer.apple.com]'' Follow the instructions on the site to install
== Prerequisites ==
* CMake &gt;= 2.6.0 (<span class="caps">OBS</span>: cmake 2.8.2 does not work for me with python2.7)
 
** [http://www.cmake.org/files/v2.6/cmake-2.6.4-Darwin-universal.dmg CMake 2.6.4] ''[cmake.org]''
* &quot;Xcode - Developer Tools&amp;quot;:http://developer.apple.com/technologies/tools/xcode.html Follow the instructions on the site to install
* CMake &gt;= 2.6.0 (OBS: cmake 2.8.2 does not work for me with python2.7)  
** &quot;CMake 2.6.4&amp;quot;:http://www.cmake.org/files/v2.6/cmake-2.6.4-Darwin-universal.dmg
* Qt libraries and development headers &gt;= 4.6 (preferably the latest stable release)
* Qt libraries and development headers &gt;= 4.6 (preferably the latest stable release)
** [http://qt.nokia.com/downloads/sdk-mac-os-cpp Qt 4.7] ''[qt.nokia.com]''
** &quot;Qt 4.7&amp;quot;:http://qt.nokia.com/downloads/sdk-mac-os-cpp
* Python libraries and development headers &gt;= 2.5 (for shiboken and pyside)
* Python libraries and development headers &gt;= 2.5 (for shiboken and pyside)
** [http://www.python.org/ftp/python/2.7/python-2.7-macosx10.5.dmg Python 2.7] ''[python.org]''
** &quot;Python 2.7&amp;quot;:http://www.python.org/ftp/python/2.7/python-2.7-macosx10.5.dmg
* Optional
* Optional
** Git (necessary to get the source code)
** Git (necessary to get the source code)
*** [http://git-osx-installer.googlecode.com/files/git-1.7.3.1-intel-leopard.dmg Git 1.7] ''[git-osx-installer.googlecode.com]''
*** &quot;Git 1.7&amp;quot;:http://git-osx-installer.googlecode.com/files/git-1.7.3.1-intel-leopard.dmg
** (Documentation) libxml2 and development headers &gt;= 2.6.32 (for apiextractor only)
** (Documentation) libxml2 and development headers &gt;= 2.6.32 (for apiextractor only)
** (Documentation) libxslt and development headers &gt;= 1.1.19 (for apiextractor only)
** (Documentation) libxslt and development headers &gt;= 1.1.19 (for apiextractor only)


==Building and installing==
== Building and installing ==


To build the components, follow the instructions in [[PySide CMake Primer|PySide_CMake_Primer]] for every source code package (apiextractor, generatorrunner, shiboken, pyside).
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:
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:


Remember:<br /> If you are installing the libs in a non default system dir you need specify this new location using the var ‘<span class="caps">DYLD</span>_LIBRARY_PATH’:
<code><br />mkdir build<br />cd build<br />cmake ..<br />make<br />sudo make install<br /></code>


===Some flags you can use on cmake command===
Remember:<br />If you are installing the libs in a non default system dir you need specify this new location using the var 'DYLD_LIBRARY_PATH':


* -<span class="caps">DCMAKE</span>_BUILD_TYPE=[Release|Debug]<br /> This can be used to specify which kind of library do you want, if you are only using PySide use Release
<code><br />export DYLD_LIBRARY_PATH=~/work/install/lib<br /></code>


* -<span class="caps">DCMAKE</span>_INSTALL_PREFIX=[Prefix]<br /> Used to specify a different install directory (Remember to export <span class="caps">DYLD</span>_LIBRARY_PATH to the same location)
=== Some flags you can use on cmake command ===


* -<span class="caps">DALTERNATIVE</span>_QT_INCLUDE_DIR=[Qt Include dir] (I use: /Library/Frameworks/)<br /> 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.
* -DCMAKE_BUILD_TYPE=[Release|Debug]<br />This can be used to specify which kind of library do you want, if you are only using PySide use Release


* -<span class="caps">DSITE</span>_PACKAGE=[Site packages dir] (i.e., /Library/Python/2.6/site-packages)<br /> Use this flag to specify the Python site-packages directory where ‘make install’ will install the packages.
* -DCMAKE_INSTALL_PREFIX=[Prefix]<br />Used to specify a different install directory (Remember to export DYLD_LIBRARY_PATH to the same location)


===Categories:===
* -DALTERNATIVE_QT_INCLUDE_DIR=[Qt Include dir] (I use: /Library/Frameworks/)<br />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.


* [[:Category:LanguageBindings|LanguageBindings]]
* -DSITE_PACKAGE=[Site packages dir] (i.e., /Library/Python/2.6/site-packages)<br />Use this flag to specify the Python site-packages directory where 'make install' will install the packages.
** [[:Category:LanguageBindings::PySide|PySide]]

Revision as of 14:46, 23 February 2015


English "French&quot;:http://qt-devnet.developpez.com/tutoriels/python/pyside/installer/?page=osx#VIII

Building PySide on OS X

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 "Gitorious repository&quot;:http://qt.gitorious.org/pyside.

Prerequisites

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:

<br />mkdir build<br />cd build<br />cmake ..<br />make<br />sudo make install<br />

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':

<br />export DYLD_LIBRARY_PATH=~/work/install/lib<br />

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.