Skip to content

Commit 9f90144

Browse files
enen92neheb
authored andcommitted
Set conditional HTTP depending on EXIV2_ENABLE_WEBREADY
1 parent 2a55877 commit 9f90144

File tree

7 files changed

+26
-5
lines changed

7 files changed

+26
-5
lines changed

include/exiv2/exiv2.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#include "exiv2/exif.hpp"
2020
#include "exiv2/futils.hpp"
2121
#include "exiv2/gifimage.hpp"
22+
#ifdef EXV_ENABLE_WEBREADY
2223
#include "exiv2/http.hpp"
24+
#endif
2325
#include "exiv2/image.hpp"
2426
#include "exiv2/iptc.hpp"
2527
#include "exiv2/jp2image.hpp"

include/meson.build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ headers = files(
1414
'exiv2/exiv2.hpp',
1515
'exiv2/futils.hpp',
1616
'exiv2/gifimage.hpp',
17-
'exiv2/http.hpp',
1817
'exiv2/image.hpp',
1918
'exiv2/image_types.hpp',
2019
'exiv2/iptc.hpp',
@@ -47,6 +46,10 @@ if get_option('video')
4746
headers += files('exiv2/asfvideo.hpp', 'exiv2/matroskavideo.hpp', 'exiv2/quicktimevideo.hpp', 'exiv2/riffvideo.hpp')
4847
endif
4948

49+
if get_option('webready')
50+
headers += files('exiv2/http.hpp')
51+
endif
52+
5053
if zlib_dep.found()
5154
headers += files('exiv2/pngimage.hpp')
5255
endif

meson.build

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ if brotli_dep.found()
6767
deps += brotli_dep
6868
endif
6969

70-
curl_dep = dependency('libcurl', disabler: true, required: get_option('curl'))
70+
if get_option('webready')
71+
curl_dep = dependency('libcurl', disabler: true, required: get_option('curl'))
72+
else
73+
curl_dep = dependency('', disabler: true, required: false)
74+
endif
75+
7176
if curl_dep.found()
7277
deps += curl_dep
7378
endif
@@ -113,9 +118,9 @@ cdata.set('EXV_HAVE_XMP_TOOLKIT', expat_dep.found())
113118
cdata.set('EXV_HAVE_BROTLI', brotli_dep.found())
114119
cdata.set('EXV_HAVE_ICONV', iconv_dep.found())
115120
cdata.set('EXV_HAVE_LIBZ', zlib_dep.found())
121+
cdata.set('EXV_ENABLE_WEBREADY', get_option('webready'))
116122
cdata.set('EXV_USE_CURL', curl_dep.found())
117123
cdata.set('EXV_ENABLE_NLS', intl_dep.found())
118-
cdata.set('EXV_ENABLE_WEBREADY', curl_dep.found())
119124

120125
cfile = configure_file(
121126
input: 'cmake/config.h.cmake',

meson_options.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ option('xmp', type : 'feature',
4444
option('unitTests', type : 'feature',
4545
description : 'Build and run unit tests',
4646
)
47+
48+
option('webready', type : 'boolean',
49+
value: true,
50+
description : 'Build with support for webready',
51+
)

src/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ set(PUBLIC_HEADERS
7272
../include/exiv2/exiv2.hpp
7373
../include/exiv2/futils.hpp
7474
../include/exiv2/gifimage.hpp
75-
../include/exiv2/http.hpp
7675
../include/exiv2/image.hpp
7776
../include/exiv2/image_types.hpp
7877
../include/exiv2/iptc.hpp
@@ -117,7 +116,6 @@ add_library(
117116
futils.cpp
118117
fff.h
119118
gifimage.cpp
120-
http.cpp
121119
image.cpp
122120
iptc.cpp
123121
jp2image.cpp
@@ -158,6 +156,10 @@ generate_export_header(
158156

159157
# Conditional addition of sources to library targets
160158
# ---------------------------------------------------------
159+
if(EXIV2_ENABLE_WEBREADY)
160+
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/http.hpp)
161+
target_sources(exiv2lib PRIVATE http.cpp ../include/exiv2/http.hpp)
162+
endif()
161163

162164
if(EXIV2_ENABLE_PNG)
163165
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/pngimage.hpp)

src/basicio.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@ void RemoteIo::populateFakeData() {
13641364
}
13651365
}
13661366

1367+
#ifdef EXV_ENABLE_WEBREADY
13671368
//! Internal Pimpl structure of class HttpIo.
13681369
class HttpIo::HttpImpl : public Impl {
13691370
public:
@@ -1503,6 +1504,7 @@ void HttpIo::HttpImpl::writeRemote(const byte* data, size_t size, size_t from, s
15031504
HttpIo::HttpIo(const std::string& url, size_t blockSize) {
15041505
p_ = std::make_unique<HttpImpl>(url, blockSize);
15051506
}
1507+
#endif
15061508

15071509
#ifdef EXV_USE_CURL
15081510
//! Internal Pimpl structure of class RemoteIo.

src/image.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,10 @@ BasicIo::UniquePtr ImageFactory::createIo(const std::string& path, [[maybe_unuse
813813
}
814814
#endif
815815

816+
#ifdef EXV_ENABLE_WEBREADY
816817
if (fProt == pHttp)
817818
return std::make_unique<HttpIo>(path); // may throw
819+
#endif
818820
if (fProt == pFileUri)
819821
return std::make_unique<FileIo>(pathOfFileUrl(path));
820822
if (fProt == pStdin || fProt == pDataUri)

0 commit comments

Comments
 (0)