Compile on MacOS/es

La compilación de FreeCAD en Mac no es muy diferente de los pasos a realizar en Linux u otras variantes de UNIX. El desafío más grande es realmente llegar a tener todas las dependencias instaladas. En las secciones siguientes, yo (lhagan) detallaré los pasos exactos que tuve que seguir para conseguir compilar esta aplicación sobre Leopard y Snow Leopard utilizando un Intel Mac (PowerPC debería ser factible, pero requiere la recompilación de algunas bibliotecas binarias que aún no tengo). ¿Por lo que sé, soy el único que ha construido satisfactoriamente FreeCAD sobre un Mac recientemente, así que por favor escribe en el foro de discusión si estos pasos funcionan para ti, sobre el foro de ayuda si no funcionan, o corrige esta página si encuentras errores.

Descargar las fuentes de FreeCAD
First you need to get a copy of the FreeCAD source tree. Just check out the latest revision from the Sourceforge subversion repository using this command in the terminal:

svn co http://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk freecad

This will put the FreeCAD source and related files in your home folder (~/freecad/). Location is not important if you'd rather put it somewhere else, you just need full access to the files.

Install MacPorts and Library Dependencies
Next, if you don't already have it, install MacPorts. MacPorts is a system that allows you to download, compile, and install many common open-source applications with a single command. Similar applications from the UNIX/Linux world are PKGSRC and APT. To install, just download the disk image from the MacPorts site and follow the directions:


 * http://www.macports.org/install.php

Whether or not you just installed MacPorts, you'll probably want to make sure it's up to date. Run:

sudo port selfupdate Now that MacPorts is installed and up to date, you can start installing some of FreeCAD's required packages:

The following command will compile/install all required libraries. If MacPorts produces errors, you may want to try installing them one at a time.
 * ode
 * xercesc
 * boost
 * gts
 * opencv

sudo port install ode xercesc boost gts opencv

'''On Snow Leopard, opencv does not currently build. You can, however, proceed without opencv.'''

Install Frameworks and OpenCASCADE
FreeCAD has other dependencies (see CompileOnUnix), but the rest are either included by default in OS X Leopard or can be installed using Installer packages. Download and install the following:


 * Qt		http://qt.nokia.com/downloads
 * Get the "Framework Only" version unless you plan to develop using Qt (it's much smaller). FreeCAD compiles on OS X Leopard with Qt 4.5. Installs in /Library/Frameworks and /usr/bin.


 * Coin	http://www.coin3d.org/lib/coin/releases/
 * Install Coin.pkg AND CoinTools.pkg. FreeCAD compiles on OS X Leopard with Coin 3.1.0. Installs in /Library/Frameworks.


 * SoQt	http://dl.getdropbox.com/u/103808/FreeCAD/SoQt-1.4.1.dmg
 * Install SoQt.pkg AND SoQtTools.pkg. For some reason, the SoQt framework is not provided as an official binary. For convenience, I'm providing the above compiled version. If you'd like to compile your own, download the latest source from http://www.coin3d.org/lib/soqt/releases and follow the directions in README.MACOSX. FreeCAD compiles on OS X Leopard with SoQt 1.4.1. Installs in /Library/Frameworks.


 * OpenCASCADE http://dl.getdropbox.com/u/103808/FreeCAD/OpenCASCADE_i386_6.3.0_20091128.dmg
 * The above OCC 6.3.0 binary distribution is a modified version of the one provided by the maintainers of PythonOCC http://www.pythonocc.org/. You can use the version from PythonOCC, however changes to the .la files are needed in order for the FreeCAD build process to properly link to it and you'll need to download the OCC source separately. I have not yet successfully built OpenCASCADE myself, but would like to eventually -- this would be key to providing a PowerPC distribution (if that's even possible). If you get OpenCASCADE to build on OS X, let me know how. Installs in /usr/local/lib/OCC and /usr/local/include/OCC.
 * UPDATED 2009-11-28 with fixes for Snow Leopard. If you installed OCC prior to this date, it is recommended that you manually delete the old files and install the new package.

sudo rm -r /usr/local/lib/OCC sudo rm -r /usr/local/include/OCC

Download and 'install' the FreeCAD.app template
The following archive contains an application bundle template for FreeCAD. This is not strictly necessary, but it makes working with FreeCAD more convenient than the default installation configuration. Mine is in the /Applications folder, but you should be able to put it anywhere you want -- just remember that the bundle can't be moved after FreeCAD is complied and installed (without some further modifications). Running make install using the configuration below will install into this bundle.


 * http://dl.getdropbox.com/u/103808/FreeCAD/FreeCAD_bundle_template_20091128.tar.gz
 * UPDATED 2009-11-28 with the new FreeCAD application icon

Compile
Now configure, compile, and install FreeCAD using the following commands from within the root FreeCAD folder. If you put your FreeCAD.app bundle somewhere other than /Applications (or aren't using the bundle), change the 'PREFIX' line accordingly.

./autogen.sh PREFIX=/Applications/FreeCAD.app/Contents ./configure --with-xercesc-lib=/opt/local/lib --with-xercesc-include=/opt/local/include --with-boost-lib=/opt/local/lib \ --with-boost-include=/opt/local/include --with-qt4-bin=/usr/bin --with-qt4-framework=/Library/Frameworks \ --with-occ-lib=/usr/local/lib/OCC --with-occ-include=/usr/local/include/OCC --with-coin=/Library/Frameworks \ --with-soqt=/Library/Frameworks --prefix=$PREFIX --bindir=$PREFIX/MacOS --libdir=$PREFIX/Frameworks/FreeCAD \ --includedir=$PREFIX/Resources/include --datarootdir=$PREFIX/Resources/share make LDFLAGS=-Wl,-headerpad_max_install_names make install

Depending on your machine, the make step can take quite a while.

Run
If everything went properly, double-clicking the .app bundle should start FreeCAD. If you have any issues, post the details on the help forum.