muzgen/lib/CMakeLists.txt

62 lines
1.1 KiB
CMake
Raw Normal View History

2024-01-29 10:59:55 +00:00
cmake_minimum_required(VERSION 3.2)
project(MuzGenLib)
configure_file(
conf.in.hpp
${CMAKE_SOURCE_DIR}/lib/conf.hpp
)
add_library(muz-lib OBJECT
# Audio
2024-01-29 10:59:55 +00:00
Signal.cpp
AudioEngine.cpp
AudioConf.cpp
Constant.cpp
Sine.cpp
# Language
Node.cpp
Lexer.cpp
Parser.cpp
Compiler.cpp
2024-01-29 10:59:55 +00:00
)
set_property(TARGET muz-lib
PROPERTY CXX_STANDARD 17
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PortAudio portaudio-2.0 IMPORTED_TARGET REQUIRED)
target_compile_options(muz-lib
PUBLIC -Wall -Wextra
)
target_link_libraries(muz-lib
PUBLIC PkgConfig::PortAudio
)
2024-01-29 10:59:55 +00:00
if (CMAKE_BUILD_TYPE STREQUAL Debug)
target_compile_options(muz-lib
PRIVATE --coverage
)
target_link_options(muz-lib
PUBLIC --coverage
)
find_program(LCOV_PATH lcov REQUIRED)
find_program(GENHTML_PATH genhtml REQUIRED)
add_custom_target(cov
COMMAND ${LCOV_PATH} -d . --zerocounters
COMMAND $<TARGET_FILE:muz-test>
COMMAND ${LCOV_PATH} -d . --capture -o cov.info
COMMAND ${LCOV_PATH} -r cov.info '/usr/include/*' -o cov.info
COMMAND ${LCOV_PATH} -r cov.info '*.hpp' -o cov.info
2024-01-29 10:59:55 +00:00
COMMAND ${GENHTML_PATH} --legend -o cov_html cov.info
)
endif()