From 75592bd89387527763857225de173b2fb1711862 Mon Sep 17 00:00:00 2001 From: Pradeep Date: Fri, 6 Nov 2015 11:26:59 -0500 Subject: [PATCH] Turn on examples build for jenkins ci Also, has couple of fixes for examples on Windows platform --- CMakeLists.txt | 2 +- examples/CMakeLists.txt | 4 +++- examples/opencl/plotting.cpp | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12e29744..34abc32d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ SET(USE_WINDOW_TOOLKIT "glfw3" CACHE STRING "Choose Window toolkit") SET_PROPERTY(CACHE USE_WINDOW_TOOLKIT PROPERTY STRINGS "glfw3" "sdl2") OPTION(BUILD_DOCUMENTATION "Build Documentation" OFF) -OPTION(BUILD_EXAMPLES "Build Examples" OFF) +OPTION(BUILD_EXAMPLES "Build Examples" ON) OPTION(USE_SYSTEM_GLM "Use system GLM" OFF) OPTION(USE_SYSTEM_FREETYPE "Use system freetype" OFF) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 141861b7..6cafc4ec 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -75,7 +75,9 @@ ENDIF() FIND_PACKAGE(OpenCL QUIET) IF(OpenCL_FOUND) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-function") + IF(UNIX) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-function") + ENDIF() FILE(GLOB OpenCL_EXAMPLE_SRC_FILES "opencl/*.cpp") INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_SOURCE_DIR}/opencl" diff --git a/examples/opencl/plotting.cpp b/examples/opencl/plotting.cpp index eab356b6..ba7f8af0 100644 --- a/examples/opencl/plotting.cpp +++ b/examples/opencl/plotting.cpp @@ -30,13 +30,13 @@ const unsigned WIN_COLS = 2; const float dx = 0.1; const float FRANGE_START = 0.f; const float FRANGE_END = 2 * 3.141592f; -const unsigned SIZE = ( FRANGE_END - FRANGE_START ) / dx; +const unsigned DATA_SIZE = ( FRANGE_END - FRANGE_START ) / dx; static const std::string sinf_ocl_kernel = -"kernel void sinf(global float* out, const float dx, const unsigned SIZE)\n" +"kernel void sinf(global float* out, const float dx, const unsigned DATA_SIZE)\n" "{\n" " unsigned x = get_global_id(0);\n" -" if(x < SIZE){\n" +" if(x < DATA_SIZE){\n" " out[2 * x] = x * dx ;\n" " out[2 * x + 1] = sin(x*dx);\n" " }\n" @@ -54,11 +54,11 @@ void kernel(cl::Buffer& devOut, cl::CommandQueue& queue) kern = cl::Kernel(prog, "sinf"); }); - static const NDRange global(SIZE * 2); + static const NDRange global(DATA_SIZE * 2); kern.setArg(0, devOut); kern.setArg(1, dx); - kern.setArg(2, SIZE); + kern.setArg(2, DATA_SIZE); queue.enqueueNDRangeKernel(kern, cl::NullRange, global); } @@ -91,10 +91,10 @@ int main(void) /* Create several plot objects which creates the necessary * vertex buffer objects to hold the different plot types */ - fg::Plot plt0(SIZE, fg::f32); //create a default plot - fg::Plot plt1(SIZE, fg::f32, fg::FG_LINE, fg::FG_NONE); //or specify a specific plot type - fg::Plot plt2(SIZE, fg::f32, fg::FG_LINE, fg::FG_TRIANGLE); //last parameter specifies marker shape - fg::Plot plt3(SIZE, fg::f32, fg::FG_SCATTER, fg::FG_POINT); + fg::Plot plt0(DATA_SIZE, fg::f32); //create a default plot + fg::Plot plt1(DATA_SIZE, fg::f32, fg::FG_LINE, fg::FG_NONE); //or specify a specific plot type + fg::Plot plt2(DATA_SIZE, fg::f32, fg::FG_LINE, fg::FG_TRIANGLE); //last parameter specifies marker shape + fg::Plot plt3(DATA_SIZE, fg::f32, fg::FG_SCATTER, fg::FG_POINT); /* * Set plot colors @@ -156,7 +156,7 @@ int main(void) } } - cl::Buffer devOut(context, CL_MEM_READ_WRITE, sizeof(float) * SIZE * 2); + cl::Buffer devOut(context, CL_MEM_READ_WRITE, sizeof(float) * DATA_SIZE * 2); kernel(devOut, queue); /* copy your data into the vertex buffer object exposed by