From ab91276fca437bf76d87b8d08a1672971d1c53cd Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Thu, 12 Sep 2019 14:59:24 +0200 Subject: [PATCH] Replace std::filesystem with boost::filesystem. Somehow, travis still doesn't support the right one. --- .travis.yml | 3 ++- 2019/CMakeLists.txt | 4 ++-- 2019/tests/test_solutions.cpp | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 99b9dda..cd0dd7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,11 @@ before_script: - cd 2019 # CMake build -script: cmake . && make && ./test_solutions +script: cmake . && make && make test addons: apt: packages: + - libboost-filesystem-dev - libboost-program-options-dev - libboost-test-dev diff --git a/2019/CMakeLists.txt b/2019/CMakeLists.txt index 2c30c6f..d8c7ad6 100644 --- a/2019/CMakeLists.txt +++ b/2019/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12) project(aoc2019) -find_package(Boost REQUIRED COMPONENTS program_options unit_test_framework) +find_package(Boost REQUIRED COMPONENTS program_options unit_test_framework filesystem) add_library(AoCSolutions src/solutions.hpp src/solutions.cpp src/day01.cpp) target_compile_features(AoCSolutions PUBLIC cxx_std_17) @@ -13,7 +13,7 @@ target_link_libraries(runner AoCSolutions Boost::program_options) add_executable(test_solutions tests/test_solutions.cpp) target_compile_features(test_solutions PUBLIC cxx_std_17) -target_link_libraries(test_solutions AoCSolutions Boost::unit_test_framework) +target_link_libraries(test_solutions AoCSolutions Boost::unit_test_framework Boost::filesystem) target_include_directories(test_solutions PRIVATE "${CMAKE_SOURCE_DIR}/src") enable_testing() diff --git a/2019/tests/test_solutions.cpp b/2019/tests/test_solutions.cpp index 464e10b..81e24fa 100644 --- a/2019/tests/test_solutions.cpp +++ b/2019/tests/test_solutions.cpp @@ -1,16 +1,15 @@ #define BOOST_TEST_MODULE solutions_tests -#include #include #include -#include +#include #include #include #include "solutions.hpp" std::vector get_samples() { std::vector samples; - for (auto entry : std::filesystem::directory_iterator("./samples")) { + for (const auto &entry : boost::filesystem::directory_iterator("./samples")) { if (entry.path().filename().extension() == ".in") { samples.push_back(entry.path().string()); }