Skip to content
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

Add GMTL - Generic Math Template Library recipe #13674

Merged
merged 25 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 7 additions & 0 deletions recipes/gmtl/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sources:
# Newer versions at the top
"0.7.1":
url: [
"https://github.com/psyinf/gmtl/archive/refs/tags/0.7.1.tar.gz",
]
sha256: "64e36b8c41b1829933921cd5a2f2825111840010b6d0e3aaa82c023c8fd7ebd5"
45 changes: 45 additions & 0 deletions recipes/gmtl/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from conan import ConanFile
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy
from conan.tools.layout import basic_layout
import os


required_conan_version = ">=1.52.0"


class PackageConan(ConanFile):
name = "gmtl"
psyinf marked this conversation as resolved.
Show resolved Hide resolved
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://ggt.sourceforge.net/html/main.html"
topics = ("linear-algebra", "collision", "vector", "matrix", "template", "math", "header-only")
settings = "os", "arch", "compiler", "build_type" # even for header only
no_copy_source = True

def export_sources(self):
export_conandata_patches(self)

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="*.h",
dst=os.path.join(self.package_folder, "include"),
src=os.path.join(self.source_folder, "."),
psyinf marked this conversation as resolved.
Show resolved Hide resolved
)

def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []


11 changes: 11 additions & 0 deletions recipes/gmtl/all/test_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 C) # if the project is pure C
project(test_package CXX) # if the project uses c++

find_package(gmtl REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
# don't link to ${CONAN_LIBS} or CONAN_PKG::package
target_link_libraries(${PROJECT_NAME} PRIVATE gmtl::gmtl)

27 changes: 27 additions & 0 deletions recipes/gmtl/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


# It will become the standard on Conan 2.x
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/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;
}
14 changes: 14 additions & 0 deletions recipes/gmtl/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.8)

project(test_package C) # if the project is pure C
project(test_package CXX) # if the project uses c++

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package(gmtl REQUIRED CONFIG)

# Re-use the same source file from test_package folder
add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
# don't link to ${CONAN_LIBS} or CONAN_PKG::package
target_link_libraries(${PROJECT_NAME} PRIVATE gmtl::gmtl)
19 changes: 19 additions & 0 deletions recipes/gmtl/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from conans import ConanFile, CMake
from conan.tools.build import cross_building
import os


# legacy validation with Conan 1.x
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)
4 changes: 4 additions & 0 deletions recipes/gmtl/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
versions:
# Newer versions at the top
"0.7.1":
folder: all