@@ -747,6 +747,15 @@ if(TARGET simdjson::simdjson)
747747 endif ()
748748 endif ()
749749 endif ()
750+
751+ # Final fallback: On Windows with vcpkg, always use header-only mode.
752+ # vcpkg's simdjson package provides a stub library that doesn't contain
753+ # the actual implementation, so we must compile it ourselves.
754+ if (NOT ARROW_SIMDJSON_HEADER_ONLY AND WIN32 AND VCPKG_TARGET_TRIPLET)
755+ message (STATUS "simdjson: forcing header-only mode for Windows vcpkg build" )
756+ set (ARROW_SIMDJSON_HEADER_ONLY TRUE )
757+ endif ()
758+
750759 message (STATUS "simdjson: ARROW_SIMDJSON_HEADER_ONLY=${ARROW_SIMDJSON_HEADER_ONLY} " )
751760endif ()
752761
@@ -1070,20 +1079,15 @@ else()
10701079endif ()
10711080
10721081if (ARROW_JSON)
1073- # simdjson_impl.cc provides the simdjson implementation when using header-only mode.
1074- # The source file itself handles the necessary #defines (SIMDJSON_IMPLEMENTATION,
1075- # SIMDJSON_BUILDING_WINDOWS_DYNAMIC_LIBRARY) based on compile-time conditions.
1076- # We always include it when ARROW_JSON is built to ensure simdjson symbols are available.
1077- # When simdjson is used as a proper library (non-header-only), the guards in the source
1078- # file prevent duplicate symbol definitions.
1082+ # In header-only mode, we need to compile the simdjson implementation ourselves.
1083+ # Detection of header-only mode was done earlier and stored in ARROW_SIMDJSON_HEADER_ONLY.
10791084 set (ARROW_SIMDJSON_IMPL_SRC "" )
1080- if (TARGET simdjson::simdjson)
1081- # Always compile simdjson_impl.cc to provide implementation symbols
1085+ if (TARGET simdjson::simdjson AND ARROW_SIMDJSON_HEADER_ONLY)
10821086 set (ARROW_SIMDJSON_IMPL_SRC json/simdjson_impl.cc)
10831087 # Skip unity build for this file to avoid issues with simdjson's implementation macros
10841088 set_source_files_properties (json/simdjson_impl.cc
10851089 PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON )
1086- message (STATUS "simdjson: including simdjson_impl.cc ( header-only= ${ARROW_SIMDJSON_HEADER_ONLY} ) " )
1090+ message (STATUS "simdjson: including simdjson_impl.cc for header-only mode " )
10871091 endif ()
10881092 arrow_add_object_library (ARROW_JSON
10891093 extension/fixed_shape_tensor.cc
0 commit comments