Compile on MacOS/ro

Overview
Această pagină descrie modul de compilare a celei mai recente surse FreeCAD pe macOS X.  Latest  înseamnă cel mai recent angajament al filialei principale a depozitului Github al FreeCAD.

These instructions have been tested on macOS Catalina with standard XCode 11.6. It is known to work on macOS BigSur Beta with XCode 12.0 beta. If you plan to use XCode Beta, please be sure to download Command Line Tools add on through a dmg package to workaround some libz dependency issues.

Această pagină servește ca un început rapid și nu intenționează să fie cuprinzătoare în ceea ce privește descrierea tuturor opțiunilor de compilare disponibile.

If you just want to evaluate the latest pre-release build of FreeCAD, you can download pre-built binaries from here.

Instalați cerințele preliminare
Următorul software trebuie instalat pentru a sprijini procesul de construire.

The following software must be installed to support the build process.

Managerul de pachete Homebrew
Homebrew este un manager de pachete de linie de comandă pentru MacOS. The Homebrew main page furnizează o linie de comandă de instalare pe care pur și simplu o inserați într-o fereastră de terminal.

Homebrew is a command line based package manager for macOS. The Homebrew main page provides an installation command line that you simply paste into a terminal window.

CMake
CMake este un instrument de complilare care construiește o configurație de complilare bazată pe variabilele pe care le specificați. Apoi, emiteți comanda "make" pentru a compila configurația respectivă. The command-line version of CMake is automatically installed as part of the Homebrew installation, above. If you prefer to use a GUI version of CMake, you can download it from here.

CMake is a build tool that generates a build configuration based on variables you specify. You then issue the 'make' command to actually build that configuration. The command-line version of CMake is automatically installed as part of the Homebrew installation, above. If you prefer to use a GUI version of CMake, you can download it from here.

Instalarea dependențelor
FreeCAD menține un "robinet" al Homebrew care instalează formulele și dependențele necesare. Eliberați următoarele comenzi de brew în terminalul dvs.

FreeCAD maintains a Homebrew 'cask' which installs the required formulas and dependencies. Issue the following brew commands in your terminal.

Notes:
 * 1) 'brew install' may take quite a while, so you may want go grab a beverage. :-)

Alternately, you can install the individual dependencies manually by installing the following packages using :


 * - Only Qt5 is currently supported, support for Qt6 is a work-in-progress
 * - Note that as of this writing (Nov. 2022) this will install an unusable version of pyside@2 as a dependency.
 * - Only Qt5 is currently supported, support for Qt6 is a work-in-progress
 * - Note that as of this writing (Nov. 2022) this will install an unusable version of pyside@2 as a dependency.
 * - Only Qt5 is currently supported, support for Qt6 is a work-in-progress
 * - Note that as of this writing (Nov. 2022) this will install an unusable version of pyside@2 as a dependency.
 * - Only Qt5 is currently supported, support for Qt6 is a work-in-progress
 * - Note that as of this writing (Nov. 2022) this will install an unusable version of pyside@2 as a dependency.
 * - Only Qt5 is currently supported, support for Qt6 is a work-in-progress
 * - Note that as of this writing (Nov. 2022) this will install an unusable version of pyside@2 as a dependency.
 * - Note that as of this writing (Nov. 2022) this will install an unusable version of pyside@2 as a dependency.
 * - Note that as of this writing (Nov. 2022) this will install an unusable version of pyside@2 as a dependency.
 * - Note that as of this writing (Nov. 2022) this will install an unusable version of pyside@2 as a dependency.

There are several packages that are only available when you have tapped the freecad cask: you must do that. Due to some historical bug workarounds, at the time of this writing (Nov. 2022) the versions of PySide2 and Shiboken2 installed by Homebrew are not usable because they force the use of Py_Limited_API, which FreeCAD does not support. It is expected that this workaround will be removed in the coming months, but in the meantime you must use the FreeCAD cask versions of PySide and Shiboken. Use, install the following packages:



You will also need to "link" PySide and Shiboken:

In some cases the packages installed by Homebrew do not use the same Python version: for example, at the time of this writing PySide2 uses Python 3.10, but boost-python3 uses Python 3.11. While it is possible to "roll back" the more advanced version (so that in this case boost-python3 uses Python 3.10) this is an advanced operation, and in many cases it is best to wait for an update to the other package. If you want to pursue that path anyway, look at the "brew extract" command, which you can use to extract a formula into a new cask (typically freecad/freecad). You can then edit that formula as needed.

You will need to set the path to Qt: Qt5 is currently supported, while support for Qt6 is a work-in-progress. Set FREECAD_QT_VERSION to "Auto" or "5" to select Qt5 (the default). On the command line, use something like:

Get the source
În instrucțiunile de mai jos, sunt create soursă și folderele compilate unele sub altele

In the following instructions, the source and build folders are created side-by-side under

but you can use whatever folders you want.

The following command will clone the FreeCAD git repository into a directory called FreeCAD-git.

Create the build folder.

Run CMake
Next, we will run CMake to generate the build configuration. Several options must be passed to CMake. The following table describes the options and gives some background.

CMake Options
Note: Command line to generate CMAKE_PREFIX_PATH:

ls -d $(brew list -1 | grep qt | tail -1 | xargs brew --cellar)/*/lib/cmake

CMake GUI
Deschideți aplicația CMake și completați câmpurile sursă și construiți dosarul. În acest exemplu, ar fi /Users/username/FreeCAD/FreeCAD-gitpentru sursă, și /Users/username/FreeCAD/build pentru construirea folderului.

Open the CMake app, and fill in the source and build folder fields. In this example, 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.

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

CMake command line
Enter the following in the terminal.

Enter the following in the terminal.

Run make
În cele din urmă, de la un terminal rulați make pentru a compila și a lega FreeCAD și a genera pachetul de aplicații.

Finally, from a terminal run make to compile and link FreeCAD, and generate the app bundle.

Opțiunea -j specifică câte procese de procesare se execută simultan. Unul plus numărul de nuclee CPU este, de obicei, un număr bun de utilizat. Cu toate acestea, dacă compilarea eșuează dintr-un motiv oarecare, este utilă reluarea efectuării fără opțiunea -j, astfel încât să puteți vedea exact unde a apărut eroarea.

A se vedea și Compiling - Speeding up.

Dacă ați finalizat fără erori, puteți lansa FreeCAD făcând dublu clic pe executabilul din Finder

Updating după Github
Dezvoltarea FreeCAD are loc rapid; aproape în fiecare zi sunt bug fixe sau noi funcionalități. Pentru a obține cele mai recente modificări, utilizați git pentru a actualiza directorul sursă (consultați Source code management), apoi re-executați CMake și parcurgeți pașii de mai sus. De obicei, nu este necesar să începeți cu un director de compliare curat în acest caz, iar compilatele ulterioare vor merge, în general, mult mai repede decât prima.

FreeCAD development happens fast; every day or so there are bug fixes or new features. To get the latest changes, use git to update the source directory (see Source code management), then re-run the CMake and make steps above. It is not usually necessary to start with a clean build directory in this case, and subsequent compiles will generally go much faster than the first one.

Compilarea cu Qt4
FreeCAD a trecut de la Qt 4 la Qt 5. Dacă trebuie să complilați cu Qt4, sunt necesari următorii pași suplimentari.

FreeCAD has transitioned from Qt 4 to Qt 5 as well as homebrew. Qt 4 is no longer available as an option for new build on macOS following Qt 5 transition. Python 2.7 has been deprecated within homebrew and upcoming macOS and we do not support it anymore for macOS build either.

Segfault on Qt5 launch
În cazul în care Qt4 a fost instalat anterior via brew, și apoi ați construit cu Qt5, puteți obține o excepție EXC_BAD_ACCESS (SEGSEGV) atunci când lansați compilarea nouli Qt5. Remedierea pentru aceasta este de a dezinstala manual Qt4.

If Qt4 was previously installed via brew, and you then build with Qt5, you may get a EXC_BAD_ACCESS (SEGSEGV) exception when launching the new Qt5 build. The fix for this is to manually uninstall Qt4.

Fortran
"No CMAKE_Fortran_COMPILER could be found." în timpul configurației - versiunile mai vechi ale FreeCAD vor trebui să compileze instalate. Cu Homebrew, procedați la "brew install gcc" și încerdați configurarea din nou, dând lui cmake cale spre Fortran ie -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.9. Sau, de preferat, utilizați o versiune mai nouă a sursei FreeCAD!

"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, giving 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!

FreeType
Atunci când se utilizează versiuni CMake mai vechi de 3.1.0, este necesar să setați variabila CMake FREETYPE_INCLUDE_DIR_freetype2 manually, eg /usr/local/include/freetype2

When using CMake versions older than 3.1.0, it's necessary to set CMake variable FREETYPE_INCLUDE_DIR_freetype2 manually, eg /usr/local/include/freetype2

Additional Build Instructions
FreeCAD can be built against the latest git master hosted on github, and launched from a CLI using libraries provided by the homebrew-freecad tap. For a complete list of build instructions see here.