1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

CMake fixes

Remove Boost usage from lib, and fix it in apps to be used only if std::filesystem is not found.
Be more precise in specifying whether include directories are PUBLIC or PRIVATE.
Some whitespace tweaks
This commit is contained in:
Carles Fernandez 2019-12-15 12:43:07 -03:00
parent eacdce0a50
commit 5f97d52998
5 changed files with 191 additions and 198 deletions

View File

@ -225,12 +225,11 @@ volk_python_check_module("python >= 2.7" sys "sys.version.split()[0] >= '2.7'" P
volk_python_check_module("mako >= 0.4.2" mako "mako.__version__ >= '0.4.2'" MAKO_FOUND) volk_python_check_module("mako >= 0.4.2" mako "mako.__version__ >= '0.4.2'" MAKO_FOUND)
volk_python_check_module("six - python 2 and 3 compatibility library" six "True" SIX_FOUND) volk_python_check_module("six - python 2 and 3 compatibility library" six "True" SIX_FOUND)
if(NOT PYTHON_MIN_VER_FOUND) if(NOT PYTHON_MIN_VER_FOUND)
message(FATAL_ERROR "Python 2.7 or greater required to build VOLK_GNSSSDR") message(FATAL_ERROR "Python 2.7 or greater required to build VOLK_GNSSSDR")
endif() endif()
# Mako # Mako
if(NOT MAKO_FOUND) if(NOT MAKO_FOUND)
message(FATAL_ERROR "Mako templates required to build VOLK_GNSSSDR") message(FATAL_ERROR "Mako templates required to build VOLK_GNSSSDR")
endif() endif()
@ -252,10 +251,7 @@ if(MSVC)
unset(BOOST_REQUIRED_COMPONENTS) # empty components list for static link unset(BOOST_REQUIRED_COMPONENTS) # empty components list for static link
endif() endif()
endif() endif()
if(${FILESYSTEM_FOUND}) if(NOT ${FILESYSTEM_FOUND})
set(Boost_LIBRARIES "")
set(Boost_INCLUDE_DIRS "")
else()
include(VolkBoost) include(VolkBoost)
if(NOT Boost_FOUND) if(NOT Boost_FOUND)
message(FATAL_ERROR "VOLK-GNSSSDR requires Boost to build") message(FATAL_ERROR "VOLK-GNSSSDR requires Boost to build")
@ -265,9 +261,9 @@ endif()
# Orc # Orc
option(ENABLE_ORC "Enable Orc" TRUE) option(ENABLE_ORC "Enable Orc" TRUE)
if(ENABLE_ORC) if(ENABLE_ORC)
find_package(ORC) find_package(ORC)
else() else()
message(STATUS "Disabling use of ORC") message(STATUS "Disabling use of ORC")
endif() endif()
@ -279,8 +275,8 @@ if(DOXYGEN_FOUND)
configure_file( configure_file(
${PROJECT_SOURCE_DIR}/Doxyfile.in ${PROJECT_SOURCE_DIR}/Doxyfile.in
${PROJECT_BINARY_DIR}/Doxyfile ${PROJECT_BINARY_DIR}/Doxyfile
@ONLY) @ONLY
)
add_custom_target(doc add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
@ -313,9 +309,9 @@ install(
######################################################################## ########################################################################
# Install all headers in the include directories # Install all headers in the include directories
######################################################################## ########################################################################
set(VOLK_RUNTIME_DIR bin) set(VOLK_RUNTIME_DIR bin)
set(VOLK_LIBRARY_DIR lib${LIB_SUFFIX}) set(VOLK_LIBRARY_DIR lib${LIB_SUFFIX})
set(VOLK_INCLUDE_DIR include) set(VOLK_INCLUDE_DIR include)
install( install(
DIRECTORY ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr DIRECTORY ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr
@ -352,16 +348,19 @@ if(APPLE)
if(NOT CMAKE_INSTALL_NAME_DIR) if(NOT CMAKE_INSTALL_NAME_DIR)
set(CMAKE_INSTALL_NAME_DIR set(CMAKE_INSTALL_NAME_DIR
${CMAKE_INSTALL_PREFIX}/${VOLK_LIBRARY_DIR} CACHE ${CMAKE_INSTALL_PREFIX}/${VOLK_LIBRARY_DIR} CACHE
PATH "Library Install Name Destination Directory" FORCE) PATH "Library Install Name Destination Directory" FORCE
)
endif() endif()
if(NOT CMAKE_INSTALL_RPATH) if(NOT CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH set(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_PREFIX}/${VOLK_LIBRARY_DIR} CACHE ${CMAKE_INSTALL_PREFIX}/${VOLK_LIBRARY_DIR} CACHE
PATH "Library Install RPath" FORCE) PATH "Library Install RPath" FORCE
)
endif() endif()
if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
BOOL "Do Build Using Library Install RPath" FORCE) BOOL "Do Build Using Library Install RPath" FORCE
)
endif() endif()
endif() endif()
@ -372,7 +371,8 @@ endif()
configure_file( configure_file(
${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in ${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
@ONLY) @ONLY
)
# Only add the target if there isn't one defined already # Only add the target if there isn't one defined already
if(NOT TARGET uninstall) if(NOT TARGET uninstall)
@ -390,14 +390,16 @@ endif()
######################################################################## ########################################################################
configure_file( configure_file(
${CMAKE_SOURCE_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake.in ${CMAKE_SOURCE_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake.in
${CMAKE_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake ${CMAKE_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake
@ONLY) @ONLY
)
configure_file( configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/VolkGnsssdrConfigVersion.cmake.in ${PROJECT_SOURCE_DIR}/cmake/Modules/VolkGnsssdrConfigVersion.cmake.in
${PROJECT_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfigVersion.cmake ${PROJECT_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfigVersion.cmake
@ONLY) @ONLY
)
######################################################################## ########################################################################
@ -425,9 +427,9 @@ install(EXPORT VOLK_GNSSSDR-export FILE VolkGnsssdrTargets.cmake
######################################################################## ########################################################################
option(ENABLE_TESTING "Enable QA testing" ON) option(ENABLE_TESTING "Enable QA testing" ON)
if(ENABLE_TESTING) if(ENABLE_TESTING)
message(STATUS "QA Testing is enabled.") message(STATUS "QA Testing is enabled.")
else() else()
message(STATUS "QA Testing is disabled.") message(STATUS "QA Testing is disabled.")
endif() endif()
message(STATUS " Modify using: -DENABLE_TESTING=ON/OFF") message(STATUS " Modify using: -DENABLE_TESTING=ON/OFF")
@ -437,24 +439,24 @@ message(STATUS " Modify using: -DENABLE_TESTING=ON/OFF")
######################################################################## ########################################################################
option(ENABLE_PROFILING "Launch system profiler after build" OFF) option(ENABLE_PROFILING "Launch system profiler after build" OFF)
if(ENABLE_PROFILING) if(ENABLE_PROFILING)
set(ENABLE_STATIC_LIBS ON) set(ENABLE_STATIC_LIBS ON)
if(DEFINED VOLK_CONFIGPATH) if(DEFINED VOLK_CONFIGPATH)
get_filename_component(VOLK_CONFIGPATH ${VOLK_CONFIGPATH} ABSOLUTE) get_filename_component(VOLK_CONFIGPATH ${VOLK_CONFIGPATH} ABSOLUTE)
set(VOLK_CONFIGPATH "${VOLK_CONFIGPATH}/volk_gnsssdr") set(VOLK_CONFIGPATH "${VOLK_CONFIGPATH}/volk_gnsssdr")
message(STATUS "System profiling is enabled, using path: ${VOLK_CONFIGPATH}") message(STATUS "System profiling is enabled, using path: ${VOLK_CONFIGPATH}")
elseif(DEFINED ENV{VOLK_CONFIGPATH}) elseif(DEFINED ENV{VOLK_CONFIGPATH})
set(VOLK_CONFIGPATH "$ENV{VOLK_CONFIGPATH}/volk_gnsssdr") set(VOLK_CONFIGPATH "$ENV{VOLK_CONFIGPATH}/volk_gnsssdr")
message(STATUS "System profiling is enabled, using env path: $ENV{VOLK_CONFIGPATH}") message(STATUS "System profiling is enabled, using env path: $ENV{VOLK_CONFIGPATH}")
else() else()
message(STATUS "System profiling is enabled with default paths.") message(STATUS "System profiling is enabled with default paths.")
if(DEFINED ENV{HOME}) if(DEFINED ENV{HOME})
set(VOLK_CONFIGPATH "$ENV{HOME}/.volk_gnsssdr") set(VOLK_CONFIGPATH "$ENV{HOME}/.volk_gnsssdr")
elseif(DEFINED ENV{APPDATA}) elseif(DEFINED ENV{APPDATA})
set(VOLK_CONFIGPATH "$ENV{APPDATA}/.volk_gnsssdr") set(VOLK_CONFIGPATH "$ENV{APPDATA}/.volk_gnsssdr")
endif()
endif() endif()
endif()
else() else()
message(STATUS "System profiling is disabled.") message(STATUS "System profiling is disabled.")
endif() endif()
message(STATUS " Modify using: -DENABLE_PROFILING=ON/OFF") message(STATUS " Modify using: -DENABLE_PROFILING=ON/OFF")
######################################################################## ########################################################################

View File

@ -20,21 +20,6 @@
######################################################################## ########################################################################
# Setup profiler # Setup profiler
######################################################################## ########################################################################
if(MSVC)
include_directories(${PROJECT_SOURCE_DIR}/cmake/msvc)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/lib
${PROJECT_BINARY_DIR}/lib
${Boost_INCLUDE_DIRS}
)
if(ORC_FOUND) if(ORC_FOUND)
set(orc_lib ${ORC_LIBRARIES}) set(orc_lib ${ORC_LIBRARIES})
else() else()
@ -58,6 +43,29 @@ add_executable(volk_gnsssdr_profile
${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc
) )
if(MSVC)
target_include_directories(volk_gnsssdr_profile
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/cmake/msvc>
)
endif(MSVC)
target_include_directories(volk_gnsssdr_profile
PRIVATE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PRIVATE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/lib>
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib>
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
)
if(NOT ${FILESYSTEM_FOUND})
target_include_directories(volk_gnsssdr_profile
PUBLIC ${Boost_INCLUDE_DIRS}
)
target_link_libraries(volk_gnsssdr_profile PRIVATE ${Boost_LIBRARIES})
endif()
if(${FILESYSTEM_FOUND}) if(${FILESYSTEM_FOUND})
add_definitions(-DHAS_STD_FILESYSTEM=1) add_definitions(-DHAS_STD_FILESYSTEM=1)
if(${find_experimental}) if(${find_experimental})
@ -67,9 +75,9 @@ if(${FILESYSTEM_FOUND})
endif() endif()
if(ENABLE_STATIC_LIBS) if(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr_profile PUBLIC volk_gnsssdr_static ${Boost_LIBRARIES} ${orc_lib}) target_link_libraries(volk_gnsssdr_profile PUBLIC volk_gnsssdr_static ${orc_lib})
else() else()
target_link_libraries(volk_gnsssdr_profile PUBLIC volk_gnsssdr ${Boost_LIBRARIES} ${orc_lib}) target_link_libraries(volk_gnsssdr_profile PUBLIC volk_gnsssdr ${orc_lib})
add_dependencies(volk_gnsssdr_profile volk_gnsssdr) add_dependencies(volk_gnsssdr_profile volk_gnsssdr)
endif() endif()
@ -77,7 +85,8 @@ endif()
if(ENABLE_STRIP) if(ENABLE_STRIP)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr_profile set_target_properties(volk_gnsssdr_profile
PROPERTIES LINK_FLAGS "-s") PROPERTIES LINK_FLAGS "-s"
)
endif() endif()
endif() endif()
@ -103,7 +112,8 @@ endif()
if(ENABLE_STRIP) if(ENABLE_STRIP)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr-config-info set_target_properties(volk_gnsssdr-config-info
PROPERTIES LINK_FLAGS "-s") PROPERTIES LINK_FLAGS "-s"
)
endif() endif()
endif() endif()

View File

@ -47,7 +47,7 @@ endif()
# Setup the compiler name # Setup the compiler name
######################################################################## ########################################################################
set(COMPILER_NAME ${CMAKE_C_COMPILER_ID}) set(COMPILER_NAME ${CMAKE_C_COMPILER_ID})
if(MSVC) #its not set otherwise if(MSVC) # its not set otherwise
set(COMPILER_NAME MSVC) set(COMPILER_NAME MSVC)
endif() endif()
@ -77,11 +77,11 @@ include(CheckSymbolExists)
check_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN) check_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
if(HAVE_POSIX_MEMALIGN) if(HAVE_POSIX_MEMALIGN)
add_definitions(-DHAVE_POSIX_MEMALIGN) add_definitions(-DHAVE_POSIX_MEMALIGN)
endif() endif()
if(NOT DEFINED _XOPEN_SOURCE AND NOT MSVC) if(NOT DEFINED _XOPEN_SOURCE AND NOT MSVC)
add_definitions(-D_XOPEN_SOURCE=700) add_definitions(-D_XOPEN_SOURCE=700)
endif() endif()
######################################################################## ########################################################################
@ -111,7 +111,7 @@ macro(check_arch arch_name)
else() else()
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
set(have_flag have${flag}) set(have_flag have${flag})
#make the have_flag have nice alphanum chars (just for looks/not necessary) # make the have_flag have nice alphanum chars (just for looks/not necessary)
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import re; print(re.sub('\\W', '_', '${have_flag}'))" COMMAND ${PYTHON_EXECUTABLE} -c "import re; print(re.sub('\\W', '_', '${have_flag}'))"
OUTPUT_VARIABLE have_flag OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE have_flag OUTPUT_STRIP_TRAILING_WHITESPACE
@ -153,20 +153,22 @@ if(CPU_IS_x86)
if(NOT MSVC) if(NOT MSVC)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "unsigned long long _xgetbv(unsigned int index) { unsigned int eax, edx; __asm__ __volatile__(\"xgetbv\" : \"=a\"(eax), \"=d\"(edx) : \"c\"(index)); return ((unsigned long long)edx << 32) | eax; } int main (void) { (void) _xgetbv(0); return (0); }") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "unsigned long long _xgetbv(unsigned int index) { unsigned int eax, edx; __asm__ __volatile__(\"xgetbv\" : \"=a\"(eax), \"=d\"(edx) : \"c\"(index)); return ((unsigned long long)edx << 32) | eax; } int main (void) { (void) _xgetbv(0); return (0); }")
else() else()
#MSVC defines an intrinsic # MSVC defines an intrinsic
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "#include <stdio.h> \n #include <intrin.h> \n int main() { int avxSupported = 0; \n#if (_MSC_FULL_VER >= 160040219) \nint cpuInfo[4]; __cpuid(cpuInfo, 1);\nif ((cpuInfo[2] & (1 << 27) || 0) && (cpuInfo[2] & (1 << 28) || 0)) \n{\nunsigned long long xcrFeatureMask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);\n avxSupported = (xcrFeatureMask & 0x6) == 6;}\n#endif \n return 1- avxSupported; }") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "#include <stdio.h> \n #include <intrin.h> \n int main() { int avxSupported = 0; \n#if (_MSC_FULL_VER >= 160040219) \nint cpuInfo[4]; __cpuid(cpuInfo, 1);\nif ((cpuInfo[2] & (1 << 27) || 0) && (cpuInfo[2] & (1 << 28) || 0)) \n{\nunsigned long long xcrFeatureMask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);\n avxSupported = (xcrFeatureMask & 0x6) == 6;}\n#endif \n return 1- avxSupported; }")
endif() endif()
execute_process(COMMAND ${CMAKE_C_COMPILER} -o execute_process(COMMAND ${CMAKE_C_COMPILER} -o
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c
OUTPUT_QUIET ERROR_QUIET OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_compile_result) RESULT_VARIABLE avx_compile_result
)
if(NOT ${avx_compile_result} EQUAL 0) if(NOT ${avx_compile_result} EQUAL 0)
overrule_arch(avx "Compiler or linker missing xgetbv instruction") overrule_arch(avx "Compiler or linker missing xgetbv instruction")
elseif(NOT CROSSCOMPILE_MULTILIB) elseif(NOT CROSSCOMPILE_MULTILIB)
execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
OUTPUT_QUIET ERROR_QUIET OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_exe_result) RESULT_VARIABLE avx_exe_result
)
if(NOT ${avx_exe_result} EQUAL 0) if(NOT ${avx_exe_result} EQUAL 0)
overrule_arch(avx "CPU missing xgetbv") overrule_arch(avx "CPU missing xgetbv")
else() else()
@ -177,7 +179,8 @@ if(CPU_IS_x86)
set(HAVE_XGETBV 1) set(HAVE_XGETBV 1)
endif() endif()
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c) ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c
)
######################################################################### #########################################################################
# eliminate AVX if cvtpi32_ps intrinsic fails like some versions of clang # eliminate AVX if cvtpi32_ps intrinsic fails like some versions of clang
@ -187,26 +190,29 @@ if(CPU_IS_x86)
if(CMAKE_SIZEOF_VOID_P EQUAL 4) if(CMAKE_SIZEOF_VOID_P EQUAL 4)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }")
execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_compile_result)
if(NOT ${avx_compile_result} EQUAL 0)
overrule_arch(avx "Compiler missing cvtpi32_ps intrinsic")
elseif(NOT CROSSCOMPILE_MULTILIB)
execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
OUTPUT_QUIET ERROR_QUIET OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_exe_result) RESULT_VARIABLE avx_compile_result
if(NOT ${avx_exe_result} EQUAL 0) )
overrule_arch(avx "CPU missing cvtpi32_ps") if(NOT ${avx_compile_result} EQUAL 0)
else() overrule_arch(avx "Compiler missing cvtpi32_ps intrinsic")
set(HAVE_AVX_CVTPI32_PS 1) elseif(NOT CROSSCOMPILE_MULTILIB)
endif() execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_exe_result
)
if(NOT ${avx_exe_result} EQUAL 0)
overrule_arch(avx "CPU missing cvtpi32_ps")
else()
set(HAVE_AVX_CVTPI32_PS 1)
endif()
else() else()
set(HAVE_AVX_CVTPI32_PS 1) set(HAVE_AVX_CVTPI32_PS 1)
endif() endif()
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c) ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c
)
else() else()
# 64-bit compilations won't need this command so don't overrule AVX # 64-bit compilations won't need this command so don't overrule AVX
set(HAVE_AVX_CVTPI32_PS 0) set(HAVE_AVX_CVTPI32_PS 0)
@ -214,21 +220,21 @@ if(CPU_IS_x86)
# Disable SSE4a if Clang is less than version 3.2 # Disable SSE4a if Clang is less than version 3.2
if(CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_ID MATCHES "Clang")
# Figure out the version of Clang # Figure out the version of Clang
if(CMAKE_VERSION VERSION_LESS "2.8.10") if(CMAKE_VERSION VERSION_LESS "2.8.10")
# Extract the Clang version from the --version string. # Extract the Clang version from the --version string.
# In cmake 2.8.10, we can just use CMAKE_C_COMPILER_VERSION # In cmake 2.8.10, we can just use CMAKE_C_COMPILER_VERSION
# without having to go through these string manipulations # without having to go through these string manipulations
execute_process(COMMAND ${CMAKE_C_COMPILER} --version execute_process(COMMAND ${CMAKE_C_COMPILER} --version
OUTPUT_VARIABLE clang_version) OUTPUT_VARIABLE clang_version
string(REGEX MATCH "[0-9].[0-9]" CMAKE_C_COMPILER_VERSION ${clang_version}) )
endif() string(REGEX MATCH "[0-9].[0-9]" CMAKE_C_COMPILER_VERSION ${clang_version})
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_LESS "3.2") if(CMAKE_C_COMPILER_VERSION VERSION_LESS "3.2")
overrule_arch(sse4_a "Clang >= 3.2 required for SSE4a") overrule_arch(sse4_a "Clang >= 3.2 required for SSE4a")
endif() endif()
endif() endif()
endif() endif()
if(${HAVE_XGETBV}) if(${HAVE_XGETBV})
@ -310,7 +316,7 @@ if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86)
overrule_arch(64 "CPU width is 32 bits") overrule_arch(64 "CPU width is 32 bits")
endif() endif()
#MSVC 64 bit does not have MMX, overrule it # MSVC 64 bit does not have MMX, overrule it
if(${SIZEOF_CPU} EQUAL 64 AND MSVC) if(${SIZEOF_CPU} EQUAL 64 AND MSVC)
overrule_arch(mmx "No MMX for Win64") overrule_arch(mmx "No MMX for Win64")
if(MSVC_VERSION GREATER 1700) if(MSVC_VERSION GREATER 1700)
@ -361,7 +367,7 @@ message(STATUS "Available machines: ${available_machines}")
# Create rules to run the volk_gnsssdr generator # Create rules to run the volk_gnsssdr generator
######################################################################## ########################################################################
#dependencies are all python, xml, and header implementation files # dependencies are all python, xml, and header implementation files
file(GLOB xml_files ${PROJECT_SOURCE_DIR}/gen/*.xml) file(GLOB xml_files ${PROJECT_SOURCE_DIR}/gen/*.xml)
list(SORT xml_files) list(SORT xml_files)
file(GLOB py_files ${PROJECT_SOURCE_DIR}/gen/*.py) file(GLOB py_files ${PROJECT_SOURCE_DIR}/gen/*.py)
@ -397,29 +403,30 @@ message(STATUS "BUILD TYPE = ${CBTU}")
message(STATUS "Base cflags = ${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS}") message(STATUS "Base cflags = ${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS}")
set(COMPILER_INFO "") set(COMPILER_INFO "")
if(MSVC) if(MSVC)
if(MSVC90) #Visual Studio 9 if(MSVC90) # Visual Studio 9
set(cmake_c_compiler_version "Microsoft Visual Studio 9.0") set(cmake_c_compiler_version "Microsoft Visual Studio 9.0")
elseif(MSVC10) #Visual Studio 10 elseif(MSVC10) # Visual Studio 10
set(cmake_c_compiler_version "Microsoft Visual Studio 10.0") set(cmake_c_compiler_version "Microsoft Visual Studio 10.0")
elseif(MSVC11) #Visual Studio 11 elseif(MSVC11) # Visual Studio 11
set(cmake_c_compiler_version "Microsoft Visual Studio 11.0") set(cmake_c_compiler_version "Microsoft Visual Studio 11.0")
elseif(MSVC12) #Visual Studio 12 elseif(MSVC12) # Visual Studio 12
set(cmake_c_compiler_version "Microsoft Visual Studio 12.0") set(cmake_c_compiler_version "Microsoft Visual Studio 12.0")
elseif(MSVC14) #Visual Studio 14 elseif(MSVC14) # Visual Studio 14
set(cmake_c_compiler_version "Microsoft Visual Studio 14.0") set(cmake_c_compiler_version "Microsoft Visual Studio 14.0")
endif() endif()
else() else()
execute_process(COMMAND ${CMAKE_C_COMPILER} --version execute_process(COMMAND ${CMAKE_C_COMPILER} --version
OUTPUT_VARIABLE cmake_c_compiler_version) OUTPUT_VARIABLE cmake_c_compiler_version
)
endif() endif()
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") 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}) foreach(machine_name ${available_machines})
#generate machine source # generate machine source
set(machine_source ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_machine_${machine_name}.c) set(machine_source ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_machine_${machine_name}.c)
gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_gnsssdr_machine_xxx.tmpl.c ${machine_source} ${machine_name}) gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_gnsssdr_machine_xxx.tmpl.c ${machine_source} ${machine_name})
#determine machine flags # determine machine flags
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
${PROJECT_SOURCE_DIR}/gen/volk_gnsssdr_compile_utils.py ${PROJECT_SOURCE_DIR}/gen/volk_gnsssdr_compile_utils.py
@ -434,7 +441,7 @@ foreach(machine_name ${available_machines})
set_source_files_properties(${machine_source} PROPERTIES COMPILE_FLAGS "${${machine_name}_flags}") set_source_files_properties(${machine_source} PROPERTIES COMPILE_FLAGS "${${machine_name}_flags}")
endif() endif()
#add to available machine defs # add to available machine defs
string(TOUPPER LV_MACHINE_${machine_name} machine_def) string(TOUPPER LV_MACHINE_${machine_name} machine_def)
list(APPEND machine_defs ${machine_def}) list(APPEND machine_defs ${machine_def})
endforeach() endforeach()
@ -446,84 +453,72 @@ message(STATUS "Compiler Version: ${cmake_c_compiler_version}")
string(REPLACE "\n" " \\n" cmake_c_compiler_version ${cmake_c_compiler_version}) string(REPLACE "\n" " \\n" cmake_c_compiler_version ${cmake_c_compiler_version})
string(REPLACE "\n" " \\n" COMPILER_INFO ${COMPILER_INFO}) string(REPLACE "\n" " \\n" COMPILER_INFO ${COMPILER_INFO})
########################################################################
# Set local include directories first
########################################################################
include_directories(
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/kernels
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
######################################################################## ########################################################################
# Handle ASM support # Handle ASM support
# on by default, but let users turn it off # on by default, but let users turn it off
######################################################################## ########################################################################
if(${CMAKE_VERSION} VERSION_GREATER "2.8.9") if(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
set(ASM_ARCHS_AVAILABLE "neonv7" "neonv8") set(ASM_ARCHS_AVAILABLE "neonv7" "neonv8")
set(FULL_C_FLAGS "${CMAKE_C_FLAGS}" "${CMAKE_CXX_COMPILER_ARG1}") set(FULL_C_FLAGS "${CMAKE_C_FLAGS}" "${CMAKE_CXX_COMPILER_ARG1}")
# sort through a list of all architectures we have ASM for # sort through a list of all architectures we have ASM for
# if we find one that matches our current system architecture # if we find one that matches our current system architecture
# set up the assembler flags and include the source files # set up the assembler flags and include the source files
foreach(ARCH ${ASM_ARCHS_AVAILABLE}) foreach(ARCH ${ASM_ARCHS_AVAILABLE})
string(REGEX MATCH "${ARCH}" ASM_ARCH "${available_archs}") string(REGEX MATCH "${ARCH}" ASM_ARCH "${available_archs}")
if(ASM_ARCH STREQUAL "neonv7") if(ASM_ARCH STREQUAL "neonv7")
message(STATUS "---- Adding ASM files") # we always use ATT syntax message(STATUS "---- Adding ASM files") # we always use ATT syntax
message(STATUS "-- Detected neon architecture; enabling ASM") message(STATUS "-- Detected neon architecture; enabling ASM")
# architecture specific assembler flags are now set in the cmake toolchain file # architecture specific assembler flags are now set in the cmake toolchain file
# then add the files # then add the files
include_directories(${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/neon) include_directories(${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/neon)
file(GLOB asm_files ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/neon/*.s) file(GLOB asm_files ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/neon/*.s)
list(SORT asm_files) list(SORT asm_files)
foreach(asm_file ${asm_files}) foreach(asm_file ${asm_files})
list(APPEND volk_gnsssdr_sources ${asm_file}) list(APPEND volk_gnsssdr_sources ${asm_file})
message(STATUS "Adding source file: ${asm_file}") message(STATUS "Adding source file: ${asm_file}")
endforeach() endforeach()
endif() endif()
enable_language(ASM) enable_language(ASM)
message(STATUS "c flags: ${FULL_C_FLAGS}") message(STATUS "c flags: ${FULL_C_FLAGS}")
message(STATUS "asm flags: ${CMAKE_ASM_FLAGS}") message(STATUS "asm flags: ${CMAKE_ASM_FLAGS}")
endforeach() endforeach()
else() else()
message(STATUS "Not enabling ASM support. CMake >= 2.8.10 required.") message(STATUS "Not enabling ASM support. CMake >= 2.8.10 required.")
foreach(machine_name ${available_machines}) foreach(machine_name ${available_machines})
string(REGEX MATCH "neon" NEON_MACHINE ${machine_name}) string(REGEX MATCH "neon" NEON_MACHINE ${machine_name})
if(NEON_MACHINE STREQUAL "neon") if(NEON_MACHINE STREQUAL "neon")
message(FATAL_ERROR "CMake >= 2.8.10 is required for ARM NEON support") message(FATAL_ERROR "CMake >= 2.8.10 is required for ARM NEON support")
endif() endif()
endforeach() endforeach()
endif() endif()
######################################################################## ########################################################################
# Handle orc support # Handle orc support
######################################################################## ########################################################################
if(ORC_FOUND) if(ORC_FOUND)
#setup orc library usage # setup orc library usage
include_directories(${ORC_INCLUDE_DIRS}) include_directories(${ORC_INCLUDE_DIRS})
link_directories(${ORC_LIBRARY_DIRS}) link_directories(${ORC_LIBRARY_DIRS})
list(APPEND volk_gnsssdr_libraries ${ORC_LIBRARIES}) list(APPEND volk_gnsssdr_libraries ${ORC_LIBRARIES})
#setup orc functions # setup orc functions
file(GLOB orc_files ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/orc/*.orc) file(GLOB orc_files ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/orc/*.orc)
list(SORT orc_files) list(SORT orc_files)
foreach(orc_file ${orc_files}) foreach(orc_file ${orc_files})
# extract the name for the generated c source from the orc file
#extract the name for the generated c source from the orc file
get_filename_component(orc_file_name_we ${orc_file} NAME_WE) get_filename_component(orc_file_name_we ${orc_file} NAME_WE)
set(orcc_gen ${CMAKE_CURRENT_BINARY_DIR}/${orc_file_name_we}.c) set(orcc_gen ${CMAKE_CURRENT_BINARY_DIR}/${orc_file_name_we}.c)
#create a rule to generate the source and add to the list of sources # create a rule to generate the source and add to the list of sources
add_custom_command( add_custom_command(
COMMAND ${ORCC_EXECUTABLE} --include math.h --implementation -o ${orcc_gen} ${orc_file} COMMAND ${ORCC_EXECUTABLE} --include math.h --implementation -o ${orcc_gen} ${orc_file}
DEPENDS ${orc_file} OUTPUT ${orcc_gen} DEPENDS ${orc_file} OUTPUT ${orcc_gen}
) )
list(APPEND volk_gnsssdr_sources ${orcc_gen}) list(APPEND volk_gnsssdr_sources ${orcc_gen})
endforeach() endforeach()
else() else()
message(STATUS "Did not find liborc and orcc, disabling orc support...") message(STATUS "Did not find liborc and orcc, disabling orc support...")
@ -535,13 +530,14 @@ endif()
message(STATUS "Loading version ${VERSION} into constants...") message(STATUS "Loading version ${VERSION} into constants...")
#double escape for windows backslash path separators # double escape for windows backslash path separators
string(REPLACE "\\" "\\\\" prefix "${prefix}") string(REPLACE "\\" "\\\\" prefix "${prefix}")
configure_file( configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/constants.c.in ${CMAKE_CURRENT_SOURCE_DIR}/constants.c.in
${CMAKE_CURRENT_BINARY_DIR}/constants.c ${CMAKE_CURRENT_BINARY_DIR}/constants.c
@ONLY) @ONLY
)
list(APPEND volk_gnsssdr_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.c) list(APPEND volk_gnsssdr_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.c)
@ -560,7 +556,7 @@ list(APPEND volk_gnsssdr_sources
${volk_gnsssdr_gen_sources} ${volk_gnsssdr_gen_sources}
) )
#set the machine definitions where applicable # set the machine definitions where applicable
set_source_files_properties( set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr.c ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr.c
${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_machines.c ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_machines.c
@ -568,53 +564,53 @@ set_source_files_properties(
) )
if(MSVC) if(MSVC)
#add compatibility includes for stdint types # add compatibility includes for stdint types
include_directories(${PROJECT_SOURCE_DIR}/cmake/msvc) include_directories(${PROJECT_SOURCE_DIR}/cmake/msvc)
add_definitions(-DHAVE_CONFIG_H) add_definitions(-DHAVE_CONFIG_H)
#compile the sources as C++ due to the lack of complex.h under MSVC # compile the sources as C++ due to the lack of complex.h under MSVC
set_source_files_properties(${volk_gnsssdr_sources} PROPERTIES LANGUAGE CXX) set_source_files_properties(${volk_gnsssdr_sources} PROPERTIES LANGUAGE CXX)
endif() endif()
#Create a volk_gnsssdr object library # Create a volk_gnsssdr object library
if(NOT (CMAKE_GENERATOR STREQUAL Xcode)) if(NOT (CMAKE_GENERATOR STREQUAL Xcode))
add_library(volk_gnsssdr_obj OBJECT ${volk_gnsssdr_sources}) add_library(volk_gnsssdr_obj OBJECT ${volk_gnsssdr_sources})
target_include_directories(volk_gnsssdr_obj target_include_directories(volk_gnsssdr_obj
PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> PRIVATE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PUBLIC $<INSTALL_INTERFACE:include> PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/kernels>
PRIVATE ${PROJECT_SOURCE_DIR}/kernels
PRIVATE ${CMAKE_CURRENT_BINARY_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
) )
# Configure object target properties
if(NOT MSVC)
set_target_properties(volk_gnsssdr_obj PROPERTIES COMPILE_FLAGS "-fPIC")
endif()
endif() endif()
#Add dynamic library # Add dynamic library
if(CMAKE_GENERATOR STREQUAL Xcode) if(CMAKE_GENERATOR STREQUAL Xcode)
add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources}) add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources})
else() else()
add_library(volk_gnsssdr SHARED $<TARGET_OBJECTS:volk_gnsssdr_obj>) add_library(volk_gnsssdr SHARED $<TARGET_OBJECTS:volk_gnsssdr_obj>)
endif() endif()
target_link_libraries(volk_gnsssdr ${volk_gnsssdr_libraries}) target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries})
target_include_directories(volk_gnsssdr target_include_directories(volk_gnsssdr
PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PUBLIC $<INSTALL_INTERFACE:include> PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/kernels>
PRIVATE ${PROJECT_SOURCE_DIR}/kernels
PRIVATE ${CMAKE_CURRENT_BINARY_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC $<INSTALL_INTERFACE:include>
) )
#Configure target properties # Configure target properties
if(NOT MSVC) if(NOT MSVC)
if(NOT (CMAKE_GENERATOR STREQUAL Xcode)) target_link_libraries(volk_gnsssdr PUBLIC m)
set_target_properties(volk_gnsssdr_obj PROPERTIES COMPILE_FLAGS "-fPIC")
endif()
target_link_libraries(volk_gnsssdr m)
endif() endif()
set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${LIBVER}) set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${LIBVER})
set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS") set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS")
#Install locations # Install locations
install(TARGETS volk_gnsssdr install(TARGETS volk_gnsssdr
EXPORT VOLK_GNSSSDR-export EXPORT VOLK_GNSSSDR-export
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file
@ -622,22 +618,22 @@ install(TARGETS volk_gnsssdr
RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file
) )
#Configure static library # Configure static library
if(ENABLE_STATIC_LIBS) if(ENABLE_STATIC_LIBS)
if(CMAKE_GENERATOR STREQUAL Xcode) if(CMAKE_GENERATOR STREQUAL Xcode)
add_library(volk_gnsssdr_static STATIC ${volk_gnsssdr_sources}) add_library(volk_gnsssdr_static STATIC ${volk_gnsssdr_sources})
else() else()
add_library(volk_gnsssdr_static STATIC $<TARGET_OBJECTS:volk_gnsssdr_obj>) add_library(volk_gnsssdr_static STATIC $<TARGET_OBJECTS:volk_gnsssdr_obj>)
endif() endif()
target_link_libraries(volk_gnsssdr_static ${volk_gnsssdr_libraries} pthread) target_link_libraries(volk_gnsssdr_static PUBLIC ${volk_gnsssdr_libraries} pthread)
if(NOT MSVC) if(NOT MSVC)
target_link_libraries(volk_gnsssdr_static m) target_link_libraries(volk_gnsssdr_static PUBLIC m)
endif() endif()
target_include_directories(volk_gnsssdr_static target_include_directories(volk_gnsssdr_static
PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/kernels>
PUBLIC $<INSTALL_INTERFACE:include> PUBLIC $<INSTALL_INTERFACE:include>
PRIVATE ${PROJECT_SOURCE_DIR}/kernels
PRIVATE ${CMAKE_CURRENT_BINARY_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
) )
@ -654,24 +650,18 @@ endif()
# Build the QA test application # Build the QA test application
######################################################################## ########################################################################
if(ENABLE_TESTING) if(ENABLE_TESTING)
#include Boost headers
include_directories(${Boost_INCLUDE_DIRS})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.unittest) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.unittest)
set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc PROPERTIES
COMPILE_DEFINITIONS "BOOST_TEST_DYN_LINK;BOOST_TEST_MAIN"
)
include(VolkAddTest) include(VolkAddTest)
volk_gen_test("volk_gnsssdr_test_all" volk_gen_test(volk_gnsssdr_test_all
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc
${CMAKE_CURRENT_SOURCE_DIR}/qa_utils.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_utils.cc
TARGET_DEPS volk_gnsssdr TARGET_DEPS volk_gnsssdr
) )
foreach(kernel ${h_files}) foreach(kernel ${h_files})
get_filename_component(kernel ${kernel} NAME) get_filename_component(kernel ${kernel} NAME)
string(REPLACE ".h" "" kernel ${kernel}) string(REPLACE ".h" "" kernel ${kernel})
volk_add_test(${kernel} "volk_gnsssdr_test_all") volk_add_test(${kernel} volk_gnsssdr_test_all)
endforeach() endforeach()
endif() endif()

View File

@ -144,14 +144,6 @@ bool run_volk_gnsssdr_tests(
bool benchmark_mode = false); bool benchmark_mode = false);
#define VOLK_RUN_TESTS(func, tol, scalar, len, iter) \
BOOST_AUTO_TEST_CASE(func##_test) \
{ \
BOOST_CHECK_EQUAL(run_volk_gnsssdr_tests( \
func##_get_func_desc(), (void (*)())func##_manual, \
std::string(#func), tol, scalar, len, iter, 0, "NULL"), \
0); \
}
#define VOLK_PROFILE(func, test_params, results) run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), test_params, results, "NULL") #define VOLK_PROFILE(func, test_params, results) run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), test_params, results, "NULL")
#define VOLK_PUPPET_PROFILE(func, puppet_master_func, test_params, results) run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), test_params, results, std::string(#puppet_master_func)) #define VOLK_PUPPET_PROFILE(func, puppet_master_func, test_params, results) run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), test_params, results, std::string(#puppet_master_func))
typedef void (*volk_gnsssdr_fn_1arg)(void *, unsigned int, const char *); // one input, operate in place typedef void (*volk_gnsssdr_fn_1arg)(void *, unsigned int, const char *); // one input, operate in place

View File

@ -28,7 +28,6 @@ class volk_gnsssdr_modtool(object):
def __init__(self, cfg): def __init__(self, cfg):
self.volk_gnsssdr = re.compile('volk_gnsssdr'); self.volk_gnsssdr = re.compile('volk_gnsssdr');
self.remove_after_underscore = re.compile("_.*"); self.remove_after_underscore = re.compile("_.*");
self.volk_gnsssdr_run_tests = re.compile(r'^\s*VOLK_RUN_TESTS.*\n', re.MULTILINE);
self.volk_gnsssdr_profile = re.compile(r'^\s*(VOLK_PROFILE|VOLK_PUPPET_PROFILE).*\n', re.MULTILINE); self.volk_gnsssdr_profile = re.compile(r'^\s*(VOLK_PROFILE|VOLK_PUPPET_PROFILE).*\n', re.MULTILINE);
self.my_dict = cfg; self.my_dict = cfg;
self.lastline = re.compile(r'\s*char path\[1024\];.*'); self.lastline = re.compile(r'\s*char path\[1024\];.*');