Skip to content

Commit

Permalink
Turn on examples build for jenkins ci
Browse files Browse the repository at this point in the history
Also, has couple of fixes for examples on Windows platform
  • Loading branch information
9prady9 committed Nov 6, 2015
1 parent 2b1dbf7 commit 75592bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 10 additions & 10 deletions examples/opencl/plotting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 75592bd

Please sign in to comment.