mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Apply all changes done to the backend test to the front-end test, too
This commit is contained in:
parent
9ff3f13c19
commit
b69df5ad91
@ -21,3 +21,7 @@ set_target_properties(zint_frontend PROPERTIES OUTPUT_NAME "zint")
|
||||
target_link_libraries(zint_frontend zint)
|
||||
|
||||
install(TARGETS zint_frontend DESTINATION "${BIN_INSTALL_DIR}" RUNTIME)
|
||||
|
||||
if(ZINT_TEST)
|
||||
add_subdirectory(tests)
|
||||
endif(ZINT_TEST)
|
||||
|
@ -8,51 +8,16 @@ project(zint_frontend_tests)
|
||||
|
||||
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")
|
||||
|
||||
find_package(LibZint REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
check_c_compiler_flag(-Wall C_COMPILER_FLAG_WALL)
|
||||
if(C_COMPILER_FLAG_WALL)
|
||||
add_compile_options("-Wall")
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-Wextra C_COMPILER_FLAG_WEXTRA)
|
||||
if(C_COMPILER_FLAG_WEXTRA)
|
||||
add_compile_options("-Wextra")
|
||||
endif()
|
||||
|
||||
if(ZINT_DEBUG)
|
||||
check_c_compiler_flag(-g C_COMPILER_FLAG_G)
|
||||
if(C_COMPILER_FLAG_G)
|
||||
add_compile_options("-g")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ZINT_SANITIZE)
|
||||
# check_c_compiler_flag fails for -fsanitize
|
||||
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
|
||||
add_compile_options("-fsanitize=undefined")
|
||||
add_compile_options("-fsanitize=address")
|
||||
link_libraries("-fsanitize=undefined -fsanitize=address")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories(../../backend/tests)
|
||||
add_library(testcommon STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(testcommon PROPERTIES IMPORTED_LOCATION "../../../backend/tests/build/libtestcommon.a")
|
||||
|
||||
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 ZINT::ZINT ${PNG_LIBRARIES} ${ADDITIONAL_LIBS})
|
||||
target_link_libraries(${test_command} testcommon ${ADDITIONAL_LIBS})
|
||||
add_test(${test_name} ${test_command})
|
||||
if(ZINT_STATIC)
|
||||
add_executable(${test_command}-static ${test_command}.c)
|
||||
target_link_libraries(${test_command}-static testcommon-static ${ADDITIONAL_LIBS})
|
||||
add_test(${test_name}-static ${test_command}-static)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
zint_add_test(args, test_args)
|
||||
zint_add_test(args test_args)
|
||||
|
@ -1,26 +1,7 @@
|
||||
Zint frontend test suite
|
||||
------------------------
|
||||
|
||||
See <project-dir>/backend/tests/README first to build the backend test suite, as
|
||||
its library <project-dir>/backend/tests/build/libtestcommon.a is used here. Then
|
||||
|
||||
cd <project-dir>
|
||||
cd frontend/tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
|
||||
If the backend test suite was made with -DZINT_SANITIZE:BOOL=1 then instead
|
||||
|
||||
cd <project-dir>
|
||||
cd frontend/tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DZINT_SANITIZE:BOOL=1 ..
|
||||
make
|
||||
|
||||
-DZINT_DEBUG:BOOL=1 can also be used.
|
||||
See <project-dir>/backend/tests/README to see how to build the test suite.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user