@@ -85,18 +85,28 @@ add_gandiva_test(precompiled-test
8585 ARROW_STATIC
8686 GANDIVA_STATIC )
8787
88- # microbenchmark (built as a gandiva test so it links the precompiled sources
89- # directly; run on demand via the gandiva-precompiled-benchmark binary)
90- add_gandiva_test (precompiled-benchmark
91- SOURCES
92- ../context_helper.cc
93- string_ops_benchmark.cc
94- string_ops.cc
95- EXTRA_INCLUDES
96- ${CMAKE_SOURCE_DIR } /src
97- EXTRA_LINK_LIBS
98- Boost::headers
99- DEFINITIONS
100- GANDIVA_UNIT_TEST=1
101- ARROW_STATIC
102- GANDIVA_STATIC )
88+ # REPLACE microbenchmark. Built on demand only -- it is a plain executable, NOT
89+ # registered as a ctest test, so it never runs in check-in/ctest runs. Build and
90+ # run it explicitly via the gandiva-precompiled-benchmark binary. It compiles the
91+ # precompiled sources locally (with GANDIVA_UNIT_TEST=1) so the functions are
92+ # directly callable, mirroring how the precompiled-test target links.
93+ if (ARROW_BUILD_TESTS)
94+ if (ARROW_TEST_LINKAGE STREQUAL "static" )
95+ set (GANDIVA_BENCHMARK_LINK_LIBS ${GANDIVA_STATIC_TEST_LINK_LIBS} )
96+ else ()
97+ set (GANDIVA_BENCHMARK_LINK_LIBS ${GANDIVA_SHARED_TEST_LINK_LIBS} )
98+ endif ()
99+ add_executable (gandiva-precompiled-benchmark string_ops_benchmark.cc string_ops.cc
100+ ../context_helper.cc )
101+ target_link_libraries (gandiva-precompiled-benchmark
102+ PRIVATE ${ARROW_GTEST_GTEST_HEADERS}
103+ ${GANDIVA_BENCHMARK_LINK_LIBS} Boost::headers )
104+ target_include_directories (gandiva-precompiled-benchmark SYSTEM
105+ PUBLIC ${CMAKE_SOURCE_DIR } /src )
106+ target_compile_definitions (gandiva-precompiled-benchmark
107+ PRIVATE GANDIVA_UNIT_TEST=1 ARROW_STATIC GANDIVA_STATIC )
108+ if (ARROW_TEST_LINKAGE STREQUAL "static" )
109+ # libLLVM*.a needs the executable to export the ORC EH-frame wrappers.
110+ set_target_properties (gandiva-precompiled-benchmark PROPERTIES ENABLE_EXPORTS TRUE )
111+ endif ()
112+ endif ()
0 commit comments