Skip to content

Commit

Permalink
Merge pull request #6 from scipopt/hedtke-reduce-cmake-requirement
Browse files Browse the repository at this point in the history
Set minimum CMake version to 3.15.7
  • Loading branch information
hedtke authored Aug 10, 2023
2 parents 01f0fed + 5bf0534 commit 6e28f16
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
- name: Run Conan Install
run: |
conan profile detect
powershell -Command "(gc $(conan profile path default)) -replace 'compiler.cppstd=14', 'compiler.cppstd=17' | Out-File -encoding ASCII $(conan profile path default)"
conan install -of . -o with_tests=True .
- name: Run CMake
run: cmake --preset conan-default .
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.15.7)
project(ScipPP LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)

Expand Down
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] - [Doc:Unreleased]

## [1.0.1] - 2023-08-10

### Added

- [PR6](https://github.com/scipopt/SCIPpp/pull/6)
Added attributes `description`, `package_type`, `topics`, `license`, and `homepage` to `conanfile.py`.

### Fixed

- [PR6](https://github.com/scipopt/SCIPpp/pull/6)
Downgraded minimum CMake version from 3.16 to 3.15.7

## [1.0.0] - 2023-08-09

Initial release

[Doc:Unreleased]: https://scipopt.github.io/SCIPpp/
[Unreleased]: https://github.com/scipopt/SCIPpp
[1.0.1]: https://github.com/scipopt/SCIPpp/releases/tag/1.0.1
[1.0.0]: https://github.com/scipopt/SCIPpp/releases/tag/1.0.0
48 changes: 46 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,65 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.scm import Git
from conan.tools.microsoft import check_min_vs, is_msvc
from conan.tools.scm import Git, Version


class ScipPlusPlus(ConanFile):
name = "scippp"
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps"
exports_sources = "CMakeLists.txt", "source/*", "include/*"
description = "SCIP++ is a C++ wrapper for SCIP's C interface"
package_type = "library"
topics = ("mip", "solver", "linear", "programming")
license = "Apache-2.0"
homepage = "https://github.com/scipopt/SCIPpp"
options = {
"with_tests": [True, False]
"with_tests": [True, False],
"shared": [True, False],
"fPIC": [True, False]
}
default_options = {
"with_tests": False,
"shared": False,
"fPIC": True
}
_full_version: str = None

@property
def _min_cppstd(self):
return 17

@property
def _compilers_minimum_version(self):
return {
"gcc": "7",
"clang": "7",
"apple-clang": "10",
"msvc": "192"
}

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
check_min_vs(self, 192)
if not is_msvc(self):
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def set_version(self):
git = Git(self, folder=self.recipe_folder)
try:
Expand Down

0 comments on commit 6e28f16

Please sign in to comment.