Skip to content

Commit

Permalink
cmake: rename ZXING_HAS_... to ZXING_...
Browse files Browse the repository at this point in the history
This brings the cmake option in line with the #define in Version.h
  • Loading branch information
axxel committed Mar 15, 2024
1 parent 993f0c3 commit 1c51b11
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
2 changes: 0 additions & 2 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,6 @@ install (
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ZXing"
)

set(ZXING_HAS_READERS ${ZXING_READERS})
set(ZXING_HAS_WRITERS ${ZXING_WRITERS})
configure_file (Version.h.in Version.h)

install (
Expand Down
4 changes: 2 additions & 2 deletions core/Version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#pragma once

#cmakedefine ZXING_HAS_READERS
#cmakedefine ZXING_HAS_WRITERS
#cmakedefine ZXING_READERS
#cmakedefine ZXING_WRITERS

// Version numbering
#define ZXING_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
Expand Down
6 changes: 3 additions & 3 deletions core/src/ZXingC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static uint8_t* copy(const ByteArray& ba, int* len) noexcept
} \
ZX_CATCH({})

#ifdef ZXING_HAS_READERS
#ifdef ZXING_READERS
static std::tuple<Barcodes, bool> ReadBarcodesAndSetLastError(const ZXing_ImageView* iv, const ZXing_ReaderOptions* opts,
int maxSymbols)
{
Expand Down Expand Up @@ -250,7 +250,7 @@ ZXing_Barcode* ZXing_Barcodes_move(ZXing_Barcodes* barcodes, int i)
ZX_TRY(new Barcode(std::move((*barcodes)[i])));
}

#ifdef ZXING_HAS_READERS
#ifdef ZXING_READERS

/*
* ZXing/ReaderOptions.h
Expand Down Expand Up @@ -319,7 +319,7 @@ ZXing_Barcodes* ZXing_ReadBarcodes(const ZXing_ImageView* iv, const ZXing_Reader

#endif

#ifdef ZXING_HAS_WRITERS
#ifdef ZXING_WRITERS
#ifdef ZXING_EXPERIMENTAL_API
/*
* ZXing/WriteBarcode.h
Expand Down
18 changes: 9 additions & 9 deletions core/src/ZXingC.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#if __has_include("Version.h")
#include "Version.h"
#else
#define ZXING_HAS_READERS
#define ZXING_READERS
#endif

#ifdef __cplusplus
Expand All @@ -26,14 +26,14 @@ typedef ZXing::Barcodes ZXing_Barcodes;
typedef ZXing::ImageView ZXing_ImageView;
typedef ZXing::Image ZXing_Image;

#ifdef ZXING_HAS_READERS
#ifdef ZXING_READERS
#include "ReaderOptions.h"

typedef ZXing::ReaderOptions ZXing_ReaderOptions;
#endif

#ifdef ZXING_EXPERIMENTAL_API
#ifdef ZXING_HAS_WRITERS
#ifdef ZXING_WRITERS
#include "WriteBarcode.h"
typedef ZXing::CreatorOptions ZXing_CreatorOptions;
typedef ZXing::WriterOptions ZXing_WriterOptions;
Expand All @@ -52,11 +52,11 @@ typedef struct ZXing_Barcodes ZXing_Barcodes;
typedef struct ZXing_ImageView ZXing_ImageView;
typedef struct ZXing_Image ZXing_Image;

#ifdef ZXING_HAS_READERS
#ifdef ZXING_READERS
typedef struct ZXing_ReaderOptions ZXing_ReaderOptions;
#endif

#ifdef ZXING_HAS_WRITERS
#ifdef ZXING_WRITERS
typedef struct ZXing_CreatorOptions ZXing_CreatorOptions;
typedef struct ZXing_WriterOptions ZXing_WriterOptions;
#endif
Expand Down Expand Up @@ -201,7 +201,7 @@ const ZXing_Barcode* ZXing_Barcodes_at(const ZXing_Barcodes* barcodes, int i);
ZXing_Barcode* ZXing_Barcodes_move(ZXing_Barcodes* barcodes, int i);


#ifdef ZXING_HAS_READERS
#ifdef ZXING_READERS

/*
* ZXing/ReaderOptions.h
Expand Down Expand Up @@ -268,9 +268,9 @@ int ZXing_ReaderOptions_getMaxNumberOfSymbols(const ZXing_ReaderOptions* opts);
ZXing_Barcode* ZXing_ReadBarcode(const ZXing_ImageView* iv, const ZXing_ReaderOptions* opts);
ZXing_Barcodes* ZXing_ReadBarcodes(const ZXing_ImageView* iv, const ZXing_ReaderOptions* opts);

#endif /* ZXING_HAS_READERS */
#endif /* ZXING_READERS */

#ifdef ZXING_HAS_WRITERS
#ifdef ZXING_WRITERS
#ifdef ZXING_EXPERIMENTAL_API

/*
Expand Down Expand Up @@ -319,7 +319,7 @@ ZXing_Barcode* ZXing_CreateBarcodeFromBytes(const void* data, int size, const ZX
char* ZXing_WriteBarcodeToSVG(const ZXing_Barcode* barcode, const ZXing_WriterOptions* opts);
ZXing_Image* ZXing_WriteBarcodeToImage(const ZXing_Barcode* barcode, const ZXing_WriterOptions* opts);

#endif /* ZXING_HAS_WRITERS */
#endif /* ZXING_WRITERS */
#endif /* ZXING_EXPERIMENTAL_API */

/* ZXing_LastErrorMsg() returns NULL in case there is no last error and a copy of the string otherwise. */
Expand Down
2 changes: 1 addition & 1 deletion wrappers/c/ZXingCTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int main(int argc, char** argv)
CHECK(iv)
} else {
fprintf(stderr, "Could not read image '%s'\n", filename);
#if defined(ZXING_EXPERIMENTAL_API) && defined(ZXING_HAS_WRITERS)
#if defined(ZXING_EXPERIMENTAL_API) && defined(ZXING_WRITERS)
if (formats == ZXing_BarcodeFormat_Invalid)
return 2;
fprintf(stderr, "Using '%s' as text input to create barcode\n", filename);
Expand Down

0 comments on commit 1c51b11

Please sign in to comment.