-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6a480f
commit e7d6e4b
Showing
6 changed files
with
198 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
sources: | ||
"1.17.3": | ||
url: "https://github.com/wdas/partio/archive/refs/tags/v1.17.3.tar.gz" | ||
sha256: "08a571ca75cf133f373415dfd50b7d0e33a0dd1811dfb63409f0ae46652033c1" | ||
# patches: | ||
# # Newer versions at the top | ||
# "1.1.0": | ||
# - patch_file: "patches/0001-fix-cmake.patch" | ||
# patch_description: "correct the order of cmake min and project" | ||
# patch_type: "backport" | ||
# patch_source: "https://github.com/owner/package/pulls/42" | ||
# - patch_file: "patches/0002-fix-linux.patch" | ||
# patch_description: "add missing header to support linux" | ||
# patch_type: "portability" | ||
# patch_source: "https://github.com/owner/package/issues/0" |
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,104 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||
from conan.tools.env import VirtualBuildEnv | ||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir | ||
from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime | ||
Check warning on line 7 in recipes/partio/all/conanfile.py GitHub Actions / Lint changed conanfile.py (v2 migration)
Check warning on line 7 in recipes/partio/all/conanfile.py GitHub Actions / Lint changed conanfile.py (v2 migration)
|
||
from conan.tools.scm import Version | ||
import os | ||
|
||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
class PartioConan(ConanFile): | ||
name = "partio" | ||
description = "Library for easily reading/writing/manipulating common animation particle formats such as PDB, BGEO, PTC." | ||
license = "LicenseRef-LICENSE" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/wdas/partio" | ||
topics = ("point-cloud", "particles", "houdini") | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": True, | ||
"fPIC": 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 export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
self.options.rm_safe("fPIC") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("zlib/[>=1.2.11 <2]") | ||
self.requires("freeglut/3.4.0") | ||
self.requires("opengl/system") | ||
|
||
def validate(self): | ||
if self.settings.compiler.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 generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["PARTIO_BUILD_SHARED_LIBS"] = self.options.shared | ||
tc.generate() | ||
|
||
tc = CMakeDeps(self) | ||
tc.generate() | ||
|
||
def _patch_sources(self): | ||
apply_conandata_patches(self) | ||
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(src/doc)", "") | ||
|
||
def build(self): | ||
self._patch_sources() | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
rmdir(self, os.path.join(self.package_folder, "lib", "python3.12")) | ||
rmdir(self, os.path.join(self.package_folder, "share")) | ||
rm(self, "*.la", os.path.join(self.package_folder, "lib")) | ||
rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) | ||
rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) | ||
|
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,9 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(partio REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE partio::partio) | ||
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,25 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
class TestPartioConan(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.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,42 @@ | ||
#include <cstdlib> | ||
#include <Partio.h> | ||
#ifdef PARTIO_WIN32 | ||
#define M_PI (3.14159265359893238) | ||
#endif | ||
|
||
#include <cmath> | ||
|
||
using namespace Partio; | ||
int main(void) { | ||
ParticlesDataMutable* p=create(); | ||
ParticleAttribute positionAttr=p->addAttribute("position",VECTOR,3); | ||
ParticleAttribute normalAttr=p->addAttribute("normal",VECTOR,3); | ||
int n=30; | ||
for(int i=0;i<n;i++){ | ||
int particle=p->addParticle(); | ||
float* pos=p->dataWrite<float>(positionAttr,particle); | ||
float* norm=p->dataWrite<float>(normalAttr,particle); | ||
float theta=i*2*M_PI/(float)n; | ||
pos[2]=cos(theta); | ||
pos[0]=sin(theta); | ||
pos[1]=0; | ||
norm[0]=cos(theta); | ||
norm[2]=-sin(theta); | ||
norm[1]=0; | ||
|
||
} | ||
write("circle.00001.bgeo",*p); | ||
write("circle.00001.geo",*p); | ||
write("circle.00001.bin",*p); | ||
write("circle.00001.pdc",*p); | ||
write("circle.00001.pdb",*p); | ||
write("circle.00001.pda",*p); | ||
write("circle.00001.ptc",*p); | ||
write("circle.00001.rib",*p); | ||
write("circle.00001.mc",*p); | ||
|
||
|
||
p->release(); | ||
|
||
return EXIT_SUCCESS; | ||
} |
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: | ||
"1.17.3": | ||
folder: all |