diff --git a/CMakeLists.txt b/CMakeLists.txt index f89b093..8875491 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,6 @@ set(CMAKE_CXX_FLAGS_DEBUG " ${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O # Options # ------- -option(BAYESNET_VCPKG_CONFIG "Use vcpkg version of BayesNet" ON) option(ENABLE_TESTING "Unit testing build" OFF) option(CODE_COVERAGE "Collect coverage from test library" OFF) @@ -75,29 +74,18 @@ find_package(Torch CONFIG REQUIRED) find_package(fimdlp CONFIG REQUIRED) find_package(folding CONFIG REQUIRED) find_package(argparse CONFIG REQUIRED) +find_package(nlohmann_json CONFIG REQUIRED) find_package(Boost REQUIRED COMPONENTS python) find_package(arff-files CONFIG REQUIRED) -find_package(ZLIB REQUIRED) -find_library(LIBZIP_LIBRARY NAMES zip) - # BayesNet -# if set to ON it will use the vcpkg version of BayesNet else it will use the locally installed version -if (BAYESNET_VCPKG_CONFIG) - message(STATUS "Using BayesNet vcpkg config") - find_package(bayesnet CONFIG REQUIRED) - set(BayesNet_LIBRARIES bayesnet::bayesnet) -else(BAYESNET_VCPKG_CONFIG) - message(STATUS "Using BayesNet local library config") - find_library(bayesnet NAMES libbayesnet bayesnet libbayesnet.a PATHS ${Platform_SOURCE_DIR}/../lib/lib REQUIRED) - find_path(Bayesnet_INCLUDE_DIRS REQUIRED NAMES bayesnet PATHS ${Platform_SOURCE_DIR}/../lib/include) - add_library(bayesnet::bayesnet UNKNOWN IMPORTED) - set_target_properties(bayesnet::bayesnet PROPERTIES - IMPORTED_LOCATION ${bayesnet} - INTERFACE_INCLUDE_DIRECTORIES ${Bayesnet_INCLUDE_DIRS} - ) -endif(BAYESNET_VCPKG_CONFIG) -message(STATUS "BayesNet_LIBRARIES=${BayesNet_LIBRARIES}") +find_library(bayesnet NAMES libbayesnet bayesnet libbayesnet.a PATHS ${Platform_SOURCE_DIR}/../lib/lib REQUIRED) +find_path(Bayesnet_INCLUDE_DIRS REQUIRED NAMES bayesnet PATHS ${Platform_SOURCE_DIR}/../lib/include) +add_library(bayesnet::bayesnet UNKNOWN IMPORTED) +set_target_properties(bayesnet::bayesnet PROPERTIES + IMPORTED_LOCATION ${bayesnet} + INTERFACE_INCLUDE_DIRECTORIES ${Bayesnet_INCLUDE_DIRS}) +message(STATUS "BayesNet=${bayesnet}") message(STATUS "BayesNet_INCLUDE_DIRS=${Bayesnet_INCLUDE_DIRS}") # PyClassifiers diff --git a/Makefile b/Makefile index 8db9498..1b810c9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SHELL := /bin/bash .DEFAULT_GOAL := help -.PHONY: init clean coverage setup help build test clean debug release buildr buildd install dependency testp testb clang-uml debug_local release_local example +.PHONY: init clean coverage setup help build test clean debug release buildr buildd install dependency testp testb clang-uml example f_release = build_Release f_debug = build_Debug @@ -80,28 +80,15 @@ debug: ## Build a debug version of the project with BayesNet from vcpkg @echo ">>> Building Debug Platform..."; @if [ -d ./$(f_debug) ]; then rm -rf ./$(f_debug); fi @mkdir $(f_debug); - @cmake -S . -B $(f_debug) -DBAYESNET_VCPKG_CONFIG=ON -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake - @echo ">>> Done"; - -debug_local: ## Build a debug version of the project with BayesNet local - @echo ">>> Building Debug Platform..."; - @if [ -d ./$(f_debug) ]; then rm -rf ./$(f_debug); fi - @mkdir $(f_debug); - @cmake -S . -B $(f_debug) -DBAYESNET_VCPKG_CONFIG=OFF -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake + @cmake -S . -B $(f_debug) -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake @echo ">>> Done"; release: ## Build a Release version of the project with BayesNet from vcpkg @echo ">>> Building Release Platform..."; @if [ -d ./$(f_release) ]; then rm -rf ./$(f_release); fi @mkdir $(f_release); - @cmake -S . -B $(f_release) -DBAYESNET_VCPKG_CONFIG=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake + @cmake -S . -B $(f_release) -D CMAKE_BUILD_TYPE=Release -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake @echo ">>> Done"; -release_local: ## Build a Release version of the project with BayesNet local - @echo ">>> Building Release Platform..."; - @if [ -d ./$(f_release) ]; then rm -rf ./$(f_release); fi - @mkdir $(f_release); - @cmake -S . -B $(f_release) -DBAYESNET_VCPKG_CONFIG=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake - @echo ">>> Done"; opt = "" test: ## Run tests (opt="-s") to verbose output the tests, (opt="-c='Test Maximum Spanning Tree'") to run only that section diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4e0f2e9..b89cebc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -57,7 +57,7 @@ add_executable(b_main commands/b_main.cpp ${main_sources} experimental_clfs/XA1DE.cpp experimental_clfs/ExpClf.cpp ) -target_link_libraries(b_main "${PyClassifiers}" bayesnet::bayesnet fimdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" Boost::python Boost::numpy) +target_link_libraries(b_main PRIVATE nlohmann_json::nlohmann_json "${PyClassifiers}" bayesnet::bayesnet fimdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" Boost::python Boost::numpy) # b_manage set(manage_sources ManageScreen.cpp OptionsMenu.cpp ResultsManager.cpp) diff --git a/src/commands/b_manage.cpp b/src/commands/b_manage.cpp index 0dda157..66a2ea6 100644 --- a/src/commands/b_manage.cpp +++ b/src/commands/b_manage.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "common/Paths.h" #include #include "manage/ManageScreen.h" #include @@ -13,6 +14,7 @@ void manageArguments(argparse::ArgumentParser& program, int argc, char** argv) { program.add_argument("-m", "--model").default_value("any").help("Filter results of the selected model)"); program.add_argument("-s", "--score").default_value("any").help("Filter results of the score name supplied"); + program.add_argument("--folder").help("Results folder to use").default_value(platform::Paths::results()); program.add_argument("--platform").default_value("any").help("Filter results of the selected platform"); program.add_argument("--complete").help("Show only results with all datasets").default_value(false).implicit_value(true); program.add_argument("--partial").help("Show only partial results").default_value(false).implicit_value(true); @@ -116,6 +118,7 @@ int main(int argc, char** argv) auto program = argparse::ArgumentParser("b_manage", { platform_project_version.begin(), platform_project_version.end() }); manageArguments(program, argc, argv); std::string model = program.get("model"); + std::string path = program.get("folder"); std::string score = program.get("score"); std::string platform = program.get("platform"); bool complete = program.get("complete"); @@ -125,7 +128,7 @@ int main(int argc, char** argv) partial = false; signal(SIGWINCH, handleResize); auto [rows, cols] = numRowsCols(); - manager = new platform::ManageScreen(rows, cols, model, score, platform, complete, partial, compare); + manager = new platform::ManageScreen(path, rows, cols, model, score, platform, complete, partial, compare); manager->doMenu(); auto fileName = manager->getExcelFileName(); delete manager; diff --git a/src/manage/ManageScreen.cpp b/src/manage/ManageScreen.cpp index 6648d94..f4b11d1 100644 --- a/src/manage/ManageScreen.cpp +++ b/src/manage/ManageScreen.cpp @@ -18,8 +18,8 @@ namespace platform { const std::string STATUS_OK = "Ok."; const std::string STATUS_COLOR = Colors::GREEN(); - ManageScreen::ManageScreen(int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare) : - rows{ rows }, cols{ cols }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(model, score, platform, complete, partial)) + ManageScreen::ManageScreen(const std::string path, int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare) : + rows{ rows }, cols{ cols }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(path, model, score, platform, complete, partial)) { results.load(); openExcel = false; diff --git a/src/manage/ManageScreen.h b/src/manage/ManageScreen.h index 7e41896..7aab91d 100644 --- a/src/manage/ManageScreen.h +++ b/src/manage/ManageScreen.h @@ -15,7 +15,7 @@ namespace platform { }; class ManageScreen { public: - ManageScreen(int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare); + ManageScreen(const std::string path, int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare); ~ManageScreen() = default; void doMenu(); void updateSize(int rows, int cols); diff --git a/src/manage/ResultsManager.cpp b/src/manage/ResultsManager.cpp index f4b722a..fa4e895 100644 --- a/src/manage/ResultsManager.cpp +++ b/src/manage/ResultsManager.cpp @@ -1,10 +1,9 @@ #include -#include "common/Paths.h" #include "ResultsManager.h" namespace platform { - ResultsManager::ResultsManager(const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial) : - path(Paths::results()), model(model), scoreName(score), platform(platform), complete(complete), partial(partial), maxModel(0), maxTitle(0) + ResultsManager::ResultsManager(const std::string& path_, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial) : + path(path_), model(model), scoreName(score), platform(platform), complete(complete), partial(partial), maxModel(0), maxTitle(0) { } void ResultsManager::load() diff --git a/src/manage/ResultsManager.h b/src/manage/ResultsManager.h index cabf909..f891c44 100644 --- a/src/manage/ResultsManager.h +++ b/src/manage/ResultsManager.h @@ -18,7 +18,7 @@ namespace platform { }; class ResultsManager { public: - ResultsManager(const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial); + ResultsManager(const std::string& path_, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial); void load(); // Loads the list of results void sortResults(SortField field, SortType type); // Sorts the list of results void sortDate(SortType type); diff --git a/vcpkg.json b/vcpkg.json index 31fc479..69ded49 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -7,9 +7,7 @@ "fimdlp", "libtorch-bin", "folding", - "bayesnet", - "argparse", - "libxlsxwriter" + "argparse" ], "overrides": [ { @@ -24,10 +22,6 @@ "name": "libtorch-bin", "version": "2.7.0" }, - { - "name": "bayesnet", - "version": "1.1.1" - }, { "name": "folding", "version": "1.1.1" @@ -36,10 +30,6 @@ "name": "argpase", "version": "3.2" }, - { - "name": "libxlsxwriter", - "version": "1.2.2" - }, { "name": "nlohmann-json", "version": "3.11.3"