@@ -307,20 +307,32 @@ fn main() {
307307 println ! ( "cargo:rustc-link-arg=-Wl,-rpath,{}" , library_path. display( ) ) ;
308308
309309 // Compile our C++ code that exposes additional DuckDB functionality.
310- cc:: Build :: new ( )
311- . std ( "c++17" )
312- // Enable compiler warnings.
313- . flag ( "-Wall" )
314- . flag ( "-Wextra" )
315- . flag ( "-Wpedantic" )
316- // Allow C++20 designator syntax even with C++17 std
317- . flag ( "-Wno-c++20-designator" )
318- // Enable C++20 extensions
319- . flag ( "-Wno-c++20-extensions" )
320- // Unused parameter warnings are disabled as we include DuckDB
321- // headers with implementations that have unused parameters.
322- . flag ( "-Wno-unused-parameter" )
323- . cpp ( true )
310+ let mut builder = cc:: Build :: new ( ) ;
311+ builder. std ( "c++17" ) . cpp ( true ) ;
312+
313+ #[ cfg( target_os = "windows" ) ]
314+ {
315+ builder
316+ // Enable C++ exception handling
317+ . flag ( "/EHsc" )
318+ }
319+
320+ #[ cfg( not( target_os = "windows" ) ) ]
321+ {
322+ builder
323+ . flag ( "-Wall" )
324+ . flag ( "-Wextra" )
325+ . flag ( "-Wpedantic" )
326+ // Allow C++20 designator syntax even with C++17 std
327+ . flag ( "-Wno-c++20-designator" )
328+ // Enable C++20 extensions
329+ . flag ( "-Wno-c++20-extensions" )
330+ // Unused parameter warnings are disabled as we include DuckDB
331+ // headers with implementations that have unused parameters.
332+ . flag ( "-Wno-unused-parameter" ) ;
333+ }
334+
335+ builder
324336 // We include DuckDB headers from the DuckDB extension submodule.
325337 . include ( duckdb_repo. join ( format ! ( "duckdb-{}/src/include" , DUCKDB_VERSION . as_str( ) ) ) )
326338 . include ( "cpp/include" )
0 commit comments