commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 01/01: Windows compatibility fixes


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/01: Windows compatibility fixes
Date: Fri, 7 Mar 2014 20:01:49 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch maint
in repository gnuradio.

commit c951015f2b94f961a92e133ef6bb5f33a011a0bb
Author: Nicholas Corgan <address@hidden>
Date:   Wed Feb 12 09:10:21 2014 -0800

    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
---
 CMakeLists.txt          | 26 +++++++++++++++++++++-----
 volk/lib/CMakeLists.txt | 19 ++++++++++++++++---
 volk/lib/volk_malloc.c  |  4 ++++
 3 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cab3efa..2ea4c47 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Free Software Foundation, Inc.
+# Copyright 2010-2012,2014 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -106,10 +106,26 @@ endif(MSVC)
 # Record Compiler Info for record
 STRING(TOUPPER ${CMAKE_BUILD_TYPE} GRCBTU)
 set(COMPILER_INFO "")
-execute_process(COMMAND ${CMAKE_C_COMPILER} --version
-        OUTPUT_VARIABLE cmake_c_compiler_version)
-execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
-        OUTPUT_VARIABLE cmake_cxx_compiler_version)
+IF(MSVC)
+    IF(MSVC90)   #Visual Studio 9
+        SET(cmake_c_compiler_version "Microsoft Visual Studio 9.0")
+        SET(cmake_cxx_compiler_version "Microsoft Visual Studio 9.0")
+    ELSE(MSVC10) #Visual Studio 10
+        SET(cmake_c_compiler_version "Microsoft Visual Studio 10.0")
+        SET(cmake_cxx_compiler_version "Microsoft Visual Studio 10.0")
+    ELSE(MSVC11) #Visual Studio 11
+        SET(cmake_c_compiler_version "Microsoft Visual Studio 11.0")
+        SET(cmake_cxx_compiler_version "Microsoft Visual Studio 11.0")
+    ELSE(MSVC12) #Visual Studio 12
+        SET(cmake_c_compiler_version "Microsoft Visual Studio 12.0")
+        SET(cmake_cxx_compiler_version "Microsoft Visual Studio 12.0")
+    ENDIF()
+ELSE()
+    execute_process(COMMAND ${CMAKE_C_COMPILER} --version
+            OUTPUT_VARIABLE cmake_c_compiler_version)
+    execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
+            OUTPUT_VARIABLE cmake_cxx_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" )
 
 # Convert to a C string to compile and display properly
diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt
index dbebac0..d2e4e62 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 1333345..65cb5eb 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));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]