Skip to content

Commit

Permalink
feat(c): Add BigQuery library to Meson build system
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Jul 9, 2024
1 parent 66ecd33 commit f681467
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
69 changes: 69 additions & 0 deletions c/driver/bigquery/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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.


golang = find_program('go')

if build_machine.system() == 'windows'
prefix = ''
suffix = '.lib'
elif build_machine.system() == 'darwin'
prefix = 'lib'
suffix = '.dylib'
else
prefix = 'lib'
suffix = '.so'
endif

adbc_driver_bigquery_name = prefix + 'adbc_driver_bigquery' + suffix
adbc_driver_bigquery_lib = custom_target(
'adbc_driver_bigquery',
output: adbc_driver_bigquery_name,
command : [
golang,
'build',
'-C',
meson.project_source_root() + '/../go/adbc/pkg/bigquery',
'-tags=driverlib',
'-buildmode=c-shared',
'-o',
meson.current_build_dir() + '/' + adbc_driver_bigquery_name,
],
install : true,
install_dir : '.',
)

pkg.generate(
name: 'adbc_driver_bigquery',
description: 'ADBC Driver for BigQuery',
libraries: [adbc_driver_bigquery_lib],
filebase: 'adbc-driver-bigquery',
)

if get_option('tests')
exc = executable(
'adbc-driver-bigquery-test',
'bigquery_test.cc',
include_directories: [root_dir, driver_dir],
link_with: [
adbc_common_lib,
adbc_driver_bigquery_lib
],
dependencies: [adbc_validation_dep],
)
test('adbc-driver-bigquery', exc)
endif
6 changes: 6 additions & 0 deletions c/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ endif
needs_driver_manager = get_option('driver_manager') \
or get_option('tests')

pkg = import('pkgconfig')

if needs_driver_manager
subdir('driver_manager')
endif
Expand All @@ -59,6 +61,10 @@ if get_option('tests')
subdir('validation')
endif

if get_option('bigquery')
subdir('driver/bigquery')
endif

if get_option('flightsql')
subdir('driver/flightsql')
endif
Expand Down
6 changes: 6 additions & 0 deletions c/meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

option('tests', type: 'boolean', description: 'Build tests', value: false)
option('benchmarks', type: 'boolean', description: 'Build benchmarks', value: false)
option(
'bigquery',
type: 'boolean',
description: 'Build ADBC BigQuery driver',
value: false
)
option(
'flightsql',
type: 'boolean',
Expand Down

0 comments on commit f681467

Please sign in to comment.