Update installation way

This commit is contained in:
2025-04-30 13:25:37 +02:00
parent 6cfd7ec904
commit 260c79f17d
6 changed files with 29 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
project(BayesNet project(bayesnet
VERSION 1.1.1 VERSION 1.1.1
DESCRIPTION "Bayesian Network and basic classifiers Library." DESCRIPTION "Bayesian Network and basic classifiers Library."
HOMEPAGE_URL "https://github.com/rmontanana/bayesnet" HOMEPAGE_URL "https://github.com/rmontanana/bayesnet"
@@ -83,43 +83,39 @@ MESSAGE(STATUS "Testing enabled")
add_subdirectory(tests) add_subdirectory(tests)
endif (ENABLE_TESTING) endif (ENABLE_TESTING)
############################################################################################# #############################################################################################
############################################################################################# #############################################################################################
install(TARGETS BayesNet # Installation
EXPORT bayesnetTargets # ------------
ARCHIVE DESTINATION lib include(CMakePackageConfigHelpers)
LIBRARY DESTINATION lib write_basic_package_version_file(
RUNTIME DESTINATION bin "${CMAKE_CURRENT_BINARY_DIR}/bayesnetConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
) )
install(TARGETS bayesnet
EXPORT bayesnetTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
CONFIGURATIONS Release)
install(DIRECTORY bayesnet/ DESTINATION include/bayesnet FILES_MATCHING CONFIGURATIONS Release PATTERN "*.h")
install(FILES ${CMAKE_BINARY_DIR}/configured_files/include/bayesnet/config.h DESTINATION include/bayesnet CONFIGURATIONS Release)
install(EXPORT bayesnetTargets install(EXPORT bayesnetTargets
FILE bayesnetTargets.cmake FILE bayesnetTargets.cmake
NAMESPACE bayesnet:: NAMESPACE bayesnet::
DESTINATION lib/cmake/bayesnet DESTINATION lib/cmake/bayesnet)
)
include(CMakePackageConfigHelpers)
configure_package_config_file( configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/bayesnetConfig.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/bayesnetConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/bayesnetConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/bayesnetConfig.cmake"
INSTALL_DESTINATION lib/cmake/bayesnet INSTALL_DESTINATION lib/cmake/bayesnet
) )
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/bayesnetConfig.cmake"
DESTINATION lib/cmake/bayesnet
)
install(DIRECTORY bayesnet/ DESTINATION include/bayesnet FILES_MATCHING CONFIGURATIONS Release PATTERN "*.h")
install(FILES ${CMAKE_BINARY_DIR}/configured_files/include/bayesnet/config.h DESTINATION include/bayesnet CONFIGURATIONS Release)
############################################################################################# #############################################################################################
############################################################################################# #############################################################################################
# Installation # Installation
# ------------ # ------------
# install(TARGETS BayesNet # install(TARGETS BayesNet

View File

@@ -5,7 +5,7 @@ SHELL := /bin/bash
f_release = build_Release f_release = build_Release
f_debug = build_Debug f_debug = build_Debug
f_diagrams = diagrams f_diagrams = diagrams
app_targets = BayesNet app_targets = bayesnet
test_targets = TestBayesNet test_targets = TestBayesNet
clang-uml = clang-uml clang-uml = clang-uml
plantuml = plantuml plantuml = plantuml

View File

@@ -1,13 +1,9 @@
include_directories( include_directories(
${BayesNet_SOURCE_DIR}/lib/log ${bayesnet_SOURCE_DIR}
${BayesNet_SOURCE_DIR}/lib/mdlp/src
${BayesNet_SOURCE_DIR}/lib/folding
${BayesNet_SOURCE_DIR}/lib/json/include
${BayesNet_SOURCE_DIR}
${CMAKE_BINARY_DIR}/configured_files/include ${CMAKE_BINARY_DIR}/configured_files/include
) )
file(GLOB_RECURSE Sources "*.cc") file(GLOB_RECURSE Sources "*.cc")
add_library(BayesNet ${Sources}) add_library(bayesnet ${Sources})
target_link_libraries(BayesNet fimdlp "${TORCH_LIBRARIES}") target_link_libraries(bayesnet fimdlp::fimdlp folding::folding "${TORCH_LIBRARIES}")

