Skip to content

Commit c4e3e62

Browse files
authored
Clarify optional libraries and allow optionally disabling them (openstreetmap#453)
`libcurl` & `libcairo` are also optional and their usage can now be optionally disabled (along with `libmemcached` & `librados`.) * No longer test macOS Autotools building
1 parent 52e7a10 commit c4e3e62

File tree

4 files changed

+57
-14
lines changed

4 files changed

+57
-14
lines changed

.github/workflows/build-and-test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ jobs:
171171
on_default_branch:
172172
- ${{ contains(github.ref, 'master') || contains(github.ref, 'develop') || contains(github.ref, 'CI') }}
173173
include:
174-
- os: macos-14
175-
build_system: Autotools
176-
compiler: LLVM
177174
- os: macos-14
178175
build_system: CMake
179176
compiler: LLVM

CMakeLists.txt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ set(CMAKE_CXX_STANDARD 11 CACHE STRING "Sets the C++ standard.")
2525
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2626
set(THREADS_PREFER_PTHREAD_FLAG ON)
2727

28+
set(CMAKE_INSTALL_MODULESDIR CACHE PATH "Apache HTTP Server module installation directory")
2829
set(ENABLE_MAN ON CACHE BOOL "Build man pages")
2930
set(ENABLE_TESTS OFF CACHE BOOL "Build test suite")
30-
set(CMAKE_INSTALL_MODULESDIR CACHE PATH "Apache HTTP Server module installation directory")
31+
set(USE_CAIRO ON CACHE BOOL "Add cairo support if available (for `store_ro_composite.c` backend)")
32+
set(USE_CURL ON CACHE BOOL "Add curl support if available (for `store_ro_http_proxy.c` backend)")
33+
set(USE_MEMCACHED ON CACHE BOOL "Add memcached support if available (for `store_memcached.c` backend)")
34+
set(USE_RADOS ON CACHE BOOL "Add rados support if available (for `store_rados.c` backend)")
3135

3236
#-----------------------------------------------------------------------------
3337
#
@@ -38,23 +42,32 @@ set(CMAKE_INSTALL_MODULESDIR CACHE PATH "Apache HTTP Server module installation
3842
include(GNUInstallDirs)
3943

4044
# Packages
41-
find_package(CURL)
4245
find_package(ICU REQUIRED uc)
4346
find_package(Threads REQUIRED)
4447

4548
find_package(APR REQUIRED)
46-
find_package(CAIRO REQUIRED)
4749
find_package(GLIB 2.50 REQUIRED)
4850
find_package(HTTPD 2.4 REQUIRED)
4951
find_package(INIPARSER REQUIRED)
5052
find_package(LIBMAPNIK 3 REQUIRED)
51-
find_package(LIBMEMCACHED)
52-
find_package(LIBRADOS)
5353

5454
if(LIBMAPNIK_VERSION VERSION_GREATER_EQUAL 4)
5555
set(CMAKE_CXX_STANDARD 17)
5656
endif()
5757

58+
if(USE_CURL)
59+
find_package(CURL)
60+
endif()
61+
if(USE_CAIRO)
62+
find_package(CAIRO)
63+
endif()
64+
if(USE_MEMCACHED)
65+
find_package(LIBMEMCACHED)
66+
endif()
67+
if(USE_RADOS)
68+
find_package(LIBRADOS)
69+
endif()
70+
5871
# Programs
5972
find_program(APXS_EXECUTABLE apxs REQUIRED)
6073

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ Dependencies
2222
------------
2323

2424
* `Supported Operating Systems`
25-
* `GNU/Linux` (works best on Debian or Ubuntu)
2625
* `FreeBSD`
26+
* `GNU/Linux`
2727
* `macOS`
2828
* `Supported Build Systems`
29-
* `GNU Autotools <https://www.gnu.org/software/software.html>`__
3029
* `CMake <https://cmake.org/>`__
30+
* `GNU Autotools <https://www.gnu.org/software/software.html>`__
3131
* `Runtime/Build Dependencies`
3232
* `Apache 2 HTTP webserver <https://httpd.apache.org/>`__
33-
* `Mapnik <https://mapnik.org/>`__
34-
* `Cairo 2D graphics library <https://cairographics.org/>`__
35-
* `Curl library (SSL variant) <https://curl.haxx.se/>`__
36-
* `Iniparser library <https://github.com/ndevilla/iniparser>`__
33+
* `Cairo 2D graphics library (optional) <https://cairographics.org/>`__
34+
* `Curl library (optional) <https://curl.haxx.se/>`__
3735
* `GLib library <https://gitlab.gnome.org/GNOME/glib>`__
36+
* `Iniparser library <https://github.com/ndevilla/iniparser>`__
37+
* `Mapnik library <https://mapnik.org/>`__
3838
* `Memcached library (optional) <https://libmemcached.org/>`__
3939
* `RADOS library (optional) <https://docs.ceph.com/en/latest/rados/api/librados/>`__
4040

tests/gen_tile_test.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,8 +1206,31 @@ TEST_CASE("rados storage-backend", "RADOS Tile storage backend")
12061206
}
12071207
}
12081208

1209+
TEST_CASE("ro_composite storage-backend", "RO Composite Tile storage backend")
1210+
{
1211+
int found;
1212+
std::string err_log_lines, out_log_lines;
1213+
struct storage_backend *store = NULL;
1214+
1215+
#ifndef HAVE_CAIRO
1216+
SECTION("storage/initialise", "should return NULL") {
1217+
start_capture();
1218+
REQUIRE(init_storage_backend("composite:{") == NULL);
1219+
std::tie(err_log_lines, out_log_lines) = end_capture();
1220+
1221+
found = err_log_lines.find("init_storage_ro_coposite: Support for compositing storage has not been compiled into this program");
1222+
REQUIRE(found > -1);
1223+
}
1224+
#endif
1225+
}
1226+
12091227
TEST_CASE("ro_http_proxy storage-backend", "RO HTTP Proxy Tile storage backend")
12101228
{
1229+
int found;
1230+
std::string err_log_lines, out_log_lines;
1231+
struct storage_backend *store = NULL;
1232+
1233+
#ifdef HAVE_LIBCURL
12111234
SECTION("storage/initialise", "should return 1") {
12121235
struct storage_backend *store = NULL;
12131236

@@ -1216,6 +1239,16 @@ TEST_CASE("ro_http_proxy storage-backend", "RO HTTP Proxy Tile storage backend")
12161239

12171240
store->close_storage(store);
12181241
}
1242+
#else
1243+
SECTION("storage/initialise", "should return NULL") {
1244+
start_capture();
1245+
REQUIRE(init_storage_backend("ro_http_proxy://") == NULL);
1246+
std::tie(err_log_lines, out_log_lines) = end_capture();
1247+
1248+
found = err_log_lines.find("init_storage_ro_http_proxy: Support for curl and therefore the http proxy storage has not been compiled into this program");
1249+
REQUIRE(found > -1);
1250+
}
1251+
#endif
12191252
}
12201253

12211254
TEST_CASE("projections", "Test projections")

0 commit comments

Comments
 (0)