diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | cmake/Modules/FindUHD.cmake | 108 | ||||
-rw-r--r-- | cmake/Modules/UseSWIG.cmake | 317 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_makexml.py | 2 | ||||
-rw-r--r-- | gr-wxgui/python/wxgui/forms/forms.py | 4 | ||||
-rw-r--r-- | grc/gui/Actions.py | 2 | ||||
-rw-r--r-- | grc/gui/Bars.py | 2 | ||||
-rw-r--r-- | volk/lib/volk_malloc.c | 18 |
8 files changed, 439 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7accbdc7ae..60efb20259 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,8 @@ cmake_minimum_required(VERSION 2.6) project(gnuradio CXX C) enable_testing() -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) +#make sure our local CMake Modules path comes first +list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) include(GrBuildTypes) diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index b4d12b6d7b..94db092e8e 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -2,27 +2,113 @@ # Find the library for the USRP Hardware Driver ######################################################################## -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_UHD uhd) +# First check to see if UHD installed its own version +# of FindUHD, and if so use it. -FIND_PATH( +unset(UHD_FOUND) + +# obvious locations for FindUHD.cmake to already be installed are: +# ${prefix}/share/cmake-X.Y/Modules (${CMAKE_ROOT}) +# ${prefix}/share/cmake/Modules +# ${prefix}/lib/cmake +# ${prefix}/lib64/cmake + +get_filename_component(CMAKE_ROOT_PARENT "${CMAKE_ROOT}" PATH) + +find_path( + LOCAL_FINDUHD_DIR + NAMES FindUHD.cmake + PATH_SUFFIXES cmake cmake/Modules Modules + HINTS ${CMAKE_MODULES_DIR} + PATHS ${CMAKE_ROOT} + ${CMAKE_ROOT_PARENT} + ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib64 +) + +if(LOCAL_FINDUHD_DIR) + + # save the current MODULE path + set(SAVED_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) + + # remove the current directory from the MODULE path + list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + + # prepend the found directory to the MODULE path + list(INSERT CMAKE_MODULE_PATH 0 ${LOCAL_FINDUHD_DIR}) + + # "QUITE" works on CMake 2.8+ only + unset(LOCAL_UHD_QUIET) + if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.0") + set(LOCAL_UHD_QUIET "QUIET") + endif() + + # set REQUIRED, as directed + unset(LOCAL_UHD_REQUIRED) + if(UHD_FIND_REQUIRED) + set(LOCAL_UHD_REQUIRED "REQUIRED") + endif(UHD_FIND_REQUIRED) + + # set VERSION to be checking, as directed + unset(LOCAL_UHD_VERSION) + if(UHD_FIND_VERSION) + set(LOCAL_UHD_VERSION "${UHD_FIND_VERSION}") + endif(UHD_FIND_VERSION) + + # set EXACT, as directed, but only if VERSION was specified + unset(LOCAL_UHD_VERSION_EXACT) + if(UHD_FIND_VERSION_EXACT) + if(LOCAL_UHD_VERSION) + set(LOCAL_UHD_VERSION_EXACT "EXACT") + endif(LOCAL_UHD_VERSION) + endif(UHD_FIND_VERSION_EXACT) + + # try to find UHD using the already-installed FindUHD, as directed + find_package( + UHD ${LOCAL_UHD_VERSION} ${LOCAL_UHD_VERSION_EXACT} + ${LOCAL_UHD_REQUIRED} ${LOCAL_UHD_QUIET} + ) + + # restore CMAKE_MODULE_PATH + + set(CMAKE_MODULE_PATH ${SAVED_CMAKE_MODULE_PATH}) + + # print the standard message iff UHD was found + if(UHD_FOUND) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) + endif(UHD_FOUND) + +endif(LOCAL_FINDUHD_DIR) + +# check if UHD was found above +if(NOT UHD_FOUND) + + # Not found; try the "old" method (not as robust) + + include(FindPkgConfig) + pkg_check_modules(PC_UHD uhd) + + find_path( UHD_INCLUDE_DIRS NAMES uhd/config.hpp HINTS $ENV{UHD_DIR}/include - ${PC_UHD_INCLUDEDIR} + ${PC_UHD_INCLUDEDIR} PATHS /usr/local/include /usr/include -) + ) -FIND_LIBRARY( + find_library( UHD_LIBRARIES NAMES uhd HINTS $ENV{UHD_DIR}/lib - ${PC_UHD_LIBDIR} + ${PC_UHD_LIBDIR} PATHS /usr/local/lib /usr/lib -) + ) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) + mark_as_advanced(UHD_LIBRARIES UHD_INCLUDE_DIRS) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) -MARK_AS_ADVANCED(UHD_LIBRARIES UHD_INCLUDE_DIRS) +endif(NOT UHD_FOUND) diff --git a/cmake/Modules/UseSWIG.cmake b/cmake/Modules/UseSWIG.cmake new file mode 100644 index 0000000000..008bfa0ed5 --- /dev/null +++ b/cmake/Modules/UseSWIG.cmake @@ -0,0 +1,317 @@ +# - SWIG module for CMake +# Defines the following macros: +# SWIG_ADD_MODULE(name language [ files ]) +# - Define swig module with given name and specified language +# SWIG_LINK_LIBRARIES(name [ libraries ]) +# - Link libraries to swig module +# All other macros are for internal use only. +# To get the actual name of the swig module, +# use: ${SWIG_MODULE_${name}_REAL_NAME}. +# Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify +# special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add +# special flags to all swig calls. +# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify +# where to write all the swig generated module (swig -outdir option) +# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used +# to specify extra dependencies for the generated modules. +# If the source file generated by swig need some special flag you can use +# set_source_files_properties( ${swig_generated_file_fullname} +# PROPERTIES COMPILE_FLAGS "-bla") + + +#============================================================================= +# Copyright 2004-2009 Kitware, Inc. +# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +set(SWIG_CXX_EXTENSION "cxx") +set(SWIG_EXTRA_LIBRARIES "") + +set(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py") + +# +# For given swig module initialize variables associated with it +# +macro(SWIG_MODULE_INITIALIZE name language) + string(TOUPPER "${language}" swig_uppercase_language) + string(TOLOWER "${language}" swig_lowercase_language) + set(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}") + set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") + + set(SWIG_MODULE_${name}_REAL_NAME "${name}") + if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN") + message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") + elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON") + # when swig is used without the -interface it will produce in the module.py + # a 'import _modulename' statement, which implies having a corresponding + # _modulename.so (*NIX), _modulename.pyd (Win32). + set(SWIG_MODULE_${name}_REAL_NAME "_${name}") + elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL") + set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") + endif() +endmacro() + +# +# For a given language, input file, and output file, determine extra files that +# will be generated. This is internal swig macro. +# + +macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) + set(${outfiles} "") + get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename + ${infile} SWIG_MODULE_NAME) + if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") + get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) + endif() + foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) + set(${outfiles} ${${outfiles}} + "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}") + endforeach() +endmacro() + +# +# Take swig (*.i) file and add proper custom commands for it +# +macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) + set(swig_full_infile ${infile}) + get_filename_component(swig_source_file_path "${infile}" PATH) + get_filename_component(swig_source_file_name_we "${infile}" NAME_WE) + get_source_file_property(swig_source_file_generated ${infile} GENERATED) + get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS) + get_source_file_property(swig_source_file_flags ${infile} SWIG_FLAGS) + if("${swig_source_file_flags}" STREQUAL "NOTFOUND") + set(swig_source_file_flags "") + endif() + set(swig_source_file_fullname "${infile}") + if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") + string(REGEX REPLACE + "^${CMAKE_CURRENT_SOURCE_DIR}" "" + swig_source_file_relative_path + "${swig_source_file_path}") + else() + if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") + string(REGEX REPLACE + "^${CMAKE_CURRENT_BINARY_DIR}" "" + swig_source_file_relative_path + "${swig_source_file_path}") + set(swig_source_file_generated 1) + else() + set(swig_source_file_relative_path "${swig_source_file_path}") + if(swig_source_file_generated) + set(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}") + else() + set(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}") + endif() + endif() + endif() + + set(swig_generated_file_fullname + "${CMAKE_CURRENT_BINARY_DIR}") + if(swig_source_file_relative_path) + set(swig_generated_file_fullname + "${swig_generated_file_fullname}/${swig_source_file_relative_path}") + endif() + # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir + if(CMAKE_SWIG_OUTDIR) + set(swig_outdir ${CMAKE_SWIG_OUTDIR}) + else() + set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) + endif() + SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE} + swig_extra_generated_files + "${swig_outdir}" + "${infile}") + set(swig_generated_file_fullname + "${swig_generated_file_fullname}/${swig_source_file_name_we}") + # add the language into the name of the file (i.e. TCL_wrap) + # this allows for the same .i file to be wrapped into different languages + set(swig_generated_file_fullname + "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap") + + if(swig_source_file_cplusplus) + set(swig_generated_file_fullname + "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}") + else() + set(swig_generated_file_fullname + "${swig_generated_file_fullname}.c") + endif() + + # Shut up some warnings from poor SWIG code generation that we + # can do nothing about. + set_source_files_properties( ${swig_generated_file_fullname} + PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable") + + #message("Full path to source file: ${swig_source_file_fullname}") + #message("Full path to the output file: ${swig_generated_file_fullname}") + get_directory_property(cmake_include_directories INCLUDE_DIRECTORIES) + set(swig_include_dirs) + foreach(it ${cmake_include_directories}) + set(swig_include_dirs ${swig_include_dirs} "-I${it}") + endforeach() + + set(swig_special_flags) + # default is c, so add c++ flag if it is c++ + if(swig_source_file_cplusplus) + set(swig_special_flags ${swig_special_flags} "-c++") + endif() + set(swig_extra_flags) + if(SWIG_MODULE_${name}_EXTRA_FLAGS) + set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) + endif() + + # hack to work around CMake bug in add_custom_command with multiple OUTPUT files + + file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib +unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5] +print(re.sub('\\W', '_', '${name} ${reldir} ' + unique))" + OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + file( + WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp.in + "int main(void){return 0;}\n" + ) + + # create dummy dependencies + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp.in + ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp + DEPENDS "${swig_source_file_fullname}" ${SWIG_MODULE_${name}_EXTRA_DEPS} + COMMENT "" + ) + + # create the dummy target + add_executable(${_target} ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp) + + # add a custom command to the dummy target + add_custom_command( + TARGET ${_target} + # Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir) + COMMAND ${CMAKE_COMMAND} -E make_directory ${swig_outdir} + COMMAND "${SWIG_EXECUTABLE}" + ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}" + ${swig_source_file_flags} + ${CMAKE_SWIG_FLAGS} + -outdir ${swig_outdir} + ${swig_special_flags} + ${swig_extra_flags} + ${swig_include_dirs} + -o "${swig_generated_file_fullname}" + "${swig_source_file_fullname}" + COMMENT "Swig source" + ) + + #add dummy independent dependencies from the _target to each file + #that will be generated by the SWIG command above + + set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files}) + + foreach(swig_gen_file ${${outfiles}}) + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: name adding dep from '${_target}' to '${swig_gen_file}'") + add_custom_command( + OUTPUT ${swig_gen_file} + COMMAND "" + DEPENDS ${_target} + COMMENT "" + ) + endforeach() + + set_source_files_properties( + ${outfiles} PROPERTIES GENERATED 1 + ) + + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: name is '${name}'") + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: ${name} swig_generated_file_fullname is '${swig_generated_file_fullname}'") + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: ${name} swig_extra_generated_files is '${swig_extra_generated_files}'") + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: ${name} outfiles is '${outfiles}'") + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: ${name} {outfiles} is '${${outfiles}}'") + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: SWIG_MODULE_${name}_EXTRA_DEPS is '${SWIG_MODULE_${name}_EXTRA_DEPS}'") + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: SWIG_MODULE_${name}_EXTRA_FLAGS is '${SWIG_MODULE_${name}_EXTRA_FLAGS}'") + #message(STATUS "UseSWIG::SWIG_ADD_SOURCE_TO_MODULE: SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG is '${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}'") + +endmacro() + +# +# Create Swig module +# +macro(SWIG_ADD_MODULE name language) + SWIG_MODULE_INITIALIZE(${name} ${language}) + set(swig_dot_i_sources) + set(swig_other_sources) + foreach(it ${ARGN}) + if(${it} MATCHES ".*\\.i$") + set(swig_dot_i_sources ${swig_dot_i_sources} "${it}") + else() + set(swig_other_sources ${swig_other_sources} "${it}") + endif() + endforeach() + + set(swig_generated_sources) + foreach(it ${swig_dot_i_sources}) + SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it}) + set(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}") + endforeach() + get_directory_property(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) + set_directory_properties(PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}") + add_library(${SWIG_MODULE_${name}_REAL_NAME} + MODULE + ${swig_generated_sources} + ${swig_other_sources}) + string(TOLOWER "${language}" swig_lowercase_language) + if ("${swig_lowercase_language}" STREQUAL "java") + if (APPLE) + # In java you want: + # System.loadLibrary("LIBRARY"); + # then JNI will look for a library whose name is platform dependent, namely + # MacOS : libLIBRARY.jnilib + # Windows: LIBRARY.dll + # Linux : libLIBRARY.so + set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib") + endif () + endif () + if ("${swig_lowercase_language}" STREQUAL "python") + # this is only needed for the python case where a _modulename.so is generated + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") + # Python extension modules on Windows must have the extension ".pyd" + # instead of ".dll" as of Python 2.5. Older python versions do support + # this suffix. + # http://docs.python.org/whatsnew/ports.html#SECTION0001510000000000000000 + # <quote> + # Windows: .dll is no longer supported as a filename extension for extension modules. + # .pyd is now the only filename extension that will be searched for. + # </quote> + if(WIN32 AND NOT CYGWIN) + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd") + endif() + endif () + + #message(STATUS "UseSWIG::SWIG_ADD_MODULE: name is '${name}'") + #message(STATUS "UseSWIG::SWIG_ADD_MODULE: ${name} swig_generated_sources is '${swig_generated_sources}'") + #message(STATUS "UseSWIG::SWIG_ADD_MODULE: ${name} swig_other_sources is '${swig_other_sources}'") + +endmacro() + +# +# Like TARGET_LINK_LIBRARIES but for swig modules +# +macro(SWIG_LINK_LIBRARIES name) + if(SWIG_MODULE_${name}_REAL_NAME) + target_link_libraries(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN}) + else() + message(SEND_ERROR "Cannot find Swig library \"${name}\".") + endif() +endmacro() diff --git a/gr-utils/python/modtool/modtool_makexml.py b/gr-utils/python/modtool/modtool_makexml.py index 28eabe1b81..82dc9d94d4 100644 --- a/gr-utils/python/modtool/modtool_makexml.py +++ b/gr-utils/python/modtool/modtool_makexml.py @@ -137,7 +137,7 @@ class ModToolMakeXML(ModTool): 'std::vector<float>': 'real_vector', 'std::vector<gr_complex>': 'complex_vector', } - if p_type in ('int',) and default_v[:2].lower() == '0x': + if p_type in ('int',) and default_v is not None and len(default_v) > 1 and default_v[:2].lower() == '0x': return 'hex' try: return translate_dict[p_type] diff --git a/gr-wxgui/python/wxgui/forms/forms.py b/gr-wxgui/python/wxgui/forms/forms.py index db55472210..f819f13397 100644 --- a/gr-wxgui/python/wxgui/forms/forms.py +++ b/gr-wxgui/python/wxgui/forms/forms.py @@ -515,13 +515,13 @@ class notebook(_chooser_base): _chooser_base.__init__(self, **kwargs) assert len(pages) == len(self._choices) self._notebook = notebook - self._notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self._handle) + self._notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self._handle) #add pages, setting the label on each tab for i, page in enumerate(pages): self._notebook.AddPage(page, self._labels[i]) self._add_widget(self._notebook) - def _handle(self, event): self[INT_KEY] = self._notebook.GetSelection() + def _handle(self, event): self[INT_KEY] = event.GetSelection() # SetSelection triggers a page change event (deprecated, breaks on Windows) and ChangeSelection does not def _update(self, i): self._notebook.ChangeSelection(i) diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py index 50ee456e76..c41798aab8 100644 --- a/grc/gui/Actions.py +++ b/grc/gui/Actions.py @@ -334,7 +334,7 @@ FLOW_GRAPH_GEN = Action( FLOW_GRAPH_EXEC = Action( label='_Execute', tooltip='Execute the flow graph', - stock_id=gtk.STOCK_EXECUTE, + stock_id=gtk.STOCK_MEDIA_PLAY, keypresses=(gtk.keysyms.F6, NO_MODS_MASK), ) FLOW_GRAPH_KILL = Action( diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index 6ddaa4ab21..743345200e 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -104,7 +104,7 @@ MENU_BAR_LIST = ( Actions.ERRORS_WINDOW_DISPLAY, Actions.FIND_BLOCKS, ]), - (gtk.Action('Build', '_Build', None, None), [ + (gtk.Action('Run', '_Run', None, None), [ Actions.FLOW_GRAPH_GEN, Actions.FLOW_GRAPH_EXEC, Actions.FLOW_GRAPH_KILL, diff --git a/volk/lib/volk_malloc.c b/volk/lib/volk_malloc.c index b0ffcb5ef2..d5e17090a2 100644 --- a/volk/lib/volk_malloc.c +++ b/volk/lib/volk_malloc.c @@ -75,6 +75,24 @@ void volk_free(void *ptr) free(ptr); } +// _aligned_malloc has no restriction on size, +// available on Windows since Visual C++ 2005 +#elif _MSC_VER >= 1400 + +void *volk_malloc(size_t size, size_t alignment) +{ + void *ptr = _aligned_malloc(size, alignment); + if(ptr == NULL) { + fprintf(stderr, "VOLK: Error allocating memory (_aligned_malloc)\n"); + } + return ptr; +} + +void volk_free(void *ptr) +{ + _aligned_free(ptr); +} + // No standard handlers; we'll do it ourselves. #else // _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || HAVE_POSIX_MEMALIGN |