diff --git a/.github/workflows/MainDistributionPipeline.yml b/.github/workflows/MainDistributionPipeline.yml index 9720e43..1ca1192 100644 --- a/.github/workflows/MainDistributionPipeline.yml +++ b/.github/workflows/MainDistributionPipeline.yml @@ -23,8 +23,10 @@ jobs: duckdb-stable-build: name: Build extension binaries - uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.4.4 + # ci-tools v1.4.5 finds VS 2026's vcvars on windows-latest; v1.4.4 only + # knows the VS 2022 path, so windows_amd64 silently built with MinGW gcc. + uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.4.5 with: duckdb_version: v1.4.4 - ci_tools_version: v1.4.4 + ci_tools_version: v1.4.5 extension_name: parser_tools diff --git a/Makefile b/Makefile index d03b95c..019f982 100644 --- a/Makefile +++ b/Makefile @@ -5,4 +5,17 @@ EXT_NAME=parser_tools EXT_CONFIG=${PROJ_DIR}extension_config.cmake # Include the Makefile from extension-ci-tools -include extension-ci-tools/makefiles/duckdb_extension.Makefile \ No newline at end of file +include extension-ci-tools/makefiles/duckdb_extension.Makefile + +# duckdb/CMakeLists.txt sets CMAKE_CXX_STANDARD 11 as a plain (non-FORCE) cache +# default; MSVC has no /std:c++11, so on real MSVC that resolves to its +# implicit default dialect, which does not enable C++17 inline variables. The +# vendored fmt (third_party/fmt) needs them, so a real-MSVC windows_amd64 +# build fails compiling fmt's format.h ("inline variables require +# /std:c++17"). Passing this on the cmake command line wins over the +# unforced cache set() in duckdb's own CMakeLists.txt. Scoped to plain MSVC: +# windows_amd64_mingw/_rtools build with g++, which already compiles fmt +# fine under GCC's default dialect. +ifeq ($(DUCKDB_PLATFORM),windows_amd64) + BUILD_FLAGS += -DCMAKE_CXX_STANDARD=17 +endif \ No newline at end of file diff --git a/extension_config.cmake b/extension_config.cmake index 08d8033..0d742ee 100644 --- a/extension_config.cmake +++ b/extension_config.cmake @@ -1,5 +1,11 @@ # This file is included by DuckDB's build system. It specifies which extension to load +# DuckDB v1.4.4's bundled fmt uses stdext::checked_array_iterator when +# _SECURE_SCL is defined. VS 2026 removed that non-standard iterator, so select +# fmt's portable pointer implementation before DuckDB configures third_party. +set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE) +include(${CMAKE_CURRENT_LIST_DIR}/scripts/patch_bundled_fmt.cmake) + # Extension from this repo duckdb_extension_load(parser_tools SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} @@ -7,4 +13,4 @@ duckdb_extension_load(parser_tools ) # Any extra extensions that should be built -# e.g.: duckdb_extension_load(json) \ No newline at end of file +# e.g.: duckdb_extension_load(json) diff --git a/scripts/patch_bundled_fmt.cmake b/scripts/patch_bundled_fmt.cmake new file mode 100644 index 0000000..25e96c2 --- /dev/null +++ b/scripts/patch_bundled_fmt.cmake @@ -0,0 +1,27 @@ +# Work around fmt 6.1.2 using the removed MSVC stdext::checked_array_iterator. +# +# This is intentionally idempotent: configure can be re-run without changing the +# DuckDB submodule after the first successful patch. On non-MSVC compilers the +# guarded branch was already inactive, so selecting the fallback is equivalent. + +set(_parser_tools_fmt_header + "${CMAKE_CURRENT_LIST_DIR}/../duckdb/third_party/fmt/include/fmt/format.h") + +if(NOT EXISTS "${_parser_tools_fmt_header}") + message(FATAL_ERROR "Bundled fmt header not found: ${_parser_tools_fmt_header}") +endif() + +file(READ "${_parser_tools_fmt_header}" _parser_tools_fmt_contents) +string(FIND "${_parser_tools_fmt_contents}" "#ifdef _SECURE_SCL" _parser_tools_guard) + +if(_parser_tools_guard GREATER -1) + string(REPLACE + "#ifdef _SECURE_SCL" + "#if 0 // stdext::checked_array_iterator was removed from newer MSVC" + _parser_tools_fmt_contents + "${_parser_tools_fmt_contents}") + file(WRITE "${_parser_tools_fmt_header}" "${_parser_tools_fmt_contents}") + message(STATUS "Patched bundled fmt to avoid stdext::checked_array_iterator") +else() + message(STATUS "Bundled fmt already uses the portable iterator implementation") +endif()