Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some build enhancements. No longer depends directly on CUDA SDK.

Signed-off-by: Steven Lovegrove <stevenlovegrove@gmail.com>
  • Loading branch information...
commit b53b539d7a709b2d40fbb2b400ba936da5359b32 1 parent 5db1df6
@stevenlovegrove authored
View
4 CMakeLists.txt
@@ -5,10 +5,6 @@ SET(PANGOLIN_VERSION_MINOR 1)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/CMakeModules/")
-IF (CMAKE_COMPILER_IS_GNUCXX )
- ADD_DEFINITIONS("-Wall -Werror")
-ENDIF()
-
OPTION(BUILD_EXAMPLES "Build Examples" ON)
# SET(BUILD_SHARED_LIBS ON)
View
17 examples/VBODisplay/CMakeLists.txt
@@ -10,9 +10,7 @@ FIND_PACKAGE(Boost 1.40 COMPONENTS thread QUIET)
IF(FREEGLUT_FOUND AND CUDA_FOUND AND GLEW_FOUND AND Boost_FOUND)
CUDA_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
- INCLUDE_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/common/inc )
- LINK_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/lib )
- LINK_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/common/lib )
+
SET(CUDA_NVCC_FLAGS "-O3;--verbose" )
ADD_DEFINITIONS(-DCUDA_BUILD)
@@ -28,6 +26,17 @@ IF(FREEGLUT_FOUND AND CUDA_FOUND AND GLEW_FOUND AND Boost_FOUND)
${LIBRARY_NAME}
${GLEW_LIBRARY}
${Boost_LIBRARIES}
- libcutil_x86_64.a
)
+
+ IF(CUDA_SDK_ROOT_DIR)
+ ADD_DEFINITIONS(-DUSE_CUTIL)
+ INCLUDE_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/common/inc )
+ LINK_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/lib )
+ LINK_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/common/lib )
+ TARGET_LINK_LIBRARIES(
+ VBODisplay
+ libcutil_x86_64.a
+ )
+ ENDIF()
+
ENDIF()
View
28 examples/VBODisplay/main.cpp
@@ -6,12 +6,13 @@
#include <pangolin/pangolin.h>
#include <cuda_runtime.h>
-#include <cutil_inline.h>
-#include <cutil_gl_inline.h>
-#include <cutil_gl_error.h>
#include <cuda_gl_interop.h>
#include <vector_types.h>
+#ifdef USE_CUTIL
+ #include <cutil_inline.h>
+#endif // USE_CUTIL
+
using namespace pangolin;
using namespace std;
@@ -23,7 +24,12 @@ extern "C" void launch_kernel(float4* dVertexArray, uchar4* dColourArray, unsign
int main( int /*argc*/, char* argv[] )
{
- cudaGLSetGLDevice(cutGetMaxGflopsDeviceId());
+#ifdef USE_CUTIL
+ cudaGLSetGLDevice(cutGetMaxGflopsDeviceId());
+#else
+ cudaGLSetGLDevice(0);
+#endif
+
pangolin::CreateGlutWindowAndBind("Main",640,480);
glewInit();
@@ -52,19 +58,23 @@ int main( int /*argc*/, char* argv[] )
View& d_panel = pangolin::CreatePanel("ui")
.SetBounds(1.0, 0.0, 0, 150);
+#ifdef USE_CUTIL
// Apply timer as used by CUDA samples
// The fps measure they use is actually completely incorrect!
unsigned int timer = 0;
cutCreateTimer(&timer);
+#endif
// Default hooks for exiting (Esc) and fullscreen (tab).
for(int frame=0; !pangolin::ShouldQuit(); ++frame)
{
static double time = 0;
- static Var<double> fps("ui.fps");
static Var<double> delta("ui.time delta", 0.001, 0, 0.005);
+#ifdef USE_CUTIL
+ static Var<double> fps("ui.fps");
cutStartTimer(timer);
+#endif
if(HasResized())
DisplayBase().ActivateScissorAndClear();
@@ -96,19 +106,25 @@ int main( int /*argc*/, char* argv[] )
// Render our UI panel when we receive input
if(HadInput() | !(frame%1000))
{
+#ifdef USE_CUTIL
fps = 1000.0 / cutGetAverageTimerValue(timer);
- d_panel.Render();
cutResetTimer(timer);
+#endif
+ d_panel.Render();
}
// Swap frames and Process Events
glutSwapBuffers();
glutMainLoopEvent();
+#ifdef USE_CUTIL
cutStopTimer(timer);
+#endif
}
+#ifdef USE_CUTIL
cutilCheckError( cutDeleteTimer( timer));
+#endif
return 0;
}
View
7 pangolin/CMakeLists.txt
@@ -36,9 +36,6 @@ FIND_PACKAGE(CUDA QUIET)
IF(CUDA_FOUND)
SET(HAVE_CUDA 1)
CUDA_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
- INCLUDE_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/common/inc )
- LINK_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/lib )
- LINK_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/common/lib )
SET(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE OFF)
SET(CUDA_NVCC_FLAGS "-O3;-arch=sm_20;--verbose" )
ADD_DEFINITIONS(-DCUDA_BUILD)
@@ -90,8 +87,8 @@ TARGET_LINK_LIBRARIES( ${LIBRARY_NAME} ${OPENGL_LIBRARIES} ${Boost_LIBRARIES} )
## Set Special Compiler flags
IF(MSVC)
SET(CMAKE_CXX_FLAGS "/EHs")
-ELSE()
- SET(CMAKE_CXX_FLAGS "-Wall")
+ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_CXX_FLAGS "-Wall -Wno-error=deprecated-declarations -Werror")
ENDIF()
#######################################################
Please sign in to comment.
Something went wrong with that request. Please try again.