Compiling (Speeding up)/it: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
Line 1: Line 1:
<languages/>
<languages/>
<div class="mw-translate-fuzzy">
{{docnav/it|[[Compile on MacOS/it|Compilare in Mac]]|[[Third Party Libraries/it|Librerie di terze parti]]}}
{{docnav/it|[[Compile on MacOS/it|Compilare in Mac]]|[[Third Party Libraries/it|Librerie di terze parti]]}}
</div>


FreeCAD è una grande applicazione che può richiedere da 10 minuti a un'ora per essere compilata completamente dal sorgente. Ciò dipende principalmente dalla CPU in uso e dal numero di core utilizzati nel processo di compilazione. Ecco alcuni suggerimenti per abbreviare tale processo e ridurre i tempi di costruzione.
FreeCAD è una grande applicazione che può richiedere da 10 minuti a un'ora per essere compilata completamente dal sorgente. Ciò dipende principalmente dalla CPU in uso e dal numero di core utilizzati nel processo di compilazione. Ecco alcuni suggerimenti per abbreviare tale processo e ridurre i tempi di costruzione.
Line 11: Line 13:


For example, to avoid building the FEM and Mesh workbenches:
For example, to avoid building the FEM and Mesh workbenches:

{{Code|code=
{{Code|code=
cmake -DBUILD_FEM=OFF -DBUILD_MESH=OFF ../freecad-source
cmake -DBUILD_FEM=OFF -DBUILD_MESH=OFF ../freecad-source
Line 27: Line 30:


Compile as many files in parallel as the number of CPU cores in your system. This is useful if you have many cores and want to use them all to compile the software.
Compile as many files in parallel as the number of CPU cores in your system. This is useful if you have many cores and want to use them all to compile the software.

{{code|code=
{{code|code=
make -j$(nproc)
make -j$(nproc)
Line 32: Line 36:


Compile as many files in parallel as the number of CPU cores in your system, minus two. Use this so that your system is still responsive to do some other task; for example, two cores will allow you to use a browser, while the rest of the cores keep compiling the software on the background.
Compile as many files in parallel as the number of CPU cores in your system, minus two. Use this so that your system is still responsive to do some other task; for example, two cores will allow you to use a browser, while the rest of the cores keep compiling the software on the background.

{{code|code=
{{code|code=
make -j$(nproc --ignore=2)
make -j$(nproc --ignore=2)
Line 39: Line 44:
Il programma {{incode|distcc}} può essere utilizzato per eseguire compilazioni distribuite di codice C e C++ su più macchine in una rete.
Il programma {{incode|distcc}} può essere utilizzato per eseguire compilazioni distribuite di codice C e C++ su più macchine in una rete.


<div class="mw-translate-fuzzy">
{{docnav/it|[[Compile on MacOS/it|Compilare in Mac]]|[[Third Party Libraries/it|Librerie di terze parti]]}}
{{docnav/it|[[Compile on MacOS/it|Compilare in Mac]]|[[Third Party Libraries/it|Librerie di terze parti]]}}
</div>


{{Userdocnavi/it}}
{{Userdocnavi/it}}

Revision as of 09:28, 14 November 2019

FreeCAD è una grande applicazione che può richiedere da 10 minuti a un'ora per essere compilata completamente dal sorgente. Ciò dipende principalmente dalla CPU in uso e dal numero di core utilizzati nel processo di compilazione. Ecco alcuni suggerimenti per abbreviare tale processo e ridurre i tempi di costruzione.

CCache

Installare ccache per la costruzione cache

Disabilitare i moduli

Quando si utilizza cmake per configurare la build, è possibile disabilitare la compilazione di alcuni ambienti che al momento potrebbero non essere necessari. Questo è utile se si vuole solo testare alcuni ambienti di lavoro.

For example, to avoid building the FEM and Mesh workbenches:

cmake -DBUILD_FEM=OFF -DBUILD_MESH=OFF ../freecad-source

Use cmake-gui, cmake-curses-gui, or cmake-qt-gui to display all the possible variables that can be edited in the configuration; using these interfaces you can easily switch on or off different workbenches.

Numero di lavori in parallelo

Dopo la configurazione fatta con cmake, il programma make avvia il compilatore C++ effettivo per lavorare sui file del codice sorgente. Si può velocizzare la compilazione lavorando su vari file contemporaneamente. Ciò si ottiene con l'opzione -j di make, che indica il numero di "lavori" o comandi di compilazione eseguiti contemporaneamente. Questa opzione è un numero intero.

Run four compilation commands in parallel:

make -j4

Compile as many files in parallel as the number of CPU cores in your system. This is useful if you have many cores and want to use them all to compile the software.

make -j$(nproc)

Compile as many files in parallel as the number of CPU cores in your system, minus two. Use this so that your system is still responsive to do some other task; for example, two cores will allow you to use a browser, while the rest of the cores keep compiling the software on the background.

make -j$(nproc --ignore=2)

distcc

Il programma distcc può essere utilizzato per eseguire compilazioni distribuite di codice C e C++ su più macchine in una rete.