Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.16)
project(cmake_exercise)

set(CMAKE_CXX_STANDARD 17)

add_executable(main
main.cpp
flatset/flatset.cpp
filesystem/filesystem.cpp
fem/fem.cpp
yamlParser/yamlParser.cpp
)

# --- BOOST ---
find_package(Boost REQUIRED COMPONENTS filesystem)
target_link_libraries(main Boost::filesystem)

# --- DEAL.II ---
find_package(deal.II REQUIRED)
deal_ii_initialize_cached_variables()
deal_ii_setup_target(main)

# --- YAML.CPP ---
find_package(yaml-cpp 0.6.3 REQUIRED)
target_link_libraries(main yaml-cpp)
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM ubuntu:24.04

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
wget \
unzip \
vim \
git \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

# Install Boost libraries
RUN apt-get update && apt-get install -y --no-install-recommends \
libboost-all-dev \
&& rm -rf /var/lib/apt/lists/*

# Install deal.II
RUN apt-get update && apt-get install -y --no-install-recommends \
libdeal.ii-dev \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /tmp

# Install yaml-cpp v0.6.3 from source
RUN wget https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.zip -O yaml-cpp.zip \
&& unzip yaml-cpp.zip \
&& mv yaml-cpp-yaml-cpp-0.6.3 yaml-cpp

# Build and install yaml-cpp
WORKDIR /tmp/yaml-cpp
RUN mkdir build && cd build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release \
&& make -j$(nproc) \
&& make install

ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

WORKDIR /cmake-exercise

COPY . /cmake-exercise

RUN mkdir build && cd build \
&& cmake .. \
&& make -j$(nproc)

CMD ["/bin/bash"]
52 changes: 26 additions & 26 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -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 <iostream>

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;
}