diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | include/clblast.h | 16 | ||||
-rw-r--r-- | include/clblast_c.h | 6 | ||||
-rw-r--r-- | scripts/generator/generator.py | 2 | ||||
-rw-r--r-- | src/clblast.cpp | 1 | ||||
-rw-r--r-- | src/public_api.hpp | 34 |
7 files changed, 27 insertions, 40 deletions
@@ -1,6 +1,7 @@ Development version (next release) - Updated to version 6.0 of the CLCudaAPI C++11 OpenCL header +- Fixed proper MSVC dllimport and dllexport declarations Version 0.8.0 - Added support for half-precision floating-point (fp16) in the library diff --git a/CMakeLists.txt b/CMakeLists.txt index 6deee35d..70e4198c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ # # ================================================================================================== -cmake_minimum_required(VERSION 2.8.10) +cmake_minimum_required(VERSION 2.8.11) # Overrides for MSVC static runtime set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake) @@ -166,6 +166,11 @@ endforeach() add_library(clblast SHARED ${SOURCES}) target_link_libraries(clblast ${OPENCL_LIBRARIES}) +# Sets the proper __declspec(dllexport) keyword for Visual Studio when the library is built +if(MSVC) + target_compile_definitions(clblast PRIVATE COMPILING_DLL=1) # requires at least CMake 2.8.11 +endif() + # Installs the library install(TARGETS clblast DESTINATION lib) install(FILES include/clblast.h DESTINATION include) diff --git a/include/clblast.h b/include/clblast.h index c8596b39..e1d4f25b 100644 --- a/include/clblast.h +++ b/include/clblast.h @@ -25,6 +25,18 @@ #include <CL/opencl.h> #endif +// Exports library functions under Windows when building a DLL. See also: +// https://msdn.microsoft.com/en-us/library/a90k134d.aspx +#ifdef _WIN32 + #ifdef COMPILING_DLL + #define PUBLIC_API __declspec(dllexport) + #else + #define PUBLIC_API __declspec(dllimport) + #endif +#else + #define PUBLIC_API +#endif + namespace clblast { // ================================================================================================= @@ -576,11 +588,11 @@ StatusCode Omatcopy(const Layout layout, const Transpose a_transpose, // CLBlast stores binaries of compiled kernels into a cache in case the same kernel is used later on // for the same device. This cache can be cleared to free up system memory or in case of debugging. -StatusCode ClearCache(); +StatusCode PUBLIC_API ClearCache(); // The cache can also be pre-initialized for a specific device with all possible CLBLast kernels. // Further CLBlast routine calls will then run at maximum speed. -StatusCode FillCache(const cl_device_id device); +StatusCode PUBLIC_API FillCache(const cl_device_id device); // ================================================================================================= diff --git a/include/clblast_c.h b/include/clblast_c.h index b92febac..a13b8e64 100644 --- a/include/clblast_c.h +++ b/include/clblast_c.h @@ -25,7 +25,11 @@ // Exports library functions under Windows when building a DLL. See also: // https://msdn.microsoft.com/en-us/library/a90k134d.aspx #ifdef _WIN32 - #define PUBLIC_API __declspec(dllexport) + #ifdef COMPILING_DLL + #define PUBLIC_API __declspec(dllexport) + #else + #define PUBLIC_API __declspec(dllimport) + #endif #else #define PUBLIC_API #endif diff --git a/scripts/generator/generator.py b/scripts/generator/generator.py index cf01f79e..6aa6fc18 100644 --- a/scripts/generator/generator.py +++ b/scripts/generator/generator.py @@ -385,7 +385,7 @@ files = [ path_clblast+"/test/wrapper_clblas.hpp", path_clblast+"/test/wrapper_cblas.hpp", ] -header_lines = [84, 74, 93, 22, 29, 41] +header_lines = [96, 73, 97, 22, 29, 41] footer_lines = [17, 75, 19, 14, 6, 6] # Checks whether the command-line arguments are valid; exists otherwise diff --git a/src/clblast.cpp b/src/clblast.cpp index 88d60772..79c30ca4 100644 --- a/src/clblast.cpp +++ b/src/clblast.cpp @@ -16,7 +16,6 @@ #include <string> #include "clblast.h" -#include "public_api.hpp" #include "cache.hpp" // BLAS level-1 includes diff --git a/src/public_api.hpp b/src/public_api.hpp deleted file mode 100644 index d0732297..00000000 --- a/src/public_api.hpp +++ /dev/null @@ -1,34 +0,0 @@ - -// ================================================================================================= -// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This -// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- -// width of 100 characters per line. -// -// Author(s): -// Cedric Nugteren <www.cedricnugteren.nl> -// -// This file provides macro's to define the public API. This is needed when building a Windows DLL. -// Note: this is only used for the C++ interface, the C interface has its own definition included in -// the header file itself. -// -// ================================================================================================= - -#ifndef CLBLAST_PUBLIC_API_H_ -#define CLBLAST_PUBLIC_API_H_ - -namespace clblast { -// ================================================================================================= - -// Exports library functions under Windows when building a DLL. See also: -// https://msdn.microsoft.com/en-us/library/a90k134d.aspx -#ifdef _WIN32 - #define PUBLIC_API __declspec(dllexport) -#else - #define PUBLIC_API -#endif - -// ================================================================================================= -} // namespace clblast - -// CLBLAST_PUBLIC_API_H_ -#endif |