forked from boberfly/GafferCycles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_linux_osx.sh
executable file
·88 lines (74 loc) · 2.52 KB
/
build_linux_osx.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
set -e
if [[ -z "${GAFFER_ROOT}" ]]; then
echo "ERROR : GAFFER_ROOT environment variable not set"
exit 1
fi
# Packaging variables
VERSION=0.10.2
GAFFERVERSION=0.54.2.0
if [[ -z "${GAFFER_BUILD_TYPE}" ]]; then
echo "WARNING : GAFFER_BUILD_TYPE environment variable not set, defaulting to release"
GAFFER_BUILD_TYPE="release"
fi
if [[ $GAFFER_BUILD_TYPE == "release" ]]; then
CMAKE_BUILD_TYPE=Release
elif [[ $GAFFER_BUILD_TYPE == "debug" ]]; then
CMAKE_BUILD_TYPE=Debug
fi
if [[ `uname` = "Linux" ]] ; then
SHLIBSUFFIX=".so"
PLATFORM="linux"
GAFFERCYCLES=linux_$GAFFER_BUILD_TYPE
CC=gcc-6
CXX=g++-6
else
SHLIBSUFFIX=".dylib"
PLATFORM="osx"
GAFFERCYCLES=osx_$GAFFER_BUILD_TYPE
CC=clang
CXX=clang++
fi
GAFFERCYCLES_INSTALL=$PWD/install/$GAFFERCYCLES
# To build OSL shaders
export LD_LIBRARY_PATH=$GAFFER_ROOT/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH:-}
# Dependencies
cmake -E make_directory install/$GAFFERCYCLES
cd dependencies
$GAFFER_ROOT/bin/python ./build/build.py --project Gflags --buildDir $GAFFERCYCLES_INSTALL --forceCCompiler $CC --forceCxxCompiler $CXX
$GAFFER_ROOT/bin/python ./build/build.py --project Glog --buildDir $GAFFERCYCLES_INSTALL --forceCCompiler $CC --forceCxxCompiler $CXX
$GAFFER_ROOT/bin/python ./build/build.py --project Embree --buildDir $GAFFERCYCLES_INSTALL --forceCCompiler $CC --forceCxxCompiler $CXX
$GAFFER_ROOT/bin/python ./build/build.py --project OpenSubdiv --buildDir $GAFFERCYCLES_INSTALL --forceCCompiler $CC --forceCxxCompiler $CXX
cd ..
# CMake build
cmake -E make_directory build/$GAFFERCYCLES
cd build/$GAFFERCYCLES
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DGAFFER_ROOT=$GAFFER_ROOT -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_INSTALL_PREFIX=$GAFFERCYCLES_INSTALL -DWITH_CYCLES_EMBREE=ON -DWITH_CYCLES_OPENSUBDIV=ON -DWITH_CYCLES_LOGGING=ON $@ ../..
make -j `getconf _NPROCESSORS_ONLN`
make install
manifest="
doc/*
include/*
lib/*.cubin
lib/libembree3$SHLIBSUFFIX*
lib/libosdCPU$SHLIBSUFFIX*
lib/libGafferCycles$SHLIBSUFFIX
license/*
python/*
shader/*
source/*
startup/*
"
cd $GAFFERCYCLES_INSTALL
packageName=gafferCycles-$VERSION-gaffer-$GAFFERVERSION-$PLATFORM
if [[ $GAFFER_BUILD_TYPE == "debug" ]]; then
packageName=$packageName-$GAFFER_BUILD_TYPE
fi
archiveName=$packageName.tar.gz
tar -c -z -f /tmp/intermediate.tar $manifest
rm -rf /tmp/$packageName
mkdir /tmp/$packageName
cd /tmp/$packageName
tar -x -f /tmp/intermediate.tar
cd /tmp
tar -c -z -f $GAFFERCYCLES_INSTALL/$archiveName $packageName