From eb43a23b777d2438d22b67ae6dfd9b4d69406593 Mon Sep 17 00:00:00 2001
From: Nick Foster
Date: Wed, 20 Jul 2011 16:29:43 -0700
Subject: Volk: add in mutex capability to archs.xml. Turns out some compilers
can do both 32-bit and 64-bit compilations, and this breaks Volk. Only works
in CMake right now.
---
volk/gen/archs.xml | 1 +
volk/gen/volk_register.py | 2 +-
volk/lib/CMakeLists.txt | 21 +++++++++++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
(limited to 'volk')
diff --git a/volk/gen/archs.xml b/volk/gen/archs.xml
index f6822871f..960558b7c 100644
--- a/volk/gen/archs.xml
+++ b/volk/gen/archs.xml
@@ -29,6 +29,7 @@
1
MD_SUBCPU
x86
+ 32
diff --git a/volk/gen/volk_register.py b/volk/gen/volk_register.py
index 75e5eeb87..f5854bbce 100644
--- a/volk/gen/volk_register.py
+++ b/volk/gen/volk_register.py
@@ -91,7 +91,7 @@ for arch in archs:
if a_var:
archs.remove(arch);
-
+#strip out mutex archs
archflags_dict = {}
for filearch in filearchs:
diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt
index d69b4941d..b332ea5a3 100644
--- a/volk/lib/CMakeLists.txt
+++ b/volk/lib/CMakeLists.txt
@@ -27,6 +27,14 @@ EXECUTE_PROCESS(
OUTPUT_VARIABLE arch_lines OUTPUT_STRIP_TRAILING_WHITESPACE
)
+#get any mutually exclusive archs so we can exclude them
+#this is really for compilers which can do both 32- and 64-bit compilations.
+EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c
+ "from xml.dom import minidom; print ';'.join(map(lambda a: '%s %s'%(a.parentNode.attributes['name'].value,a.firstChild.data),minidom.parse('../gen/archs.xml').getElementsByTagName('mutex')))"
+ OUTPUT_VARIABLE mutex_lines OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
#This macro sets the ${arch}_flag variable,
#and handles special cases for MSVC arch flags.
MACRO(set_arch_flag name flag)
@@ -59,12 +67,25 @@ MACRO(handle_arch name flag)
ENDIF()
ENDMACRO(handle_arch)
+MACRO(remove_mutex name mutex)
+ IF(have_${name})
+ UNSET(have_${mutex})
+ ENDIF()
+ LIST(REMOVE_ITEM available_arches ${mutex})
+ENDMACRO(remove_mutex)
+
#create a list of available arches
FOREACH(arch_line ${arch_lines})
SEPARATE_ARGUMENTS(args UNIX_COMMAND "${arch_line}")
handle_arch(${args})
ENDFOREACH(arch_line)
+#strip out mutex archs
+FOREACH(mutex_line ${mutex_lines})
+ SEPARATE_ARGUMENTS(args UNIX_COMMAND "${mutex_line}")
+ remove_mutex(${args})
+ENDFOREACH(mutex_line)
+
MESSAGE(STATUS "Available arches: ${available_arches}")
########################################################################
--
cgit