Skip to content

Commit d163cc4

Browse files
committed
feat: Add support for Meson build system
1 parent 0fc573a commit d163cc4

23 files changed

+665
-61
lines changed

.github/workflows/test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,53 @@ jobs:
9696
run: |
9797
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
9898
bash -c "ci/scripts/build_example.sh $(pwd)/example"
99+
ubuntu-meson:
100+
name: Meson - AMD64 Ubuntu 24.04
101+
runs-on: ubuntu-24.04
102+
timeout-minutes: 30
103+
strategy:
104+
fail-fast: false
105+
steps:
106+
- uses: actions/setup-python@v5
107+
with:
108+
python-version: '3.x'
109+
- name: Checkout iceberg-cpp
110+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
111+
with:
112+
fetch-depth: 0
113+
- name: Install build dependencies
114+
run: |
115+
python3 -m pip install --upgrade pip
116+
python3 -m pip install meson ninja
117+
- name: Build Iceberg
118+
run: |
119+
meson setup builddir
120+
meson compile -C builddir
121+
- name: Test Iceberg
122+
run: |
123+
meson test -C builddir
124+
windows-meson:
125+
name: Meson - AMD64 Windows 2022
126+
runs-on: windows-2022
127+
timeout-minutes: 30
128+
strategy:
129+
fail-fast: false
130+
steps:
131+
- uses: actions/setup-python@v5
132+
with:
133+
python-version: '3.x'
134+
- name: Checkout iceberg-cpp
135+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
136+
with:
137+
fetch-depth: 0
138+
- name: Install build dependencies
139+
run: |
140+
python3 -m pip install --upgrade pip
141+
python3 -m pip install meson ninja
142+
- name: Build Iceberg
143+
run: |
144+
meson setup builddir --vsenv
145+
meson compile -C builddir
146+
- name: Test Iceberg
147+
run: |
148+
meson test -C builddir

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ cmake-build-release/
2626

2727
# vscode files
2828
.vscode
29+
30+
# meson subprojects - wrap files need to be kept to let meson download
31+
# dependencies as needed, but dependencies themselves should not be versioned
32+
/subprojects/*
33+
!/subprojects/packagefiles
34+
!/subprojects/*.wrap

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,15 @@ repos:
3939
rev: v0.6.10
4040
hooks:
4141
- id: cmake-format
42+
43+
- repo: https://github.com/trim21/pre-commit-mirror-meson
44+
rev: v1.9.0
45+
hooks:
46+
- id: meson-fmt
47+
alias: cpp
48+
args: ['--inplace']
49+
files: >-
50+
(
51+
?.*meson\.build$|
52+
?.*meson\.options$|
53+
)

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ include(CMakeParseArguments)
6060
include(IcebergBuildUtils)
6161
include(IcebergSanitizer)
6262
include(IcebergThirdpartyToolchain)
63-
include(GenerateExportHeader)
6463

6564
add_subdirectory(src)
6665

cmake_modules/IcebergBuildUtils.cmake

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -217,18 +217,6 @@ function(add_iceberg_lib LIB_NAME)
217217
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
218218
endif()
219219

220-
# generate export header file
221-
if(BUILD_SHARED)
222-
generate_export_header(${LIB_NAME}_shared BASE_NAME ${LIB_NAME})
223-
if(BUILD_STATIC)
224-
string(TOUPPER ${LIB_NAME} LIB_NAME_UPPER)
225-
target_compile_definitions(${LIB_NAME}_static
226-
PUBLIC ${LIB_NAME_UPPER}_STATIC_DEFINE)
227-
endif()
228-
elseif(BUILD_STATIC)
229-
generate_export_header(${LIB_NAME}_static BASE_NAME ${LIB_NAME})
230-
endif()
231-
232220
# Modify variable in calling scope
233221
if(ARG_OUTPUTS)
234222
set(${ARG_OUTPUTS}

meson.build

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
project(
19+
'iceberg',
20+
'cpp',
21+
version: '0.2.0',
22+
license: 'Apache-2.0',
23+
meson_version: '>=1.3.0',
24+
default_options: ['cpp_std=c++23', 'warning_level=2'],
25+
)
26+
27+
subdir('src')
28+
29+
if get_option('tests').enabled()
30+
subdir('test')
31+
endif
32+
33+
install_data(
34+
['LICENSE', 'NOTICE'],
35+
install_dir: get_option('datadir') / 'doc/Iceberg',
36+
)

meson.options

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
option('tests', type: 'feature', description: 'Build tests', value: 'enabled')

src/iceberg/catalog/meson.build

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
install_headers(['in_memory_catalog.h'], subdir: 'iceberg/catalog')

src/iceberg/expression/meson.build

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
install_headers(['expression.h', 'literal.h'], subdir: 'iceberg/expression')

src/iceberg/iceberg_export.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#pragma once
21+
22+
#if defined(_WIN32) || defined(__CYGWIN__)
23+
# ifdef ICEBERG_STATIC
24+
# define ICEBERG_EXPORT
25+
# elif defined(ICEBERG_EXPORTING)
26+
# define ICEBERG_EXPORT __declspec(dllexport)
27+
# else
28+
# define ICEBERG_EXPORT __declspec(dllimport)
29+
# endif
30+
#else // Not Windows
31+
# ifndef ICEBERG_EXPORT
32+
# define ICEBERG_EXPORT __attribute__((visibility("default")))
33+
# endif
34+
#endif

0 commit comments

Comments
 (0)