commit 9c75d5ac03c41a6d6fc91674e2f2bf2694473a78
parent fceafa22d22e3b2f610ee83337bd3bae51d93ded
Author: vaplv <vaplv@free.fr>
Date: Sat, 14 Dec 2013 14:42:16 +0100
Fix an issue in the test_library in Debug
Diffstat:
5 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -11,3 +11,4 @@ tmp
tags
cmake_build
rsys_version.h
+platform.h
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -23,13 +23,21 @@ endif()
add_definitions(-D_POSIX_C_SOURCE=200112L)
################################################################################
-# Define targets
+# Configure some generated files
################################################################################
set(VERSION_MAJOR 0)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
configure_file(rsys_version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/rsys_version.h)
+string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
+set(LIB_SUFFIX ${CMAKE_${BUILD_TYPE}_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})
+set(LIB_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
+configure_file(platform.h.in ${CMAKE_CURRENT_SOURCE_DIR}/platform.h)
+
+################################################################################
+# Define targets
+################################################################################
set(RSYS_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
message(STATUS "Current library version: ${RSYS_VERSION}")
diff --git a/src/library.h b/src/library.h
@@ -3,10 +3,6 @@
#include "rsys.h"
-#ifdef PLATFORM_UNIX
- #define SHARED_LIBRARY_NAME(Lib) "lib"Lib".so"
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/platform.h.in b/src/platform.h.in
@@ -0,0 +1,8 @@
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#define SHARED_LIBRARY_PREFIX "@LIB_PREFIX@"
+#define SHARED_LIBRARY_SUFFIX "@LIB_SUFFIX@"
+
+#endif /* PLATFORM_H */
+
diff --git a/src/rsys.h b/src/rsys.h
@@ -9,6 +9,7 @@
#error "Unsupported compiler"
#endif
+#include "platform.h"
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
@@ -33,6 +34,12 @@
#endif
/*******************************************************************************
+ * Shared library
+ ******************************************************************************/
+#define SHARED_LIBRARY_NAME(Name) \
+ SHARED_LIBRARY_PREFIX Name SHARED_LIBRARY_SUFFIX
+
+/*******************************************************************************
* Symbol visibility
******************************************************************************/
#define EXPORT_SYM __attribute__((visibility("default")))