Skip to content

Commit

Permalink
(#13674) Add GMTL - Generic Math Template Library recipe
Browse files Browse the repository at this point in the history
* Add GMTL - Generic Math Template Library recipe

* Fixed line trailing spaces

* Apply suggestions from code review

Co-authored-by: Jordan Williams <jordan@jwillikers.com>

* processed review remarks and corrected referenced source

* Removed comment

* remove superficial import

* Update recipes/gmtl/all/conanfile.py

Co-authored-by: Jordan Williams <jordan@jwillikers.com>

* Renamed package according to suggestions to indicate that this is a fork

* Renamed package according to suggestions to indicate that this is a fork

* adapted cmake imported packages to fork-name

* Update recipes/psyinf-gmtl/all/conandata.yml

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/conandata.yml

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/conanfile.py

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/test_package/CMakeLists.txt

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/test_v1_package/conanfile.py

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/config.yml

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/conanfile.py

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/conanfile.py

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/conanfile.py

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/conanfile.py

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/test_package/CMakeLists.txt

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update recipes/psyinf-gmtl/all/test_package/conanfile.py

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Fixed small issues from suggestions

Co-authored-by: Jordan Williams <jordan@jwillikers.com>
Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
  • Loading branch information
3 people authored Nov 3, 2022
1 parent 002ca72 commit 3adeb9c
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/psyinf-gmtl/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"0.7.1":
url: "https://github.com/psyinf/gmtl/archive/refs/tags/0.7.1.tar.gz"
sha256: "64e36b8c41b1829933921cd5a2f2825111840010b6d0e3aaa82c023c8fd7ebd5"
46 changes: 46 additions & 0 deletions recipes/psyinf-gmtl/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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")


8 changes: 8 additions & 0 deletions recipes/psyinf-gmtl/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
26 changes: 26 additions & 0 deletions recipes/psyinf-gmtl/all/test_package/conanfile.py
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 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")
16 changes: 16 additions & 0 deletions recipes/psyinf-gmtl/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <cstdlib>
#include <iostream>
#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;
}
11 changes: 11 additions & 0 deletions recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 18 additions & 0 deletions recipes/psyinf-gmtl/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions recipes/psyinf-gmtl/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.7.1":
folder: all

0 comments on commit 3adeb9c

Please sign in to comment.