From 4065529bdf10061cc4a1bd9f4673f68b36d8ccad Mon Sep 17 00:00:00 2001 From: John Keiser Date: Thu, 20 Aug 2020 10:52:44 -0700 Subject: [PATCH] Don't try to compile Haswell benchmarks on ARM --- benchmark/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 2804dd25..178cbe35 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -5,7 +5,16 @@ link_libraries(simdjson-windows-headers test-data) if (TARGET benchmark::benchmark) add_executable(bench_sax bench_sax.cpp) target_link_libraries(bench_sax simdjson-internal-flags simdjson-include-source benchmark::benchmark) - target_compile_options(bench_sax PRIVATE -mavx2 -mbmi -mpclmul -mlzcnt) + # Don't pass all the compiler options on ARM + CHECK_CXX_COMPILER_FLAG(-mavx2 HAVE_MAVX2_FLAG) + if (HAVE_MAVX2_FLAG) + target_compile_options(bench_sax PRIVATE -mavx2 -mbmi -mpclmul -mlzcnt) + # Some ARM compilers "support" -mavx2 but don't use it. This makes them not complain. + CHECK_CXX_COMPILER_FLAG(-Qunused-arguments HAVE_QUNUSED_ARGUMENTS_FLAG) + if (HAVE_QUNUSED_ARGUMENTS_FLAG) + target_compile_options(bench_sax PRIVATE -Qunused-arguments) + endif() + endif() endif (TARGET benchmark::benchmark) link_libraries(simdjson simdjson-flags)