-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
sleef: migrate to Conan v2 #18721
Merged
Merged
sleef: migrate to Conan v2 #18721
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
35680cc
sleef: migrate to Conan v2
valgur b8ecde3
sleef: add version cci.20210405
valgur 36b69dc
sleef: fix shared option
valgur 2abcfd2
sleef: rmdir dummy
valgur 170994b
sleef: armv8 cross-building is not supported
valgur 8fcbc08
sleef: cross-compilation to x86_64 is not supported either
valgur 4ef992f
sleef: armv8 is not supported either
valgur 2b11c1f
sleef: add v3.6, drop custom version
valgur 264530a
sleef: update options
valgur 9a40caa
sleef: use newer CMake
valgur a86faa1
sleef: restore apple-clang checks for v3.5
valgur fa16abc
sleef: cross-building is still broken
valgur abab162
Update recipes/sleef/all/conanfile.py
valgur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
sources: | ||
"3.6": | ||
url: "https://github.com/shibatch/sleef/archive/3.6.tar.gz" | ||
sha256: "de4f3d992cf2183a872cd397f517c1defcd3ee6cafa2ce5fa36963bd7e562446" | ||
"3.5.1": | ||
url: "https://github.com/shibatch/sleef/archive/3.5.1.tar.gz" | ||
sha256: "415ee9b1bcc5816989d3d4d92afd0cd3f9ee89cbd5a33eb008e69751e40438ab" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
|
||
required_conan_version = ">=1.32.0" | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import cross_building | ||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout | ||
from conan.tools.env import VirtualBuildEnv | ||
from conan.tools.files import copy, get, rmdir | ||
from conan.tools.scm import Version | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class SleefConan(ConanFile): | ||
name = "sleef" | ||
description = "SLEEF is a library that implements vectorized versions " \ | ||
"of C standard math functions." | ||
description = "SLEEF is a library that implements vectorized versions of C standard math functions." | ||
license = "BSL-1.0" | ||
topics = ("conan", "sleef", "vectorization", "simd") | ||
homepage = "https://sleef.org" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://sleef.org" | ||
topics = ("vectorization", "simd") | ||
|
||
package_type = "library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
|
@@ -24,75 +30,92 @@ class SleefConan(ConanFile): | |
"fPIC": True, | ||
} | ||
|
||
short_paths = True | ||
|
||
exports_sources = "CMakeLists.txt" | ||
generators = "cmake" | ||
_cmake = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
self.options.rm_safe("fPIC") | ||
self.settings.rm_safe("compiler.libcxx") | ||
self.settings.rm_safe("compiler.cppstd") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def validate(self): | ||
if self.settings.os == "Windows" and self.options.shared: | ||
raise ConanInvalidConfiguration("shared sleef not supported on Windows, it produces runtime errors") | ||
raise ConanInvalidConfiguration( | ||
"shared sleef not supported on Windows, it produces runtime errors" | ||
) | ||
if self.settings.compiler == "apple-clang": | ||
if cross_building(self): | ||
# Fails with "No rule to make target `/bin/mkrename'" | ||
# https://github.com/shibatch/sleef/issues/308 | ||
raise ConanInvalidConfiguration(f"{self.ref} does not support cross-building with apple-clang") | ||
if Version(self.version) < "3.6" and self.settings.arch == "armv8": | ||
# clang: error: the clang compiler does not support '-march=armv7-a' | ||
# clang: warning: argument unused during compilation: '-mfpu=vfpv4' [-Wunused-command-line-argument] | ||
# clang: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument] | ||
# clang: warning: argument unused during compilation: '-mmacosx-version-min=11.0' [-Wunused-command-line-argument] | ||
raise ConanInvalidConfiguration(f"{self.ref} does not support Mac M1. Please, use {self.name} version >=3.6.") | ||
|
||
def build_requirements(self): | ||
if Version(self.version) >= "3.6": | ||
self.tool_requires("cmake/[>=3.18 <4]") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename(self.name + "-" + self.version, self._source_subfolder) | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
self._cmake = CMake(self) | ||
self._cmake.definitions["BUILD_STATIC_TEST_BINS"] = False | ||
self._cmake.definitions["ENABLE_LTO"] = False | ||
self._cmake.definitions["BUILD_LIBM"] = True | ||
self._cmake.definitions["BUILD_DFT"] = False | ||
self._cmake.definitions["BUILD_QUAD"] = False | ||
self._cmake.definitions["BUILD_GNUABI_LIBS"] = False | ||
self._cmake.definitions["BUILD_TESTS"] = False | ||
self._cmake.definitions["BUILD_INLINE_HEADERS"] = False | ||
self._cmake.definitions["SLEEF_TEST_ALL_IUT"] = False | ||
self._cmake.definitions["SLEEF_SHOW_CONFIG"] = True | ||
self._cmake.definitions["SLEEF_SHOW_ERROR_LOG"] = False | ||
self._cmake.definitions["ENFORCE_TESTER"] = False | ||
self._cmake.definitions["ENFORCE_TESTER3"] = False | ||
self._cmake.definitions["ENABLE_ALTDIV"] = False | ||
self._cmake.definitions["ENABLE_ALTSQRT"] = False | ||
self._cmake.definitions["DISABLE_FFTW"] = True | ||
self._cmake.configure(build_folder=self._build_subfolder) | ||
return self._cmake | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
VirtualBuildEnv(self).generate() | ||
|
||
tc = CMakeToolchain(self) | ||
tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared | ||
if Version(self.version) >= "3.6": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some options changed in 3.6, including for testing. Please, check in the new release. |
||
tc.cache_variables["SLEEF_BUILD_STATIC_TEST_BINS"] = False | ||
tc.cache_variables["SLEEF_BUILD_LIBM"] = True | ||
tc.cache_variables["SLEEF_BUILD_DFT"] = False | ||
tc.cache_variables["SLEEF_BUILD_QUAD"] = False | ||
tc.cache_variables["SLEEF_BUILD_GNUABI_LIBS"] = False | ||
tc.cache_variables["SLEEF_BUILD_SCALAR_LIB"] = False | ||
tc.cache_variables["SLEEF_BUILD_TESTS"] = False | ||
tc.cache_variables["SLEEF_BUILD_INLINE_HEADERS"] = False | ||
tc.cache_variables["SLEEF_SHOW_CONFIG"] = True | ||
tc.cache_variables["SLEEF_SHOW_ERROR_LOG"] = False | ||
tc.cache_variables["SLEEF_ENABLE_ALTDIV"] = False | ||
tc.cache_variables["SLEEF_ENABLE_ALTSQRT"] = False | ||
tc.cache_variables["SLEEF_DISABLE_FFTW"] = True | ||
tc.cache_variables["SLEEF_DISABLE_MPFR"] = True | ||
tc.cache_variables["SLEEF_DISABLE_SSL"] = True | ||
tc.cache_variables["SLEEF_ENABLE_CUDA"] = False | ||
tc.cache_variables["SLEEF_ENABLE_CXX"] = False | ||
else: | ||
tc.cache_variables["BUILD_DFT"] = False | ||
tc.cache_variables["BUILD_GNUABI_LIBS"] = False | ||
tc.cache_variables["BUILD_TESTS"] = False | ||
tc.cache_variables["DISABLE_FFTW"] = True | ||
tc.generate() | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) | ||
cmake = self._configure_cmake() | ||
copy(self, "LICENSE.txt", | ||
dst=os.path.join(self.package_folder, "licenses"), | ||
src=self.source_folder) | ||
cmake = CMake(self) | ||
cmake.install() | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
rmdir(self, os.path.join(self.package_folder, "dummy")) | ||
|
||
def package_info(self): | ||
self.cpp_info.names["pkg_config"] = "sleef" | ||
self.cpp_info.set_property("pkg_config_name", "sleef") | ||
self.cpp_info.libs = ["sleef"] | ||
if self.settings.os == "Windows" and not self.options.shared: | ||
self.cpp_info.defines = ["SLEEF_STATIC_LIBS"] | ||
if self.settings.os == "Linux": | ||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs = ["m"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(sleef REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE sleef::sleef) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
versions: | ||
"3.6": | ||
folder: all | ||
"3.5.1": | ||
folder: all |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that it does not work in 3.6 too.