From 79eb1a995d640e1ee624abec293a9cc69f3ca2bf Mon Sep 17 00:00:00 2001
From: Jonnhy Jazeix <jazeix@gmail.com>
Date: Sat, 6 Feb 2010 16:23:23 +0000
Subject: [PATCH] options for choosing otf dir added in the configure script,
 plugins window updated

---
 configure   | 42 ++++++++++++++++++++++++++++++++----------
 src/src.pro |  4 ++--
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/configure b/configure
index e8cf55e9..6972238b 100755
--- a/configure
+++ b/configure
@@ -49,6 +49,7 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 makefile="Makefile"
 
 with_otf=0
+with_otf_default=1
 config_specified=0
 
 # where will we concatenate options like macros, libs...
@@ -58,7 +59,8 @@ compilation_src_pro="src.pro"
 config="\"CONFIG+="
 defines="\"DEFINES+="
 libs="\"LIBS+="
-includes="\"INCLUDES+="
+includepath="\"INCLUDEPATH+="
+dependpath="\"DEPENDPATH+="
 sources="\"SOURCES+="
 headers="\"HEADERS+="
 
@@ -103,8 +105,8 @@ usage()
   echo "  --enable_otf"
   echo "        enables the otf support. The otf release used by default is in the src/general directory"
 ## Will be added later
-#  echo "  --otf_include_dir=<path>    set the otf directory path"
-#  echo "  --otf_library_dir=<path>    set the otf library path (<path>/libotf.a)"
+  echo "  --otf_include_dir=<path>    set the otf directory path (default is general/otf/otflib if --enable_otf is set)"
+  echo "  --otf_library_dir=<path>    set the otf library path (<path>/libotf.a)"
   exit 0
 }
 
@@ -119,10 +121,8 @@ while [ 0 -lt $# ]; do
         --enable_otf) # otf support
             with_otf=1;
             defines="$defines WITH_OTF"
-            libs="$libs general/otf/otflib/.libs/libotf.a -Lgeneral/otf/otflib/.libs"
             sources="$sources parser/ParserOTF.cpp parser/ParserEventOTF.cpp parser/ParserDefinitionOTF.cpp"
             headers="$headers parser/ParserOTF.hpp parser/ParserEventOTF.hpp parser/ParserDefinitionOTF.hpp"
-            includes="$includes "
             #compilation_src_pro="\"DEFINES+=WITH_OTF\" \"LIBS+=general/otf/otflib/.libs/libotf.a -Lgeneral/otf/otflib/.libs\" \"SOURCES+=parser/ParserOTF.cpp parser/ParserEventOTF.cpp parser/ParserDefinitionOTF.cpp\" \"HEADERS+=parser/ParserOTF.hpp parser/ParserEventOTF.hpp parser/ParserDefinitionOTF.hpp\" src.pro "
             ;;
         --enable_spinning_logo) # good openGL spinning rabbit :)
@@ -136,6 +136,17 @@ while [ 0 -lt $# ]; do
             config_specified=1;
             config="$config debug"
             ;;
+        --otf_include_dir=*) # otf include directory
+            include_dir=`echo $OPT | awk -F"--otf_include_dir=" '{print $2}'`
+            includepath="$includepath $include_dir"
+            dependpath="$dependpath $include_dir"
+            with_otf_default=0
+            ;;
+        --otf_library_dir=*)
+            lib_dir=`echo $OPT | awk -F"--otf_library_dir=" '{print $2}'`
+            libs="$libs $lib_dir/libotf.a -L$lib_dir"
+            with_otf_default=0
+            ;;
         *)
             echo "invalid option : $OPT";
             exit 0;
@@ -149,13 +160,24 @@ if [ $config_specified == 1 ]; then
 else
     config="$config release\"";
 fi
+
+if [ $with_otf == 1 -a "$includepath" = "\"INCLUDEPATH+=" ]; then
+    includepath="$includepath general/otf/otflib/"
+    dependpath="$dependpath general/otf/otflib/"
+fi
+
+if [ $with_otf == 1 -a "$libs" = "\"LIBS+=" ]; then
+    libs="$libs general/otf/otflib/.libs/libotf.a -Lgeneral/otf/otflib/.libs"
+fi
+
 defines="$defines\"";
 libs="$libs\"";
-includes="$includes\"";
+includepath="$includepath\"";
+dependpath="$dependpath\"";
 sources="$sources\"";
 headers="$headers\"";
 
-compilation_src_pro="$defines $config $libs $includes $sources $headers";
+compilation_src_pro="$defines $config $libs $sources $headers $includepath $dependpath";
 
 # find a make command
 if [ -z "$MAKE" ]; then
@@ -186,7 +208,7 @@ cat > "$makefile" <<EOF
 ########################################################################
 EOF
 
-if [ $with_otf == 1 ]; then # set the directory... should be decided by the user, we will see after how to do beautiful options :)
+if [ $with_otf == 1 -a $with_otf_default == 1 ]; then # set the directory... should be decided by the user, we will see after how to do beautiful options :)
 
 cat >> "$makefile" <<EOF
 OTFLIB_DIR = ./src/general/otf
@@ -253,7 +275,7 @@ clean:
 cleanall:	clean
 EOF
 
-if [ $with_otf == 1 ]; then
+if [ $with_otf == 1 -a $with_otf_default == 1 ]; then
     cat >>"$makefile" <<EOF
 	make -C \$(OTFLIB_DIR) clean
 EOF
@@ -278,7 +300,7 @@ fi
 EOF
 
 
-if [ $with_otf == 1 ]; then
+if [ $with_otf == 1 -a $with_otf_default == 1 ]; then
     echo >&2 "Configuration of the otf library"
     cd $OTFLIB_DIR && ./configure
 fi
diff --git a/src/src.pro b/src/src.pro
index 22691baa..9c21b1ef 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -50,8 +50,8 @@ CONFIG+=uitools
 QT+=opengl
 TEMPLATE = app
 TARGET = vite
-DEPENDPATH += . common interface parser trace trace/values trace/tree general/otf/otflib info render statistics
-INCLUDEPATH += . general/otf/otflib
+DEPENDPATH += . common interface parser trace trace/values trace/tree info render statistics
+INCLUDEPATH += .
 QMAKE_CFLAGS += -O2
 QMAKE_CXXFLAGS += -O2
 
-- 
GitLab