Skip to content

Commit

Permalink
libelas: add a patch for a minor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed May 19, 2024
1 parent 1d2535b commit 65e2285
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions recipes/libelas/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ sources:
license:
url: "https://raw.githubusercontent.com/kou1okada/libelas/master/README.TXT"
sha256: "627924f4cb0fe790de303fe721233d227a6d0c1734ed39fa4641923dcb9c5b8f"
patches:
"cci.20150630":
- patch_file: "patches/001-fix-cast.patch"
patch_type: "portability"
patch_description: "Add a missing explicit cast from int to float"
4 changes: 3 additions & 1 deletion recipes/libelas/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps
from conan.tools.files import copy, get, rm, download, load, save
from conan.tools.files import copy, get, rm, download, load, save, export_conandata_patches, apply_conandata_patches

required_conan_version = ">=1.53.0"

Expand All @@ -28,6 +28,7 @@ class LibelasConan(ConanFile):
}

def export_sources(self):
export_conandata_patches(self)
copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src"))

def config_options(self):
Expand Down Expand Up @@ -60,6 +61,7 @@ def generate(self):
deps.generate()

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down
13 changes: 13 additions & 0 deletions recipes/libelas/all/patches/001-fix-cast.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Fix
error: non-constant-expression cannot be narrowed from type 'int32_t' (aka 'int') to 'float' in initializer list [-Wc++11-narrowing]
--- elas.cpp
+++ elas.cpp
@@ -874,7 +874,7 @@
tri_u[1] = p_support[c2].u-p_support[c2].d;
tri_u[2] = p_support[c3].u-p_support[c3].d;
}
- float tri_v[3] = {p_support[c1].v,p_support[c2].v,p_support[c3].v};
+ float tri_v[3] = {static_cast<float>(p_support[c1].v), static_cast<float>(p_support[c2].v), static_cast<float>(p_support[c3].v)};

for (uint32_t j=0; j<3; j++) {
for (uint32_t k=0; k<j; k++) {

0 comments on commit 65e2285

Please sign in to comment.