Skip to content

Commit

Permalink
Try to fix MinGW build (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Jul 5, 2022
1 parent 93d518e commit f27fa71
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cpp/src/arrow/flight/sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ add_custom_command(OUTPUT ${FLIGHT_SQL_GENERATED_PROTO_FILES}
set_source_files_properties(${FLIGHT_SQL_GENERATED_PROTO_FILES} PROPERTIES GENERATED TRUE)
if(MSVC)
# Suppress warnings caused by Protobuf (casts, dll-interface)
set_source_files_properties(${FLIGHT_SQL_GENERATED_PROTO_FILES}
PROPERTIES COMPILE_FLAGS "/wd4251 /wd4267")
set_source_files_properties(${FLIGHT_SQL_GENERATED_PROTO_FILES} PROPERTIES COMPILE_FLAGS
"/wd4267")
endif()

add_custom_target(flight_sql_protobuf_gen ALL DEPENDS ${FLIGHT_SQL_GENERATED_PROTO_FILES})
Expand All @@ -47,7 +47,7 @@ set(ARROW_FLIGHT_SQL_SRCS
sql_info_internal.cc
column_metadata.cc
client.cc
"${CMAKE_CURRENT_BINARY_DIR}/FlightSql.pb.cc")
protocol_internal.cc)

add_arrow_lib(arrow_flight_sql
CMAKE_PACKAGE_NAME
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/flight/sql/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <google/protobuf/any.pb.h>

#include "arrow/buffer.h"
#include "arrow/flight/sql/FlightSql.pb.h"
#include "arrow/flight/sql/protocol_internal.h"
#include "arrow/flight/types.h"
#include "arrow/io/memory.h"
#include "arrow/ipc/reader.h"
Expand Down
10 changes: 8 additions & 2 deletions cpp/src/arrow/flight/sql/client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@

#include <utility>

// XXX(ARROW-16902): Protobuf doesn't insert dllimport declarations in
// all the right places for MinGW (causing an error "redeclared
// without dllimport attribute"). Instead, just omit them and rely on
// symbols being found implicitly.
#if defined(__MINGW32__)
#define ARROW_FLIGHT_SQL_STATIC
#endif
// Must come before Protobuf include
#include "arrow/flight/sql/visibility.h"
#include "arrow/flight/sql/protocol_internal.h"

#include "arrow/buffer.h"
#include "arrow/flight/sql/FlightSql.pb.h"
#include "arrow/flight/sql/api.h"
#include "arrow/testing/gtest_util.h"

Expand Down
23 changes: 23 additions & 0 deletions cpp/src/arrow/flight/sql/protocol_internal.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations

#include "arrow/flight/sql/protocol_internal.h"

// NOTE(lidavidm): Normally this is forbidden, but on Windows to get
// the dllexport/dllimport macro in the right places, we need to
// ensure our header gets included (and Protobuf will not insert the
// include for you)
#include "arrow/flight/sql/FlightSql.pb.cc" // NOLINT
26 changes: 26 additions & 0 deletions cpp/src/arrow/flight/sql/protocol_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations

#pragma once

// This addresses platform-specific defines, e.g. on Windows
#include "arrow/flight/platform.h" // IWYU pragma: keep

// This header holds the Flight SQL definitions.

#include "arrow/flight/sql/visibility.h"

#include "arrow/flight/sql/FlightSql.pb.h" // IWYU pragma: export
2 changes: 1 addition & 1 deletion cpp/src/arrow/flight/sql/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "arrow/buffer.h"
#include "arrow/builder.h"
#include "arrow/flight/sql/FlightSql.pb.h"
#include "arrow/flight/sql/protocol_internal.h"
#include "arrow/flight/sql/sql_info_internal.h"
#include "arrow/type.h"
#include "arrow/util/checked_cast.h"
Expand Down

0 comments on commit f27fa71

Please sign in to comment.