Skip to content

Commit b0d581a

Browse files
committed
Use cmake presets on conan builds
1 parent ad3b950 commit b0d581a

File tree

4 files changed

+22
-37
lines changed

4 files changed

+22
-37
lines changed

.github/workflows/cmake_ubuntu.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,19 @@ jobs:
3232
- name: Create default profile
3333
run: conan profile detect
3434

35-
- name: Create Build Environment
36-
# Some projects don't allow in-source building, so create a separate build directory
37-
# We'll use this as our working directory for all subsequent commands
38-
run: cmake -E make_directory ${{github.workspace}}/build
39-
4035
- name: Install conan dependencies
41-
working-directory: ${{github.workspace}}/build
42-
run: conan install ${{github.workspace}}/conanfile.py -s build_type=${{env.BUILD_TYPE}} --build=missing
36+
run: conan install conanfile.py -s build_type=${{env.BUILD_TYPE}} --build=missing
4337

4438
- name: Configure CMake
4539
shell: bash
46-
working-directory: ${{github.workspace}}/build
47-
run: cmake ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${{env.BUILD_TYPE}}/generators/conan_toolchain.cmake
40+
run: cmake --preset conan-${{ toLower(env.BUILD_TYPE) }}
4841

4942
- name: Build
5043
shell: bash
51-
working-directory: ${{github.workspace}}/build
52-
run: cmake --build . --config ${{env.BUILD_TYPE}}
44+
run: cmake --build --preset conan-${{ toLower(env.BUILD_TYPE) }}
5345

5446
- name: run test (Linux)
55-
working-directory: ${{github.workspace}}/build/tests
56-
run: ctest
47+
run: ctest --test-dir build/${{env.BUILD_TYPE}}
5748

5849
- name: Upload coverage reports to Codecov
5950
uses: codecov/codecov-action@v3

.github/workflows/cmake_windows.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,17 @@ jobs:
3232
- name: Create default profile
3333
run: conan profile detect
3434

35-
- name: Create Build Environment
36-
# Some projects don't allow in-source building, so create a separate build directory
37-
# We'll use this as our working directory for all subsequent commands
38-
run: cmake -E make_directory ${{github.workspace}}/build
39-
4035
- name: Install conan dependencies
41-
working-directory: ${{github.workspace}}/build
42-
run: conan install ${{github.workspace}}/conanfile.py -s build_type=${{env.BUILD_TYPE}} --build=missing
36+
run: conan install conanfile.py -s build_type=${{env.BUILD_TYPE}} --build=missing
4337

4438
- name: Configure CMake
4539
shell: bash
46-
working-directory: ${{github.workspace}}/build
47-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake
40+
run: cmake --preset conan-${{ toLower(env.BUILD_TYPE) }}
4841

4942
- name: Build
50-
working-directory: ${{github.workspace}}/build
5143
shell: bash
52-
run: cmake --build . --config ${{env.BUILD_TYPE}}
44+
run: cmake --build --preset conan-${{ toLower(env.BUILD_TYPE) }}
5345

5446
- name: run test (Windows)
55-
working-directory: ${{github.workspace}}/build
47+
working-directory: ${{github.workspace}}/build/${{env.BUILD_TYPE}}
5648
run: $env:PATH+=";${{env.BUILD_TYPE}}"; tests/${{env.BUILD_TYPE}}/behaviortree_cpp_test.exe

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ Three build systems are supported:
6161

6262
Compiling with [conan](https://conan.io/):
6363

64+
> [!NOTE]
65+
> Conan builds require CMake 3.23 or newer.
66+
6467
Assuming that you are in the **root** directory of `BehaviorTree.CPP`:
6568

6669
```
67-
mkdir build_release
68-
conan install . -of build_release -s build_type=Release --build=missing
69-
cmake -S . -B build_release -DCMAKE_TOOLCHAIN_FILE="build_release/build/Release/generators/conan_toolchain.cmake"
70-
cmake --build build_release --parallel
70+
conan install . -s build_type=Release --build=missing
71+
cmake --preset conan-release
72+
cmake --build --preset conan-release
7173
```
7274

7375
If you have dependencies such as ZeroMQ and SQlite already installed and you don't want to

conanfile.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ def requirements(self):
2626
def generate(self):
2727
tc = CMakeToolchain(self)
2828

29-
#tc.variables["USE_VENDORED_CPPSQLITE"] = False
30-
tc.variables["USE_VENDORED_CPPZMQ"] = False
31-
tc.variables["USE_VENDORED_FLATBUFFERS"] = False
32-
#tc.variables["USE_VENDORED_LEXY"] = False
33-
tc.variables["USE_VENDORED_MINICORO"] = False
34-
tc.variables["USE_VENDORED_MINITRACE"] = False
35-
tc.variables["USE_VENDORED_TINYXML2"] = False
36-
#tc.variables["USE_VENDORED_WILDCARDS"] = False
29+
#tc.cache_variables["USE_VENDORED_CPPSQLITE"] = False
30+
tc.cache_variables["USE_VENDORED_CPPZMQ"] = False
31+
tc.cache_variables["USE_VENDORED_FLATBUFFERS"] = False
32+
#tc.cache_variables["USE_VENDORED_LEXY"] = False
33+
tc.cache_variables["USE_VENDORED_MINICORO"] = False
34+
tc.cache_variables["USE_VENDORED_MINITRACE"] = False
35+
tc.cache_variables["USE_VENDORED_TINYXML2"] = False
36+
#tc.cache_variables["USE_VENDORED_WILDCARDS"] = False
3737
tc.generate()
3838

3939
deps = CMakeDeps(self)

0 commit comments

Comments
 (0)