2023-06-29 20:00:41 +00:00
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
|
2023-07-17 20:51:15 +00:00
|
|
|
project(BayesNet
|
|
|
|
VERSION 0.1.0
|
|
|
|
DESCRIPTION "Bayesian Network and basic classifiers Library."
|
|
|
|
HOMEPAGE_URL "https://github.com/rmontanana/bayesnet"
|
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
|
|
|
|
2023-06-29 20:00:41 +00:00
|
|
|
find_package(Torch REQUIRED)
|
|
|
|
|
|
|
|
if (POLICY CMP0135)
|
|
|
|
cmake_policy(SET CMP0135 NEW)
|
|
|
|
endif ()
|
|
|
|
|
2023-07-17 20:51:15 +00:00
|
|
|
# Global CMake variables
|
|
|
|
# ----------------------
|
2023-06-29 20:00:41 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2023-07-17 20:51:15 +00:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
2023-06-29 20:00:41 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
|
|
|
|
|
2023-07-17 20:51:15 +00:00
|
|
|
# Options
|
|
|
|
# -------
|
|
|
|
option(ENABLE_CLANG_TIDY "Enable to add clang tidy." OFF)
|
|
|
|
option(ENABLE_TESTING "Unit testing build" ON)
|
|
|
|
option(CODE_COVERAGE "Collect coverage from test library" ON)
|
|
|
|
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
|
|
|
|
|
|
|
|
|
|
# Subdirectories
|
|
|
|
# --------------
|
|
|
|
add_subdirectory(config)
|
2023-07-01 00:33:26 +00:00
|
|
|
add_subdirectory(src)
|
2023-07-17 20:51:15 +00:00
|
|
|
add_subdirectory(sample)
|
|
|
|
|
|
|
|
# Testing
|
|
|
|
# -------
|
|
|
|
|
|
|
|
if (ENABLE_TESTING)
|
|
|
|
enable_testing()
|
|
|
|
#if (CODE_COVERAGE)
|
|
|
|
SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
|
|
|
|
SET(GCC_COVERAGE_LINK_FLAGS "--coverage")
|
|
|
|
#endif (CODE_COVERAGE)
|
|
|
|
find_package(Catch2 3 REQUIRED)
|
|
|
|
include(CTest)
|
|
|
|
include(Catch)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif (ENABLE_TESTING)
|