diff --git a/CMakeLists.txt b/CMakeLists.txt index a1db9f5f6..c573596b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -275,6 +275,25 @@ if(CMAKE_VERSION VERSION_GREATER 3.1 AND NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "G set(USE_GENERIC_LAMBDAS ON) endif() +# Determine if we use lambdas +if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1") + set(DO_NOT_USE_LAMBDAS ON) + endif() +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + if(CLANG_VERSION VERSION_LESS "600") + set(DO_NOT_USE_LAMBDAS ON) + endif() + else() + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0") + set(DO_NOT_USE_LAMBDAS ON) + endif() + endif() +endif() + # Determine if we are using make or ninja if(CMAKE_MAKE_PROGRAM MATCHES "make") set(CMAKE_MAKE_PROGRAM_PRETTY_NAME "make") diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index a39884468..1fefc2489 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -149,28 +149,10 @@ 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() +if(DO_NOT_USE_LAMBDAS) + target_compile_definitions(algorithms_libs + PRIVATE -DDO_NOT_USE_LAMBDAS=1 + ) endif() set_property(TARGET algorithms_libs diff --git a/src/algorithms/libs/item_type_helpers.cc b/src/algorithms/libs/item_type_helpers.cc index ce308498a..2a5543526 100644 --- a/src/algorithms/libs/item_type_helpers.cc +++ b/src/algorithms/libs/item_type_helpers.cc @@ -177,7 +177,7 @@ 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 +#ifdef DO_NOT_USE_LAMBDAS return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, input_size); #else @@ -189,7 +189,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, { if (output_type == "short") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_8i_16i, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -198,7 +198,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "float") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_8i_32f, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -211,7 +211,7 @@ 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 +#ifdef DO_NOT_USE_LAMBDAS return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, input_size); #else @@ -220,7 +220,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } if (output_type == "cshort" or output_type == "ishort") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_8ic_16ic, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -229,7 +229,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "gr_complex") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_8ic_32fc, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -242,7 +242,7 @@ 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 +#ifdef DO_NOT_USE_LAMBDAS return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, input_size); #else @@ -251,7 +251,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "cshort" or output_type == "ishort") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_8i_16i, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -260,7 +260,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "gr_complex") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_8i_32f, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -272,7 +272,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, { if (output_type == "byte") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_16i_8i, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -281,7 +281,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "float") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_16i_32f, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -293,7 +293,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, { if (output_type == "cbyte" or output_type == "ibyte") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_16ic_8ic, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -303,7 +303,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, if (output_type == "ishort") { size_t input_size = item_type_size(input_type); -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, input_size); #else @@ -312,7 +312,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "gr_complex") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_16ic_32fc, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -324,7 +324,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, { if (output_type == "cbyte" or output_type == "ibyte") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_16i_8i, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -334,7 +334,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, if (output_type == "cshort") { size_t input_size = item_type_size(input_type); -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, input_size); #else @@ -343,7 +343,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "gr_complex") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_16i_32f, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -355,7 +355,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, { if (output_type == "byte") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_32f_8i, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -364,7 +364,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "short") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_32f_16i, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -376,7 +376,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, { if (output_type == "cbyte" or output_type == "ibyte") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_32fc_8ic, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else @@ -385,7 +385,7 @@ item_type_converter_t make_vector_converter(const std::string &input_type, } else if (output_type == "cshort" or output_type == "ishort") { -#ifdef OLDCOMPILER +#ifdef DO_NOT_USE_LAMBDAS return std::bind(convert_32fc_16ic, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); #else