Commit 8dce44f9 authored by schultezub's avatar schultezub
Browse files

making OpenCL optional

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@342 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent bd7d78b4
......@@ -38,6 +38,7 @@ IF(CAMPVIS_BUILD_LIB_TGT)
ENDIF()
IF(CAMPVIS_BUILD_LIB_KISSCL)
LIST(APPEND CAMPVIS_DEFINITIONS "-DHAS_KISSCL")
ADD_SUBDIRECTORY(ext/kisscl)
ENDIF()
......
......@@ -53,4 +53,4 @@ ADD_EXECUTABLE(campvis-application
)
ADD_DEFINITIONS(${CAMPVIS_DEFINITIONS} ${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${CAMPVIS_INCLUDE_DIRECTORIES})
TARGET_LINK_LIBRARIES(campvis-application campvis-core campvis-modules tgt kisscl ${CAMPVIS_EXTERNAL_LIBRARIES} ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(campvis-application campvis-core campvis-modules tgt ${CAMPVIS_EXTERNAL_LIBRARIES} ${QT_LIBRARIES})
......@@ -39,7 +39,9 @@
#include "tgt/qt/qtcontextmanager.h"
#include "tbb/include/tbb/compat/thread"
#ifdef HAS_KISSCL
#include "kisscl/clruntime.h"
#endif
#include "application/campvispainter.h"
#include "application/gui/mainwindow.h"
......@@ -113,9 +115,11 @@ namespace campvis {
QuadRenderer::init();
#ifdef HAS_KISSCL
if (_useOpenCL) {
kisscl::CLRuntime::init();
}
#endif
if (_argc > 0) {
// ugly hack
......@@ -124,10 +128,12 @@ namespace campvis {
ShdrMgr.addPath(basePath);
ShdrMgr.addPath(basePath + "/core/glsl");
#ifdef HAS_KISSCL
if (_useOpenCL) {
CLRtm.addPath(basePath);
CLRtm.addPath(basePath + "/core/cl");
}
#endif
}
_mainWindow->init();
......@@ -172,9 +178,11 @@ namespace campvis {
QuadRenderer::deinit();
#ifdef HAS_KISSCL
if (_useOpenCL) {
kisscl::CLRuntime::deinit();
}
#endif
}
OpenGLJobProcessor::deinit();
......
......@@ -6,7 +6,7 @@ IF(WIN32)
DOC "Path to the OpenCL SDK (Nvidia GPU Computing / AMD APP SDK)"
)
IF(NOT EXISTS ${OPENCL_SDK})
MESSAGE(FATAL_ERROR "OpenCL SDK (Nvidia GPU Computing / AMD APP SDK) not found! Please set Option 'OPENCL_SDK'!")
MESSAGE(STATUS "OpenCL SDK (Nvidia GPU Computing / AMD APP SDK) not found! Please set Option 'OPENCL_SDK' if you need OpenCL!")
ENDIF()
FIND_PATH(
......@@ -69,6 +69,7 @@ IF(OPENCL_INCLUDE_DIR AND OPENCL_LIBRARY)
SET(OPENCL_FOUND TRUE)
MARK_AS_ADVANCED(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
ELSE()
MESSAGE(FATAL_ERROR "OpenCL library not found (OPENCL_INCLUDE_DIR and/or OPENCL_LIBRARY missing)!")
SET(OPENCL_FOUND FALSE)
MESSAGE(STATUS "OpenCL library not found (OPENCL_INCLUDE_DIR and/or OPENCL_LIBRARY missing)!")
MARK_AS_ADVANCED(CLEAR OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
ENDIF()
......@@ -133,7 +133,7 @@ SET(CAMPVIS_REQUIRED_QT_VERSION "4.8")
# detect libraries
MESSAGE(STATUS "--------------------------------------------------------------------------------")
MESSAGE(STATUS "Detecting Common Mandatory Libraries:")
MESSAGE(STATUS "Detecting Mandatory External Libraries:")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CAMPVIS_HOME}/cmake")
......@@ -175,14 +175,18 @@ ELSE(TBB_FOUND)
MESSAGE(FATAL_ERROR "TBB not found!")
ENDIF(TBB_FOUND)
# detect libraries
MESSAGE(STATUS "--------------------------------------------------------------------------------")
MESSAGE(STATUS "Detecting Optional External Libraries:")
# OpenCL
FIND_PACKAGE(CL REQUIRED)
FIND_PACKAGE(CL)
IF (OPENCL_FOUND)
MESSAGE(STATUS "* Found OpenCL")
LIST(APPEND CAMPVIS_INCLUDE_DIRECTORIES ${OPENCL_INCLUDE_DIR})
LIST(APPEND CAMPVIS_EXTERNAL_LIBRARIES ${OPENCL_LIBRARY})
IF (OPENCL_FOUND)
ELSE(OPENCL_FOUND)
MESSAGE(FATAL_ERROR "OpenCL not found!")
MESSAGE(STATUS "* Did NOT find OpenCL!")
ENDIF(OPENCL_FOUND)
......
......@@ -50,4 +50,4 @@ ADD_LIBRARY(campvis-core
)
ADD_DEFINITIONS(${CAMPVIS_DEFINITIONS} ${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${CAMPVIS_INCLUDE_DIRECTORIES})
TARGET_LINK_LIBRARIES(campvis-core tgt kisscl ${CAMPVIS_EXTERNAL_LIBRARIES} ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(campvis-core tgt ${CAMPVIS_EXTERNAL_LIBRARIES} ${QT_LIBRARIES})
......@@ -228,6 +228,7 @@ namespace campvis {
return (_baseType == rhs._baseType) && (_numChannels == rhs._numChannels) && (_pointer == rhs._pointer);
}
#ifdef HAS_KISSCL
cl_channel_type WeaklyTypedPointer::getClChannelType() const {
switch (_baseType) {
case WeaklyTypedPointer::UINT8:
......@@ -263,5 +264,6 @@ namespace campvis {
return CL_A;
}
}
#endif
}
......@@ -36,7 +36,9 @@
#include "tgt/tgt_gl.h"
#include "tgt/types.h"
#ifdef HAS_KISSCL
#include "kisscl/kisscl.h"
#endif
namespace campvis {
......@@ -118,9 +120,11 @@ namespace campvis {
GLint getGlInternalFormat() const;
#ifdef HAS_KISSCL
cl_channel_type getClChannelType() const;
cl_channel_order getClChannelOrder() const;
#endif
BaseType _baseType; ///< Base data type of the pointer
size_t _numChannels; ///< Number of channels, must be in [1, 4]!
......
# CMake file for OpenCL module
IF(NOT OPENCL_FOUND)
MESSAGE(FATAL_ERROR "OpenCL was not found but is mandatory for OpenCL module.")
ENDIF(NOT OPENCL_FOUND)
# Source files:
FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
modules/opencl/processors/*.cpp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment