-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#25307) mathter: add new version 2.0.0
* added new version mathter/2.0.0 * include conan 1.x * fix license and cmake config * require gcc 9 as older ones don't have c++17 std::reduce
- Loading branch information
Showing
11 changed files
with
214 additions
and
45 deletions.
There are no files selected for viewing
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,13 @@ | ||
sources: | ||
"1.1.1": | ||
url: "https://github.com/petiaccja/Mathter/archive/v1.1.1.tar.gz" | ||
sha256: "510e6aa198cd7b207a44d319e4471021f207cba8c4d2d7e40086f1f042fe13ab" | ||
"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" | ||
"1.0.0": | ||
url: "https://github.com/petiaccja/Mathter/archive/v1.0.0.tar.gz" | ||
sha256: "c75cca8d8aec627935250908f2c0f9f1839561e7596a4199bcf80e12b0e6c53b" |
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,84 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.files import copy, get | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.scm import Version | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
|
||
class MathterConan(ConanFile): | ||
name = "mathter" | ||
description = "Powerful 3D math and small-matrix linear algebra library for games and science." | ||
license = "MIT" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/petiaccja/Mathter" | ||
topics = ("game-dev", "linear-algebra", "vector-math", "matrix-library", "header-only") | ||
|
||
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 | ||
def _min_cppstd(self): | ||
return 17 | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
return { | ||
"apple-clang": 10, | ||
"clang": 6, | ||
"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") | ||
|
||
def package_id(self): | ||
self.info.clear() | ||
|
||
def validate(self): | ||
if self.settings.compiler.cppstd: | ||
check_min_cppstd(self, self._min_cppstd) | ||
|
||
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.name} requires C++{self._min_cppstd}, " | ||
"which your compiler does not support.") | ||
|
||
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")) | ||
include_dir = os.path.join(self.source_folder, "Mathter") | ||
else: | ||
copy(self, "LICENCE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
include_dir = os.path.join(self.source_folder, "include", "Mathter") | ||
copy(self, "*.hpp", include_dir, os.path.join(self.package_folder, "include", "Mathter")) | ||
copy(self, "*.natvis", include_dir, os.path.join(self.package_folder, "include", "Mathter")) | ||
|
||
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"] |
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(TestPackage CXX) | ||
|
||
find_package(mathter REQUIRED CONFIG) | ||
|
||
add_executable(test_package test_package.cpp) | ||
target_link_libraries(test_package PRIVATE mathter::mathter) | ||
target_compile_features(test_package PRIVATE cxx_std_17) |
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,26 @@ | ||
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 = "CMakeDeps", "CMakeToolchain" | ||
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 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,16 @@ | ||
#include <Mathter/Vector.hpp> | ||
#include <iostream> | ||
|
||
int main() { | ||
using Vec3 = mathter::Vector<float, 3>; | ||
Vec3 v1 = {1, 0, 3}; | ||
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; | ||
} |
File renamed without changes.
File renamed without changes.
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,13 +1,4 @@ | ||
sources: | ||
"1.1.1": | ||
url: "https://github.com/petiaccja/Mathter/archive/v1.1.1.tar.gz" | ||
sha256: "510e6aa198cd7b207a44d319e4471021f207cba8c4d2d7e40086f1f042fe13ab" | ||
"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" | ||
"1.0.0": | ||
url: "https://github.com/petiaccja/Mathter/archive/v1.0.0.tar.gz" | ||
sha256: "c75cca8d8aec627935250908f2c0f9f1839561e7596a4199bcf80e12b0e6c53b" | ||
"2.0.0": | ||
url: "https://github.com/petiaccja/Mathter/archive/v2.0.0.tar.gz" | ||
sha256: "cec8472d3a56613d4815d1a14e5bf42976884177cc5283c5ad5aba0710cc4bab" |
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
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,16 +1,32 @@ | ||
#include <Mathter/Geometry.hpp> | ||
#include <Mathter/IoStream.hpp> | ||
#include <Mathter/Matrix.hpp> | ||
#include <Mathter/Quaternion.hpp> | ||
#include <Mathter/Transforms.hpp> | ||
#include <Mathter/Utility.hpp> | ||
#include <Mathter/Vector.hpp> | ||
|
||
#include <iostream> | ||
|
||
using namespace mathter; | ||
|
||
|
||
int main() { | ||
using Vec3 = mathter::Vector<float, 3>; | ||
Vec3 v1 = {1, 0, 3}; | ||
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; | ||
const auto u = Vector(1, 2, 3); | ||
const auto v = Vector(4, 6, 8); | ||
const auto r = u + v; | ||
if (r[0] != 5) { | ||
std::cout << "Mathter installation failing." << std::endl; | ||
return 1; | ||
} | ||
else { | ||
std::cout << "Mathter installation works." << std::endl; | ||
std::cout << "Options:" << std::endl; | ||
#ifdef MATHTER_ENABLE_SIMD | ||
std::cout << " with_xsimd = True" << std::endl; | ||
#else | ||
std::cout << "XSimd disabled." << std::endl; | ||
std::cout << " with_xsimd = False" << std::endl; | ||
#endif | ||
return 0; | ||
return 0; | ||
} | ||
} |
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,9 +1,11 @@ | ||
versions: | ||
"1.1.1": | ||
"2.0.0": | ||
folder: all | ||
"1.1.1": | ||
folder: 1.x.x | ||
"1.1.0": | ||
folder: all | ||
folder: 1.x.x | ||
"1.0.1": | ||
folder: all | ||
folder: 1.x.x | ||
"1.0.0": | ||
folder: all | ||
folder: 1.x.x |