My favorites | Sign in
Project Home Wiki Issues Source
Search
for
Installation  
Updated Dec 22, 2011 by sloriot...@gmail.com

Prerequisites

  • CGAL version 3.9 or newer,
  • Check-out the CGAL installation manual pages for more details.
  • SWIG version 2.0 or newer,
  • Check-out the SWIG web site for more details.
  • Cmake version 2.8 or newer.
  • For compiling the Java bindings, a JDK must be available. One tested is the Sun JDK 6.26.
  • For compiling the Python bindings, Python development tools must be available. It has been tested with Python 2.6.

Step-By-Step Installation Guide

  1. Check-out the git repository at https://code.google.com/p/cgal-bindings/
  2. cmake configuration:
    1. Choose between in-source and out-of-source build:
    2. An in-source build indicates the fact that the CGAL bindings are compiled from the root of the project (that is to say from CGAL_BINDINGS_ROOT). In that case all temporary files are generated in the source tree. This prevents building the cgal bindings with different compiler options for example. An out-of-source build indicates the fact that the CGAL bindings are compiled from a dedicated directory (for example CGAL_BINDINGS_ROOT/build/CGAL-3.9_release). This type of build allows several different builds.
    3. cmake options:
    • CGAL_DIR
    • Path to the file CGALConfig.cmake created when installing/compiling CGAL. For Debian and Ubunto packages, it is /usr/lib/CGAL for example.
    • BUILD_JAVA = [ON/OFF]:
    • States whether Java bindings should be generated. The default value is ON.
    • BUILD_PYTHON = [ON/OFF]:
    • States whether Python bindings should be generated. The default value is ON.
    • JAVA_OUTDIR_PREFIX:
    • Java specific files output directory prefix; Java files and libraries will be respectively generated into JAVA_OUTDIR_PREFIX/CGAL and JAVA_OUTDIR_PREFIX/lib directories. The default is CURRENT_PATH/build-java.
    • PYTHON_OUTDIR_PREFIX:
    • Python specific files output directory prefix; Python files and libraries will be generated into PYTHON_OUTDIR_PREFIX/CGAL directory. The default is CURRENT_PATH/build-python.
    • COMMON_LIBRARIES_PATH:
    • Path where libraries common to all target languages are generated. The default is CURRENT_PATH/lib.
  3. If the cmake configuration step went fine, it only remains to compile.

Full example:

> git clone https://code.google.com/p/cgal-bindings
> cd cgal-bindings
> mkdir build/CGAL-3.9_release -p
> cd build/CGAL-3.9_release
> cmake -DCGAL_DIR=/usr/lib/CGAL -DBUILD_PYTHON=OFF -DJAVA_OUTDIR_PREFIX=../../examples/java ../..
> make -j 4
> cd ../../examples/java
> javac test_kernel.java
> export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:lib
> java test_kernel
... output of the example test_kernel.java ...
Comment by Patrick....@gmail.com, May 13, 2012

To build on Mac OS X (10.7.3), I need to specify the C/C++ compiler explicitly. I'm using Python 2.7 and Java 1.6

CC=llvm-gcc CXX=llvm-g++ cmake -DCGAL_DIR=../CGAL-4.0 -DBUILD_PYTHON=ON -DBUILD_JAVA=ON -DCGAL_CXX_FLAGS=-DCGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES .

Comment by Patrick....@gmail.com, May 13, 2012

For Java examples on OS X, I need to specify the Java classpath when compiling, and also set DYLD_LIBRARY_PATH (rather than LD_LIBRARY_PATH) when executing, e.g.:

    cd examples/java
    export CLASSPATH=.:/Users/pds/tools/cgal-bindings/build-java/ 
    javac test_kernel.java 
    export DYLD_LIBRARY_PATH=/Users/pds/tools/cgal-bindings/build-java/lib 
    java test_kernel

For Python examples, I set the Python search path using:

    cd examples/python 
    export PYTHONPATH=/Users/pds/tools/cgal-bindings/build-python/ 
    python test_aabb.py

Sign in to add a comment
Powered by Google Project Hosting