Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
abeimler committed Jan 5, 2023
1 parent eaf8a0c commit 13d074e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.ci-setup-cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RUN chmod +x /setup_cpp_linux
RUN /setup_cpp_linux --compiler llvm --gcc true --make true --cmake true --ninja true --ccache true --doxygen true --gcovr true --cppcheck true --clangtidy true --clangformat true --conan true --task true
RUN rm -rf /tmp/*
RUN echo 'source /root/.cpprc' >> /root/.bash_profile
#RUN cp /root/.cpprc /root/.bashrc
RUN cp /root/.cpprc /root/.bashrc

# Install more tools from standard repos
RUN apt-get update -y && \
Expand Down Expand Up @@ -80,7 +80,7 @@ ARG setup_env_script_args=""
ENV SETUP_ENV_SCRIPT $setup_env_script
ENV SETUP_ENV_SCRIPT_ARGS $setup_env_script_args
RUN echo 'source "$SETUP_ENV_SCRIPT $SETUP_ENV_SCRIPT_ARGS"' >> /root/.bash_profile
RUN bash -c 'source $setup_env_script $setup_env_script_args'
RUN . $setup_env_script $setup_env_script_args

# setup project env
WORKDIR /home/project
Expand Down
53 changes: 40 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Simple C++ Builder with compilers, buildtools and dependency manager.
## Features

- Pre-installed Compilers and Tools
- Ready to use build scripts ([docker-build.sh](https://github.com/abeimler/simple-cppbuilder/blob/main/scripts/docker-build.sh) and [docker-test.sh](https://github.com/abeimler/simple-cppbuilder/blob/main/scripts/docker-test.sh))
- Ready to use ~~build scripts ([docker-build.sh](https://github.com/abeimler/simple-cppbuilder/blob/main/scripts/docker-build.sh) and [docker-test.sh](https://github.com/abeimler/simple-cppbuilder/blob/main/scripts/docker-test.sh))~~ [Taskfiles](https://github.com/abeimler/simple-cppbuilder/blob/main/taskfiles/TaskfileDefault.sh)

## What's included

Expand All @@ -32,11 +32,11 @@ You can find a full C++ project example [here](https://github.com/abeimler/simpl
## build stage
FROM abeimler/simple-cppbuilder as build
COPY . .
CMD ["./docker-build.sh"]
CMD ["task", "-t", "/home/taskfiles/Taskfile.yml", "build"]

## test stage
FROM build as test
CMD ["./docker-test.sh"]
CMD ["task", "-t", "/home/taskfiles/Taskfile.yml", "test"]
```

2. Build and run the Docker image:
Expand Down Expand Up @@ -141,7 +141,7 @@ RUN pacman-db-upgrade && pacman -S --noconfirm \
# build stage
FROM base as build
COPY . .
CMD ["./docker-build.sh"]
CMD ["task", "-t", "/home/taskfiles/Taskfile.yml", "build"]
```

### Dockerfile using AUR
Expand Down Expand Up @@ -206,18 +206,43 @@ services:
$ docker-compose up --build
```

### Use your custom build script
### ~~Use your custom build script~~ Better use a [Taskfile](https://taskfile.dev/usage/)

#### `my-build.sh`
#### ~~`my-build.sh`~~

```bash
#!/bin/bash
#### `Taskfile.yml`

mkdir build
cd build
cmake -G "Ninja" -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=arm -DCMAKE_C_COMPILER=clang -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_TARGET=arm-linux-gnueabihf ..
```yml
---
version: "3"

vars:
PROJECT_DIR: '{{.PROJECT_DIR | default "."}}'
TARGET: '{{.TARGET | default "all"}}'
CMAKE_GENERATOR: '{{.CMAKE_GENERATOR | default "Ninja Multi-Config"}}'
BUILD_TYPE: '{{.BUILD_TYPE | default "Release"}}'

tasks:
configure:
dir: '{{.PROJECT_DIR}}'
cmds:
- >
cmake -B build -S . -G "{{.CMAKE_GENERATOR}}" \
-DCMAKE_BUILD_TYPE="{{.BUILD_TYPE}}" \
{{.CMAKE_ARGS}}
build:
dir: '{{.PROJECT_DIR}}'
cmds:
- task: configure
- 'cmake --build build --target "{{.TARGET}}"'

test:
dir: '{{.PROJECT_DIR}}'
cmds:
- task: build
- ctest --build-test --test-dir build

make my-app -j 4
```

#### `Dockerfile`
Expand All @@ -229,7 +254,8 @@ FROM abeimler/simple-cppbuilder as base
# build stage
FROM base as build
COPY . .
CMD ["./my-build.sh"]
#CMD ["./my-build.sh"]
CMD ["task", "build"]
```

#### `docker-compose.yml`
Expand Down Expand Up @@ -365,5 +391,6 @@ As for any pre-built image usage, it is the image user's responsibility to ensur
- [simple-cppbuilder DockerHub](https://hub.docker.com/r/abeimler/simple-cppbuilder)
- [simple-cppbuilder GitHub](https://github.com/abeimler/simple-cppbuilder)
- [cpp_starter_project](https://github.com/lefticus/cpp_starter_project)
- [cpp_vcpkg_project](https://github.com/abeimler/cpp_vcpkg_project/tree/v2)
- [cppdock](https://github.com/ricejasonf/cppdock)
- Icon made by [me](https://hub.docker.com/u/abeimler) using C++-Icon made by [Freepik](https://www.freepik.com) from [Flaticon](https://www.flaticon.com/)
3 changes: 1 addition & 2 deletions taskfiles/docker/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ tasks:
#- docker build --force-rm=true -f ./Dockerfile.gcc --build-arg gcc_version=5 -t abeimler/simple-cppbuilder:gcc-5 .
#- docker build --force-rm=true -f ./Dockerfile.gcc --build-arg gcc_version=49 -t abeimler/simple-cppbuilder:gcc-4.9 .


all:
default:
- task: base
- task: base:libs
- task: ci
Expand Down
16 changes: 15 additions & 1 deletion taskfiles/docker/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,18 @@ tasks:

gcc:
- container-structure-test test --image abeimler/simple-cppbuilder:gcc-10 --config tests/gcc10-test.yaml
- container-structure-test test --image abeimler/simple-cppbuilder:gcc-9 --config tests/gcc9-test.yaml
- container-structure-test test --image abeimler/simple-cppbuilder:gcc-9 --config tests/gcc9-test.yaml

default:
- task: base
- task: clang
- task: single
#- task: cpp_starter_project
- task: ci
- task: emscripten
- task: mingw
#- task: android
#- task: arm:rpi
#- task: rpi
#- task: mingw:mxe
#- task: gcc

0 comments on commit 13d074e

Please sign in to comment.