mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-18 17:25:09 -04:00
- cmake: remove zintconfig.h.in for now as incompatible with MSVC
project builds (will add back in future if go fully CMake) - NO_PNG -> ZINT_NO_PNG and new API function `Zint_NoPng()` to determine if no PNG support in libzint; replace use in GUI with backend_qt method `noPng()`
This commit is contained in:
parent
536a581d9e
commit
6393813cff
31 changed files with 138 additions and 156 deletions
|
@ -4,8 +4,6 @@
|
|||
|
||||
project(zint)
|
||||
|
||||
configure_file(zintconfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/zintconfig.h)
|
||||
|
||||
set(zint_COMMON_SRCS common.c library.c large.c reedsol.c gs1.c eci.c general_field.c)
|
||||
set(zint_ONEDIM_SRCS bc412.c code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c)
|
||||
set(zint_POSTAL_SRCS postal.c auspost.c imail.c mailmark.c)
|
||||
|
@ -69,7 +67,7 @@ endif()
|
|||
if(ZINT_USE_PNG AND PNG_FOUND)
|
||||
zint_target_link_libraries(PNG::PNG)
|
||||
else()
|
||||
zint_target_compile_definitions(PUBLIC NO_PNG)
|
||||
zint_target_compile_definitions(PRIVATE ZINT_NO_PNG)
|
||||
endif()
|
||||
|
||||
if(ZINT_TEST)
|
||||
|
|
|
@ -34,8 +34,8 @@ LIB_OBJ:= $(COMMON_OBJ) $(ONEDIM_OBJ) $(TWODIM_OBJ) $(POSTAL_OBJ) $(OUTPUT_OBJ)
|
|||
DLL_OBJ:= $(LIB_OBJ:.o=.lo) dllversion.lo
|
||||
|
||||
|
||||
ifeq ($(NO_PNG),true)
|
||||
DEFINES+= -DNO_PNG
|
||||
ifeq ($(ZINT_NO_PNG),true)
|
||||
DEFINES+= -DZINT_NO_PNG
|
||||
else
|
||||
DEFINES_DLL+= -DPNG_DLL -DZLIB_DLL
|
||||
LIBS+= -lpng -lz
|
||||
|
|
|
@ -61,7 +61,7 @@ struct zint_symbol *ZBarcode_Create(void) {
|
|||
symbol->fgcolor = &symbol->fgcolour[0];
|
||||
strcpy(symbol->bgcolour, "ffffff");
|
||||
symbol->bgcolor = &symbol->bgcolour[0];
|
||||
#ifdef NO_PNG
|
||||
#ifdef ZINT_NO_PNG
|
||||
strcpy(symbol->outfile, "out.gif");
|
||||
#else
|
||||
strcpy(symbol->outfile, "out.png");
|
||||
|
@ -1856,6 +1856,15 @@ unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Whether Zint built without PNG support */
|
||||
int ZBarcode_NoPng(void) {
|
||||
#ifdef ZINT_NO_PNG
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return the version of Zint linked to */
|
||||
int ZBarcode_Version(void) {
|
||||
if (ZINT_VERSION_BUILD) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#ifndef NO_PNG
|
||||
#ifndef ZINT_NO_PNG
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
@ -348,4 +348,4 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
|
|||
/* https://stackoverflow.com/a/26541331 Suppresses gcc warning ISO C forbids an empty translation unit */
|
||||
typedef int make_iso_compilers_happy;
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif /* NO_PNG */
|
||||
#endif /* ZINT_NO_PNG */
|
||||
|
|
|
@ -49,9 +49,9 @@
|
|||
|
||||
#define UPCEAN_TEXT 1
|
||||
|
||||
#ifndef NO_PNG
|
||||
#ifndef ZINT_NO_PNG
|
||||
INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
|
||||
#endif /* NO_PNG */
|
||||
#endif /* ZINT_NO_PNG */
|
||||
INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
|
||||
INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
|
||||
INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
|
||||
|
@ -233,7 +233,7 @@ static int save_raster_image_to_file(struct zint_symbol *symbol, const int image
|
|||
}
|
||||
break;
|
||||
case OUT_PNG_FILE:
|
||||
#ifndef NO_PNG
|
||||
#ifndef ZINT_NO_PNG
|
||||
error_number = png_pixel_plot(symbol, rotated_pixbuf);
|
||||
#else
|
||||
if (rotate_angle) {
|
||||
|
@ -1335,12 +1335,12 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
|
|||
INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) {
|
||||
int error;
|
||||
|
||||
#ifdef NO_PNG
|
||||
#ifdef ZINT_NO_PNG
|
||||
if (file_type == OUT_PNG_FILE) {
|
||||
strcpy(symbol->errtxt, "660: PNG format disabled at compile time");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
#endif /* NO_PNG */
|
||||
#endif /* ZINT_NO_PNG */
|
||||
|
||||
error = out_check_colour_options(symbol);
|
||||
if (error != 0) {
|
||||
|
|
|
@ -25,12 +25,18 @@ if(ZINT_SHARED)
|
|||
add_library(testcommon ${testcommon_SRCS})
|
||||
target_link_libraries(testcommon zint)
|
||||
target_include_directories(testcommon PUBLIC ${zint_backend_tests_SOURCE_DIR})
|
||||
if(NOT (ZINT_USE_PNG AND PNG_FOUND))
|
||||
target_compile_definitions(testcommon PRIVATE ZINT_NO_PNG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ZINT_STATIC)
|
||||
add_library(testcommon-static ${testcommon_SRCS})
|
||||
target_link_libraries(testcommon-static zint-static)
|
||||
target_include_directories(testcommon-static PUBLIC ${zint_backend_tests_SOURCE_DIR})
|
||||
if(NOT (ZINT_USE_PNG AND PNG_FOUND))
|
||||
target_compile_definitions(testcommon-static PRIVATE ZINT_NO_PNG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
zint_add_test(2of5 test_2of5)
|
||||
|
|
|
@ -102,9 +102,9 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
}
|
||||
|
||||
for (j = 0; j < exts_size; j++) {
|
||||
#ifdef NO_PNG
|
||||
if (strcmp(exts[j], "png") == 0) continue;
|
||||
#endif
|
||||
|
||||
if (ZBarcode_NoPng() && strcmp(exts[j], "png") == 0) continue;
|
||||
|
||||
assert_nonzero(sizeof(data_subdir) > strlen(data_dir) + 1 + strlen(exts[j]),
|
||||
"sizeof(data_subdir) (%d) <= strlen(data_dir) (%d) + 1 + strlen(%s) (%d)\n",
|
||||
(int) sizeof(data_subdir), (int) strlen(data_dir), exts[j], (int) strlen(exts[j]));
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <windows.h>
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#ifndef NO_PNG
|
||||
#ifndef ZINT_NO_PNG
|
||||
#include <png.h>
|
||||
#include <zlib.h>
|
||||
#include <setjmp.h>
|
||||
|
@ -1363,7 +1363,7 @@ int testUtilRename(const char *oldpath, const char *newpath) {
|
|||
/* Compare 2 PNG files */
|
||||
int testUtilCmpPngs(const char *png1, const char *png2) {
|
||||
int ret = -1;
|
||||
#ifdef NO_PNG
|
||||
#ifdef ZINT_NO_PNG
|
||||
(void)png1; (void)png2;
|
||||
#else
|
||||
FILE *fp1;
|
||||
|
|
|
@ -102,7 +102,7 @@ extern "C" {
|
|||
char bgcolour[10]; /* Background as RGB/RGBA hexadecimal string, 6 or 8 characters, NUL-terminated */
|
||||
char *fgcolor; /* Pointer to fgcolour (alternate spelling) */
|
||||
char *bgcolor; /* Pointer to bgcolour (alternate spelling) */
|
||||
char outfile[256]; /* Name of file to output to, NUL-terminated. Default "out.png" ("out.gif" if NO_PNG) */
|
||||
char outfile[256]; /* Name of file to output to, NUL-terminated. Default "out.png" ("out.gif" if no PNG) */
|
||||
char primary[128]; /* Primary message data (MaxiCode, Composite), NUL-terminated */
|
||||
int option_1; /* Symbol-specific options (see "../docs/manual.txt") */
|
||||
int option_2; /* Symbol-specific options */
|
||||
|
@ -442,6 +442,10 @@ extern "C" {
|
|||
/* Return the capability flags for symbology `symbol_id` that match `cap_flag` */
|
||||
ZINT_EXTERN unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag);
|
||||
|
||||
|
||||
/* Whether Zint built without PNG support */
|
||||
ZINT_EXTERN int ZBarcode_NoPng(void);
|
||||
|
||||
/* Return the version of Zint linked to */
|
||||
ZINT_EXTERN int ZBarcode_Version(void);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* zintconfig.h - the configured options and settings for libzint, generated from "zintconfig.h.in" by CMake */
|
||||
/* zintconfig.h - the configured options and settings for libzint
|
||||
NOTE: previously generated by CMake from "zintconfig.h.in", disabled for now */
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/* zintconfig.h - the configured options and settings for libzint, generated from "zintconfig.h.in" by CMake */
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the project nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#ifndef ZINTCONFIG_H
|
||||
#define ZINTCONFIG_H
|
||||
|
||||
#define ZINT_VERSION_MAJOR @ZINT_VERSION_MAJOR@
|
||||
#define ZINT_VERSION_MINOR @ZINT_VERSION_MINOR@
|
||||
#define ZINT_VERSION_RELEASE @ZINT_VERSION_RELEASE@
|
||||
#define ZINT_VERSION_BUILD @ZINT_VERSION_BUILD@
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif /* ZINTCONFIG_H */
|
Loading…
Add table
Add a link
Reference in a new issue