2020-04-07 08:26:13 +12:00
|
|
|
# Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
2019-09-02 08:09:47 +12:00
|
|
|
# Adapted from qrencode/tests/CMakeLists.txt
|
|
|
|
# Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
2020-06-15 01:42:40 +12:00
|
|
|
# vim: set ts=4 sw=4 et :
|
2019-09-02 08:09:47 +12:00
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
cmake_minimum_required(VERSION 3.9)
|
2019-09-02 08:09:47 +12:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
2019-09-02 08:09:47 +12:00
|
|
|
|
|
|
|
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
|
|
|
|
2020-08-05 09:22:26 +12:00
|
|
|
find_package(LibZint REQUIRED)
|
2019-10-14 21:49:15 +13:00
|
|
|
find_package(PNG)
|
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
if(PNG_FOUND)
|
2019-10-14 21:49:15 +13:00
|
|
|
include_directories(${PNG_INCLUDES})
|
2020-05-06 09:28:25 +12:00
|
|
|
else()
|
2019-10-14 21:49:15 +13:00
|
|
|
add_definitions(-DNO_PNG)
|
2020-05-06 09:28:25 +12:00
|
|
|
endif()
|
2019-09-02 08:09:47 +12:00
|
|
|
|
2020-07-11 06:39:32 +12:00
|
|
|
set(BWIPP_TAR ${CMAKE_CURRENT_SOURCE_DIR}/tools/bwipp_dump.ps.tar.xz)
|
|
|
|
set(BWIPP_PS ${CMAKE_CURRENT_SOURCE_DIR}/tools/bwipp_dump.ps)
|
|
|
|
|
|
|
|
if(NOT EXISTS ${BWIPP_PS})
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${BWIPP_TAR}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools)
|
|
|
|
endif()
|
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
|
|
|
if(ZINT_DEBUG)
|
2019-09-02 08:09:47 +12:00
|
|
|
add_compile_options("-g")
|
2020-05-06 09:28:25 +12:00
|
|
|
endif()
|
|
|
|
if(ZINT_SANITIZE)
|
2019-09-02 08:09:47 +12:00
|
|
|
add_compile_options("-fsanitize=undefined")
|
|
|
|
add_compile_options("-fsanitize=address")
|
2020-05-06 09:28:25 +12:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address")
|
|
|
|
endif()
|
|
|
|
if(ZINT_TEST)
|
2019-12-19 13:37:55 +13:00
|
|
|
add_definitions("-DZINT_TEST")
|
2020-05-06 09:28:25 +12:00
|
|
|
endif()
|
|
|
|
endif()
|
2019-09-02 08:09:47 +12:00
|
|
|
|
2020-06-15 01:42:40 +12:00
|
|
|
add_library(testcommon testcommon.c testcommon.h)
|
2020-05-06 09:28:25 +12:00
|
|
|
if(PNG_FOUND)
|
2019-10-14 21:49:15 +13:00
|
|
|
target_link_libraries(testcommon ZINT::ZINT ${PNG_LIBRARIES})
|
2020-05-06 09:28:25 +12:00
|
|
|
else()
|
2019-10-14 21:49:15 +13:00
|
|
|
target_link_libraries(testcommon ZINT::ZINT)
|
2020-05-06 09:28:25 +12:00
|
|
|
endif()
|
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})
|
2020-06-15 01:42:40 +12:00
|
|
|
endmacro()
|
2019-09-02 08:09:47 +12:00
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
zint_add_test(2of5, test_2of5)
|
2020-03-26 04:40:13 +13:00
|
|
|
zint_add_test(auspost, test_auspost)
|
2020-03-29 11:50:55 +13:00
|
|
|
zint_add_test(aztec, test_aztec)
|
2020-06-05 05:45:25 +12:00
|
|
|
zint_add_test(bmp, test_bmp)
|
2019-09-02 08:09:47 +12:00
|
|
|
zint_add_test(channel, test_channel)
|
2020-03-26 08:27:34 +13:00
|
|
|
zint_add_test(codablock, test_codablock)
|
2020-06-05 05:45:25 +12:00
|
|
|
zint_add_test(code, test_code)
|
2020-03-28 23:13:06 +13:00
|
|
|
zint_add_test(code1, test_code1)
|
2020-04-03 09:55:58 +13:00
|
|
|
zint_add_test(code128, test_code128)
|
2020-05-22 05:22:28 +12:00
|
|
|
zint_add_test(code16k, test_code16k)
|
|
|
|
zint_add_test(code49, test_code49)
|
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)
|
2020-03-26 11:31:59 +13:00
|
|
|
zint_add_test(dotcode, test_dotcode)
|
2019-09-02 08:09:47 +12:00
|
|
|
zint_add_test(eci, test_eci)
|
2020-05-06 09:51:04 +12:00
|
|
|
zint_add_test(emf, test_emf)
|
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)
|
2020-05-06 12:33:56 +12:00
|
|
|
zint_add_test(gif, test_gif)
|
2019-11-29 08:15:29 +13:00
|
|
|
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)
|
2020-06-15 01:42:40 +12:00
|
|
|
zint_add_test(large, test_large)
|
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)
|
2020-06-05 05:45:25 +12:00
|
|
|
zint_add_test(medical, test_medical)
|
2020-04-07 08:26:13 +12:00
|
|
|
zint_add_test(pcx, test_pcx)
|
2019-12-20 09:29:11 +13:00
|
|
|
zint_add_test(pdf417, test_pdf417)
|
2020-06-05 05:45:25 +12:00
|
|
|
zint_add_test(plessey, test_plessey)
|
2020-04-04 07:40:59 +13:00
|
|
|
zint_add_test(png, test_png)
|
2019-10-14 21:49:15 +13:00
|
|
|
zint_add_test(postal, test_postal)
|
2020-04-05 03:53:29 +12:00
|
|
|
zint_add_test(print, test_print)
|
2020-08-13 09:16:11 +12:00
|
|
|
zint_add_test(ps, test_ps)
|
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)
|
2020-04-04 07:40:59 +13:00
|
|
|
zint_add_test(svg, test_svg)
|
2020-03-27 03:22:27 +13:00
|
|
|
zint_add_test(telepen, test_telepen)
|
2020-05-07 06:57:27 +12:00
|
|
|
zint_add_test(tif, test_tif)
|
2020-04-10 09:08:54 +12:00
|
|
|
zint_add_test(ultra, test_ultra)
|
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)
|