1
0
mirror of https://github.com/woo-j/zint.git synced 2024-12-26 07:21:31 +03:00
zint/backend/tests/CMakeLists.txt

106 lines
3.3 KiB
CMake
Raw Normal View History

# Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
2019-09-01 23:09:47 +03:00
# Adapted from qrencode/tests/CMakeLists.txt
# Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
# vim: set ts=4 sw=4 et :
2019-09-01 23:09:47 +03:00
cmake_minimum_required(VERSION 3.9)
2019-09-01 23:09:47 +03:00
enable_testing()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
2019-09-01 23:09:47 +03:00
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")
2019-09-01 23:09:47 +03:00
find_package(LibZint 2.7.1 REQUIRED)
find_package(PNG)
if(PNG_FOUND)
include_directories(${PNG_INCLUDES})
else()
add_definitions(-DNO_PNG)
endif()
2019-09-01 23:09:47 +03: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()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if(ZINT_DEBUG)
2019-09-01 23:09:47 +03:00
add_compile_options("-g")
endif()
if(ZINT_SANITIZE)
2019-09-01 23:09:47 +03:00
add_compile_options("-fsanitize=undefined")
add_compile_options("-fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address")
endif()
if(ZINT_TEST)
add_definitions("-DZINT_TEST")
endif()
endif()
2019-09-01 23:09:47 +03:00
add_library(testcommon testcommon.c testcommon.h)
if(PNG_FOUND)
target_link_libraries(testcommon ZINT::ZINT ${PNG_LIBRARIES})
else()
target_link_libraries(testcommon ZINT::ZINT)
endif()
2019-09-01 23:09:47 +03: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()
2019-09-01 23:09:47 +03:00
zint_add_test(2of5, test_2of5)
zint_add_test(auspost, test_auspost)
zint_add_test(aztec, test_aztec)
zint_add_test(bmp, test_bmp)
2019-09-01 23:09:47 +03:00
zint_add_test(channel, test_channel)
zint_add_test(codablock, test_codablock)
zint_add_test(code, test_code)
zint_add_test(code1, test_code1)
zint_add_test(code128, test_code128)
zint_add_test(code16k, test_code16k)
zint_add_test(code49, test_code49)
zint_add_test(common, test_common)
zint_add_test(composite, test_composite)
zint_add_test(dmatrix, test_dmatrix)
zint_add_test(dotcode, test_dotcode)
2019-09-01 23:09:47 +03:00
zint_add_test(eci, test_eci)
zint_add_test(emf, test_emf)
zint_add_test(gb18030, test_gb18030)
zint_add_test(gb2312, test_gb2312)
zint_add_test(gif, test_gif)
zint_add_test(gridmtx, test_gridmtx)
zint_add_test(gs1, test_gs1)
zint_add_test(hanxin, test_hanxin)
2019-09-01 23:09:47 +03:00
zint_add_test(imail, test_imail)
zint_add_test(large, test_large)
zint_add_test(library, test_library)
2019-09-01 23:09:47 +03:00
zint_add_test(mailmark, test_mailmark)
zint_add_test(maxicode, test_maxicode)
zint_add_test(medical, test_medical)
zint_add_test(pcx, test_pcx)
zint_add_test(pdf417, test_pdf417)
zint_add_test(plessey, test_plessey)
zint_add_test(png, test_png)
zint_add_test(postal, test_postal)
zint_add_test(print, test_print)
2019-09-02 13:43:14 +03:00
zint_add_test(qr, test_qr)
zint_add_test(raster, test_raster)
2019-09-01 23:09:47 +03:00
zint_add_test(rss, test_rss)
zint_add_test(sjis, test_sjis)
zint_add_test(svg, test_svg)
zint_add_test(telepen, test_telepen)
zint_add_test(tif, test_tif)
zint_add_test(ultra, test_ultra)
2019-09-01 23:09:47 +03:00
zint_add_test(upcean, test_upcean)
zint_add_test(vector, test_vector)