Skip to content

Add GMTL - Generic Math Template Library recipe #13674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ea9a504
Add GMTL - Generic Math Template Library recipe
psyinf Oct 21, 2022
a26cba5
Fixed line trailing spaces
psyinf Oct 21, 2022
9513fac
Apply suggestions from code review
psyinf Oct 23, 2022
6feccba
processed review remarks and corrected referenced source
psyinf Oct 23, 2022
1cbab2f
Removed comment
psyinf Oct 24, 2022
0b124cb
remove superficial import
psyinf Oct 24, 2022
c49580c
Update recipes/gmtl/all/conanfile.py
psyinf Oct 24, 2022
a01b00b
Renamed package according to suggestions to indicate that this is a fork
psyinf Oct 31, 2022
2068375
Renamed package according to suggestions to indicate that this is a fork
psyinf Oct 31, 2022
d02e8f4
adapted cmake imported packages to fork-name
psyinf Nov 1, 2022
1b19eba
Update recipes/psyinf-gmtl/all/conandata.yml
psyinf Nov 1, 2022
a7e8412
Update recipes/psyinf-gmtl/all/conandata.yml
psyinf Nov 1, 2022
56a8102
Update recipes/psyinf-gmtl/all/conanfile.py
psyinf Nov 1, 2022
e74811e
Update recipes/psyinf-gmtl/all/test_package/CMakeLists.txt
psyinf Nov 1, 2022
0e858e4
Update recipes/psyinf-gmtl/all/test_v1_package/conanfile.py
psyinf Nov 1, 2022
5988824
Update recipes/psyinf-gmtl/config.yml
psyinf Nov 1, 2022
09eff4c
Update recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt
psyinf Nov 1, 2022
824b2a7
Update recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt
psyinf Nov 1, 2022
3fc11ea
Update recipes/psyinf-gmtl/all/conanfile.py
psyinf Nov 1, 2022
39817a7
Update recipes/psyinf-gmtl/all/conanfile.py
psyinf Nov 1, 2022
5681a22
Update recipes/psyinf-gmtl/all/conanfile.py
psyinf Nov 1, 2022
4ccaa15
Update recipes/psyinf-gmtl/all/conanfile.py
psyinf Nov 1, 2022
920c7e8
Update recipes/psyinf-gmtl/all/test_package/CMakeLists.txt
psyinf Nov 1, 2022
0382a7a
Update recipes/psyinf-gmtl/all/test_package/conanfile.py
psyinf Nov 1, 2022
ceb2ca9
Fixed small issues from suggestions
psyinf Nov 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.50.0 is enough



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)
Comment on lines +8 to +11
Copy link
Contributor

@SpaceIm SpaceIm Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

names in CMakeDeps & cmake_find_package[_multi] are not consistent

Copy link
Contributor Author

@psyinf psyinf Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried to use the recipe with cmake multi environment. Do we need to set
self.cpp_info.names["cmake_find_package"] = "gmtl"
self.cpp_info.names["cmake_find_package_multi"] = "gmtl"
to use it as a drop-in replacement?

Also, should'nt I use
self.cpp_info.set_property("cmake_target_name", "gmtl::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