commit 2d80b9dd34d31bfd9f4b0ac8c592f2d9a26bff88
parent 83a2b1d3995f40c5cd6f33d596a58721d2757591
Author: vaplv <vaplv@free.fr>
Date: Wed, 27 May 2015 09:37:49 +0200
Make the library compliant with the CL compiler
Diffstat:
3 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -29,6 +29,8 @@ include_directories(${RCMake_INCLUDE_DIR} ${RSys_INCLUDE_DIR})
set(CMAKE_MODULE_PATH ${RCMAKE_SOURCE_DIR})
include(rcmake)
+include(rcmake_runtime)
+rcmake_append_runtime_dirs(_runtime_dirs RSys)
################################################################################
# Define targets
@@ -50,6 +52,12 @@ set_target_properties(aw PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION_MAJOR})
+if(MSVC)
+ # The CL compiler does not support the strtok_r POSIX function but proposes
+ # the strtok_s function that have the same profile and does the same thing.
+ set_target_properties(aw PROPERTIES COMPILE_FLAGS "/Dstrtok_r=strtok_s")
+endif(MSVC)
+
rcmake_setup_devel(aw AW ${VERSION} aw_version.h)
################################################################################
@@ -58,10 +66,12 @@ rcmake_setup_devel(aw AW ${VERSION} aw_version.h)
add_executable(test_aw_obj ${AW_SOURCE_DIR}/test_aw_obj.c)
target_link_libraries(test_aw_obj aw)
add_test(test_aw_obj test_aw_obj)
+rcmake_set_test_runtime_dirs(test_aw_obj _runtime_dirs)
add_executable(test_aw_mtl ${AW_SOURCE_DIR}/test_aw_mtl.c)
target_link_libraries(test_aw_mtl aw)
add_test(test_aw_mtl test_aw_mtl)
+rcmake_set_test_runtime_dirs(test_aw_mtl _runtime_dirs)
################################################################################
# Install directories
diff --git a/src/aw_mtl.c b/src/aw_mtl.c
@@ -27,6 +27,11 @@
#include <float.h>
+#ifdef COMPILER_CL
+ #pragma warning(push)
+ #pragma warning(disable:4706) /* Assignment within a condition */
+#endif
+
enum map_type {
MAP_COMMON = BIT(0),
MAP_SCALAR = BIT(1),
@@ -645,3 +650,7 @@ aw_material_copy_and_release(struct aw_material* dst, struct aw_material* src)
return RES_OK;
}
+#ifndef COMPILER_CL
+ #pragma warning(pop)
+#endif
+
diff --git a/src/aw_obj.c b/src/aw_obj.c
@@ -29,6 +29,11 @@
#include <float.h>
+#ifdef COMPILER_CL
+ #pragma warning(push)
+ #pragma warning(disable:4706) /* Assignment within a condition */
+#endif
+
struct vertex {
size_t iposition;
size_t inormal;
@@ -759,3 +764,6 @@ aw_obj_named_group_copy_and_release
return str_copy_and_release(&dst->name, &src->name);
}
+#ifndef COMPILER_CL
+ #pragma warning(pop)
+#endif