Skip to content

Commit

Permalink
GeoRaster: fix build on Windows where libjpeg's boolean typedef confl…
Browse files Browse the repository at this point in the history
…icts with OCI one
  • Loading branch information
rouault committed Dec 8, 2023
1 parent 363fb81 commit 849226c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions frmts/georaster/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ endif ()
if (GDAL_ENABLE_DRIVER_JPEG AND GDAL_USE_JPEG_INTERNAL)
gdal_add_vendored_lib(gdal_GEOR libjpeg)
target_compile_definitions(gdal_GEOR PRIVATE -DJPEG_SUPPORTED)
target_sources(gdal_GEOR PRIVATE georaster_jpeg_vsidataio.cpp)
# Need a separate compilation unit given that libjpeg's boolean typedef would conflict with OCI one
set_property(SOURCE georaster_jpeg_vsidataio.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
endif ()

# Include libjpeg first so that if we want to use jpeg-turbo on homebrew
Expand Down
3 changes: 3 additions & 0 deletions frmts/georaster/georaster_jpeg_vsidataio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "georaster_jpeg_vsidataio.h"

#include "../jpeg/vsidataio.cpp"
8 changes: 8 additions & 0 deletions frmts/georaster/georaster_jpeg_vsidataio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef GEORASTER_JPEG_VSIDATAIO_H_INCLUDED
#define GEORASTER_JPEG_VSIDATAIO_H_INCLUDED

#define jpeg_vsiio_src GEOR_jpeg_vsiio_src
#define jpeg_vsiio_dest GEOR_jpeg_vsiio_dest
#include "../jpeg/vsidataio.h"

#endif /* GEORASTER_JPEG_VSIDATAIO_H_INCLUDED */
9 changes: 4 additions & 5 deletions frmts/georaster/georaster_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#include "cpl_string.h"
#include "cpl_minixml.h"

#ifdef JPEG_SUPPORTED
#include "georaster_jpeg_vsidataio.h"
#endif

// ---------------------------------------------------------------------------
// GeoRasterWrapper()
// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -3936,11 +3940,6 @@ void GeoRasterWrapper::PackNBits(GByte *pabyData) const

#ifdef JPEG_SUPPORTED

#define jpeg_vsiio_src GEOR_jpeg_vsiio_src
#define jpeg_vsiio_dest GEOR_jpeg_vsiio_dest
#include "../jpeg/vsidataio.h"
#include "../jpeg/vsidataio.cpp"

// ---------------------------------------------------------------------------
// UncompressJpeg()
// ---------------------------------------------------------------------------
Expand Down

0 comments on commit 849226c

Please sign in to comment.