-
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.
(#23113) lielab: new package and v0.1.1
* Adding Lielab v0.1.1 * Update recipes/lielab/all/conanfile.py Co-authored-by: Martin Valgur <[email protected]> * Update recipes/lielab/all/conanfile.py Co-authored-by: Martin Valgur <[email protected]> * Update recipes/lielab/all/conanfile.py Co-authored-by: Uilian Ries <[email protected]> * Update conanfile.py * Adding test_package * Changed lielab 0.1.1 to 0.4.0 - Hopefully clean up the relative file import path errors. * Forgot to change config.yml to v0.4.0 * Updated hash for Lielab v0.4.0 * Endlines to pass linter * test package requires C++20 --------- Co-authored-by: Martin Valgur <[email protected]> Co-authored-by: Uilian Ries <[email protected]>
- Loading branch information
1 parent
4085239
commit 05de5ac
Showing
6 changed files
with
136 additions
and
0 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,4 @@ | ||
sources: | ||
"0.4.0": | ||
url: "https://github.com/sandialabs/Lielab/archive/refs/tags/v0.4.0.tar.gz" | ||
sha256: "5CABF2D31D7D38EEEF525ADEE5D22C0359E9C043884D4AB5FBA219D3CB217A5C" |
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,83 @@ | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMakeToolchain, CMake | ||
from conan.tools.files import copy, get, rmdir | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.scm import Version | ||
from conan.errors import ConanInvalidConfiguration | ||
import os | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
class LielabConan(ConanFile): | ||
name = "lielab" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/sandialabs/Lielab" | ||
description = "Lielab is a C++ library for numerical Lie-theory: Lie groups," \ | ||
" Lie algebras, homogeneous manifolds, and various functions and algorithms" \ | ||
" on these spaces." | ||
topics = ("Lie-theory", "Lie-group", "Lie-algebra", "numerical", "header-only") | ||
package_type = "header-library" | ||
license = "MIT" | ||
|
||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
no_copy_source = True | ||
|
||
def requirements(self): | ||
self.requires("eigen/3.4.0") | ||
|
||
@property | ||
def _min_cppstd(self): | ||
return 20 | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
return { | ||
"gcc": "11", | ||
"clang": "12", | ||
"apple-clang": "13.1", | ||
"Visual Studio": "17", | ||
"msvc": "193", | ||
} | ||
|
||
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.ref} requires C++{self._min_cppstd}, which your compiler does not support.") | ||
|
||
def build_requirements(self): | ||
self.tool_requires("cmake/[>=3.23 <4]") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], | ||
destination=self.source_folder, strip_root=True) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["LIELAB_INSTALL_LIBRARY"] = True | ||
tc.variables["LIELAB_BUILD_TESTS"] = False | ||
tc.variables["LIELAB_BUILD_PYTHON"] = False | ||
tc.generate() | ||
|
||
def package(self): | ||
copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.install() | ||
rmdir(self, os.path.join(self.package_folder, "share")) | ||
|
||
def package_info(self): | ||
self.cpp_info.bindirs = [] | ||
self.cpp_info.libdirs = [] | ||
|
||
self.cpp_info.set_property("cmake_file_name", "Lielab") | ||
self.cpp_info.set_property("cmake_target_name", "Lielab::Lielab") | ||
|
||
self.cpp_info.names["cmake_find_package"] = "Lielab" | ||
self.cpp_info.names["cmake_find_package_multi"] = "Lielab" | ||
|
||
def package_id(self): | ||
self.info.clear() | ||
|
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 LANGUAGES CXX) | ||
|
||
find_package(Lielab REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Lielab::Lielab) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) |
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", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
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,12 @@ | ||
#include <cstdlib> | ||
#include <iostream> | ||
#include <Lielab.hpp> | ||
|
||
|
||
int main(void) { | ||
std::cout << "Lielab v" << Lielab::VERSION << std::endl; | ||
std::cout << Lielab::AUTHOR << std::endl; | ||
std::cout << Lielab::LOCATION << std::endl; | ||
|
||
return EXIT_SUCCESS; | ||
} |
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,3 @@ | ||
versions: | ||
"0.4.0": | ||
folder: "all" |