Skip to content

Commit da7f433

Browse files
committed
Add cpr dependency for rest catalog client
1 parent 44902fd commit da7f433

File tree

7 files changed

+121
-1
lines changed

7 files changed

+121
-1
lines changed

meson.build

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ project(
2121
version: '0.2.0',
2222
license: 'Apache-2.0',
2323
meson_version: '>=1.3.0',
24-
default_options: ['cpp_std=c++23,c++latest', 'warning_level=2'],
24+
default_options: [
25+
'cpp_std=c++23,c++latest',
26+
'warning_level=2',
27+
# Don't build any tests for curl
28+
'curl:tests=disabled',
29+
'curl:unittests=disabled',
30+
],
2531
)
2632

2733
subdir('src')

meson.options

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
option('rest', type: 'feature', description: 'Build rest catalog client', value: 'enabled')
1819
option('tests', type: 'feature', description: 'Build tests', value: 'enabled')

src/iceberg/catalog/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@
1616
# under the License.
1717

1818
install_headers(['in_memory_catalog.h'], subdir: 'iceberg/catalog')
19+
20+
if get_option('rest').enabled()
21+
subdir('rest')
22+
endif
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_REST_STATIC
24+
# define ICEBERG_REST_EXPORT
25+
# elif defined(ICEBERG_REST_EXPORTING)
26+
# define ICEBERG_REST_EXPORT __declspec(dllexport)
27+
# else
28+
# define ICEBERG_REST_EXPORT __declspec(dllimport)
29+
# endif
30+
#else // Not Windows
31+
# ifndef ICEBERG_REST_EXPORT
32+
# define ICEBERG_REST_EXPORT __attribute__((visibility("default")))
33+
# endif
34+
#endif
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
iceberg_rest_sources = files('rest_catalog.cc')
19+
# cpr does not export symbols, so on Windows it must
20+
# be used as a static lib
21+
cpr_needs_static = (
22+
get_option('default_library') == 'static' or
23+
host_machine.system() == 'windows'
24+
)
25+
cpr_dep = dependency('cpr', static: cpr_needs_static)
26+
27+
iceberg_rest_build_deps = [iceberg_dep, cpr_dep]
28+
iceberg_rest_lib = library(
29+
'iceberg_rest',
30+
sources: iceberg_rest_sources,
31+
dependencies: iceberg_rest_build_deps,
32+
gnu_symbol_visibility: 'hidden',
33+
cpp_shared_args: ['-DICEBERG_REST_EXPORTING'],
34+
cpp_static_args: ['-DICEBERG_REST_STATIC'],
35+
)
36+
37+
iceberg_rest_compile_args = []
38+
if get_option('default_library') == 'static'
39+
iceberg_rest_compile_args += ['-DICEBERG_REST_STATIC']
40+
endif
41+
iceberg_rest_dep = declare_dependency(
42+
link_with: [iceberg_rest_lib],
43+
dependencies: iceberg_rest_build_deps,
44+
compile_args: iceberg_rest_compile_args,
45+
)
46+
meson.override_dependency('iceberg-rest', iceberg_rest_dep)
47+
pkg.generate(iceberg_rest_lib)
48+
49+
install_headers(['rest_catalog.h'], subdir: 'iceberg/catalog/rest')

subprojects/cpr.wrap

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[wrap-file]
2+
directory = cpr-1.12.0
3+
source_url = https://github.com/libcpr/cpr/archive/1.12.0.tar.gz
4+
source_filename = cpr-1.12.0.tar.gz
5+
source_hash = f64b501de66e163d6a278fbb6a95f395ee873b7a66c905dd785eae107266a709
6+
patch_filename = cpr_1.12.0-1_patch.zip
7+
patch_url = https://wrapdb.mesonbuild.com/v2/cpr_1.12.0-1/get_patch
8+
patch_hash = 16404431dd8b2dbb49afc78a07b3bbe3c84c9f83ce1f45c3510934fadab99e72
9+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cpr_1.12.0-1/cpr-1.12.0.tar.gz
10+
wrapdb_version = 1.12.0-1
11+
12+
[provide]
13+
cpr = cpr_dep

subprojects/curl.wrap

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[wrap-file]
2+
directory = curl-8.10.1
3+
source_url = https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz
4+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/curl_8.10.1-1/curl-8.10.1.tar.xz
5+
source_filename = curl-8.10.1.tar.xz
6+
source_hash = 73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee
7+
patch_filename = curl_8.10.1-1_patch.zip
8+
patch_url = https://wrapdb.mesonbuild.com/v2/curl_8.10.1-1/get_patch
9+
patch_hash = 707c28f35fc9b0e8d68c0c2800712007612f922a31da9637ce706a2159f3ddd8
10+
wrapdb_version = 8.10.1-1
11+
12+
[provide]
13+
dependency_names = libcurl

0 commit comments

Comments
 (0)