91 lines
2.4 KiB
CMake
91 lines
2.4 KiB
CMake
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
|
project (whisper-com VERSION 0.0.1 LANGUAGES CXX C)
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
|
include(compdb)
|
|
include(doxygen)
|
|
|
|
build_docs(PROCESS_DOXYFILE DOXYFILE_PATH "docs/Doxyfile.in" )
|
|
|
|
IF(NOT TARGET loguru)
|
|
find_package (Threads REQUIRED)
|
|
add_library(loguru STATIC libs/loguru/loguru.cpp libs/loguru/loguru.hpp)
|
|
target_include_directories(loguru PUBLIC libs/loguru/)
|
|
target_compile_options(loguru PUBLIC -DLOGURU_WITH_STREAMS=1)
|
|
target_link_libraries(loguru PUBLIC dl Threads::Threads)
|
|
set_property(TARGET loguru PROPERTY POSITION_INDEPENDENT_CODE 1)
|
|
ENDIF()
|
|
|
|
|
|
set(WHISPER_SOURCES
|
|
include/Whisper/Data/Classification.hpp
|
|
src/Whisper/Data/Classification.cpp
|
|
)
|
|
|
|
set(WHISPER_REQUIRED_LIBRARIES loguru)
|
|
|
|
add_library(objlib OBJECT ${WHISPER_SOURCES})
|
|
set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
|
|
target_include_directories(objlib
|
|
PUBLIC
|
|
include
|
|
PRIVATE
|
|
src
|
|
)
|
|
target_link_libraries(objlib PUBLIC ${WHISPER_REQUIRED_LIBRARIES})
|
|
|
|
add_library(whisper SHARED $<TARGET_OBJECTS:objlib>)
|
|
target_include_directories(whisper
|
|
PUBLIC
|
|
include
|
|
PRIVATE
|
|
src
|
|
)
|
|
target_link_libraries(whisper PUBLIC ${WHISPER_REQUIRED_LIBRARIES})
|
|
|
|
add_library(whisper-static STATIC $<TARGET_OBJECTS:objlib>)
|
|
target_include_directories(whisper-static
|
|
PUBLIC
|
|
include
|
|
PRIVATE
|
|
src
|
|
)
|
|
target_link_libraries(whisper-static PUBLIC ${WHISPER_REQUIRED_LIBRARIES})
|
|
|
|
|
|
#
|
|
# Everything test related
|
|
#
|
|
|
|
|
|
option(WHISPER_TESTS "ENABLE/DISABLE all tests for whisper-com" ON)
|
|
IF(${WHISPER_TESTS})
|
|
message(STATUS "whisper-com tests enabled")
|
|
IF(NOT TARGET Catch2)
|
|
add_subdirectory(libs/Catch2)
|
|
include(libs/Catch2/contrib/Catch.cmake)
|
|
ENDIF()
|
|
include(CTest)
|
|
ELSE()
|
|
message(STATUS "whisper-com tests disabled")
|
|
ENDIF()
|
|
|
|
|
|
IF(${WHISPER_TESTS})
|
|
#
|
|
# all tests
|
|
#
|
|
add_executable(test_classification tests/test_classification.cpp)
|
|
target_link_libraries(test_classification PUBLIC Catch2::Catch2 whisper-static)
|
|
catch_discover_tests(test_classification)
|
|
#
|
|
# add_executable(test_message tests/test_message.cpp)
|
|
# target_link_libraries(test_message PUBLIC Catch2::Catch2 bc-ng loguru)
|
|
# target_compile_definitions(test_message PRIVATE -DNDEBUG=1 -DNLOGGING_VERBOSE=1)
|
|
# catch_discover_tests(test_message)
|
|
|
|
ENDIF()
|