Compiler sous MinGW
Ce guide explique les étapes nécessaires pour compiler FreeCAD sous Windows en utilisant l'environnement MSYS2/MinGW. Une connaissance de base avec les commandes du shell Bash sera utile pour comprendre ce que fait chaque étape, mais en suivant le guide, vous devriez obtenir une compilation fonctionnelle même si vous ne comprenez pas exactement ce que vous avez fait pour l'obtenir.
Avant de commencer
Téléchargez et installez MSYS2 si ce n'est pas déjà fait. Lorsque vous lancez MSYS2, utilisez le runtime "MSYS2 MinGW 64-bit" à moins que vous ne sachiez ce que vous faites et que vous ayez une raison spécifique de ne pas le faire. Si vous utilisez la console UCRT, veillez à adapter votre installation pour utiliser les paquets UCRT à la place.
pacman -Syu
et ensuite relancer et exécuter
pacman -Su
avant de poursuivre.
Installer les outils de développement de base
Dans toutes les étapes suivantes, lorsque l'interpréteur de commandes de MSYS2 vous le demande, acceptez les installations par défaut de tous les éléments en appuyant sur "Entrée".
Premièrement, installez la chaîne d'outils GCC mingw-w64 :
pacman -S --needed base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
Cette opération prendra probablement plusieurs minutes, car la chaîne d'outils du compilateur est assez volumineuse.
Installez git :
pacman -S git
Fermez votre fenêtre de console en cours et relancez la console MSYS2 MinGW 64 (dans une installation standard, elle se trouve dans votre menu Démarrer dans le dossier MSYS2).
Vérifier les sources de FreeCAD
Pour obtenir le code source de FreeCAD, clonez-le depuis le dépôt git principal :
git clone https://github.com/FreeCAD/FreeCAD
If you do not want to compile the latest HEAD, once you have the source you can check out a specific tag:
cd FreeCAD git checkout tags/1.0 -b releases/FreeCAD-1-0
Or a specific pull request (in this example, PR 1234):
cd FreeCAD git fetch origin pull/1234/head:pr/1234 git checkout pr/1234
Note that not all versions can be compiled on MSYS2, several changes were required to enable it and these were not present in the 0.19 or earlier versions. For example, the 0.19.3 tag will not be compilable.
Install required libraries
FreeCAD depends on many 3rd-party libraries for its functionality. They may be installed individually, or as a single unified command.
Now, install the following required dependencies using pacman:
- mingw-w64-x86_64-opencascade
- mingw-w64-x86_64-xerces-c
- mingw-w64-x86_64-qt5
- mingw-w64-x86_64-med
- mingw-w64-x86_64-swig
- mingw-w64-x86_64-qtwebkit
- mingw-w64-x86_64-coin
- mingw-w64-x86_64-python-pivy
- mingw-w64-x86_64-python-ply
- mingw-w64-x86_64-python-six
- mingw-w64-x86_64-python-yaml
- mingw-w64-x86_64-python-numpy
- mingw-w64-x86_64-python-matplotlib
- mingw-w64-x86_64-pyside2-qt5
- mingw-w64-x86_64-python-markdown
- mingw-w64-x86_64-python-pygit2
The following is a single command to install everything in the list above:
pacman -S mingw-w64-x86_64-opencascade mingw-w64-x86_64-xerces-c mingw-w64-x86_64-qt5 mingw-w64-x86_64-med mingw-w64-x86_64-swig mingw-w64-x86_64-qtwebkit mingw-w64-x86_64-coin mingw-w64-x86_64-python-pivy mingw-w64-x86_64-pyside2-qt5 mingw-w64-x86_64-python-python-ply mingw-w64-x86_64-python-six mingw-w64-x86_64-python-yaml mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-matplotlib mingw-w64-x86_64-python-markdown mingw-w64-x86_64-python-pygit2
Build FreeCAD
Make a directory for the build: note this is typically not a subdirectory of the source directory (it is often useful to be able to delete either the source or the build directory independently).
mkdir FreeCAD-build cd FreeCAD-build
Run cMake:
cmake ../FreeCAD
And finally:
cmake --build ./
- Démarrer avec FreeCAD
- Installation : Téléchargements, Windows, Linux, Mac, Logiciels supplémentaires, Docker, AppImage, Ubuntu Snap
- Bases : À propos de FreeCAD, Interface, Navigation par la souris, Méthodes de sélection, Objet name, Préférences, Ateliers, Structure du document, Propriétés, Contribuer à FreeCAD, Faire un don
- Aide : Tutoriels, Tutoriels vidéo
- Ateliers : Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test