Skip to content

Commit b54d32f

Browse files
committed
feat: Add support for Meson build system
1 parent 3973bef commit b54d32f

25 files changed

+704
-69
lines changed

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,36 @@ jobs:
9999
run: |
100100
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
101101
bash -c "ci/scripts/build_example.sh $(pwd)/example"
102+
meson:
103+
name: Meson - ${{ matrix.title }}
104+
runs-on: ${{ matrix.runs-on }}
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
include:
109+
- title: AMD64 Ubuntu 24.04
110+
runs-on: ubuntu-24.04
111+
- title: AMD64 Windows 2022
112+
runs-on: windows-2022
113+
meson-setup-args: --vsenv
114+
- title: AArch64 macOS 15
115+
runs-on: macos-15
116+
steps:
117+
- uses: actions/setup-python@v5
118+
with:
119+
python-version: '3.x'
120+
- name: Checkout iceberg-cpp
121+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
122+
with:
123+
fetch-depth: 0
124+
- name: Install build dependencies
125+
run: |
126+
python3 -m pip install --upgrade pip
127+
python3 -m pip install meson ninja
128+
- name: Build Iceberg
129+
run: |
130+
meson setup builddir ${{ matrix.meson-setup-args || '' }}
131+
meson compile -C builddir
132+
- name: Test Iceberg
133+
run: |
134+
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
@@ -64,7 +64,6 @@ include(CMakeParseArguments)
6464
include(IcebergBuildUtils)
6565
include(IcebergSanitizer)
6666
include(IcebergThirdpartyToolchain)
67-
include(GenerateExportHeader)
6867

6968
if(ICEBERG_BUILD_TESTS)
7069
enable_testing()

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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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,c++latest', 'warning_level=2'],
25+
)
26+
27+
subdir('src')
28+
29+
install_data(
30+
['LICENSE', 'NOTICE'],
31+
install_dir: get_option('datadir') / 'doc/Iceberg',
32+
)

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/CMakeLists.txt

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,24 @@ add_iceberg_lib(iceberg
9999
STATIC_INSTALL_INTERFACE_LIBS
100100
${ICEBERG_STATIC_INSTALL_INTERFACE_LIBS}
101101
SHARED_INSTALL_INTERFACE_LIBS
102-
${ICEBERG_SHARED_INSTALL_INTERFACE_LIBS})
102+
${ICEBERG_SHARED_INSTALL_INTERFACE_LIBS}
103+
OUTPUTS
104+
ICEBERG_LIBRARIES)
105+
106+
foreach(LIB_TARGET ${ICEBERG_LIBRARIES})
107+
target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_EXPORTING)
108+
endforeach()
109+
110+
if(ICEBERG_BUILD_STATIC)
111+
target_compile_definitions(iceberg_static PUBLIC ICEBERG_STATIC)
112+
endif()
103113

104114
iceberg_install_all_headers(iceberg)
105115

106116
add_subdirectory(catalog)
107117
add_subdirectory(expression)
108118
add_subdirectory(util)
109119

110-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_export.h
111-
DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg)
112-
113120
if(ICEBERG_BUILD_BUNDLE)
114121
set(ICEBERG_BUNDLE_SOURCES
115122
arrow/arrow_fs_file_io.cc
@@ -171,14 +178,21 @@ if(ICEBERG_BUILD_BUNDLE)
171178
STATIC_INSTALL_INTERFACE_LIBS
172179
${ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS}
173180
SHARED_INSTALL_INTERFACE_LIBS
174-
${ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS})
181+
${ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS}
182+
OUTPUTS
183+
ICEBERG_BUNDLE_LIBRARIES)
184+
185+
foreach(LIB_TARGET ${ICEBERG_BUNDLE_LIBRARIES})
186+
target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_BUNDLE_EXPORTING)
187+
endforeach()
188+
189+
if(ICEBERG_BUILD_STATIC)
190+
target_compile_definitions(iceberg_bundle_static PUBLIC ICEBERG_BUNDLE_STATIC)
191+
endif()
175192

176193
add_subdirectory(arrow)
177194
add_subdirectory(avro)
178195
add_subdirectory(parquet)
179-
180-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_bundle_export.h
181-
DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg)
182196
endif()
183197

184198
iceberg_install_cmake_package(Iceberg iceberg_targets)

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')

0 commit comments

Comments
 (0)