diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 124529ea..13a4601a 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -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 diff --git a/.github/workflows/windows_unit_tests.yml b/.github/workflows/windows_unit_tests.yml index b4d131ee..c9b708bf 100644 --- a/.github/workflows/windows_unit_tests.yml +++ b/.github/workflows/windows_unit_tests.yml @@ -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 diff --git a/conanfile.py b/conanfile.py index 19369bbf..c218b13a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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 = ( @@ -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) @@ -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):