[add] Add build instructions using a conan container

This commit is contained in:
Peter Sýkora 2021-12-21 19:56:10 +01:00
parent 3c4307bed4
commit effcff7947
2 changed files with 61 additions and 0 deletions

7
Dockerfile Normal file
View File

@ -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

54
README.md Normal file
View File

@ -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/
```