From effcff79470ad9bf8c28e227d8a7e65f3be40074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=C3=BDkora?= Date: Tue, 21 Dec 2021 19:56:10 +0100 Subject: [PATCH] [add] Add build instructions using a conan container --- Dockerfile | 7 +++++++ README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fc3f7c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM docker.io/conanio/gcc7 + +RUN wget https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-linux-x86_64.sh && sh ./cmake-3.22.1-linux-x86_64.sh --prefix=/home/conan/opt --include-subdir --skip-license && rm cmake-3.22.1-linux-x86_64.sh +RUN mkdir /home/conan/bin/ +RUN ln -s /home/conan/opt/cmake-3.22.1-linux-x86_64/bin/cmake /home/conan/bin/cmake + +WORKDIR /home/conan/project diff --git a/README.md b/README.md new file mode 100644 index 0000000..e466059 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +## Building + +### Prepare build container + +Build an image according to Dockerfile description: +```bash +podman build -t ccengineserver-builder . +``` + +Create the image, but do not start it yet: +```bash +podman create --security-opt label=disable -v /tmp/CCEngineServer:/home/conan/project --name=ccengineserver_builder -it localhost/ccengineserver-builder +``` + +Clone or copy the necessary source files into `/tmp/CCEngineServer`. As you can check this folder will be mapped into the container as /home/conan/project + +Example: +```bash +cd /tmp/CCEngineServer +git clone git@git.sykora.xyz:/srv/git/CCEngineServer.git . +``` + +Attach the container: +```bash +podman start --attach -i ccengineserver_builder +``` + +Run build in the container: +```bash +cd ~ +source .profile +cd project +sudo mkdir out +sudo chown conan:1001 out +cmake --preset="linux-gcc-release" +cmake --build --preset="linux-gcc-release" +strip --strip-all out/build/linux-gcc-release/CCEngineServer/bin/CCEngineServer +``` + +### Note + +If there is comilation issue about non existing `std::aligned_alloc` with the gcc version you are using, you can fix that with the below example: + +``` +sed -i 's/std::aligned_alloc/::aligned_alloc/' /home/conan/.conan/data/boost/1.77.0/_/_/package/cfef62e446e1bb07894de4523f2649afdfa94524/include/boost/asio/detail/memory.hpp +``` + +Copy the build results into below directory +```bash +mkdir ~/CCEngineServer-BuildResult +mkdir ~/CCEngineServer-BuildResult/data +mkdir ~/CCEngineServer-BuildResult/log +cp -r /tmp/CCEngineServer/out/build/linux-gcc-release/CCEngineServer/bin ~/CCEngineServer-BuildResult/ +``` \ No newline at end of file