Skip to content

Commit 8a2e97e

Browse files
committed
Add CGAL setup script for header-only installation
1 parent 17e987d commit 8a2e97e

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

scripts/setup/cgal.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
# CGAL setup script - downloads and installs CGAL header-only library
3+
# CGAL 5.x is header-only and only requires Boost headers
4+
5+
set -e
6+
7+
cd "$CODE/external" || exit 1
8+
9+
CGAL_VERSION="5.6.1"
10+
CGAL_DIR="CGAL-${CGAL_VERSION}"
11+
CGAL_INSTALL="$CODE/external/cgal"
12+
13+
if [ ! -d "$CGAL_INSTALL/include/CGAL" ]; then
14+
echo "Fetching and installing CGAL ${CGAL_VERSION}..."
15+
16+
# Download CGAL
17+
if [ ! -d "$CGAL_DIR" ]; then
18+
echo "Downloading CGAL ${CGAL_VERSION}..."
19+
curl -L "https://github.com/CGAL/cgal/releases/download/v${CGAL_VERSION}/CGAL-${CGAL_VERSION}.tar.xz" -o "CGAL-${CGAL_VERSION}.tar.xz"
20+
tar xf "CGAL-${CGAL_VERSION}.tar.xz"
21+
rm "CGAL-${CGAL_VERSION}.tar.xz"
22+
fi
23+
24+
# Create install directory structure
25+
mkdir -p "$CGAL_INSTALL"
26+
27+
# CGAL 5.x is header-only, just copy headers and cmake files
28+
echo "Installing CGAL headers..."
29+
cp -r "$CGAL_DIR/include" "$CGAL_INSTALL/"
30+
31+
# Copy CMake configuration files
32+
mkdir -p "$CGAL_INSTALL/lib/cmake/CGAL"
33+
cp -r "$CGAL_DIR/lib/cmake/CGAL/"* "$CGAL_INSTALL/lib/cmake/CGAL/"
34+
35+
# Clean up source directory
36+
rm -rf "$CGAL_DIR"
37+
38+
echo "CGAL ${CGAL_VERSION} installed to $CGAL_INSTALL"
39+
else
40+
echo "CGAL already installed at $CGAL_INSTALL"
41+
fi
42+
43+
# Print usage instructions
44+
echo ""
45+
echo "To use CGAL with CMake, add to your cmake command:"
46+
echo " -DCGAL_DIR=$CGAL_INSTALL/lib/cmake/CGAL"
47+
echo ""
48+
echo "Or set environment variable:"
49+
echo " export CGAL_DIR=$CGAL_INSTALL/lib/cmake/CGAL"

0 commit comments

Comments
 (0)