Skip to content

Commit

Permalink
Replace makefile by cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelkn committed Mar 16, 2023
1 parent 035e45e commit dafade1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
.vscode
.github
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.14)
project(rainflow)

include_directories(src)

add_executable(example_rainflow src/rainflow.cpp example/example_rainflow.cpp)
add_executable(test_rainflow src/rainflow.cpp test/test_rainflow.cpp)

target_link_libraries(test_rainflow gtest gtest_main pthread)
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ FROM ubuntu:latest
WORKDIR /usr/src/app

RUN apt-get update; \
apt-get install -y --no-install-recommends make g++ libgtest-dev; \
apt-get install -y --no-install-recommends make g++ libgtest-dev cmake; \
rm -rf /var/lib/apt/lists/*

COPY . .

RUN make
RUN cmake -S . -B build; \
cmake --build build

CMD [ "build/example_rainflow", "example/samples.txt" ]
33 changes: 0 additions & 33 deletions Makefile

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ docker run --rm rainflow
or locally:

```sh
make
cmake -S . -B build
cmake --build build
build/example_rainflow example/samples.txt
```

Expand All @@ -93,13 +94,15 @@ Build and run unit tests using `docker`:

```sh
docker build -t rainflow .
docker run --rm rainflow make test
docker run --rm rainflow build/test_rainflow
```

or locally:

```sh
make test
cmake -S . -B build
cmake --build build
build/test_rainflow
```

To run tests locally the [GoogleTest](https://github.com/google/googletest) library is required. Under linux it can be installed via package manager eg.:
Expand Down

0 comments on commit dafade1

Please sign in to comment.