Skip to content

Commit aa88bc4

Browse files
enen92neheb
authored andcommitted
Add EXIV2_ENABLE_FILESYSTEM_ACCESS option
1 parent 9f90144 commit aa88bc4

17 files changed

+86
-24
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ option(EXIV2_ENABLE_BMFF "Build with BMFF support" ON)
4646
option(EXIV2_ENABLE_BROTLI "Use Brotli for JPEG XL compressed boxes (BMFF)" ON)
4747
option(EXIV2_ENABLE_VIDEO "Build with video support" ON)
4848
option(EXIV2_ENABLE_INIH "Use inih library" ON)
49+
option(EXIV2_ENABLE_FILESYSTEM_ACCESS "Build with filesystem access" ON)
4950

5051
option(EXIV2_BUILD_SAMPLES "Build sample applications" OFF)
5152
option(EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON)
@@ -100,18 +101,22 @@ include(cmake/compilerFlagsExiv2.cmake REQUIRED)
100101
add_subdirectory(src)
101102

102103
if(BUILD_TESTING AND EXIV2_BUILD_UNIT_TESTS)
104+
set(EXIV2_ENABLE_FILESYSTEM_ACCESS ON)
103105
add_subdirectory(unitTests)
104106
endif()
105107

106108
if(EXIV2_BUILD_FUZZ_TESTS)
109+
set(EXIV2_ENABLE_FILESYSTEM_ACCESS ON)
107110
add_subdirectory(fuzz)
108111
endif()
109112

110113
if(EXIV2_BUILD_EXIV2_COMMAND)
111114
add_subdirectory(app)
115+
set(EXIV2_ENABLE_FILESYSTEM_ACCESS ON)
112116

113117
if(EXIV2_BUILD_SAMPLES)
114118
add_subdirectory(samples)
119+
set(EXIV2_ENABLE_FILESYSTEM_ACCESS ON)
115120
get_directory_property(SAMPLES DIRECTORY samples DEFINITION APPLICATIONS)
116121

