Skip to content

Commit

Permalink
try through conan
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Basler committed Jun 1, 2024
1 parent 485e0a5 commit 94ef8da
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
- name: Install conan
run: pip install conan>2
- run: conan profile detect
- run: conan create .
- run: conan create . --build=missing
9 changes: 9 additions & 0 deletions .github/workflows/windows_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ jobs:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores

- run: conan install . --options enable_tests=True --build=boost/1.74.0
- run: cmake --list-presets
- run: cmake --preset conan-release
- run: cmake --build --list-presets
- run: cmake --build --preset conan-release -j${{ steps.cpu-cores.outputs.count }}
- run: ctest --list-presets
- run: ctest --preset conan-release

- name: cmake
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
- name: compile
Expand Down
15 changes: 13 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ class CmaesConan(ConanFile):
"shared": [True, False],
"openmp": [True, False],
"surrog": [True, False],
"enable_tests": [True, False],
}
default_options = {
"shared": True,
"openmp": True,
"surrog": True,
"enable_tests": False,
"boost/*:without_python": False,
}
default_options = {"shared": True, "openmp": True, "surrog": True}

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

def build_requirements(self):
self.test_requires("gflags/2.2.2")
if self.options.enable_tests:
self.test_requires("gflags/2.2.2")
self.test_requires("boost/1.74.0")

def requirements(self):
self.requires("eigen/3.4.0", transitive_headers=True)
Expand Down Expand Up @@ -77,6 +86,8 @@ def generate(self):
tc.variables["LIBCMAES_BUILD_SHARED_LIBS"] = self.options.shared
tc.variables["LIBCMAES_USE_OPENMP"] = self.options.openmp
tc.variables["LIBCMAES_ENABLE_SURROG"] = self.options.surrog
tc.variables["LIBCMAES_BUILD_PYTHON"] = self.options.enable_tests
tc.variables["LIBCMAES_BUILD_TESTS"] = self.options.enable_tests
tc.generate()

def build(self):
Expand Down

0 comments on commit 94ef8da

Please sign in to comment.