Skip to content

Add building and container recipes#20

Closed
D4rkDuck wants to merge 2 commits intoSimulation-Software-Engineering:mainfrom
D4rkDuck:cmake-with-cpp
Closed

Add building and container recipes#20
D4rkDuck wants to merge 2 commits intoSimulation-Software-Engineering:mainfrom
D4rkDuck:cmake-with-cpp

Conversation

@D4rkDuck
Copy link
Copy Markdown

Gitlab Username: luxik
Instructions to run the project can be found in the readme, but I will include it here aswell:

Instructions

The imageName has to be chosen! ("cmakeFight" could be a fitting name)

  1. Build the image via (getting all dependencies will take some time)
docker buildx build -t <imageName> .
  1. Run the container
docker run -it --mount type=bind,src=.,dst=/mnt/host/cmake-exercise <imageName>
  1. Change directory into the repo
cd cmake-exercise
  1. Run the shell script (build folder should not exist beforehand!)
./build_and_run.sh

Expected output:

Let's fight with CMake, Docker, and some dependencies!

Solve Poisson problem with FEM using deal.II
FEM results available in `solution.vtk`. Try visualizing with Paraview.

Modify a flat set using boost container
Elements in s1: 1       2       3       4

Inspect the current directory using boost filesystem
"." is a directory containing:
    "CMakeCache.txt"
    "CMakeFiles"
    "Makefile"
    "cmake_install.cmake"
    "main"
    "solution.vtk"

Parse some yaml file with yaml-cpp
  ../yamlParser/config.yml
Version: 1.2.3

Copy link
Copy Markdown

@MakisH MakisH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks mostly good here and works, thanks! Just some minor comments, which are not affecting functionality in this case, but would be something to note for next projects.

Comment thread Dockerfile
Comment on lines +10 to +11
RUN apt install -y libboost-all-dev
Run apt install -y libdeal.ii-dev
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While uppercase/lowercase does not matter, I would stick to one (typically uppercase in Dockerfiles). Similarly for CMake (lowercase).

Comment thread Dockerfile
Run wget https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.zip
Run unzip yaml-cpp-0.6.3.zip
RUN cd yaml-cpp-yaml-cpp-0.6.3 && mkdir build && cd build && cmake .. && make && make install
ENV LD_LIBRARY_PATH = /usr/local/bin
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This leads to the = being part of the value:

root@22cc76132608:/mnt/host# echo $LD_LIBRARY_PATH 
= /usr/local/bin

Use either ENV var=value or the legacy ENV var value.

By the way, the value should be /usr/local/lib, since it is a library.

Comment thread CMakeLists.txt
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION "3.12")

project("main")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this can also be different from the name of the executable (and is typically something more descriptive).

Comment thread Dockerfile
RUN cd yaml-cpp-yaml-cpp-0.6.3 && mkdir build && cd build && cmake .. && make && make install
ENV LD_LIBRARY_PATH = /usr/local/bin

WORKDIR mnt/host
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WORKDIR paths should be absolute, but this worked.

@MakisH MakisH closed this Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants