Skip to content

Commit

Permalink
Merge branch 'main' into CURA-11622_conan_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
rburema committed Sep 3, 2024
2 parents 2839164 + 6ca058d commit a3fb99a
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 8 deletions.
11 changes: 4 additions & 7 deletions recipes/clipper/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from shutil import which

from conan import ConanFile
Expand Down Expand Up @@ -59,13 +60,9 @@ def build(self):
cmake.configure(build_script_folder=os.path.join(self.source_folder, "cpp"))
cmake.build()

if self.options.get_safe("enable_sentry", False):
# Upload debug symbols to sentry
sentry_project = self.conf.get("user.curaengine:sentry_project", "", check_type=str)
sentry_org = self.conf.get("user.curaengine:sentry_org", "", check_type=str)
if sentry_project == "" or sentry_org == "":
raise ConanInvalidConfiguration("sentry_project or sentry_org is not set")

sentry_project = self.conf.get("user.curaengine:sentry_project", "", check_type=str)
sentry_org = self.conf.get("user.curaengine:sentry_org", "", check_type=str)
if self.options.get_safe("enable_sentry", False) and os.environ.get('SENTRY_TOKEN', None) and sentry_project != "" and sentry_org != "":
if which("sentry-cli") is None:
self.output.warn("sentry-cli is not installed, skipping uploading debug symbols")
else:
Expand Down
8 changes: 8 additions & 0 deletions recipes/mapbox-wagyu/all/conandata.yml
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"
75 changes: 75 additions & 0 deletions recipes/mapbox-wagyu/all/conanfile.py
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)
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>
8 changes: 8 additions & 0 deletions recipes/mapbox-wagyu/all/test_package/CMakeLists.txt
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)
26 changes: 26 additions & 0 deletions recipes/mapbox-wagyu/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 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")
28 changes: 28 additions & 0 deletions recipes/mapbox-wagyu/all/test_package/test_package.cpp
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);
}
3 changes: 3 additions & 0 deletions recipes/mapbox-wagyu/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.5.0":
folder: all
2 changes: 1 addition & 1 deletion recipes/translationextractor/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _create_setting_translation_entry(self, filename: str, setting: str, field:
"\\\""))

def _create_translation_entry(self, filename: str, field: str, value: str) -> str:
return "msgctxt \"{0}\"\nmsgid \"{1}\"\nmsgstr \"\"\n\n".format(field, value.replace("\n", "\\n").replace("\"",
return "\nmsgctxt \"{0}\"\nmsgid \"{1}\"\nmsgstr \"\"\n".format(field, value.replace("\n", "\\n").replace("\"",
"\\\""))

def _create_pot_header(self) -> str:
Expand Down

0 comments on commit a3fb99a

Please sign in to comment.