diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2013-01-05 09:07:16 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2013-01-05 09:07:16 +0000 |
commit | 3ffda80f95478f4e73765f8b7ceb1bbf54ea97ee (patch) | |
tree | 1a0e0d62590da225d550ee44da9a76c32a21a6b9 | |
parent | c1d21f2a47e34362ee1d939bca8ca082f5474b33 (diff) | |
download | 2013-gpudataviz-3ffda80f95478f4e73765f8b7ceb1bbf54ea97ee.tar.gz 2013-gpudataviz-3ffda80f95478f4e73765f8b7ceb1bbf54ea97ee.tar.bz2 2013-gpudataviz-3ffda80f95478f4e73765f8b7ceb1bbf54ea97ee.zip |
- Ajout de quelques tests et messages dans compil.sh.
- Suppression des majuscules de my_gtk_gl_scene.h
- Ajout de quelques #define pour pouvoir compiler sans OpenCL
(+ changement appel initOpenCL() -> initLibs() dans gpudataviz.cc)
git-svn-id: file:///var/svn/2013-gpudataviz/trunk@3 371a6b4a-a258-45f8-9dcc-bdd82ce0ac9d
-rw-r--r-- | src/boring_parts.cc | 4 | ||||
-rw-r--r-- | src/boring_parts.h | 14 | ||||
-rwxr-xr-x | src/compil.sh | 26 | ||||
-rw-r--r-- | src/gpudataviz.cc | 6 | ||||
-rw-r--r-- | src/gtk_win_main.h | 2 | ||||
-rw-r--r-- | src/my_gtk_gl_scene.h (renamed from src/my_GTK_GL_scene.h) | 0 |
6 files changed, 37 insertions, 15 deletions
diff --git a/src/boring_parts.cc b/src/boring_parts.cc index 3affae9..5e240c2 100644 --- a/src/boring_parts.cc +++ b/src/boring_parts.cc @@ -18,11 +18,14 @@ int initLibs() { // FIXME : unused +#ifdef HAS_OPENCL RETURN_IF_FAIL( initOpenCL() ); +#endif /*HAS_OPENCL*/ return 0; } +#ifdef HAS_OPENCL int initOpenCL() { cl_uint id, numPlatforms, numDevices; char pbuf[100]; @@ -98,4 +101,5 @@ int initOpenCL() { return 0; } +#endif /*HAS_OPENCL*/ diff --git a/src/boring_parts.h b/src/boring_parts.h index fc4e09b..431a46f 100644 --- a/src/boring_parts.h +++ b/src/boring_parts.h @@ -1,8 +1,16 @@ #include <iostream> + +#ifdef HAS_OPENCL #include <CL/opencl.h> -#include "gtk_includes.h" +int initOpenCL(); +#else +// Quick and dirty cl_float4 replacement +typedef union { + float s[4]; + struct{ float x, y, z, w; }; + struct{ float s0, s1, s2, s3; }; +} cl_float4; +#endif /*HAS_OPENCL*/ int initLibs(); -int initOpenCL(); -int initGTK(); diff --git a/src/compil.sh b/src/compil.sh index 4afcc2e..bc21245 100755 --- a/src/compil.sh +++ b/src/compil.sh @@ -2,24 +2,34 @@ clear -set -x +#set -x CXX="g++ -Wall -g" BUILD_PATH="../build" AMDAPP_PATH="/opt/AMDAPP" +DEFINES="" INCLUDES="" LIBS="" # OpenCL -INCLUDES="$INCLUDES -I $AMDAPP_PATH/include" -LIBS="$LIBS -lOpenCL" +if [ -d "$AMDAPP_PATH/include" ] +then DEFINES="-DHAS_OPENCL" + INCLUDES="$INCLUDES -I $AMDAPP_PATH/include" + LIBS="$LIBS -lOpenCL" +else echo "WARNING : invalid AMDAPP_PATH : '$AMDAPP_PATH'" +fi # GTKGLEXT -INCLUDES="$INCLUDES $(pkg-config --cflags gtkglextmm-1.2)" -LIBS="$LIBS $(pkg-config --libs gtkglextmm-1.2)" - -set +x +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 \$INCLUDES -o $BUILD_PATH/$1 -c $2" @@ -33,7 +43,7 @@ function link_cxx() { $CXX $* -o $BUILD_PATH/$out $LIBS } -rm $BUILD_PATH/* || true +rm -v $BUILD_PATH/* || true build_cxx gpudataviz.o gpudataviz.cc build_cxx boring_parts.o boring_parts.cc diff --git a/src/gpudataviz.cc b/src/gpudataviz.cc index bcd498e..6f1ebd0 100644 --- a/src/gpudataviz.cc +++ b/src/gpudataviz.cc @@ -3,7 +3,7 @@ #include "gpudataviz.h" #include "boring_parts.h" #include "gtk_win_main.h" -#include "my_GTK_GL_scene.h" +#include "my_gtk_gl_scene.h" // Macro to make things readable in main() function #define EXIT_IF_FAIL(val, expr) do { \ @@ -36,8 +36,8 @@ int main(int argc, char* argv[]) { Glib::RefPtr<Gdk::GL::Config> glconfig; EXIT_IF_FAIL(2, glconfig=Gdk::GL::Config::create(glMode) ); - // Initialize OpenCL - EXIT_IF_FAIL(3, initOpenCL()==0 ); // See boring_parts.cc + // Initialize OpenCL (if available) + EXIT_IF_FAIL(3, initLibs()==0 ); // See boring_parts.cc // Initialize host work memory (array for all the vertex coordinates computed by OpenCL and displayed by OpenGL) cl_float4 *hostWorkMem = (cl_float4 *) calloc(meshWidth * meshHeight, sizeof(cl_float4)); diff --git a/src/gtk_win_main.h b/src/gtk_win_main.h index d5338ed..ab14a4a 100644 --- a/src/gtk_win_main.h +++ b/src/gtk_win_main.h @@ -1,5 +1,5 @@ #include "gtk_includes.h" -#include "my_GTK_GL_scene.h" +#include "my_gtk_gl_scene.h" #define WIN_MAIN_TITLE "GPU Data Viz v0.1" diff --git a/src/my_GTK_GL_scene.h b/src/my_gtk_gl_scene.h index dc8afbe..dc8afbe 100644 --- a/src/my_GTK_GL_scene.h +++ b/src/my_gtk_gl_scene.h |