From 53deed298facc005f71e9ec2a96d5c4e90d826af Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sat, 15 Oct 2016 17:11:08 +0200 Subject: Added documentation and minor refactoring for the recent support of static library compilation --- CHANGELOG | 1 + CMakeLists.txt | 2 +- README.md | 4 ++++ include/clblast.h | 14 +++++--------- include/clblast_c.h | 14 +++++--------- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0d517869..2affaadd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ Development version (next release) - Added support for compilation under Visual Studio 2013 (MSVC++ 12.0) - Added an option to set OpenCL compiler options through the env variable CLBLAST_BUILD_OPTIONS - Added an option to run tuned kernels multiple times to average execution times +- Added an option to build a static version of the library - Various minor fixes and enhancements - Added tuned parameters for various devices (see README) diff --git a/CMakeLists.txt b/CMakeLists.txt index 140b35a6..bf2a36dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(clblast_VERSION_MINOR 9) set(clblast_VERSION_PATCH 0) # Options and their default values -option(BUILD_SHARED_LIBS "Build shared or static library" ON) +option(BUILD_SHARED_LIBS "Build a shared (ON) or static library (OFF)" ON) option(SAMPLES "Enable compilation of the examples" OFF) option(TUNERS "Enable compilation of the tuners" OFF) option(CLIENTS "Enable compilation of the clients to test and compare performance" OFF) diff --git a/README.md b/README.md index 33282d8f..a88f5ce1 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,10 @@ A custom installation folder can be specified when calling CMake: cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/directory .. +Building a static version of the library instead of shared one (.dylib/.so/.dll) can be done by disabling the `BUILD_SHARED_LIBS` option when calling CMake. For example: + + cmake -DBUILD_SHARED_LIBS=OFF .. + Using the library ------------- diff --git a/include/clblast.h b/include/clblast.h index 335ca8e3..0f52b2f9 100644 --- a/include/clblast.h +++ b/include/clblast.h @@ -27,15 +27,11 @@ // Exports library functions under Windows when building a DLL. See also: // https://msdn.microsoft.com/en-us/library/a90k134d.aspx -#ifdef _WIN32 - #if defined(CLBLAST_DLL) - #if defined(COMPILING_DLL) - #define PUBLIC_API __declspec(dllexport) - #else - #define PUBLIC_API __declspec(dllimport) - #endif - #elif defined(CLBLAST_STATIC) - #define PUBLIC_API +#if defined(_WIN32) && defined(CLBLAST_DLL) + #if defined(COMPILING_DLL) + #define PUBLIC_API __declspec(dllexport) + #else + #define PUBLIC_API __declspec(dllimport) #endif #else #define PUBLIC_API diff --git a/include/clblast_c.h b/include/clblast_c.h index 6a454015..33fb4acf 100644 --- a/include/clblast_c.h +++ b/include/clblast_c.h @@ -24,15 +24,11 @@ // Exports library functions under Windows when building a DLL. See also: // https://msdn.microsoft.com/en-us/library/a90k134d.aspx -#ifdef _WIN32 - #if defined(CLBLAST_DLL) - #if defined(COMPILING_DLL) - #define PUBLIC_API __declspec(dllexport) - #else - #define PUBLIC_API __declspec(dllimport) - #endif - #elif defined(CLBLAST_STATIC) - #define PUBLIC_API +#if defined(_WIN32) && defined(CLBLAST_DLL) + #if defined(COMPILING_DLL) + #define PUBLIC_API __declspec(dllexport) + #else + #define PUBLIC_API __declspec(dllimport) #endif #else #define PUBLIC_API -- cgit v1.2.3