Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coin-utils: add v2.11.11, apply autoreconf, use OpenBLAS, add GLPK support #23532

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions recipes/coin-utils/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"2.11.11":
url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.11.tar.gz"
sha256: "27da344479f38c82112d738501643dcb229e4ee96a5f87d4f406456bdc1b2cb4"
"2.11.10":
url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.10.tar.gz"
sha256: "80c7c215262df8d6bd2ba171617c5df844445871e9891ec6372df12ccbe5bcfd"
Expand All @@ -13,22 +16,18 @@ sources:
sha256: "d4effff4452e73356eed9f889efd9c44fe9cd68bd37b608a5ebb2c58bd45ef81"
patches:
"2.11.10":
- patch_file: "patches/0001-no-check-pkgconfig.patch"
- patch_file: "patches/0003-cpp17-compat.patch"
patch_description: "C++17 compatibility"
patch_type: "portability"
"2.11.9":
- patch_file: "patches/0001-no-check-pkgconfig.patch"
- patch_file: "patches/0003-cpp17-compat.patch"
patch_description: "C++17 compatibility"
patch_type: "portability"
"2.11.6":
- patch_file: "patches/0001-no-check-pkgconfig.patch"
- patch_file: "patches/0002-cpp17-compat.patch"
patch_description: "C++17 compatibility"
patch_type: "portability"
"2.11.4":
- patch_file: "patches/0001-no-check-pkgconfig.patch"
- patch_file: "patches/0002-cpp17-compat.patch"
patch_description: "C++17 compatibility"
patch_type: "portability"
78 changes: 52 additions & 26 deletions recipes/coin-utils/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import shutil

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.apple import fix_apple_shared_install_name, is_apple_os
from conan.tools.build import cross_building
from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir
from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain
from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps
from conan.tools.layout import basic_layout
from conan.tools.microsoft import check_min_vs, is_msvc, unix_path
import os
Expand All @@ -28,10 +29,12 @@ class CoinUtilsConan(ConanFile):
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_glpk": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_glpk": True,
}

@property
Expand All @@ -55,22 +58,15 @@ def layout(self):
def requirements(self):
self.requires("bzip2/1.0.8")
self.requires("zlib/[>=1.2.11 <2]")
# TODO: add blas and lapack support

def validate(self):
if self.settings.os == "Windows" and self.options.shared:
raise ConanInvalidConfiguration("coin-utils does not provide a shared library on Windows")
# FIXME: This issue likely comes from very old autotools versions used to produce configure.
# It might be fixed by calling autoreconf, but https://github.com/coin-or-tools/BuildTools
# should be packaged and added to build requirements.
if hasattr(self, "settings_build") and cross_building(self) and self.options.shared:
raise ConanInvalidConfiguration("coin-utils shared not supported yet when cross-building")
self.requires("openblas/0.3.26")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.requires("openblas/0.3.26")
self.requires("openblas/0.3.27")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll handle this once the two prerequisite PRs have been merged.

if self.options.with_glpk:
self.requires("glpk/4.48") # v4.49+ are not supported due to dropped lpx_* functions

def build_requirements(self):
if is_msvc(self):
self.tool_requires("automake/1.16.5")
else:
self.tool_requires("gnu-config/cci.20210814")
self.tool_requires("coin-buildtools/0.8.11")
self.tool_requires("gnu-config/cci.20210814")
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/2.1.0")
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
Expand All @@ -82,13 +78,40 @@ def source(self):
def generate(self):
env = VirtualBuildEnv(self)
env.generate()

if not cross_building(self):
env = VirtualRunEnv(self)
env.generate(scope="build")

deps = PkgConfigDeps(self)
deps.generate()

def _add_pkg_config_alias(src_name, dst_name):
shutil.copy(os.path.join(self.generators_folder, f"{src_name}.pc"),
os.path.join(self.generators_folder, f"{dst_name}.pc"))

_add_pkg_config_alias("openblas", "coinblas")
_add_pkg_config_alias("openblas", "coinlapack")
if self.options.with_glpk:
_add_pkg_config_alias("glpk", "coinglpk")

tc = AutotoolsToolchain(self)
tc.configure_args.append("--without-blas")
tc.configure_args.append("--without-lapack")
tc.configure_args.extend([
# the coin*.pc pkg-config files are only used when set to BUILD
"--with-blas=BUILD",
"--with-lapack=BUILD",
"--with-glpk=BUILD" if self.options.with_glpk else "--without-glpk",
# These are only used for sample datasets
"--without-netlib",
"--without-sample",
])
if self.settings.os in ["Linux", "FreeBSD"]:
# enables compilation of thread aware CoinUtils
# requires pthreads and rt
tc.configure_args.append("--enable-coinutils-threads")
# TODO: maybe add as options
# tc.configure_args.append("--enable-coinutils-mempool-override-new")
# tc.configure_args.append("--enable-coinutils-mempool-maxpooled=value")
if is_msvc(self):
tc.configure_args.append(f"--enable-msvc={self.settings.compiler.runtime}")
tc.extra_cxxflags.append("-EHsc")
Expand Down Expand Up @@ -142,14 +165,17 @@ def generate(self):

def build(self):
apply_conandata_patches(self)
if not is_msvc(self):
for gnu_config in [
self.conf.get("user.gnu-config:config_guess", check_type=str),
self.conf.get("user.gnu-config:config_sub", check_type=str),
]:
if gnu_config:
copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder)
copy(self, "*", os.path.join(self.dependencies.build["coin-buildtools"].package_folder, "res"),
os.path.join(self.source_folder, "BuildTools"))
copy(self, "*", os.path.join(self.dependencies.build["coin-buildtools"].package_folder, "res"),
os.path.join(self.source_folder, "CoinUtils", "BuildTools"))
for gnu_config in [
self.conf.get("user.gnu-config:config_guess", check_type=str),
self.conf.get("user.gnu-config:config_sub", check_type=str),
]:
copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder)
autotools = Autotools(self)
autotools.autoreconf()
autotools.configure()
autotools.make()

Expand All @@ -171,6 +197,6 @@ def package_info(self):
self.cpp_info.includedirs.append(os.path.join("include", "coin"))
if not self.options.shared:
if self.settings.os in ("FreeBSD", "Linux"):
self.cpp_info.system_libs = ["m"]
self.cpp_info.system_libs = ["m", "pthread", "rt"]
if is_apple_os(self):
self.cpp_info.frameworks.append("Accelerate")
13 changes: 0 additions & 13 deletions recipes/coin-utils/all/patches/0001-no-check-pkgconfig.patch

This file was deleted.

2 changes: 2 additions & 0 deletions recipes/coin-utils/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"2.11.11":
folder: "all"
"2.11.10":
folder: "all"
"2.11.9":
Expand Down
Loading