Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
project(clew)

option( BUILD_TESTS "Build test program." ON )
option( BUILD_SHARED_LIBRARY "Shared library, rather than static library." OFF )
option( BUILD_SHARED_LIBRARY "Build shared library." OFF )
option( BUILD_STATIC_LIBRARY "Build static library." OFF )
option( INSTALL_CL_HEADER "Install cl.h / opencl.h proxy headers to ease compilation of software not aware of CLEW" OFF )

cmake_minimum_required (VERSION 2.6)
Expand All @@ -25,7 +26,10 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()

add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS)
if( NOT BUILD_SHARED_LIBRARY )
if(BUILD_SHARED_LIBRARY AND BUILD_STATIC_LIBRARY)
message(FATAL_ERROR "Choose either BUILD_SHARED_LIBRARY or BUILD_STATIC_LIBRARY, or disable both to rely on global BUILD_SHARED_LIBS")
endif()
if(BUILD_STATIC_LIBRARY OR NOT BUILD_SHARED_LIBS)
add_definitions(-Dclew_STATIC)
endif()

Expand All @@ -38,4 +42,3 @@ add_subdirectory(include)
if( BUILD_TESTS )
add_subdirectory(clewTest)
endif( BUILD_TESTS )

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ To test it works ok. You'll need at least one OpenCL-enabled device to do this
## Build options

* BUILD_TESTS: build test executable, default ON
* BUILD_SHARED_LIBRARY: build dll/so, instead of .lib/.a. default OFF
* BUILD_SHARED_LIBRARY: explicitly build dll/so, default OFF
* BUILD_STATIC_LIBRARY: explicitly build lib/a, default OFF
* INSTALL_CL_HEADER: creates include files directory `proxy-opencl`, which you can give eg to clBLAS during build, and it will build ok, without needing opencl headers installed

BUILD_SHARED_LIBRARY and BUILD_STATIC_LIBRARY may not be used simultaneously.
If none of them is on (it's the default), then CMake's global BUILD_SHARED_LIBS
will be used to decide which type of library to build.
2 changes: 0 additions & 2 deletions include/clew.h
Original file line number Diff line number Diff line change
Expand Up @@ -2605,10 +2605,8 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
# define CLEWAPI extern
#else
# ifdef clew_EXPORTS
#pragma message("exporting")
# define CLEWAPI extern __declspec(dllexport)
# else
#pragma message("importing")
# define CLEWAPI extern __declspec(dllimport)
# endif
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ SET(MICRO_VERSION 0)

if( BUILD_SHARED_LIBRARY )
add_library( clew SHARED clew.c )
elseif( BUILD_STATIC_LIBRARY )
add_library( clew STATIC clew.c )
else()
add_library( clew clew.c )
endif()
Expand Down