Difference between revisions of "Compiling"

From BRL-CAD
(update with instructions for the relatively new cmake build system)
(update debian deps)
Line 10: Line 10:
  
 
<pre>
 
<pre>
aptitude install build-essential cmake
+
aptitude install build-essential make cmake
aptitude install libxi-dev libncursesw5-dev libxt-dev libxslt1-dev libxmu-dev libxmu-headers byacc flex libtnt-dev libxext-dev libpng12-dev zlib1g-dev libsm-dev libx11-dev libxau-dev tk8.5-dev tcl8.5-dev tk8.4-dev tcl8.4-dev itcl3-dev
+
aptitude install sed byacc flex xsltproc
 +
aptitude install libncursesw5-dev libfontconfig-dev
 +
aptitude install xserver-xorg-dev
 +
aptitude install libx11-dev libxi-dev libxt-dev libxau-dev libxext-dev  libxmu-dev libxmu-headers
 +
aptitude install libtnt-dev libpng12-dev zlib1g-dev libsm-dev tcl8.5-dev tk8.5-dev itcl3-dev
 
</pre>
 
</pre>
  

Revision as of 11:44, 14 September 2012

Compiling BRL-CAD

BRL-CAD source files contain an INSTALL file with general instructions. This page contains simplified tips for building quickly.

Obtain Dev Tools

BRL-CAD uses the CMake build system and will compile with most compilers, so first up is to download and install it. If needed, compiling from their source distribution is actually very easy.

If you're on a Debian/Ubuntu system, you can install pretty much everything you might want with aptitude:

aptitude install build-essential make cmake
aptitude install sed byacc flex xsltproc
aptitude install libncursesw5-dev libfontconfig-dev 
aptitude install xserver-xorg-dev
aptitude install libx11-dev libxi-dev libxt-dev libxau-dev libxext-dev  libxmu-dev libxmu-headers
aptitude install libtnt-dev libpng12-dev zlib1g-dev libsm-dev tcl8.5-dev tk8.5-dev itcl3-dev

Download BRL-CAD

Release sources may be obtained from Sourceforge or directory from Subversion:

svn checkout https://brlcad.svn.sourceforge.net/svnroot/brlcad/brlcad/trunk brlcad
cd brlcad

Configure

Next, we set up a build directory and configure our compilation. BRL-CAD adhere's to a high conformance standard and considers most warnings as errors, so we turn off that strict behavior just so the build doesn't halt on trivialities.

We could add -DCMAKE_BUILD_TYPE=Release to get an optimized build or -DCMAKE_BUILD_TYPE=Debug to get one better suited for development work.

mkdir .build
cd .build
cmake .. -DBRLCAD_ENABLE_STRICT=OFF

Compile

Compilation will usually take anywhere from a couple minutes to an hour depending on your hardware. If you had a quad-core CPU, you might run '"make -j4" to request compiling in parallel.

make
make test

We run make test to see if all went well. If the build fails, it can be helpful to run make again capturing output to a log file. E.g., make > build.log 2>&1

Install

Depending on the version of sources you start with, BRL-CAD should install into /usr/brlcad/SUBDIR where SUBDIR is rel-VERSION or dev-VERSION.

sudo make install
/usr/brlcad/rel-VERSION/bin/mged

Quick test

You don't have to install, though, and can just run binaries that are in the brlcad/.build/bin directory.

bin/benchmark
bin/mged

That's it! If you have a Release compile, you can submit your benchmark results to benchmark at brlcad dot org. Be sure to check out the extensive Documentation and Main_Page for tutorials and Contributor Quickies for ways to get involved!