Compile on MacOS/fr: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
Line 1: Line 1:
Cette page explique comment compiler le dernier code source de FreeCAD sur MAC OS X.
This page explains how to compile the latest FreeCAD source code on Mac OS X.


== Prérequis ==
== Prerequisites ==
First of all, you will need to install the following software.
Tout d'abord, vous allez avoir besoin d'installer les logiciels suivants.


=== Xcode Development Tools ===
=== Xcode Development Tools ===
À moins que vous ne souhaitiez utiliser l'IDE Xcode pour le développement de FreeCAD, vous n'avez besoin d'installer que les outils de Ligne de Commande (Command Line Tools). Pour faire ça sur 10.9 ou plus récent, ouvrez un Terminal, lancer la commande suivante puis cliquer sur Installer dans la boîte de dialogue qui s'affiche.
Unless you want to use the Xcode IDE for FreeCAD development, you will only need to install the Command Line Tools. To do this on 10.9 and later, open Terminal, run the following command, and then click Install in the dialog that comes up.
<pre>
<pre>
xcode-select --install
xcode-select --install
</pre>
</pre>
Pour les autres version de OS X, vous pouvez avoir le paquet des sur la [https://developer.apple.com/downloads/index.action?q=xcode page de téléchargement] des développeurs Apple (connectez vous avec le même ID Apple que vous utilisez sur d'autre services d'Apple). Techniquement vous avez besoin de télécharger Development Tools 3.2 pour OS X 10.6, et Commande Line Tools 4.8 pour OS X 10.8.
For other versions of OS X, you can get the package from the Apple developer [https://developer.apple.com/downloads/index.action?q=xcode downloads page] (sign in with the same Apple ID you use for other Apple services). Specifically, you will need to download Development Tools 3.2 for OS X 10.6, and Command Line Tools 4.8 for OS X 10.8.


=== CMake ===
=== Package Manager ===
You will want to use a package manager to install prerequisite software, this page gives instructions for two of the common package managers in use for OS X: [http://brew.sh/ Homebrew] and [https://www.macports.org/ MacPorts]. It's easiest to pick one package manager for your system, and not have multiple package managers installed concurrently.
Installez la dernière version de CMake depuis http://www.cmake.org/download. Bien que Homebrew installe aussi CMake, il n'installe que l’exécutable de la ligne de commande.


=== Homebrew ===
==== Homebrew ====
Pour installer Homebrew, entrer ce qui suit dans un terminal :
To install Homebrew, enter the following in Terminal:
<pre>
<pre>
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
</pre>
</pre>

== Récupérer les sources ==
==== MacPorts ====
Dans ce guide, les dossiers source et build sont créés dans '''/Users/username/FreeCAD''', mais vous pouvez bien sur utiliser le dossier que vous voulez.
To install MacPorts, follow the instructions [https://www.macports.org/install.php from their website]

=== CMake ===
FreeCAD uses [http://www.cmake.org/ CMake] to build the source. Homebrew and MacPorts can install the command line version of CMake, or if you prefer using a GUI application, install the latest version from http://www.cmake.org/download.

For the command line version of CMake, from a terminal use either Homebrew:
<pre>
<pre>
brew install cmake
mkdir ~/FreeCAD
cd ~/FreeCAD
</pre>
</pre>
or MacPorts:
Pour télécharger le code source de FreeCAD, lancer :
<pre>
<pre>
sudo port install cmake
git clone git://git.code.sf.net/p/free-cad/code FreeCAD-git
</pre>
</pre>
== Installing the Dependencies ==
Une alternative est d'utiliser le mirroir Github : https://github.com/FreeCAD/FreeCAD_sf_master.git
All of the needed libraries can be installed using either Homebrew or MacPorts.


== Installer les dépendances ==
=== Homebrew Dependencies ===
Toutes les librairies nécessaires peuvent être installer avec Homebrew.
<pre>
<pre>
brew tap homebrew/science
brew tap homebrew/science
Line 40: Line 45:
brew install --HEAD pivy
brew install --HEAD pivy
</pre>
</pre>
== Compiler FreeCAD ==
=== MacPorts Dependencies ===
<pre>
En premier, créez un nouveau dossier pour le build :
sudo port install boost eigen3 freetype oce py27-pyside-tools xercesc Coin
</pre>
== Getting the source ==
In this guide, the source and build folders are created in '''/Users/username/FreeCAD''', but you can of course use whatever folder you want.
<pre>
mkdir ~/FreeCAD
cd ~/FreeCAD
</pre>
To get the FreeCAD source code, run:
<pre>
git clone git://git.code.sf.net/p/free-cad/code FreeCAD-git
</pre>
Alternatively, you can use the github mirror: https://github.com/FreeCAD/FreeCAD_sf_master.git

== Building FreeCAD ==
First, create a new folder for the build:
<pre>
<pre>
mkdir ~/FreeCAD/build
mkdir ~/FreeCAD/build
</pre>
</pre>
Now you will need to run CMake to generate the build files. Several options will need to be given to CMake, which can be accomplished either with the CMake GUI application, or via the command line.
Maintenant vous allez devoir lancer CMake pour générer les fichiers de build. Ouvrez l'application CMake et remplissez les chemins des dossiers source et build. Dans ce cas ce devrait être : '''/Users/username/FreeCAD/FreeCAD-git''' pour les sources, et '''/Users/username/FreeCAD/build''' pour le dossier de build.


=== CMake Options ===
Ensuite, cliquer sur le bouton "Configure". Cela fait apparaître une boîte de dialogue demandant de spécifier quel générateur utiliser. Laisser le choix par défaut (''Unix Makefiles'''). La configuration va échouer la première fois car il y a quelques options qui doivent être changés. Note : il faut cocher la case '''Advanced''' pour voir toutes les options.
These instructions are valid for FreeCAD from 25 March 2015, previously several options needed to be manually specified, see the history for this page.


{| class="wikitable" style="text-align:left"
{| class="wikitable" style="text-align:left"
|-
|-
! Nom de l'option !! Valeur !! Notes
! Name !! Value !! Notes
|-
|-
| BUILD_ROBOT || OFF (unchecked) || Puisque depuis le 19/12/2014, le module Robot échoue à la compilation avec la dernière version de clang (OS X 10.9 et suivant)
| BUILD_ROBOT || 0 (unchecked) || As of 12/19/2014, the robot module fails to build using newer versions of clang (OS X 10.9 and later)
|-
|-
| CMAKE_BUILD_TYPE || Release ||
| CMAKE_BUILD_TYPE || Release ||
|-
|-
| FREECAD_USE_EXTERNAL_PIVY || ON (checked) ||
| FREECAD_USE_EXTERNAL_PIVY || 1 (checked) || Homebrew only
|-
|-
| FREETYPE_INCLUDE_DIR_freetype2 || /usr/local/include/freetype2 || Seulement si vous utilisez une version de CMake plus vielle que la 3.1.0
| FREETYPE_INCLUDE_DIR_freetype2 || /usr/local/include/freetype2 for Homebrew, /opt/local/include/freetype2 for MacPorts|| Only CMake version older than 3.1.0
|-
|-
| OCE_DIR || /usr/local/Cellar/oce/0.16.1/OCE.framework/Versions/0.16/Resources ||
|-
| PYSIDERCC4BINARY || /usr/local/bin/pyside-rcc ||
|-
| PYSIDEUIC4BINARY || /usr/local/bin/pyside-uic ||
|-
| PYTHON_EXECUTABLE || /usr/local/bin/python ||
|-
| PYTHON_INCLUDE_DIR || /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 ||
|-
| PYTHON_LIBRARY || /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib ||
|-
|}
|}


Note : les chemins pour OCE et Python sont pour les versions respectives 0.16.1 et 2.7.9 -- à changer si besoin.


=== CMake GUI ===
Maintenant cliquer sur '''Configure''' une nouvelle fois puis cliquer sur '''Generate'''.
Open the CMake app, and fill in the source and build folder fields. In this case, it would be '''/Users/username/FreeCAD/FreeCAD-git''' for the source, and '''/Users/username/FreeCAD/build''' for the build folder.


Next, click the '''Configure''' button to populate the list of configuration options. This will display a dialog asking you to specify what generator to use. Leave it at the default '''Unix Makefiles.''' Configuring will fail the first time because there are some options that need to be changed. Note: You will need to check the '''Advanced''' checkbox to get all of the options.
Enfin, lancer la commande '''make''' pour compiler FreeCAD.

Set options from the table above, then click '''Configure''' again and then '''Generate'''.
=== CMake command line ===
Open a terminal, cd in to the build directory that was created above. Run cmake with options from the table above, following the formula -D(Name)="(Value)", and the path to your FreeCAD source directory as the final argument.
<pre>
$cd ~/FreeCAD/build
$cmake -DBUILD_ROBOT="0" ...options continue... -DPYTHON_LIBRARY="/some/path/" ../FreeCAD-git
</pre>
=== Make ===
Finally, from a terminal run '''make''' to compile FreeCAD.
<pre>
<pre>
cd ~/FreeCAD/build
cd ~/FreeCAD/build
make –j3
make –j3
</pre>
</pre>
The -j option specifies how many make processes to run at once. One plus the number of CPU cores is usually a good number to use. However, if compiling fails for some reason, it is useful to rerun make without the -j option, so that you can see exactly where the error occurred.
L'option -j spécifie combien de processeur sont utilisé en même temps. Un plus le nombre cœurs de CPU est généralement un bon nombre à utiliser. Cependant si la compilation échoue pour quelque raison que ce soit, lancer la commande sans l'option -j permet de voir où survient l'erreur.


Si la commande se termine sans erreurs, vous pouvez maintenant lancer FreeCAD, toujours depuis le terminal avec la commande suivante '''./bin/FreeCAD''', ou en double cliquant sur l’exécutable dans Finder.
If make finishes without any errors, you can now launch FreeCAD, either from Terminal with '''./bin/FreeCAD''', or by double clicking the executable in Finder.

== Créer un paquet ==
== Updating ==
TODO
FreeCAD development happens fast; everyday or so there are bug fixes or new features. To get these changes, run:
== Mettre à jour ==
Le développement de FreeCAD est rapide, tout les jours ou presque il y a des correction de bugs ou de nouvelles fonctionnalités. Pour récupérer les mises à jours, lancer :
<pre>
<pre>
cd ~/FreeCAD/FreeCAD-git
cd ~/FreeCAD/FreeCAD-git
git pull
git pull
</pre>
</pre>
And then repeat the compile step above.
Puis lancer les étapes de la compilation vu ci dessus.

== Problèmes ==
== Troubleshooting ==
TODO

=== Fortran ===
''"No CMAKE_Fortran_COMPILER could be found."'' during configuration - Older versions of FreeCAD will need a fortran compiler installed. With Homebrew, do "brew install gcc" and try configuring again, for Macports, do "sudo port install gcc49" and give cmake the path to Fortran ie -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.9 . Or, preferably use a more current version of FreeCAD source!

{{docnav|CompileOnUnix|Third Party Libraries}}
{{docnav|CompileOnUnix|Third Party Libraries}}


[[Category:Developer Documentation/fr]]
[[Category:Developer Documentation]]


{{clear}}
{{clear}}

Revision as of 20:35, 3 April 2015

This page explains how to compile the latest FreeCAD source code on Mac OS X.

Prerequisites

First of all, you will need to install the following software.

Xcode Development Tools

Unless you want to use the Xcode IDE for FreeCAD development, you will only need to install the Command Line Tools. To do this on 10.9 and later, open Terminal, run the following command, and then click Install in the dialog that comes up.

xcode-select --install

For other versions of OS X, you can get the package from the Apple developer downloads page (sign in with the same Apple ID you use for other Apple services). Specifically, you will need to download Development Tools 3.2 for OS X 10.6, and Command Line Tools 4.8 for OS X 10.8.

Package Manager

You will want to use a package manager to install prerequisite software, this page gives instructions for two of the common package managers in use for OS X: Homebrew and MacPorts. It's easiest to pick one package manager for your system, and not have multiple package managers installed concurrently.

Homebrew

To install Homebrew, enter the following in Terminal:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

MacPorts

To install MacPorts, follow the instructions from their website

CMake

FreeCAD uses CMake to build the source. Homebrew and MacPorts can install the command line version of CMake, or if you prefer using a GUI application, install the latest version from http://www.cmake.org/download.

For the command line version of CMake, from a terminal use either Homebrew:

brew install cmake

or MacPorts:

sudo port install cmake

Installing the Dependencies

All of the needed libraries can be installed using either Homebrew or MacPorts.

Homebrew Dependencies

brew tap homebrew/science
brew tap sanelson/freecad
brew install boost eigen freetype oce python qt pyside pyside-tools xerces-c
brew install --without-framework --without-soqt sanelson/freecad/coin
brew install --HEAD pivy

MacPorts Dependencies

sudo port install boost eigen3 freetype oce py27-pyside-tools xercesc Coin

Getting the source

In this guide, the source and build folders are created in /Users/username/FreeCAD, but you can of course use whatever folder you want.

mkdir ~/FreeCAD
cd ~/FreeCAD

To get the FreeCAD source code, run:

git clone git://git.code.sf.net/p/free-cad/code FreeCAD-git

Alternatively, you can use the github mirror: https://github.com/FreeCAD/FreeCAD_sf_master.git

Building FreeCAD

First, create a new folder for the build:

mkdir ~/FreeCAD/build

Now you will need to run CMake to generate the build files. Several options will need to be given to CMake, which can be accomplished either with the CMake GUI application, or via the command line.

CMake Options

These instructions are valid for FreeCAD from 25 March 2015, previously several options needed to be manually specified, see the history for this page.

Name Value Notes
BUILD_ROBOT 0 (unchecked) As of 12/19/2014, the robot module fails to build using newer versions of clang (OS X 10.9 and later)
CMAKE_BUILD_TYPE Release
FREECAD_USE_EXTERNAL_PIVY 1 (checked) Homebrew only
FREETYPE_INCLUDE_DIR_freetype2 /usr/local/include/freetype2 for Homebrew, /opt/local/include/freetype2 for MacPorts Only CMake version older than 3.1.0


CMake GUI

Open the CMake app, and fill in the source and build folder fields. In this case, it would be /Users/username/FreeCAD/FreeCAD-git for the source, and /Users/username/FreeCAD/build for the build folder.

Next, click the Configure button to populate the list of configuration options. This will display a dialog asking you to specify what generator to use. Leave it at the default Unix Makefiles. Configuring will fail the first time because there are some options that need to be changed. Note: You will need to check the Advanced checkbox to get all of the options.

Set options from the table above, then click Configure again and then Generate.

CMake command line

Open a terminal, cd in to the build directory that was created above. Run cmake with options from the table above, following the formula -D(Name)="(Value)", and the path to your FreeCAD source directory as the final argument.

$cd ~/FreeCAD/build
$cmake -DBUILD_ROBOT="0" ...options continue... -DPYTHON_LIBRARY="/some/path/" ../FreeCAD-git

Make

Finally, from a terminal run make to compile FreeCAD.

cd ~/FreeCAD/build
make –j3

The -j option specifies how many make processes to run at once. One plus the number of CPU cores is usually a good number to use. However, if compiling fails for some reason, it is useful to rerun make without the -j option, so that you can see exactly where the error occurred.

If make finishes without any errors, you can now launch FreeCAD, either from Terminal with ./bin/FreeCAD, or by double clicking the executable in Finder.

Updating

FreeCAD development happens fast; everyday or so there are bug fixes or new features. To get these changes, run:

cd ~/FreeCAD/FreeCAD-git
git pull

And then repeat the compile step above.

Troubleshooting

Fortran

"No CMAKE_Fortran_COMPILER could be found." during configuration - Older versions of FreeCAD will need a fortran compiler installed. With Homebrew, do "brew install gcc" and try configuring again, for Macports, do "sudo port install gcc49" and give cmake the path to Fortran ie -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.9 . Or, preferably use a more current version of FreeCAD source!

CompileOnUnix
Third Party Libraries