Skip to content

Commit

Permalink
ARROW-1667: [GLib] Support Meson
Browse files Browse the repository at this point in the history
Author: Kouhei Sutou <[email protected]>

Closes #1196 from kou/c-glib-support-meson and squashes the following commits:

409cd7b [Kouhei Sutou] [GLib] Use pkgconfig module
1925be0 [Kouhei Sutou] [GLib] Use correct LD_LIBRARY_PATH for Meson build
c5702d9 [Kouhei Sutou] [GLib] Add missing license information
029d5b3 [Kouhei Sutou] [GLib] Fix build failure on Travis CI
37d4116 [Kouhei Sutou] [GLib] Use installed files in test
d601ad4 [Kouhei Sutou] [GLib] Disable Torch build test
f963697 [Kouhei Sutou] [GLib] Fix "string equal" operator in Travis CI script
93cdd85 [Kouhei Sutou] [GLib] Fix build dependencies
cd5e9d3 [Kouhei Sutou] [GLib] Use correct file in test
06777d3 [Kouhei Sutou] [GLib] Fix generated files dependency
9db9fef [Kouhei Sutou] [GLib] Add Travis CI configuration for building Arrow GLib with Meson
9b76f76 [Kouhei Sutou] [GLib] Support running test in no libtool case
25876b4 [Kouhei Sutou] [GLib] Support "meson test"
2d422af [Kouhei Sutou] [GLib] Fix include path
30c2e85 [Kouhei Sutou] [GLib] Support building examples
6bc0f81 [Kouhei Sutou] [GLib] Add missing Makefile.am
12383de [Kouhei Sutou] [GLib] Support Meson
  • Loading branch information
