2019-09-02 08:09:47 +12:00
|
|
|
# Copyright (C) 2019 Robin Stuart <rstuart114@gmail.com>
|
|
|
|
# Adapted from qrencode/tests/CMakeLists.txt
|
|
|
|
# Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
|
|
|
|
|
|
|
cmake_minimum_required (VERSION 3.9)
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
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")
|
2019-12-19 13:37:55 +13:00
|
|
|
set(ZINT_TEST FALSE CACHE BOOL "Set test compile flag")
|
2019-09-02 08:09:47 +12:00
|
|
|
|
2019-12-06 08:16:39 +13:00
|
|
|
find_package (LibZint 2.7.0 REQUIRED)
|
2019-10-14 21:49:15 +13:00
|
|
|
find_package(PNG)
|
|
|
|
|
|
|
|
if (PNG_FOUND)
|
|
|
|
include_directories(${PNG_INCLUDES})
|
|
|
|
else (PNG_FOUND)
|
|
|
|
add_definitions(-DNO_PNG)
|
|
|
|
endif (PNG_FOUND)
|
2019-09-02 08:09:47 +12:00
|
|
|
|
|
|
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
|
|
|
if (ZINT_DEBUG)
|
|
|
|
add_compile_options("-g")
|
|
|
|
endif (ZINT_DEBUG)
|
|
|
|
if (ZINT_SANITIZE)
|
|
|
|
add_compile_options("-fsanitize=undefined")
|
|
|
|
add_compile_options("-fsanitize=address")
|
2019-12-17 06:31:52 +13:00
|
|
|
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address")
|
2019-09-02 08:09:47 +12:00
|
|
|
endif (ZINT_SANITIZE)
|
2019-12-19 13:37:55 +13:00
|
|
|
if (ZINT_TEST)
|
|
|
|
add_definitions("-DZINT_TEST")
|
|
|
|
endif (ZINT_TEST)
|
2019-09-02 08:09:47 +12:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
add_library(testcommon
|
|
|
|
testcommon.c testcommon.h)
|
2019-10-14 21:49:15 +13:00
|
|
|
if (PNG_FOUND)
|
|
|
|
target_link_libraries(testcommon ZINT::ZINT ${PNG_LIBRARIES})
|
|
|
|
else (PNG_FOUND)
|
|
|
|
target_link_libraries(testcommon ZINT::ZINT)
|
|
|
|
endif (PNG_FOUND)
|
2019-09-02 08:09:47 +12:00
|
|
|
|
|
|
|
macro(zint_add_test test_name test_command)
|
|
|
|
set(ADDITIONAL_LIBS "${ARGN}" ${LIBRARY_FLAGS})
|
|
|
|
add_executable(${test_command} ${test_command}.c)
|
|
|
|
target_link_libraries(${test_command} testcommon ${ADDITIONAL_LIBS})
|
|
|
|
add_test(${test_name} ${test_command})
|
|
|
|
endmacro(zint_add_test)
|
|
|
|
|
|
|
|
zint_add_test(channel, test_channel)
|
2019-11-28 05:16:14 +13:00
|
|
|
zint_add_test(common, test_common)
|
2019-10-15 10:20:16 +13:00
|
|
|
zint_add_test(composite, test_composite)
|
2019-11-28 05:16:14 +13:00
|
|
|
zint_add_test(dmatrix, test_dmatrix)
|
2019-09-02 08:09:47 +12:00
|
|
|
zint_add_test(eci, test_eci)
|
2019-12-09 05:15:34 +13:00
|
|
|
zint_add_test(gb18030, test_gb18030)
|
2019-11-29 08:15:29 +13:00
|
|
|
zint_add_test(gb2312, test_gb2312)
|
|
|
|
zint_add_test(gridmtx, test_gridmtx)
|
2019-10-17 22:06:21 +13:00
|
|
|
zint_add_test(gs1, test_gs1)
|
2019-12-09 05:15:34 +13:00
|
|
|
zint_add_test(hanxin, test_hanxin)
|
2019-09-02 08:09:47 +12:00
|
|
|
zint_add_test(imail, test_imail)
|
2019-10-17 22:06:21 +13:00
|
|
|
zint_add_test(library, test_library)
|
2019-09-02 08:09:47 +12:00
|
|
|
zint_add_test(mailmark, test_mailmark)
|
|
|
|
zint_add_test(maxicode, test_maxicode)
|
2019-10-14 21:49:15 +13:00
|
|
|
zint_add_test(postal, test_postal)
|
2019-09-02 22:43:14 +12:00
|
|
|
zint_add_test(qr, test_qr)
|
2019-11-12 10:38:21 +13:00
|
|
|
zint_add_test(raster, test_raster)
|
2019-09-02 08:09:47 +12:00
|
|
|
zint_add_test(rss, test_rss)
|
2019-11-28 05:16:14 +13:00
|
|
|
zint_add_test(sjis, test_sjis)
|
2019-09-02 08:09:47 +12:00
|
|
|
zint_add_test(upcean, test_upcean)
|
2019-11-12 10:38:21 +13:00
|
|
|
zint_add_test(vector, test_vector)
|