diff --git a/recipes/psyinf-gmtl/all/conandata.yml b/recipes/psyinf-gmtl/all/conandata.yml new file mode 100644 index 0000000000000..ff448e2751be9 --- /dev/null +++ b/recipes/psyinf-gmtl/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.7.1": + url: "https://github.com/psyinf/gmtl/archive/refs/tags/0.7.1.tar.gz" + sha256: "64e36b8c41b1829933921cd5a2f2825111840010b6d0e3aaa82c023c8fd7ebd5" diff --git a/recipes/psyinf-gmtl/all/conanfile.py b/recipes/psyinf-gmtl/all/conanfile.py new file mode 100644 index 0000000000000..dfdf4b08eb11f --- /dev/null +++ b/recipes/psyinf-gmtl/all/conanfile.py @@ -0,0 +1,46 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "psyinf-gmtl" + description = "The Generic Math Template Library. A math library designed to be high-performance, extensible, and generic." + license = "LGPL-2.1-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/psyinf/gmtl" + topics = ("linear-algebra", "collision", "vector", "matrix", "template", "math", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "gmtl") + self.cpp_info.set_property("cmake_target_name", "gmtl") + self.cpp_info.set_property("pkg_config_name", "gmtl") + + diff --git a/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt b/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..774f46c194086 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(gmtl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gmtl) diff --git a/recipes/psyinf-gmtl/all/test_package/conanfile.py b/recipes/psyinf-gmtl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/conanfile.py @@ -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 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.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/psyinf-gmtl/all/test_package/test_package.cpp b/recipes/psyinf-gmtl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..221f6d72428d5 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include "gmtl/gmtl.h" + + +int main(void) { + + gmtl::Vec4f homogeneousVec; + gmtl::Vec4f homogeneousVec2; + gmtl::Matrix44f mat; + + homogeneousVec2 = mat * homogeneousVec; + + gmtl::xform(homogeneousVec2, mat, homogeneousVec); + return EXIT_SUCCESS; +} diff --git a/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt b/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..37a3e26d7064a --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(psyinf-gmtl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE psyinf-gmtl::psyinf-gmtl) diff --git a/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py b/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(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 cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/psyinf-gmtl/config.yml b/recipes/psyinf-gmtl/config.yml new file mode 100644 index 0000000000000..5232c857fcc80 --- /dev/null +++ b/recipes/psyinf-gmtl/config.yml @@ -0,0 +1,3 @@ +versions: + "0.7.1": + folder: all