View File

@@ -11,4 +11,4 @@ static constexpr std::string_view project_name = "@PROJECT_NAME@";
static constexpr std::string_view project_version = "@PROJECT_VERSION@"; static constexpr std::string_view project_version = "@PROJECT_VERSION@";
static constexpr std::string_view project_description = "@PROJECT_DESCRIPTION@"; static constexpr std::string_view project_description = "@PROJECT_DESCRIPTION@";
static constexpr std::string_view git_sha = "@GIT_SHA@"; static constexpr std::string_view git_sha = "@GIT_SHA@";
static constexpr std::string_view data_path = "@BayesNet_SOURCE_DIR@/tests/data/"; static constexpr std::string_view data_path = "@bayesnet_SOURCE_DIR@/tests/data/";

View File

@@ -1,17 +1,12 @@
if(ENABLE_TESTING) if(ENABLE_TESTING)
include_directories( include_directories(
${BayesNet_SOURCE_DIR}/tests/lib/Files ${bayesnet_SOURCE_DIR}
${BayesNet_SOURCE_DIR}/lib/folding
${BayesNet_SOURCE_DIR}/lib/mdlp/src
${BayesNet_SOURCE_DIR}/lib/log
${BayesNet_SOURCE_DIR}/lib/json/include
${BayesNet_SOURCE_DIR}
${CMAKE_BINARY_DIR}/configured_files/include ${CMAKE_BINARY_DIR}/configured_files/include
) )
file(GLOB_RECURSE BayesNet_SOURCES "${BayesNet_SOURCE_DIR}/bayesnet/*.cc") file(GLOB_RECURSE bayesnet_SOURCES "${bayesnet_SOURCE_DIR}/bayesnet/*.cc")
add_executable(TestBayesNet TestBayesNetwork.cc TestBayesNode.cc TestBayesClassifier.cc TestXSPnDE.cc TestXBA2DE.cc add_executable(TestBayesNet TestBayesNetwork.cc TestBayesNode.cc TestBayesClassifier.cc TestXSPnDE.cc TestXBA2DE.cc
TestBayesModels.cc TestBayesMetrics.cc TestFeatureSelection.cc TestBoostAODE.cc TestXBAODE.cc TestA2DE.cc TestBayesModels.cc TestBayesMetrics.cc TestFeatureSelection.cc TestBoostAODE.cc TestXBAODE.cc TestA2DE.cc
TestUtils.cc TestBayesEnsemble.cc TestModulesVersions.cc TestBoostA2DE.cc TestMST.cc TestXSPODE.cc ${BayesNet_SOURCES}) TestUtils.cc TestBayesEnsemble.cc TestModulesVersions.cc TestBoostA2DE.cc TestMST.cc TestXSPODE.cc ${bayesnet_SOURCES})
target_link_libraries(TestBayesNet PUBLIC "${TORCH_LIBRARIES}" fimdlp PRIVATE Catch2::Catch2WithMain) target_link_libraries(TestBayesNet PUBLIC "${TORCH_LIBRARIES}" fimdlp PRIVATE Catch2::Catch2WithMain)
add_test(NAME BayesNetworkTest COMMAND TestBayesNet) add_test(NAME BayesNetworkTest COMMAND TestBayesNet)
add_test(NAME A2DE COMMAND TestBayesNet "[A2DE]") add_test(NAME A2DE COMMAND TestBayesNet "[A2DE]")

View File

@@ -20,7 +20,7 @@
#include "bayesnet/ensembles/AODELd.h" #include "bayesnet/ensembles/AODELd.h"
#include "bayesnet/ensembles/BoostAODE.h" #include "bayesnet/ensembles/BoostAODE.h"
const std::string ACTUAL_VERSION = "1.1.0"; const std::string ACTUAL_VERSION = "1.1.1";
TEST_CASE("Test Bayesian Classifiers score & version", "[Models]") TEST_CASE("Test Bayesian Classifiers score & version", "[Models]")
{ {