kou committed Oct 16, 2017
1 parent a6a97a9 commit e39b479
Show file tree
Hide file tree
Showing 21 changed files with 638 additions and 68 deletions.
15 changes: 14 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,19 @@ matrix:
- compiler: gcc
language: cpp
os: linux
group: deprecated
env: BUILD_SYSTEM=autotools BUILD_TORCH_EXAMPLE=no
before_script:
- export CC="gcc-4.9"
- export CXX="g++-4.9"
- $TRAVIS_BUILD_DIR/ci/travis_lint.sh
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh --only-library
- $TRAVIS_BUILD_DIR/ci/travis_before_script_c_glib.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_c_glib.sh
- compiler: gcc
language: cpp
os: linux
env: BUILD_SYSTEM=meson BUILD_TORCH_EXAMPLE=no
before_script:
- export CC="gcc-4.9"
- export CXX="g++-4.9"
Expand All @@ -135,6 +147,7 @@ matrix:
cache:
addons:
rvm: 2.2
env: BUILD_SYSTEM=autotools
before_script:
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh --only-library
- $TRAVIS_BUILD_DIR/ci/travis_before_script_c_glib.sh
Expand Down
5 changes: 4 additions & 1 deletion c_glib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ Makefile.in
/doc/reference/gtk-doc.make
/doc/reference/*.stamp
/doc/reference/html/
/doc/reference/xml/
/doc/reference/xml/*
!/doc/reference/xml/Makefile.am
!/doc/reference/xml/meson.build
!/doc/reference/xml/gtkdocentities.ent.in
/doc/reference/tmpl/
/libtool
/m4/
Expand Down
5 changes: 4 additions & 1 deletion c_glib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = \
arrow-glib \
doc \
example
example \
tool

EXTRA_DIST = \
README.md \
meson.build \
meson_options.txt \
test

arrow_glib_docdir = ${datarootdir}/doc/arrow-glib
Expand Down
3 changes: 2 additions & 1 deletion c_glib/arrow-glib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

CLEANFILES =

EXTRA_DIST =
EXTRA_DIST = \
meson.build

AM_CPPFLAGS = \
-I$(top_builddir) \
Expand Down
197 changes: 197 additions & 0 deletions c_glib/arrow-glib/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# -*- indent-tabs-mode: nil -*-
#
# 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.

sources = files(
'array.cpp',
'array-builder.cpp',
'basic-data-type.cpp',
'buffer.cpp',
'chunked-array.cpp',
'column.cpp',
'composite-data-type.cpp',
'error.cpp',
'field.cpp',
'record-batch.cpp',
'schema.cpp',
'table.cpp',
'tensor.cpp',
'type.cpp',
)

sources += files(
'file.cpp',
'file-mode.cpp',
'input-stream.cpp',
'output-stream.cpp',
'readable.cpp',
'writeable.cpp',
'writeable-file.cpp',
)

sources += files(
'metadata-version.cpp',
'reader.cpp',
'writer.cpp',
)

sources += files(
'compute.cpp',
)

c_headers = files(
'array.h',
'array-builder.h',
'arrow-glib.h',
'basic-data-type.h',
'buffer.h',
'chunked-array.h',
'column.h',
'composite-data-type.h',
'data-type.h',
'error.h',
'field.h',
'gobject-type.h',
'record-batch.h',
'schema.h',
'table.h',
'tensor.h',
'type.h',
)


c_headers += files(
'file.h',
'file-mode.h',
'input-stream.h',
'output-stream.h',
'readable.h',
'writeable.h',
'writeable-file.h',
)

c_headers += files(
'metadata-version.h',
'reader.h',
'writer.h',
)

c_headers += files(
'compute.h',
)


cpp_headers = files(
'array.hpp',
'array-builder.hpp',
'arrow-glib.hpp',
'basic-data-type.hpp',
'buffer.hpp',
'chunked-array.hpp',
'column.hpp',
'data-type.hpp',
'error.hpp',
'field.hpp',
'record-batch.hpp',
'schema.hpp',
'table.hpp',
'tensor.hpp',
'type.hpp',
)

cpp_headers += files(
'file.hpp',
'file-mode.hpp',
'input-stream.hpp',
'output-stream.hpp',
'readable.hpp',
'writeable.hpp',
'writeable-file.hpp',
)

cpp_headers += files(
'metadata-version.hpp',
'reader.hpp',
'writer.hpp',
)

cpp_headers += files(
'compute.hpp',
)


enums = gnome.mkenums('enums',
sources: c_headers,
identifier_prefix: 'GArrow',
symbol_prefix: 'garrow',
c_template: 'enums.c.template',
h_template: 'enums.h.template',
install_dir: join_paths(include_dir, meson.project_name()),
install_header: true)
enums_source = enums[0]
enums_header = enums[1]


headers = c_headers + cpp_headers
install_headers(headers, subdir: meson.project_name())


dependencies = [
dependency('arrow'),
dependency('gobject-2.0'),
dependency('gio-2.0'),
]
libarrow_glib = library('arrow-glib',
sources: sources + enums,
install: true,
dependencies: dependencies,
include_directories: [
root_inc,
],
soversion: so_version,
version: library_version)
libarrow_glib_dependency = declare_dependency(link_with: libarrow_glib,
include_directories: [
root_inc,
],
dependencies: dependencies,
sources: enums_header)

pkgconfig.generate(filebase: meson.project_name(),
name: 'Apache Arrow GLib',
description: 'C API for Apache Arrow based on GLib',
version: version,
requires: ['gobject-2.0', 'arrow'],
libraries: [libarrow_glib],
subdirs: ['arrow-glib'])

gnome.generate_gir(libarrow_glib,
sources: sources + c_headers + enums,
namespace: 'Arrow',
nsversion: api_version,
identifier_prefix: 'GArrow',
symbol_prefix: 'garrow',
export_packages: 'arrow-glib',
includes: [
'GObject-2.0',
'Gio-2.0',
],
install: true,
extra_args: [
'--warn-all',
])
2 changes: 2 additions & 0 deletions c_glib/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ AC_CONFIG_FILES([
arrow-glib/arrow-glib.pc
doc/Makefile
doc/reference/Makefile
doc/reference/xml/Makefile
example/Makefile
example/lua/Makefile
tool/Makefile
])

AC_OUTPUT
9 changes: 7 additions & 2 deletions c_glib/doc/reference/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# specific language governing permissions and limitations
# under the License.

SUBDIRS = \
xml

DOC_MODULE = arrow-glib

DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.sgml
Expand All @@ -32,8 +35,7 @@ MKDB_OPTIONS = \
HFILE_GLOB = \
$(top_srcdir)/arrow-glib/*.h

IGNORE_HFILES = \
enums.h
IGNORE_HFILES =

CFILE_GLOB = \
$(top_srcdir)/arrow-glib/*.cpp
Expand All @@ -57,3 +59,6 @@ CLEANFILES += \
$(DOC_MODULE)-overrides.txt \
$(DOC_MODULE)-sections.txt \
$(DOC_MODULE).types

EXTRA_DIST += \
meson.build
58 changes: 58 additions & 0 deletions c_glib/doc/reference/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- indent-tabs-mode: nil -*-
#
# 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.

subdir('xml')

private_headers = [
]

content_files = [
]

html_images = [
]

glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
doc_path = join_paths(data_dir, meson.project_name(), 'gtk-doc', 'html')

gnome.gtkdoc(meson.project_name(),
main_xml: meson.project_name() + '-docs.sgml',
src_dir: [
join_paths(meson.source_root(), 'arrow-glib'),
join_paths(meson.build_root(), 'arrow-glib'),
],
dependencies: libarrow_glib_dependency,
gobject_typesfile: meson.project_name() + '.types',
scan_args: [
'--rebuild-types',
'--deprecated-guards=GARROW_DISABLE_DEPRECATED',
],
mkdb_args: [
'--output-format=xml',
'--name-space=garrow',
'--source-suffixes=c,cpp,h',
],
fixxref_args: [
'--html-dir=' + doc_path,
'--extra-dir=' + join_paths(glib_doc_path, 'glib'),
'--extra-dir=' + join_paths(glib_doc_path, 'gobject'),
],
html_assets: html_images,
install: true)
20 changes: 20 additions & 0 deletions c_glib/doc/reference/xml/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.

EXTRA_DIST = \
gtkdocentities.ent.in \
meson.build
Loading

0 comments on commit e39b479

Please sign in to comment.