forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
171 lines (147 loc) · 6.47 KB
/
Copy pathCMakeLists.txt
File metadata and controls
171 lines (147 loc) · 6.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# 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
# under the License.
add_arrow_example(row_wise_conversion_example)
add_arrow_example(rapidjson_row_converter)
if(ARROW_COMPUTE)
add_arrow_example(compute_register_example)
endif()
if(ARROW_SUBSTRAIT)
add_arrow_example(engine_substrait_consumption EXTRA_LINK_LIBS arrow_substrait_shared)
endif()
if(ARROW_COMPUTE AND ARROW_CSV)
add_arrow_example(compute_and_write_csv_example)
endif()
if(ARROW_FLIGHT)
# Static gRPC means we cannot linked to shared Arrow, since then
# we'll violate ODR for gRPC symbols
if(ARROW_GRPC_USE_SHARED)
set(FLIGHT_EXAMPLES_LINK_LIBS arrow_flight_shared)
if(APPLE)
set(GRPC_REFLECTION_LINK_LIBS gRPC::grpc++_reflection)
else()
# We don't directly use symbols from the reflection library, so
# ensure the linker still links to it
set(GRPC_REFLECTION_LINK_LIBS -Wl,--no-as-needed gRPC::grpc++_reflection
-Wl,--as-needed)
endif()
elseif(NOT ARROW_BUILD_STATIC)
message(FATAL_ERROR "Statically built gRPC requires ARROW_BUILD_STATIC=ON")
else()
set(FLIGHT_EXAMPLES_LINK_LIBS arrow_flight_static)
if(APPLE)
set(GRPC_REFLECTION_LINK_LIBS -Wl,-force_load gRPC::grpc++_reflection)
else()
set(GRPC_REFLECTION_LINK_LIBS -Wl,--whole-archive gRPC::grpc++_reflection
-Wl,--no-whole-archive)
endif()
endif()
set(FLIGHT_EXAMPLE_GENERATED_PROTO_FILES
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc"
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.h"
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc"
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.h")
set_source_files_properties(${FLIGHT_EXAMPLE_GENERATED_PROTO_FILES} PROPERTIES GENERATED
TRUE)
set(FLIGHT_EXAMPLE_PROTO "helloworld.proto")
set(FLIGHT_EXAMPLE_PROTO_PATH "${CMAKE_CURRENT_LIST_DIR}")
set(FLIGHT_EXAMPLE_PROTO_DEPENDS ${FLIGHT_EXAMPLE_PROTO} gRPC::grpc_cpp_plugin)
add_custom_command(OUTPUT ${FLIGHT_EXAMPLE_GENERATED_PROTO_FILES}
COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${FLIGHT_EXAMPLE_PROTO_PATH}"
"--cpp_out=${CMAKE_CURRENT_BINARY_DIR}"
"${FLIGHT_EXAMPLE_PROTO}"
COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${FLIGHT_EXAMPLE_PROTO_PATH}"
"--grpc_out=${CMAKE_CURRENT_BINARY_DIR}"
"--plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>"
"${FLIGHT_EXAMPLE_PROTO}"
DEPENDS ${FLIGHT_EXAMPLE_PROTO_DEPENDS})
add_custom_target(flight_grpc_example_gen ALL
DEPENDS ${FLIGHT_EXAMPLE_GENERATED_PROTO_FILES})
add_arrow_example(flight_grpc_example
DEPENDENCIES
flight_grpc_example_gen
# Not CMAKE_CURRENT_BINARY_DIR so we can #include
# "examples/arrow/helloworld.pb.h" instead of
# "helloworld.pb.h" (which fails lint)
EXTRA_INCLUDES
${CMAKE_BINARY_DIR}
EXTRA_LINK_LIBS
${FLIGHT_EXAMPLES_LINK_LIBS}
gRPC::grpc++
${GRPC_REFLECTION_LINK_LIBS}
${ARROW_PROTOBUF_LIBPROTOBUF}
${GFLAGS_LIBRARIES}
EXTRA_SOURCES
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc"
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc")
if(ARROW_FLIGHT_SQL)
if(ARROW_GRPC_USE_SHARED)
set(FLIGHT_SQL_EXAMPLES_LINK_LIBS arrow_flight_sql_shared)
else()
set(FLIGHT_SQL_EXAMPLES_LINK_LIBS arrow_flight_sql_static)
endif()
add_arrow_example(flight_sql_example
DEPENDENCIES
flight-sql-test-server
EXTRA_LINK_LIBS
${FLIGHT_EXAMPLES_LINK_LIBS}
${FLIGHT_SQL_EXAMPLES_LINK_LIBS}
gRPC::grpc++
${ARROW_PROTOBUF_LIBPROTOBUF}
${GFLAGS_LIBRARIES})
endif()
endif()
if(ARROW_PARQUET)
if(ARROW_BUILD_SHARED)
add_arrow_example(parquet_read_write EXTRA_LINK_LIBS parquet_shared)
else()
add_arrow_example(parquet_read_write EXTRA_LINK_LIBS parquet_static)
endif()
endif()
if(ARROW_PARQUET AND ARROW_DATASET)
if(ARROW_BUILD_SHARED)
set(DATASET_EXAMPLES_LINK_LIBS arrow_dataset_shared)
else()
set(DATASET_EXAMPLES_LINK_LIBS arrow_dataset_static)
endif()
add_arrow_example(dataset_parquet_scan_example EXTRA_LINK_LIBS
${DATASET_EXAMPLES_LINK_LIBS})
add_dependencies(dataset-parquet-scan-example parquet)
add_arrow_example(dataset_documentation_example EXTRA_LINK_LIBS
${DATASET_EXAMPLES_LINK_LIBS})
add_dependencies(dataset-documentation-example parquet)
add_arrow_example(execution_plan_documentation_examples EXTRA_LINK_LIBS
${DATASET_EXAMPLES_LINK_LIBS})
add_dependencies(execution-plan-documentation-examples parquet)
if(ARROW_CSV)
add_arrow_example(join_example EXTRA_LINK_LIBS ${DATASET_EXAMPLES_LINK_LIBS})
add_dependencies(join-example parquet)
endif()
add_arrow_example(udf_example)
if(ARROW_SKYHOOK)
if(ARROW_BUILD_SHARED)
list(APPEND DATASET_EXAMPLES_LINK_LIBS arrow_skyhook_shared)
else()
list(APPEND DATASET_EXAMPLES_LINK_LIBS arrow_skyhook_static)
endif()
add_arrow_example(dataset_skyhook_scan_example EXTRA_LINK_LIBS
${DATASET_EXAMPLES_LINK_LIBS})
add_dependencies(dataset-skyhook-scan-example parquet)
endif()
endif()
if(ARROW_GANDIVA)
add_arrow_example(gandiva_example EXTRA_LINK_LIBS gandiva_shared)
endif()