Skip to content

Commit

Permalink
Complete configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Feb 11, 2025
1 parent cbed8e3 commit f80bf10
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 13 deletions.
10 changes: 10 additions & 0 deletions cpp/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,14 @@ cpp_compiler = meson.get_compiler('cpp')
cpp_args = cpp_compiler.get_supported_arguments(project_args)
add_project_arguments(cpp_args, language: 'cpp')

git_id = get_option('git_id')
if git_id == ''
git_id = run_command('git', 'log', '-n1', '--format=%H').stdout().strip()
endif

git_description = get_option('git_description')
if git_description == ''
git_description = run_command('git', 'describe', '--tags').stdout().strip()
endif

subdir('src/arrow')
32 changes: 32 additions & 0 deletions cpp/meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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.

option(
'git_id',
type: 'string',
)

option(
'git_description',
type: 'string',
)

option(
'package_kind',
type: 'string',
description: 'Arbitrary string that identifies the kind of package (for informational purposes)',
)
74 changes: 61 additions & 13 deletions cpp/src/arrow/util/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -35,41 +35,89 @@ conf_data.set('ARROW_VERSION_MAJOR', ver_major)
conf_data.set('ARROW_VERSION_MINOR', ver_minor)
conf_data.set('ARROW_VERSION_PATCH', ver_patch)

conf_data.set('ARROW_VERSION_STRING', version)
# TODO: While the CMake configuration substitutes the @ARROW_VERSION@
# macro directly in the configuration file, the Meson wrapper to the
# CMake configuration file seems to still want to include that
# variable as part of the configuration data
arrow_version = ver_major.to_int() * 1000 + ver_minor.to_int() * 1000 + ver_patch.to_int()
conf_data.set('ARROW_VERSION', arrow_version)
conf_data.set('ARROW_VERSION_STRING', arrow_version)

# conf_data.set('ARROW_SO_VERSION', ...)
# conf_data.set('ARROW_FULL_SO_VERSION', ...)
arrow_so_version = ver_major.to_int() * 100 + ver_minor.to_int()
conf_data.set('ARROW_SO_VERSION', arrow_so_version)
arrow_full_so_version = '@0@.@1@.@2@'.format(arrow_so_version, ver_patch, 0)
conf_data.set('ARROW_FULL_SO_VERSION', arrow_full_so_version)

# conf_data.set('ARROW_CXX_COMPILER_ID', ...)
# conf_data.set('ARROW_CXX_COMPILER_VERSION', ...)
# conf_data.set('ARROW_CXX_COMPILER_FLAGS', ...)
# TODO: we may want to give Meson its own configuration file rather
# than backfitting onto CMake's
conf_data.set('CMAKE_CXX_COMPILER_ID', cpp_compiler.get_id())
conf_data.set('CMAKE_CXX_COMPILER_VERSION', cpp_compiler.version())
conf_data.set(
'CMAKE_CXX_FLAGS',
' '.join(cpp_compiler.get_supported_arguments()),
)

conf_data.set('UPPERCASE_BUILD_TYPE', get_option('buildtype').to_upper())

# conf_data.set('ARROW_PACKAGE_KIND', ...)
conf_data.set('ARROW_PACKAGE_KIND', get_option('package_kind'))

foreach cmakedefine : [
'ARROW_COMPUTE',
'ARROW_CSV',
'ARROW_CUDA',
'ARROW_DATASET',
'ARROW_FILESYSTEM',
'ARROW_FLIGHT',
'ARROW_FLIGHT_SQL',
'ARROW_IPC',
'ARROW_JEMALLOC',
'ARROW_JEMALLOC_VENDORED',
'ARROW_JSON',
'ARROW_MIMALLOC',
'ARROW_ORC',
'ARROW_PARQUET',
'ARROW_SUBSTRAIT',
'ARROW_AZURE',
'ARROW_ENABLE_THREADING',
'ARROW_GCS',
'ARROW_HDFS',
'ARROW_S3',
'ARROW_USE_GLOG',
'ARROW_USE_NATIVE_INT128',
'ARROW_WITH_BROTLI',
'ARROW_WITH_BZ2',
'ARROW_WITH_LZ4',
'ARROW_WITH_MUSL',
'ARROW_WITH_OPENTELEMETRY',
'ARROW_WITH_RE2',
'ARROW_WITH_SNAPPY',
'ARROW_WITH_UCX',
'ARROW_WITH_UTF8PROC',
'ARROW_WITH_ZLIB',
'ARROW_WITH_ZSTD',
'PARQUET_REQUIRE_ENCRYPTION',
]
conf_data.set(cmakedefine, false)
endforeach

configure_file(
input: 'config.h.cmake',
output: 'config.h',
configuration: conf_data,
# https://mesonbuild.com/Reference-manual_functions.html#arguments13
# TODO: need to bridge #cmakedefines somehow
format: 'cmake@',
install: true,
install_dir: '.',
)

internal_conf_data = configuration_data()

# internal_conf_data.set('ARROW_GIT_ID', ...)
# internal_conf_data.set('ARROW_GIT_DESCRIPTION', ...)
internal_conf_data.set('ARROW_GIT_ID', git_id)
internal_conf_data.set('ARROW_GIT_DESCRIPTION', git_description)

configure_file(
input: 'config_internal.h.cmake',
output: 'config_internal.h',
configuration: internal_conf_data,
# https://mesonbuild.com/Reference-manual_functions.html#arguments13
# TODO: need to bridge #cmakedefines somehow
format: 'cmake@',
install: true,
install_dir: '.',
Expand Down

0 comments on commit f80bf10

Please sign in to comment.