Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize Conan and CMake usage #20

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Modernize Conan and CMake usage
  • Loading branch information
valgur committed Dec 20, 2023
commit 56e9a5e75187c43cc0d55ceff328afc1a4065b3f
16 changes: 5 additions & 11 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,14 @@ jobs:
- name: Create default profile
run: conan profile detect


- name: install dependencies
run: conan install . --output-folder=build --build=missing --settings=build_type=${{env.BUILD_TYPE}}


run: conan install . --build=missing --settings=build_type=${{env.BUILD_TYPE}}

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_TEST_COVERAGE=1 -DCMAKE_PREFIX_PATH=${{github.workspace}}/build
run: cmake -S . --preset conan-${BUILD_TYPE,,} -DENABLE_TEST_COVERAGE=1

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build --preset conan-${BUILD_TYPE,,}

- name: Test
working-directory: ${{github.workspace}}/build/test
run: ./tests



run: ctest --preset conan-${BUILD_TYPE,,}
9 changes: 4 additions & 5 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,17 @@ jobs:
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH

- name: install dependencies
run: conan install . --output-folder=build --build=missing --settings=build_type=${{env.BUILD_TYPE}}
run: conan install . --build=missing --settings=build_type=${{env.BUILD_TYPE}}


- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_TEST_COVERAGE=1 -G Ninja -DCMAKE_PREFIX_PATH=${{github.workspace}}/build
run: cmake -S . --preset conan-${BUILD_TYPE,,} -DENABLE_TEST_COVERAGE=1 -G Ninja

- name: Build with sonnar wrapper
run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j10
run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset conan-${BUILD_TYPE,,} -j10

- name: Test
working-directory: ${{github.workspace}}/build/test
run: ./tests
run: ctest --preset conan-${BUILD_TYPE,,}

- name: Coverage
run: find . -name '*.gcda' | xargs gcov
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ jobs:
run: conan profile detect

- name: install dependencies
run: conan install . --output-folder=build --build=missing --settings=build_type=${{env.BUILD_TYPE}}
run: conan install . --build=missing --settings=build_type=${{env.BUILD_TYPE}}

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_PREFIX_PATH=${{github.workspace}}/build
run: cmake -S . --preset conan-${BUILD_TYPE,,}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j10
run: cmake --build --preset conan-${BUILD_TYPE,,} -j10

- name: Test
working-directory: ${{github.workspace}}/build/test
run: |
.\Release\tests.exe
run: ctest --preset conan-${BUILD_TYPE,,}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ The installation files include the `UnleashConfig.cmake` to integrate this libra
To build unleash client with conan and CMake run the following commands:

```
conan install . --output-folder=build --build=missing --settings=build_type=Debug
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$(pwd)/build
cmake --build build
conan install . --build=missing --settings=build_type=Debug
cmake -S . --preset conan-debug
cmake --build --preset conan-debug
ctest --preset conan-debug
```

Substitute `Debug` for `Release` to build the release version. The `CMAKE_PREFIX_PATH` and `--output-folder` parameters should point to the same directory, make sure to use an absolute path for the `CMAKE_PREFIX_PATH`.
Expand Down
10 changes: 8 additions & 2 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[requires]
cpr/1.10.5
nlohmann_json/3.11.3

[test_requires]
gtest/cci.20210126
cpr/1.7.2
nlohmann_json/3.10.5

[generators]
CMakeToolchain
CMakeDeps

[layout]
cmake_layout