Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Meson Support for ADBC #1904

Merged
merged 16 commits into from
Jun 25, 2024
Merged

feat: Meson Support for ADBC #1904

merged 16 commits into from
Jun 25, 2024

Conversation

WillAyd
Copy link
Contributor

@WillAyd WillAyd commented Jun 3, 2024

This worked pretty well in nanoarrow so figured worth trying in ADBC. In the long run arrow-adbc would make for a nice addition to the Meson WrapDB - it would be an easy way to install the source for a desired set of driver(s)

In the immediate term, Meson really helps simplify the current CMake hoops you have to jump through to wrangle dependencies, and I think is easier to use

Fixes #1941.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some TODOs in this file on things that were tripping me up. I don't know enough about Go to make that work, though the issue I linked to might have some workarounds.

DuckDB in theory could be wrangled well as a subproject, but the CMake <> Meson bridge is a bit wonky and the generated includes create a conflict between the adbc.h file in this repository versus the adbc.h file that DuckDB creates

c/meson.build Outdated
gmock_dep = disabler()
endif

if get_option('duckdb')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be tough to get working in its current state - probably will defer to fully fixing for a later PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop support for DukcDB with Meson?
I think that we don't need to maintain this because it's just for an integration test. Users don't need this and we can do it with CMake.

c/meson.build Outdated
subdir('integration/duckdb')
endif

if get_option('python')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this in for consistency with our current CMake implementation, but I think in the long run it would be easier to use meson-python and have it take care of dependencies automatically via pip install, rather than trying to toggle via a build generator option

@lidavidm
Copy link
Member

lidavidm commented Jun 4, 2024

@kou I think you're much more familiar with Meson, any thoughts?

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that Meson support is OK but we should keep maintenance cost as small as possible. Because our main build system is CMake. In general, maintaining multiple build systems are time consuming.

So I think that we should support only simple and needed build features for Meson. Other complex build features are implemented only with CMake.

Comment on lines 232 to 235
cd c
meson setup -Dpostgresql=true -Dsqlite=true -Ddriver_manager=true builddir
cd builddir
meson compile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about avoiding cd?

Suggested change
cd c
meson setup -Dpostgresql=true -Dsqlite=true -Ddriver_manager=true builddir
cd builddir
meson compile
meson setup -Dpostgresql=true -Dsqlite=true -Ddriver_manager=true c c/build
meson compile -C c/build

Comment on lines 238 to 239
cd c/builddir
meson test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cd c/builddir
meson test
meson test -C c/build

.gitignore Outdated
Comment on lines 126 to 127
c/subprojects/*
!c/subprojects/*.wrap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
c/subprojects/*
!c/subprojects/*.wrap
/c/subprojects/*
!/c/subprojects/*.wrap

CONTRIBUTING.md Outdated
To use Meson, start at the c directory and run:

```shell
$ meson setup builddir && cd builddir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ meson setup builddir && cd builddir
$ meson setup build

CONTRIBUTING.md Outdated
the SQLite3 driver along with tests, you would run:

```shell
$ meson configure -Dbuildtype=debug -Dsqlite=true -Dtests=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ meson configure -Dbuildtype=debug -Dsqlite=true -Dtests=true
$ meson configure -Dbuildtype=debug -Dsqlite=true -Dtests=true build

CONTRIBUTING.md Outdated
from its WrapDB for you:

```shell
$ meson compile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ meson compile
$ meson compile -C build

CONTRIBUTING.md Outdated
To run the test suite, simply run:

```shell
$ meson test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ meson test
$ meson test -C build

c/meson.build Outdated
project(
'arrow-adbc',
'c', 'cpp',
version: '0.6.0-SNAPSHOT', # TODO: can this be dynamic?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 4 to 7
c/subprojects/fmt*
c/subprojects/gtest*
c/subprojects/nanoarrow*
c/subprojects/sqlite3*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we set our license header to c/subprojects/*.wrap instead of excluding them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These headers were generated by meson wrap install ... - happy to add that if the fact that they are automatically generated is not important

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Let's exclude *.wrap. Can we narrow exclude targets as much as possible such as using fmt.wrap instead of fmt.*?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. I made these wildcards to prevent anything generated by the subprojects themselves being included, but those should never be committed anyway. Changed to the more explicit form you have suggested

c/meson.build Outdated
gmock_dep = disabler()
endif

if get_option('duckdb')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop support for DukcDB with Meson?
I think that we don't need to maintain this because it's just for an integration test. Users don't need this and we can do it with CMake.

@WillAyd WillAyd marked this pull request as ready for review June 5, 2024 04:07
@github-actions github-actions bot added this to the ADBC Libraries 13 milestone Jun 5, 2024
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1


To use Meson, start at the c directory and run:

```shell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell
```console

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem making this change but all of the other entries in the CONTRIBUTING.md guide currently use shell - do you want me to update all of them as part of this or leave that to a separate PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Could you use a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - will open after this goes in. For now I left this file alone, but made the updates you suggested to other files

the form ``-D_option_:_value_``. For example, to build the a debug version of
the SQLite3 driver along with tests, you would run:

```shell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell
```console

Meson will try to find them on your system and fall back to downloading a copy
from its WrapDB for you:

```shell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell
```console


To run the test suite, simply run:

```shell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell
```console

},
}

foreach nm, conf : postgres_tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
foreach nm, conf : postgres_tests
foreach name, conf : postgres_tests


foreach nm, conf : postgres_tests
exc = executable(
'adbc-' + nm + '-test',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'adbc-' + nm + '-test',
'adbc-' + name + '-test',

],
dependencies: [nanoarrow_dep, gtest_main_dep, gmock_dep, libpq_dep],
)
test('adbc-' + nm, exc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test('adbc-' + nm, exc)
test('adbc-' + name, exc)

c/meson.build Outdated
'arrow-adbc',
'c', 'cpp',
version: '1.1.0-SNAPSHOT',
license: 'Apache 2.0',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
license: 'Apache 2.0',
license: 'Apache-2.0',

@lidavidm
Copy link
Member

@kou any other feedback here?

@kou
Copy link
Member

kou commented Jun 25, 2024

No!
Let's merge this.

@kou
Copy link
Member

kou commented Jun 25, 2024

Do we need an associated issue before we merge this?

@lidavidm
Copy link
Member

I attached #1941

@lidavidm lidavidm merged commit 453a9c3 into apache:main Jun 25, 2024
65 checks passed
@WillAyd WillAyd deleted the meson-support branch June 26, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

build: add minimal Meson support
3 participants