1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-04-06 18:57:02 +00:00

Fix for old compilers

This commit is contained in:
Carles Fernandez 2019-11-16 19:21:02 +01:00
parent c7866ef385
commit 4363dfcc9f
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 129 additions and 0 deletions

View File

@ -135,6 +135,30 @@ target_compile_definitions(algorithms_libs
PUBLIC -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}"
)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1")
target_compile_definitions(algorithms_libs
PRIVATE -DOLDCOMPILER=1
)
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(CLANG_VERSION VERSION_LESS "600")
target_compile_definitions(algorithms_libs
PRIVATE -DOLDCOMPILER=1
)
endif()
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0")
target_compile_definitions(algorithms_libs
PRIVATE -DOLDCOMPILER=1
)
endif()
endif()
endif()
set_property(TARGET algorithms_libs
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

View File

@ -188,18 +188,33 @@ item_type_converter_t make_vector_converter(const std::string &input_type,
if (input_type == output_type)
{
size_t input_size = item_type_size(input_type);
#ifdef OLDCOMPILER
return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, input_size);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return copy_converter(arg1, arg2, arg3, input_size); };
#endif
}
if (input_type == "byte")
{
if (output_type == "short")
{
#ifdef OLDCOMPILER
return std::bind(convert_8i_16i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_8i_16i(arg1, arg2, arg3); };
#endif
}
else if (output_type == "float")
{
#ifdef OLDCOMPILER
return std::bind(convert_8i_32f, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_8i_32f(arg1, arg2, arg3); };
#endif
}
}
else if (input_type == "cbyte")
@ -207,15 +222,30 @@ item_type_converter_t make_vector_converter(const std::string &input_type,
if (output_type == "ibyte")
{
size_t input_size = item_type_size(input_type);
#ifdef OLDCOMPILER
return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, input_size);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return copy_converter(arg1, arg2, arg3, input_size); };
#endif
}
if (output_type == "cshort" or output_type == "ishort")
{
#ifdef OLDCOMPILER
return std::bind(convert_8ic_16ic, std::placeholders::_1,
std::placeholders::_2, std::placehold
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_8ic_16ic(arg1, arg2, arg3); };
#endif
}
else if (output_type == "gr_complex")
{
#ifdef OLDCOMPILER
return std::bind(convert_8ic_32fc, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_8ic_32fc(arg1, arg2, arg3); };
#endif
}
}
else if (input_type == "ibyte")
@ -223,80 +253,155 @@ item_type_converter_t make_vector_converter(const std::string &input_type,
if (output_type == "cbyte")
{
size_t input_size = item_type_size(input_type);
#ifdef OLDCOMPILER
return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, input_size);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return copy_converter(arg1, arg2, arg3, input_size); };
#endif
}
else if (output_type == "cshort" or output_type == "ishort")
{
#ifdef OLDCOMPILER
return std::bind(convert_8i_16i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_8i_16i(arg1, arg2, arg3); };
#endif
}
else if (output_type == "gr_complex")
{
#ifdef OLDCOMPILER
return std::bind(convert_8i_32f, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_8i_32f(arg1, arg2, arg3); };
#endif
}
}
else if (input_type == "short")
{
if (output_type == "byte")
{
#ifdef OLDCOMPILER
return std::bind(convert_16i_8i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_16i_8i(arg1, arg2, arg3); };
#endif
}
else if (output_type == "float")
{
#ifdef OLDCOMPILER
return std::bind(convert_16i_32f, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_16i_32f(arg1, arg2, arg3); };
#endif
}
}
else if (input_type == "cshort")
{
if (output_type == "cbyte" or output_type == "ibyte")
{
#ifdef OLDCOMPILER
return std::bind(convert_16ic_8ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_16ic_8ic(arg1, arg2, arg3); };
#endif
}
if (output_type == "ishort")
{
size_t input_size = item_type_size(input_type);
#ifdef OLDCOMPILER
return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, input_size);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return copy_converter(arg1, arg2, arg3, input_size); };
#endif
}
else if (output_type == "gr_complex")
{
#ifdef OLDCOMPILER
return std::bind(convert_16ic_32fc, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_16ic_32fc(arg1, arg2, arg3); };
#endif
}
}
else if (input_type == "ishort")
{
if (output_type == "cbyte" or output_type == "ibyte")
{
#ifdef OLDCOMPILER
return std::bind(convert_16i_8i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_16i_8i(arg1, arg2, arg3); };
#endif
}
if (output_type == "cshort")
{
size_t input_size = item_type_size(input_type);
#ifdef OLDCOMPILER
return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, input_size);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return copy_converter(arg1, arg2, arg3, input_size); };
#endif
}
else if (output_type == "gr_complex")
{
#ifdef OLDCOMPILER
return std::bind(convert_16i_32f, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_16i_32f(arg1, arg2, arg3); };
#endif
}
}
else if (input_type == "float")
{
if (output_type == "byte")
{
#ifdef OLDCOMPILER
return std::bind(convert_32f_8i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_32f_8i(arg1, arg2, arg3); };
#endif
}
else if (output_type == "short")
{
#ifdef OLDCOMPILER
return std::bind(convert_32f_16i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_32f_16i(arg1, arg2, arg3); };
#endif
}
}
else if (input_type == "gr_complex")
{
if (output_type == "cbyte" or output_type == "ibyte")
{
#ifdef OLDCOMPILER
return std::bind(convert_32fc_8ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_32fc_8ic(arg1, arg2, arg3); };
#endif
}
else if (output_type == "cshort" or output_type == "ishort")
{
#ifdef OLDCOMPILER
return std::bind(convert_32fc_16ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
#else
return [=](auto &&arg1, auto &&arg2, auto &&arg3) { return convert_32fc_16ic(arg1, arg2, arg3); };
#endif
}
}