Skip to content

Commit

Permalink
(#15686) zfp: use official tarball + modernize more
Browse files Browse the repository at this point in the history
* modernize more

* use official tarball
  • Loading branch information
SpaceIm authored Feb 3, 2023
1 parent 063dfdc commit 49fb187
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
8 changes: 4 additions & 4 deletions recipes/zfp/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sources:
"1.0.0":
url: "https://github.com/LLNL/zfp/archive/1.0.0.tar.gz"
sha256: "fe13b03141ee9b571692aed42ff76cf37c9dcda40f9a43a808870dca3558a57c"
url: "https://github.com/LLNL/zfp/releases/download/1.0.0/zfp-1.0.0.tar.gz"
sha256: "0ea08ae3e50e3c92f8b8cf41ba5b6e2de8892bc4a4ca0c59b8945b6c2ab617c4"
"0.5.5":
url: "https://github.com/LLNL/zfp/archive/0.5.5.tar.gz"
sha256: "6a7f4934489087d9c117a4af327fd6495ea757924f4df467b9c537abf8bd86c4"
url: "https://github.com/LLNL/zfp/releases/download/0.5.5/zfp-0.5.5.tar.gz"
sha256: "fdf7b948bab1f4e5dccfe2c2048fd98c24e417ad8fb8a51ed3463d04147393c5"
21 changes: 9 additions & 12 deletions recipes/zfp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from conan.tools.microsoft import is_msvc
import os

required_conan_version = ">=1.50.0"
required_conan_version = ">=1.54.0"


class ZfpConan(ConanFile):
Expand All @@ -13,7 +13,7 @@ class ZfpConan(ConanFile):
homepage = "https://github.com/LLNL/zfp"
url = "https://github.com/conan-io/conan-center-index"
license = "BSD-3-Clause"
topics = ("zfp", "compression", "arrays")
topics = ("compression", "arrays")

settings = "os", "arch", "compiler", "build_type"
options = {
Expand Down Expand Up @@ -47,20 +47,19 @@ def config_options(self):

def configure(self):
if self.options.shared:
del self.options.fPIC
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if self.info.options.with_cuda:
if self.options.with_cuda:
self.output.warn("Conan package for CUDA is not available, this package will be used from system.")
if self.info.options.with_openmp:
if self.options.with_openmp:
self.output.warn("Conan package for OpenMP is not available, this package will be used from system.")

def layout(self):
cmake_layout(self, src_folder="src")

def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
Expand All @@ -78,8 +77,6 @@ def generate(self):
if self.settings.os != "Windows" and not self.options.shared:
tc.variables["ZFP_ENABLE_PIC"] = self.options.fPIC
tc.variables["BUILD_TESTING"] = False
# Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()

def build(self):
Expand Down
7 changes: 4 additions & 3 deletions recipes/zfp/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"

def requirements(self):
self.requires(self.tested_reference_str)
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()
Expand Down
8 changes: 3 additions & 5 deletions recipes/zfp/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES CXX)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package(zfp REQUIRED CONFIG)

add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE zfp::zfp)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)

0 comments on commit 49fb187

Please sign in to comment.