-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into CURA-11622_conan_v2
- Loading branch information
Showing
9 changed files
with
177 additions
and
8 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
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 @@ | ||
sources: | ||
"0.5.0": | ||
url: "https://github.com/mapbox/wagyu/archive/refs/tags/0.5.0.tar.gz" | ||
sha256: "88c41eaba03107ebe79052fdbd66e419e903d331a2616a51849018e13648ab83" | ||
|
||
patches: | ||
"0.5.0": | ||
- patch_file: "patches/0001-patch-for-execinfo-file.patch" |
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,75 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.scm import Version | ||
import os | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
|
||
class MapboxWagyuConan(ConanFile): | ||
name = "mapbox-wagyu" | ||
description = "A general library for geometry operations of union, intersections, difference, and xor" | ||
license = "LicenseRef-mapbox-wagyu" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/mapbox/wagyu/" | ||
topics = ("geometry", "clipping", "header-only") | ||
package_type = "header-library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
no_copy_source = True | ||
|
||
@property | ||
def _min_cppstd(self): | ||
return 14 | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
return { | ||
"apple-clang": "10", | ||
"clang": "7", | ||
"gcc": "7", | ||
"msvc": "191", | ||
"Visual Studio": "15", | ||
} | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("mapbox-geometry/2.0.3") | ||
|
||
def package_id(self): | ||
self.info.clear() | ||
|
||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("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 source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def package(self): | ||
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
copy( | ||
self, | ||
"*.hpp", | ||
os.path.join(self.source_folder, "include"), | ||
os.path.join(self.package_folder, "include"), | ||
) | ||
|
||
def package_info(self): | ||
self.cpp_info.bindirs = [] | ||
self.cpp_info.libdirs = [] | ||
|
||
def build(self): | ||
apply_conandata_patches(self) |
24 changes: 24 additions & 0 deletions
24
recipes/mapbox-wagyu/all/patches/0001-patch-for-execinfo-file.patch
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,24 @@ | ||
diff --git a/include/mapbox/geometry/wagyu/ring.hpp b/include/mapbox/geometry/wagyu/ring.hpp | ||
--- a/include/mapbox/geometry/wagyu/ring.hpp (revision bca18747a2a529db59de34b97aaf395d815c5798) | ||
+++ b/include/mapbox/geometry/wagyu/ring.hpp (date 1708339817748) | ||
@@ -11,7 +11,7 @@ | ||
#include <sstream> | ||
#include <vector> | ||
|
||
-#ifdef DEBUG | ||
+#if defined(DEBUG) && __has_include(<execinfo.h>) | ||
#include <execinfo.h> | ||
#include <iostream> | ||
#include <sstream> | ||
Index: include/mapbox/geometry/wagyu/ring_util.hpp | ||
diff --git a/include/mapbox/geometry/wagyu/ring_util.hpp b/include/mapbox/geometry/wagyu/ring_util.hpp | ||
--- a/include/mapbox/geometry/wagyu/ring_util.hpp (revision bca18747a2a529db59de34b97aaf395d815c5798) | ||
+++ b/include/mapbox/geometry/wagyu/ring_util.hpp (date 1708339817743) | ||
@@ -1,6 +1,6 @@ | ||
#pragma once | ||
|
||
-#ifdef DEBUG | ||
+#if defined(DEBUG) && __has_include(<execinfo.h>) | ||
#include <iostream> | ||
// Example debug print for backtrace - only works on IOS | ||
#include <execinfo.h> |
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(mapbox-wagyu REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE mapbox-wagyu::mapbox-wagyu) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) |
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,28 @@ | ||
#include <cassert> | ||
|
||
#include <mapbox/geometry/wagyu/quick_clip.hpp> | ||
#include <mapbox/geometry/wagyu/wagyu.hpp> | ||
|
||
int main() { | ||
mapbox::geometry::point< std::int64_t> p1 = { 0, 0 }; | ||
mapbox::geometry::point< std::int64_t> p2 = { 100, 100 }; | ||
mapbox::geometry::box< std::int64_t> bbox(p1, p2); | ||
|
||
mapbox::geometry::linear_ring< std::int64_t> lr; | ||
lr.push_back(mapbox::geometry::point< std::int64_t>(25, 25)); | ||
lr.push_back(mapbox::geometry::point< std::int64_t>(175, 25)); | ||
lr.push_back(mapbox::geometry::point< std::int64_t>(175, 75)); | ||
lr.push_back(mapbox::geometry::point< std::int64_t>(25, 75)); | ||
lr.push_back(mapbox::geometry::point< std::int64_t>(25, 25)); | ||
|
||
auto out = mapbox::geometry::wagyu::quick_clip::quick_lr_clip(lr, bbox); | ||
|
||
mapbox::geometry::linear_ring< std::int64_t> want; | ||
want.push_back(mapbox::geometry::point< std::int64_t>(25, 25)); | ||
want.push_back(mapbox::geometry::point< std::int64_t>(100, 25)); | ||
want.push_back(mapbox::geometry::point< std::int64_t>(100, 75)); | ||
want.push_back(mapbox::geometry::point< std::int64_t>(25, 75)); | ||
want.push_back(mapbox::geometry::point< std::int64_t>(25, 25)); | ||
|
||
assert(out == want); | ||
} |
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.5.0": | ||
folder: all |
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