summaryrefslogtreecommitdiff
path: root/volk/lib
diff options
context:
space:
mode:
authorNicholas Corgan <n.corgan@gmail.com>2014-02-12 09:10:21 -0800
committerNicholas Corgan <n.corgan@gmail.com>2014-02-12 09:10:21 -0800
commit1e0c15b7df7bca6c3a20efb22db0713b8d75675d (patch)
tree2095a819403430d8724a55f285dd991452867363 /volk/lib
parent295ba353abebfedf90ece523343bcfeea2c2149d (diff)
Windows compatibility fixes
* cmake: use CMake's internal variables for compiler info * volk: void* can't be used for pointer arithmetic in MSVC, so cast
Diffstat (limited to 'volk/lib')
-rw-r--r--volk/lib/CMakeLists.txt19
-rw-r--r--volk/lib/volk_malloc.c4
2 files changed, 20 insertions, 3 deletions
diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt
index dbebac067f..d2e4e62212 100644
--- a/volk/lib/CMakeLists.txt
+++ b/volk/lib/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2011-2012 Free Software Foundation, Inc.
+# Copyright 2011-2012,2014 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -308,8 +308,21 @@ STRING(TOUPPER ${CMAKE_BUILD_TYPE} CBTU)
MESSAGE(STATUS BUILT TYPE ${CBTU})
MESSAGE(STATUS "Base cflags = ${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS}")
set(COMPILER_INFO "")
-execute_process(COMMAND ${CMAKE_C_COMPILER} --version
- OUTPUT_VARIABLE cmake_c_compiler_version)
+IF(MSVC)
+ IF(MSVC90) #Visual Studio 9
+ SET(cmake_c_compiler_version "Microsoft Visual Studio 9.0")
+ ELSE(MSVC10) #Visual Studio 10
+ SET(cmake_c_compiler_version "Microsoft Visual Studio 10.0")
+ ELSE(MSVC11) #Visual Studio 11
+ SET(cmake_c_compiler_version "Microsoft Visual Studio 11.0")
+ ELSE(MSVC12) #Visual Studio 12
+ SET(cmake_c_compiler_version "Microsoft Visual Studio 12.0")
+ ENDIF()
+ELSE()
+ execute_process(COMMAND ${CMAKE_C_COMPILER} --version
+ OUTPUT_VARIABLE cmake_c_compiler_version)
+ENDIF(MSVC)
+set(COMPILER_INFO "${CMAKE_C_COMPILER}:::${CMAKE_C_FLAGS_${GRCBTU}} ${CMAKE_C_FLAGS}\n${CMAKE_CXX_COMPILER}:::${CMAKE_CXX_FLAGS_${GRCBTU}} ${CMAKE_CXX_FLAGS}\n" )
foreach(machine_name ${available_machines})
#generate machine source
diff --git a/volk/lib/volk_malloc.c b/volk/lib/volk_malloc.c
index 1333345800..65cb5eb8e9 100644
--- a/volk/lib/volk_malloc.c
+++ b/volk/lib/volk_malloc.c
@@ -111,7 +111,11 @@ volk_malloc(size_t size, size_t alignment)
// Find and return the first aligned boundary of the pointer
void *aptr = ptr;
if((unsigned long)ptr % alignment != 0)
+#ifdef _MSC_VER
+ aptr = (void*)((unsigned long)ptr + (alignment - ((unsigned long)ptr % alignment)));
+#else
aptr = ptr + (alignment - ((unsigned long)ptr % alignment));
+#endif
// Store original pointer and aligned pointers
mbuf *n = (mbuf*)malloc(sizeof(mbuf));