diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..09a3b70 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.24) + +project("CMakeFight Exercise") + +find_package(Boost REQUIRED COMPONENTS filesystem) + +find_package(deal.II REQUIRED) + +find_package(yaml-cpp REQUIRED) + +find_package(deal.II 9.0 REQUIRED CONFIG + HINTS ${DEAL_II_DIR} $ENV{DEAL_II_DIR} +) +add_executable( + main + main.cpp + fem/fem.cpp + flatset/flatset.cpp + filesystem/filesystem.cpp + yamlParser/yamlParser.cpp +) + +target_link_libraries(main Boost::filesystem) + +DEAL_II_SETUP_TARGET(main) + +target_link_libraries(main yaml-cpp) \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a778746 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + git \ + wget \ + unzip \ + vim \ + libboost-all-dev \ + libdeal.ii-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN wget https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.3.tar.gz && \ + tar -xzf yaml-cpp-0.6.3.tar.gz && \ + cd yaml-cpp-yaml-cpp-0.6.3 && \ + mkdir build && cd build && \ + cmake -DYAML_BUILD_SHARED_LIBS=ON .. && \ + make -j$(nproc) && \ + make install && \ + ldconfig && \ + cd / && \ + rm -rf /tmp/yaml-cpp-* + +COPY . /cmake-exercise + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/main.cpp b/main.cpp index 7588360..08bc4a9 100644 --- a/main.cpp +++ b/main.cpp @@ -1,39 +1,39 @@ -//#include "fem/fem.hpp" -//#include "flatset/flatset.hpp" -//#include "filesystem/filesystem.hpp" -//#include "yamlParser/yamlParser.hpp" +#include "fem/fem.hpp" +#include "flatset/flatset.hpp" +#include "filesystem/filesystem.hpp" +#include "yamlParser/yamlParser.hpp" #include int main(int argc, char *argv[]) { std::cout << "Let's fight with CMake, Docker, and some dependencies!" << std::endl << std::endl; - //std::cout << "Solve Poisson problem with FEM using deal.II" << std::endl; - //Fem fem; - //fem.run(); - //std::cout << std::endl; + std::cout << "Solve Poisson problem with FEM using deal.II" << std::endl; + Fem fem; + fem.run(); + std::cout << std::endl; - //std::cout << "Modify a flat set using boost container" << std::endl; - //modifyAndPrintSets(); - //std::cout << std::endl; + std::cout << "Modify a flat set using boost container" << std::endl; + modifyAndPrintSets(); + std::cout << std::endl; - //std::cout << "Inspect the current directory using boost filesystem" << std::endl; - //inspectDirectory(); - //std::cout << std::endl; + std::cout << "Inspect the current directory using boost filesystem" << std::endl; + inspectDirectory(); + std::cout << std::endl; - //if ( argc == 2 ) - //{ - // const std::string yamlFile( argv[1] ); - // std::cout << "Parse some yaml file with yaml-cpp" << std::endl; - // std::cout << " " << yamlFile << std::endl; - // parseConfig( yamlFile ); - //} - //else - //{ - // std::cout << "To parse a yaml file please specify file on command line" << std::endl; - // std::cout << " ./main YAMLFILE" << std::endl; - //} + if ( argc == 2 ) + { + const std::string yamlFile( argv[1] ); + std::cout << "Parse some yaml file with yaml-cpp" << std::endl; + std::cout << " " << yamlFile << std::endl; + parseConfig( yamlFile ); + } + else + { + std::cout << "To parse a yaml file please specify file on command line" << std::endl; + std::cout << " ./main YAMLFILE" << std::endl; + } return 0; }