117122
if(BUILD_TESTING AND Python3_Interpreter_FOUND)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ option( EXIV2_ENABLE_PNG "Build with png support (requires libz)"
252252
...
253253
option( EXIV2_ENABLE_BMFF "Build with BMFF support (brotli recommended)" ON )
254254
option( EXIV2_ENABLE_BROTLI "Use Brotli for JPEG XL compressed boxes (BMFF)" ON )
255+
option( EXIV2_ENABLE_FILESYSTEM_ACCESS "Build with filesystem access" ON )
255256
577 rmills@rmillsmm:~/gnu/github/exiv2/exiv2 $
256257
```
257258

cmake/config.h.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
// Define to 1 if you want to use libcurl in httpIO.
77
#cmakedefine EXV_USE_CURL
88

9+
// Define to 1 if you want to enable filesystem access
10+
#cmakedefine EXV_ENABLE_FILESYSTEM
11+
912
// Define if you require webready support.
1013
#cmakedefine EXV_ENABLE_WEBREADY
1114

cmake/findDependencies.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ if(BUILD_TESTING)
3737
endif()
3838
endif()
3939

40-
find_package(Filesystem COMPONENTS Experimental Final REQUIRED)
40+
if(EXIV2_ENABLE_FILESYSTEM_ACCESS)
41+
find_package(Filesystem COMPONENTS Experimental Final REQUIRED)
42+
endif()
4143

4244
# don't use Frameworks on the Mac (#966)
4345
if (APPLE)

cmake/generateConfigFile.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ include(CheckCXXSymbolExists)
66
if (${EXIV2_ENABLE_WEBREADY})
77
set(EXV_USE_CURL ${EXIV2_ENABLE_CURL})
88
endif()
9-
set(EXV_ENABLE_BMFF ${EXIV2_ENABLE_BMFF})
10-
set(EXV_ENABLE_WEBREADY ${EXIV2_ENABLE_WEBREADY})
11-
set(EXV_HAVE_LENSDATA ${EXIV2_ENABLE_LENSDATA})
12-
set(EXV_ENABLE_INIH ${EXIV2_ENABLE_INIH})
9+
set(EXV_ENABLE_BMFF ${EXIV2_ENABLE_BMFF})
10+
set(EXV_ENABLE_WEBREADY ${EXIV2_ENABLE_WEBREADY})
11+
set(EXV_HAVE_LENSDATA ${EXIV2_ENABLE_LENSDATA})
12+
set(EXV_ENABLE_INIH ${EXIV2_ENABLE_INIH})
13+
set(EXV_ENABLE_FILESYSTEM ${EXIV2_ENABLE_FILESYSTEM_ACCESS})
1314

1415
set(EXV_PACKAGE_NAME ${PROJECT_NAME})
1516
set(EXV_PACKAGE_VERSION ${PROJECT_VERSION})

cmake/printSummary.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ OptionOutput( "Building unit tests: " EXIV2_BUILD_UNIT_TESTS AND
6969
OptionOutput( "Building fuzz tests: " EXIV2_BUILD_FUZZ_TESTS )
7070
OptionOutput( "Building doc: " EXIV2_BUILD_DOC )
7171
OptionOutput( "Building with coverage flags: " BUILD_WITH_COVERAGE )
72+
OptionOutput( "Building with filesystem access " EXIV2_ENABLE_FILESYSTEM_ACCESS )
7273
OptionOutput( "Using ccache: " BUILD_WITH_CCACHE )

include/exiv2/basicio.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ class EXIV2API IoCloser {
276276
IoCloser& operator=(const IoCloser&) = delete;
277277
}; // class IoCloser
278278

279+
#ifdef EXV_ENABLE_FILESYSTEM
279280
/*!
280281
@brief Provides binary file IO by implementing the BasicIo
281282
interface.
@@ -479,6 +480,7 @@ class EXIV2API FileIo : public BasicIo {
479480
std::unique_ptr<Impl> p_;
480481

481482
}; // class FileIo
483+
#endif
482484

483485
/*!
484486
@brief Provides binary IO on blocks of memory by implementing the BasicIo
@@ -686,7 +688,7 @@ class EXIV2API XPathIo : public MemIo {
686688
*/
687689
void ReadDataUri(const std::string& path);
688690
}; // class XPathIo
689-
#else
691+
#elif defined(EXV_ENABLE_FILESYSTEM)
690692
class EXIV2API XPathIo : public FileIo {
691693
public:
692694
/*!

include/exiv2/exif.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ class EXIV2API ExifThumbC {
229229
data buffer and %DataBuf ensures that it will be deleted.
230230
*/
231231
[[nodiscard]] DataBuf copy() const;
232+
#ifdef EXV_ENABLE_FILESYSTEM
232233
/*!
233234
@brief Write the thumbnail image to a file.
234235
@@ -240,6 +241,7 @@ class EXIV2API ExifThumbC {
240241
@return The number of bytes written.
241242
*/
242243
[[nodiscard]] size_t writeFile(const std::string& path) const;
244+
#endif
243245
/*!
244246
@brief Return the MIME type of the thumbnail, either \c "image/tiff"
245247
or \c "image/jpeg".
@@ -279,6 +281,7 @@ class EXIV2API ExifThumb : public ExifThumbC {
279281

280282
//! @name Manipulators
281283
//@{
284+
#ifdef EXV_ENABLE_FILESYSTEM
282285
/*!
283286
@brief Set the Exif thumbnail to the JPEG image \em path. Set
284287
XResolution, YResolution and ResolutionUnit to \em xres,
@@ -297,6 +300,7 @@ class EXIV2API ExifThumb : public ExifThumbC {
297300
application that comes with OS X for one.) - David Harvey.
298301
*/
299302
void setJpegThumbnail(const std::string& path, URational xres, URational yres, uint16_t unit);
303+
#endif
300304
/*!
301305
@brief Set the Exif thumbnail to the JPEG image pointed to by \em buf,
302306
and size \em size. Set XResolution, YResolution and
@@ -315,6 +319,7 @@ class EXIV2API ExifThumb : public ExifThumbC {
315319
application that comes with OS X for one.) - David Harvey.
316320
*/
317321
void setJpegThumbnail(const byte* buf, size_t size, URational xres, URational yres, uint16_t unit);
322+
#ifdef EXV_ENABLE_FILESYSTEM
318323
/*!
319324
@brief Set the Exif thumbnail to the JPEG image \em path.
320325
@@ -329,6 +334,7 @@ class EXIV2API ExifThumb : public ExifThumbC {
329334
@note Additional existing Exif thumbnail tags are not modified.
330335
*/
331336
void setJpegThumbnail(const std::string& path);
337+
#endif
332338
/*!
333339
@brief Set the Exif thumbnail to the JPEG image pointed to by \em buf,
334340
and size \em size.

include/exiv2/preview.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class EXIV2API PreviewImage {
6868
@brief Return the size of the preview image in bytes.
6969
*/
7070
[[nodiscard]] uint32_t size() const;
71+
#ifdef EXV_ENABLE_FILESYSTEM
7172
/*!
7273
@brief Write the thumbnail image to a file.
7374
@@ -79,6 +80,7 @@ class EXIV2API PreviewImage {
7980
@return The number of bytes written.
8081
*/
8182
[[nodiscard]] size_t writeFile(const std::string& path) const;
83+
#endif
8284
/*!
8385
@brief Return the MIME type of the preview image, usually either
8486
\c "image/tiff" or \c "image/jpeg".

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ cdata.set('EXV_HAVE_LIBZ', zlib_dep.found())
121121
cdata.set('EXV_ENABLE_WEBREADY', get_option('webready'))
122122
cdata.set('EXV_USE_CURL', curl_dep.found())
123123
cdata.set('EXV_ENABLE_NLS', intl_dep.found())
124+
cdata.set('EXV_ENABLE_FILESYSTEM', true)
124125

125126
cfile = configure_file(
126127
input: 'cmake/config.h.cmake',

0 commit comments

Comments
 (0)