mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-24 05:17:05 +00:00
libzint.so: suppress exporting INTERNAL functions to the shared library; ZINT_TEST
This commit is contained in:
@@ -10,6 +10,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/"
|
||||
|
||||
set(ZINT_DEBUG FALSE CACHE BOOL "Set debug compile flag")
|
||||
set(ZINT_SANITIZE FALSE CACHE BOOL "Set sanitize compile/link flags")
|
||||
set(ZINT_TEST FALSE CACHE BOOL "Set test compile flag")
|
||||
|
||||
find_package (LibZint 2.7.0 REQUIRED)
|
||||
find_package(PNG)
|
||||
@@ -29,6 +30,9 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
add_compile_options("-fsanitize=address")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address")
|
||||
endif (ZINT_SANITIZE)
|
||||
if (ZINT_TEST)
|
||||
add_definitions("-DZINT_TEST")
|
||||
endif (ZINT_TEST)
|
||||
endif ()
|
||||
|
||||
add_library(testcommon
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
Zint backend test suite
|
||||
-----------------------
|
||||
|
||||
To make:
|
||||
To make, first make libzint with ZINT_TEST defined:
|
||||
|
||||
cd <project-dir>
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DZINT_TEST:BOOL:1 ..
|
||||
make
|
||||
|
||||
Then make the tests:
|
||||
|
||||
cd <project-dir>
|
||||
cd backend/tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake -DZINT_TEST:BOOL:1 ..
|
||||
make
|
||||
|
||||
(ZINT_TEST is needed to export INTERNAL functions for use and testing.)
|
||||
|
||||
To run all tests:
|
||||
|
||||
make test
|
||||
@@ -50,4 +60,8 @@ To undo sanitize/debug, remake each after setting:
|
||||
cmake -DZINT_SANITIZE:BOOL=0 ..
|
||||
cmake -DZINT_DEBUG:BOOL=0 ..
|
||||
|
||||
Note that sanitize is not safe to use in production, as it's a security risk.
|
||||
To get a clean libzint, set the above and also:
|
||||
|
||||
cmake -DZINT_TEST:BOOL=0 ..
|
||||
|
||||
(The tests will now fail to link.)
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
#define TESTCOMMON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <zint.h>
|
||||
#include "../common.h"
|
||||
|
||||
extern int assertionFailed;
|
||||
|
||||
Reference in New Issue
Block a user