Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
(conan-io#23114) mathter: add new version: 1.1.0
Browse files Browse the repository at this point in the history
* update recipe to v1.1.0 with xsimd optional dependency

* fix empty YAML blocks with explicit empty dict

* yaml linter

* add v1.1.0 to config.yml

* move dependencies into python file

* linter

* print XSimd option

* Improve xsimd option handling

* update package options for compiler definitions

---------

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
  • Loading branch information
2 people authored and ericLemanissier committed Apr 16, 2024
1 parent 40453ce commit a1a3b81
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions recipes/mathter/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.1.0":
url: "https://github.com/petiaccja/Mathter/archive/v1.1.0.tar.gz"
sha256: "a9a82126ecd80112854098a5646d38f72f0af03e9655b28ab8fa38b4c03b0870"
"1.0.1":
url: "https://github.com/petiaccja/Mathter/archive/v1.0.1.tar.gz"
sha256: "ab90736abfa8774103b53fe2b8962981c5f117dc582b01698c18d66cd2398b8c"
Expand Down
16 changes: 16 additions & 0 deletions recipes/mathter/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class MathterConan(ConanFile):

package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
options = {
"with_xsimd": [True, False] # XSimd is optionally used for hand-rolled vectorization.
}
default_options = {
"with_xsimd": True
}
no_copy_source = True

@property
Expand All @@ -34,6 +40,10 @@ def _compilers_minimum_version(self):
"gcc": 7,
"Visual Studio": 16,
}

def config_options(self):
if Version(self.version) < "1.1":
del self.options.with_xsimd

def layout(self):
basic_layout(self, src_folder="src")
Expand All @@ -53,6 +63,10 @@ def validate(self):
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def requirements(self):
if self.options.get_safe("with_xsimd"):
self.requires("xsimd/11.1.0")

def package(self):
if self.version == "1.0.0":
copy(self, "LICENCE", self.source_folder, os.path.join(self.package_folder, "licenses"))
Expand All @@ -66,3 +80,5 @@ def package(self):
def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
if self.options.get_safe("with_xsimd"):
self.cpp_info.defines = ["MATHTER_USE_XSIMD=1"]
5 changes: 5 additions & 0 deletions recipes/mathter/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@ int main() {
Vec3 v2 = {2, 5, 3};
auto r = v1 + v2;
std::cout << "Mathter installation works." << std::endl;
#ifdef MATHTER_USE_XSIMD
std::cout << "XSimd enabled." << std::endl;
#else
std::cout << "XSimd disabled." << std::endl;
#endif
return 0;
}
2 changes: 2 additions & 0 deletions recipes/mathter/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.1.0":
folder: all
"1.0.1":
folder: all
"1.0.0":
Expand Down

0 comments on commit a1a3b81

Please sign in to comment.