summaryrefslogtreecommitdiff
path: root/src/compil.sh
blob: 84ed7c45f38ce4da0f8d356213a192650cc1ecbe (plain)
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
#!/bin/bash -e

clear

#set -x
CXX="g++ -Wall -g"
BUILD_PATH="../build"

AMDAPP_PATH="/opt/AMDAPP"

DEFINES=""
INCLUDES=""
LIBS=""

# OpenCL
if [ -d "$AMDAPP_PATH/include" ]
then	DEFINES="$DEFINES -DHAS_OPENCL"
	INCLUDES="$INCLUDES -I $AMDAPP_PATH/include"
	LIBS="$LIBS -L/opt/AMDAPP/lib/x86_64 -lGLEW -lOpenCL "
else	echo "WARNING : invalid AMDAPP_PATH : '$AMDAPP_PATH'"
fi

# GTKGLEXT
if pkg-config --modversion gtkglextmm-1.2 gdkmm-2.4 > /dev/null
then	INCLUDES="$INCLUDES $(pkg-config --cflags gtkglextmm-1.2)"
	LIBS="$LIBS $(pkg-config --libs gtkglextmm-1.2)"
else	echo "ERROR : pkg-config is unavailable or gtkglextmm-1.2 developpemnt files are not installed"
	echo "On Ubuntu (12.04, 12.10) you can resolve that with :"
	echo " sudo apt-get install pkg-config libgtkmm-2.4-dev libgtkglextmm-x11-1.2-dev"
	exit 1
fi
#set +x

function build_cxx() {
	echo "$PS4$CXX \$DEFINES \$INCLUDES -o $BUILD_PATH/$1 -c $2"
	$CXX $DEFINES $INCLUDES -o $BUILD_PATH/$1 -c $2
}

function link_cxx() {
	out=$1
	shift 1
	echo "$PS4$CXX -o $BUILD_PATH/$out $* \$LIBS"
	$CXX $* -o $BUILD_PATH/$out $LIBS
}

rm -v $BUILD_PATH/* || true

build_cxx gpudataviz.o gpudataviz.cc
build_cxx boring_parts.o boring_parts.cc
build_cxx gtk_win_main.o gtk_win_main.cc

link_cxx gpudataviz $BUILD_PATH/*.o