Initial commit
This commit is contained in:
7
meshoptimizer/all/conandata.yml
Normal file
7
meshoptimizer/all/conandata.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
sources:
|
||||
"1.0":
|
||||
url: "https://github.com/zeux/meshoptimizer/archive/refs/tags/v1.0.tar.gz"
|
||||
sha256: "30d1c3651986b2074e847b17223a7269c9612ab7f148b944250f81214fed4993"
|
||||
"0.25":
|
||||
url: "https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.25.tar.gz"
|
||||
sha256: "68b2fef4e4eaad98e00c657c1e7f8982a7176e61dd7efdeaec67a025b8519be9"
|
||||
71
meshoptimizer/all/conanfile.py
Normal file
71
meshoptimizer/all/conanfile.py
Normal file
@@ -0,0 +1,71 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import stdcpp_library
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import copy, get, rm, rmdir
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.54.0"
|
||||
|
||||
|
||||
class MeshOptimizerConan(ConanFile):
|
||||
name = "meshoptimizer"
|
||||
description = "Mesh optimization library that makes meshes smaller and faster to render"
|
||||
topics = ("mesh", "optimizer", "3d")
|
||||
homepage = "https://github.com/zeux/meshoptimizer"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
license = "MIT"
|
||||
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
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 source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["MESHOPT_BUILD_SHARED_LIBS"] = self.options.shared
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "meshoptimizer")
|
||||
self.cpp_info.set_property("cmake_target_name", "meshoptimizer::meshoptimizer")
|
||||
self.cpp_info.libs = ["meshoptimizer"]
|
||||
if not self.options.shared:
|
||||
libcxx = stdcpp_library(self)
|
||||
if libcxx:
|
||||
self.cpp_info.system_libs.append(libcxx)
|
||||
if self.options.shared:
|
||||
self.cpp_info.defines = ["MESHOPTIMIZER_ALLOC_EXPORT"]
|
||||
if self.settings.os == "Windows":
|
||||
self.cpp_info.defines.append("MESHOPTIMIZER_API=__declspec(dllimport)")
|
||||
7
meshoptimizer/all/test_package/CMakeLists.txt
Normal file
7
meshoptimizer/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(meshoptimizer REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE meshoptimizer::meshoptimizer)
|
||||
26
meshoptimizer/all/test_package/conanfile.py
Normal file
26
meshoptimizer/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "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.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
9
meshoptimizer/all/test_package/test_package.c
Normal file
9
meshoptimizer/all/test_package/test_package.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "meshoptimizer.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
meshopt_encodeVertexVersion(0);
|
||||
meshopt_encodeIndexVersion(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
5
meshoptimizer/config.yml
Normal file
5
meshoptimizer/config.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
versions:
|
||||
"1.0":
|
||||
folder: all
|
||||
"0.25":
|
||||
folder: all
|
||||
Reference in New Issue
Block a user