Skip to content

Commit 94ef8da

Browse files
author
Philipp Basler
committed
try through conan
1 parent 485e0a5 commit 94ef8da

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

.github/workflows/conan.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
- name: Install conan
3636
run: pip install conan>2
3737
- run: conan profile detect
38-
- run: conan create .
38+
- run: conan create . --build=missing

.github/workflows/windows_unit_tests.yml

+9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ jobs:
2929
- name: Get number of CPU cores
3030
uses: SimenB/github-actions-cpu-cores@v1
3131
id: cpu-cores
32+
33+
- run: conan install . --options enable_tests=True --build=boost/1.74.0
34+
- run: cmake --list-presets
35+
- run: cmake --preset conan-release
36+
- run: cmake --build --list-presets
37+
- run: cmake --build --preset conan-release -j${{ steps.cpu-cores.outputs.count }}
38+
- run: ctest --list-presets
39+
- run: ctest --preset conan-release
40+
3241
- name: cmake
3342
run: cmake -S . -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/conan_provider.cmake -DLIBCMAES_BUILD_PYTHON=On -DLIBCMAES_BUILD_TESTS=On -DLIBCMAES_USE_OPENMP=On -DCMAKE_BUILD_TYPE=Release
3443
- name: compile

conanfile.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ class CmaesConan(ConanFile):
2626
"shared": [True, False],
2727
"openmp": [True, False],
2828
"surrog": [True, False],
29+
"enable_tests": [True, False],
30+
}
31+
default_options = {
32+
"shared": True,
33+
"openmp": True,
34+
"surrog": True,
35+
"enable_tests": False,
36+
"boost/*:without_python": False,
2937
}
30-
default_options = {"shared": True, "openmp": True, "surrog": True}
3138

3239
# Sources are located in the same place as this recipe, copy them to the recipe
3340
exports_sources = (
@@ -40,7 +47,9 @@ class CmaesConan(ConanFile):
4047
)
4148

4249
def build_requirements(self):
43-
self.test_requires("gflags/2.2.2")
50+
if self.options.enable_tests:
51+
self.test_requires("gflags/2.2.2")
52+
self.test_requires("boost/1.74.0")
4453

4554
def requirements(self):
4655
self.requires("eigen/3.4.0", transitive_headers=True)
@@ -77,6 +86,8 @@ def generate(self):
7786
tc.variables["LIBCMAES_BUILD_SHARED_LIBS"] = self.options.shared
7887
tc.variables["LIBCMAES_USE_OPENMP"] = self.options.openmp
7988
tc.variables["LIBCMAES_ENABLE_SURROG"] = self.options.surrog
89+
tc.variables["LIBCMAES_BUILD_PYTHON"] = self.options.enable_tests
90+
tc.variables["LIBCMAES_BUILD_TESTS"] = self.options.enable_tests
8091
tc.generate()
8192

8293
def build(self):

0 commit comments

Comments
 (0)