xo-ratio: streamline example+utest build
This commit is contained in:
parent
63b4255dae
commit
ae69a418ff
4 changed files with 17 additions and 58 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
|||
# emacs project control file
|
||||
.projectile
|
||||
# clangd working space (see emacs+lsp)
|
||||
.cache
|
||||
# typical cmake build directory (source-tree-nephew)
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ enable_language(CXX)
|
|||
include(GNUInstallDirs)
|
||||
include(cmake/xo-bootstrap-macros.cmake)
|
||||
|
||||
xo_cxx_toplevel_options2()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# cmake -DCMAKE_BUILD_TYPE=coverage
|
||||
#
|
||||
xo_toplevel_coverage_config2()
|
||||
xo_cxx_toplevel_options3()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# c++ settings
|
||||
|
|
|
|||
|
|
@ -3,13 +3,10 @@
|
|||
set(SELF_EXE xo_ratio_ex1)
|
||||
set(SELF_SRCS ex1.cpp)
|
||||
|
||||
add_executable(${SELF_EXE} ${SELF_SRCS})
|
||||
xo_include_options2(${SELF_EXE})
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# dependencies..
|
||||
|
||||
xo_self_dependency(${SELF_EXE} xo_ratio)
|
||||
#xo_dependency(${SELF_EXE} reflect)
|
||||
if (XO_ENABLE_EXAMPLES)
|
||||
add_executable(${SELF_EXE} ${SELF_SRCS})
|
||||
xo_include_options2(${SELF_EXE})
|
||||
xo_self_dependency(${SELF_EXE} xo_ratio)
|
||||
endif()
|
||||
|
||||
# end CMakeLists.txt
|
||||
|
|
|
|||
|
|
@ -5,53 +5,18 @@ set(SELF_SRCS
|
|||
ratio_utest_main.cpp
|
||||
ratio.test.cpp)
|
||||
|
||||
xo_add_utest_executable(${SELF_EXE} ${SELF_SRCS})
|
||||
if (ENABLE_TESTING)
|
||||
xo_add_utest_executable(${SELF_EXE} ${SELF_SRCS})
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# in coverage build, target to build+install coverage report
|
||||
xo_utest_coverage_config2()
|
||||
|
||||
if (XO_SUBMODULE_BUILD)
|
||||
# in submodule build, generate aggregate coverage report
|
||||
# for all xo libraries
|
||||
else()
|
||||
set(CCOV_OUTPUT_DIR ${PROJECT_BINARY_DIR}/ccov/html)
|
||||
set(CCOV_INDEX_FILE ${CCOV_OUTPUT_DIR}/index.html)
|
||||
set(CCOV_REPORT_EXE ${PROJECT_BINARY_DIR}/gen-ccov)
|
||||
# CMAKE_INSTALL_DOCDIR
|
||||
# =default=> DATAROOTDIR/doc/PROJECT_NAME
|
||||
# =default=> CMAKE_INSTALL_PREFIX/share/doc/xo_flatstring
|
||||
set(CCOV_INSTALL_DOCDIR ${CMAKE_INSTALL_DOCDIR}/ccov)
|
||||
# ----------------------------------------------------------------
|
||||
# dependencies..
|
||||
|
||||
# 'test' target should always be out-of-date
|
||||
#
|
||||
# DEPENDS: reminder - can't put 'test' here, requires 'all' target
|
||||
#
|
||||
add_custom_command(
|
||||
OUTPUT ${CCOV_INDEX_FILE}
|
||||
DEPENDS ${SELF_EXE}
|
||||
COMMAND ${CCOV_REPORT_EXE}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
COMMENT "Generating coverage report -> [${CCOV_OUTPUT_DIR}]")
|
||||
|
||||
add_custom_target(
|
||||
ccov
|
||||
DEPENDS ${CCOV_INDEX_FILE} ${SELF_EXE})
|
||||
|
||||
# OPTIONAL: quietly skip this step if ccov report not generated
|
||||
install(
|
||||
DIRECTORY ${CCOV_OUTPUT_DIR}
|
||||
FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
|
||||
DESTINATION ${CCOV_INSTALL_DOCDIR}
|
||||
COMPONENT Documentation
|
||||
OPTIONAL)
|
||||
xo_self_headeronly_dependency(${SELF_EXE} xo_ratio)
|
||||
xo_dependency(${SELF_EXE} randomgen)
|
||||
xo_dependency(${SELF_EXE} indentlog)
|
||||
xo_external_target_dependency(${SELF_EXE} Catch2 Catch2::Catch2)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# dependencies..
|
||||
|
||||
xo_self_headeronly_dependency(${SELF_EXE} xo_ratio)
|
||||
xo_dependency(${SELF_EXE} randomgen)
|
||||
xo_dependency(${SELF_EXE} indentlog)
|
||||
xo_external_target_dependency(${SELF_EXE} Catch2 Catch2::Catch2)
|
||||
|
||||
# end CMakeLists.txt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue