-
Notifications
You must be signed in to change notification settings - Fork 58
feat: Add support for Meson build system #233
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
base: main
Are you sure you want to change the base?
Changes from all commits
bc75e60
be41c9b
390f321
d1e5b8b
87c6f22
873615b
f0f104e
f580dbe
a80066d
3911af2
6d50d89
4abc27a
9d71f7e
85db5e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ set(ICEBERG_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}") | |
set(ICEBERG_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}") | ||
set(ICEBERG_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}") | ||
set(ICEBERG_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake") | ||
set(ICEBERG_INSTALL_DOCDIR "share/doc/Iceberg") | ||
set(ICEBERG_INSTALL_DOCDIR "share/doc/iceberg") | ||
|
||
if(WIN32 AND NOT MINGW) | ||
set(MSVC_TOOLCHAIN TRUE) | ||
|
@@ -64,7 +64,6 @@ include(CMakeParseArguments) | |
include(IcebergBuildUtils) | ||
include(IcebergSanitizer) | ||
include(IcebergThirdpartyToolchain) | ||
include(GenerateExportHeader) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meson does not have this feature. Rather than generate something in the build directory, I created the export header directly in the source and modeled the structure of it after similar visibility.h files in Apache Arrow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
if(ICEBERG_BUILD_TESTS) | ||
enable_testing() | ||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -21,18 +21,18 @@ | |||||||
include(CMakePackageConfigHelpers) | ||||||||
|
||||||||
function(iceberg_install_cmake_package PACKAGE_NAME EXPORT_NAME) | ||||||||
set(CONFIG_CMAKE "${PACKAGE_NAME}Config.cmake") | ||||||||
set(CONFIG_CMAKE "${PACKAGE_NAME}-config.cmake") | ||||||||
set(BUILT_CONFIG_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_CMAKE}") | ||||||||
configure_package_config_file("${CONFIG_CMAKE}.in" "${BUILT_CONFIG_CMAKE}" | ||||||||
INSTALL_DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}" | ||||||||
) | ||||||||
set(CONFIG_VERSION_CMAKE "${PACKAGE_NAME}ConfigVersion.cmake") | ||||||||
set(CONFIG_VERSION_CMAKE "${PACKAGE_NAME}config-version.cmake") | ||||||||
set(BUILT_CONFIG_VERSION_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_VERSION_CMAKE}") | ||||||||
write_basic_package_version_file("${BUILT_CONFIG_VERSION_CMAKE}" | ||||||||
COMPATIBILITY SameMajorVersion) | ||||||||
install(FILES "${BUILT_CONFIG_CMAKE}" "${BUILT_CONFIG_VERSION_CMAKE}" | ||||||||
DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}") | ||||||||
set(TARGETS_CMAKE "${PACKAGE_NAME}Targets.cmake") | ||||||||
set(TARGETS_CMAKE "${PACKAGE_NAME}-targets.cmake") | ||||||||
install(EXPORT ${EXPORT_NAME} | ||||||||
DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}" | ||||||||
NAMESPACE "${PACKAGE_NAME}::" | ||||||||
|
@@ -150,6 +150,9 @@ function(add_iceberg_lib LIB_NAME) | |||||||
target_link_libraries(${LIB_NAME}_shared | ||||||||
PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>") | ||||||||
|
||||||||
string(TOUPPER ${LIB_NAME} VISIBILITY_NAME) | ||||||||
target_compile_definitions(${LIB_NAME}_shared PRIVATE ${VISIBILITY_NAME}_EXPORTING) | ||||||||
|
||||||||
install(TARGETS ${LIB_NAME}_shared | ||||||||
EXPORT iceberg_targets | ||||||||
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} | ||||||||
|
@@ -208,6 +211,9 @@ function(add_iceberg_lib LIB_NAME) | |||||||
target_link_libraries(${LIB_NAME}_static | ||||||||
PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>") | ||||||||
|
||||||||
string(TOUPPER ${LIB_NAME} VISIBILITY_NAME) | ||||||||
target_compile_definitions(${LIB_NAME}_static PUBLIC ${VISIBILITY_NAME}_STATIC) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
install(TARGETS ${LIB_NAME}_static | ||||||||
EXPORT iceberg_targets | ||||||||
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} | ||||||||
|
@@ -217,18 +223,6 @@ function(add_iceberg_lib LIB_NAME) | |||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||||||||
endif() | ||||||||
|
||||||||
# generate export header file | ||||||||
if(BUILD_SHARED) | ||||||||
generate_export_header(${LIB_NAME}_shared BASE_NAME ${LIB_NAME}) | ||||||||
if(BUILD_STATIC) | ||||||||
string(TOUPPER ${LIB_NAME} LIB_NAME_UPPER) | ||||||||
target_compile_definitions(${LIB_NAME}_static | ||||||||
PUBLIC ${LIB_NAME_UPPER}_STATIC_DEFINE) | ||||||||
endif() | ||||||||
elseif(BUILD_STATIC) | ||||||||
generate_export_header(${LIB_NAME}_static BASE_NAME ${LIB_NAME}) | ||||||||
endif() | ||||||||
|
||||||||
# Modify variable in calling scope | ||||||||
if(ARG_OUTPUTS) | ||||||||
set(${ARG_OUTPUTS} | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# 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. | ||
|
||
project( | ||
'iceberg', | ||
'cpp', | ||
version: '0.2.0', | ||
license: 'Apache-2.0', | ||
meson_version: '>=1.3.0', | ||
default_options: [ | ||
'cpp_std=c++23,c++latest', | ||
'warning_level=2', | ||
# Don't build any tests for curl | ||
'curl:tests=disabled', | ||
'curl:unittests=disabled', | ||
], | ||
) | ||
|
||
subdir('src') | ||
|
||
install_data( | ||
['LICENSE', 'NOTICE'], | ||
install_dir: get_option('datadir') / 'doc/iceberg', | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 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. | ||
|
||
# Many of the options that CMake provides do not need to be implemented | ||
# in this configuration, as Meson offers built-in support for them. | ||
# For instance, instead of ICEBERG_BUILD_STATIC and ICEBERG_BUILD_SHARED | ||
# you can pass the `--default_library=<option>` to the meson setup command, | ||
# where <option> is one of "shared", "static", or "both" | ||
# | ||
# ICEBERG_ENABLE_ASAN / ICEBERG_ENABLE_UBSAN can be specified with | ||
# the -Db_sanitize=address,undefined option. Starting in Meson 1.8, | ||
# you can provide any array of sanitizers to that same argument, | ||
# including for example the "fuzzing" option | ||
# | ||
# ICEBERG_INSTALL_LIBDIR / ICEBERG_INSTALL_BINDIR / ICEBERG_INSTALL_INCLUDEDIR | ||
# and ICEBERG_INSTALL_DOCDIR correspond to Meson's --libdir / --bindir / | ||
# --includedir / --datadir arguments, respectively | ||
|
||
option( | ||
'rest', | ||
type: 'feature', | ||
description: 'Build rest catalog client', | ||
value: 'enabled', | ||
) | ||
option('tests', type: 'feature', description: 'Build tests', value: 'enabled') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to add other CMake options? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Options like ICEBERG_BUILD_STATIC and ICEBERG_BUILD_SHARED won't be here - Meson has built-in support for generating shared, static, or both libraries via the meson setup ... --default_library=static ICEBERG_ENABLE_ASAN / ICEBERG_ENABLE_UBSAN are similar in that Meson has a built-in command like argument for sanitizers. To enable both of those, you would do: meson setup ... -Db_sanitize=address,undefined (you can also supply other sanitizers like ICEBERG_INSTALL_LIBDIR / ICEBERG_INSTALL_BINDIR / ICEBERG_INSTALL_INCLUDEDIR have corresponding CLI arguments of --libdir / --bindir / --includedir. I haven't looked closely at what ICEBERG_INSTALL_DOCDIR is but I assume that maps to Meson's --datadir ICEBERG_BUILD_REST I will add when I get this PR up to speed with recent changes. If there's any other option let me know There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps adding these as comments to this file so impatient developers do not need to do research by themselves? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,16 +83,16 @@ list(APPEND | |
ZLIB::ZLIB) | ||
list(APPEND | ||
ICEBERG_STATIC_INSTALL_INTERFACE_LIBS | ||
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,Iceberg::nanoarrow_static,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_static>,nanoarrow::nanoarrow_static,nanoarrow::nanoarrow_shared>>" | ||
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,Iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" | ||
"$<IF:$<BOOL:${CROARING_VENDORED}>,Iceberg::roaring,roaring::roaring>" | ||
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,Iceberg::spdlog,spdlog::spdlog>") | ||
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,iceberg::nanoarrow_static,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_static>,nanoarrow::nanoarrow_static,nanoarrow::nanoarrow_shared>>" | ||
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" | ||
"$<IF:$<BOOL:${CROARING_VENDORED}>,iceberg::roaring,roaring::roaring>" | ||
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,iceberg::spdlog,spdlog::spdlog>") | ||
list(APPEND | ||
ICEBERG_SHARED_INSTALL_INTERFACE_LIBS | ||
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,Iceberg::nanoarrow_shared,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_shared>,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>" | ||
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,Iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" | ||
"$<IF:$<BOOL:${CROARING_VENDORED}>,Iceberg::roaring,roaring::roaring>" | ||
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,Iceberg::spdlog,spdlog::spdlog>") | ||
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,iceberg::nanoarrow_shared,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_shared>,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>" | ||
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" | ||
"$<IF:$<BOOL:${CROARING_VENDORED}>,iceberg::roaring,roaring::roaring>" | ||
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,iceberg::spdlog,spdlog::spdlog>") | ||
|
||
add_iceberg_lib(iceberg | ||
SOURCES | ||
|
@@ -106,7 +106,9 @@ add_iceberg_lib(iceberg | |
STATIC_INSTALL_INTERFACE_LIBS | ||
${ICEBERG_STATIC_INSTALL_INTERFACE_LIBS} | ||
SHARED_INSTALL_INTERFACE_LIBS | ||
${ICEBERG_SHARED_INSTALL_INTERFACE_LIBS}) | ||
${ICEBERG_SHARED_INSTALL_INTERFACE_LIBS} | ||
OUTPUTS | ||
ICEBERG_LIBRARIES) | ||
|
||
iceberg_install_all_headers(iceberg) | ||
|
||
|
@@ -115,9 +117,6 @@ add_subdirectory(expression) | |
add_subdirectory(row) | ||
add_subdirectory(util) | ||
|
||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_export.h | ||
DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg) | ||
|
||
if(ICEBERG_BUILD_BUNDLE) | ||
set(ICEBERG_BUNDLE_SOURCES | ||
arrow/arrow_fs_file_io.cc | ||
|
@@ -156,17 +155,17 @@ if(ICEBERG_BUILD_BUNDLE) | |
|
||
list(APPEND | ||
ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS | ||
"$<IF:$<TARGET_EXISTS:Iceberg::iceberg_static>,Iceberg::iceberg_static,Iceberg::iceberg_shared>" | ||
"$<IF:$<BOOL:${ARROW_VENDORED}>,Iceberg::arrow_static,$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>>" | ||
"$<IF:$<BOOL:${ARROW_VENDORED}>,Iceberg::parquet_static,$<IF:$<TARGET_EXISTS:Parquet::parquet_static>,Parquet::parquet_static,Parquet::parquet_shared>>" | ||
"$<IF:$<BOOL:${AVRO_VENDORED}>,Iceberg::avrocpp_s,$<IF:$<TARGET_EXISTS:avro-cpp::avrocpp_static>,avro-cpp::avrocpp_static,avro-cpp::avrocpp_shared>>" | ||
"$<IF:$<TARGET_EXISTS:iceberg::iceberg_static>,iceberg::iceberg_static,iceberg::iceberg_shared>" | ||
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::arrow_static,$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>>" | ||
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::parquet_static,$<IF:$<TARGET_EXISTS:Parquet::parquet_static>,Parquet::parquet_static,Parquet::parquet_shared>>" | ||
"$<IF:$<BOOL:${AVRO_VENDORED}>,iceberg::avrocpp_s,$<IF:$<TARGET_EXISTS:avro-cpp::avrocpp_static>,avro-cpp::avrocpp_static,avro-cpp::avrocpp_shared>>" | ||
) | ||
list(APPEND | ||
ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS | ||
"$<IF:$<TARGET_EXISTS:Iceberg::iceberg_shared>,Iceberg::iceberg_shared,Iceberg::iceberg_static>" | ||
"$<IF:$<BOOL:${ARROW_VENDORED}>,Iceberg::arrow_static,$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>>" | ||
"$<IF:$<BOOL:${ARROW_VENDORED}>,Iceberg::parquet_static,$<IF:$<TARGET_EXISTS:Parquet::parquet_shared>,Parquet::parquet_shared,Parquet::parquet_static>>" | ||
"$<IF:$<BOOL:${AVRO_VENDORED}>,Iceberg::avrocpp_s,$<IF:$<TARGET_EXISTS:avro-cpp::avrocpp_shared>,avro-cpp::avrocpp_shared,avro-cpp::avrocpp_static>>" | ||
"$<IF:$<TARGET_EXISTS:iceberg::iceberg_shared>,iceberg::iceberg_shared,iceberg::iceberg_static>" | ||
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::arrow_static,$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>>" | ||
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::parquet_static,$<IF:$<TARGET_EXISTS:Parquet::parquet_shared>,Parquet::parquet_shared,Parquet::parquet_static>>" | ||
"$<IF:$<BOOL:${AVRO_VENDORED}>,iceberg::avrocpp_s,$<IF:$<TARGET_EXISTS:avro-cpp::avrocpp_shared>,avro-cpp::avrocpp_shared,avro-cpp::avrocpp_static>>" | ||
) | ||
|
||
add_iceberg_lib(iceberg_bundle | ||
|
@@ -179,17 +178,16 @@ if(ICEBERG_BUILD_BUNDLE) | |
STATIC_INSTALL_INTERFACE_LIBS | ||
${ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS} | ||
SHARED_INSTALL_INTERFACE_LIBS | ||
${ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS}) | ||
${ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS} | ||
OUTPUTS | ||
ICEBERG_BUNDLE_LIBRARIES) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need same logic to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be handled by the |
||
|
||
add_subdirectory(arrow) | ||
add_subdirectory(avro) | ||
add_subdirectory(parquet) | ||
|
||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_bundle_export.h | ||
DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg) | ||
endif() | ||
|
||
iceberg_install_cmake_package(Iceberg iceberg_targets) | ||
iceberg_install_cmake_package(iceberg iceberg_targets) | ||
|
||
if(ICEBERG_BUILD_TESTS) | ||
add_subdirectory(test) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 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. | ||
|
||
install_headers(['in_memory_catalog.h'], subdir: 'iceberg/catalog/memory') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 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('memory') | ||
|
||
if get_option('rest').enabled() | ||
subdir('rest') | ||
endif |
Uh oh!
There was an error while loading. Please reload this page.