-
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
Showing
6 changed files
with
116 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,4 @@ | ||
sources: | ||
"cci.20230223": | ||
url: "https://github.com/yuki-koyama/tinycolormap/archive/0f62abbc269d9677829083d4d563643830ac7fb9.zip" | ||
sha256: "f736d7b76ea07e43da6c6905d891bc58ef512a794bbc0ef3ba9b593b4c1e2d63" |
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,64 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.files import copy, get | ||
from conan.tools.layout import basic_layout | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
|
||
class TinycolormapConan(ConanFile): | ||
name = "tinycolormap" | ||
description = "A header-only, single-file library for colormaps written in C++11" | ||
license = "MIT" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/yuki-koyama/tinycolormap" | ||
topics = ("color", "colormap", "visualization", "header-only") | ||
package_type = "header-library" | ||
|
||
settings = "os", "arch", "compiler", "build_type" | ||
no_copy_source = True | ||
options = { | ||
"with_eigen": [True, False], | ||
"with_qt": [True, False], | ||
} | ||
default_options = { | ||
"with_eigen": False, | ||
"with_qt": False, | ||
} | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def package_id(self): | ||
self.info.clear() | ||
|
||
def requirements(self): | ||
if self.options.with_eigen: | ||
self.requires("eigen/3.4.0") | ||
if self.options.with_qt: | ||
# Only Qt5 is supported | ||
self.requires("qt/5.15.13") | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, 11) | ||
|
||
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 = [] | ||
|
||
if self.options.with_eigen: | ||
self.cpp_info.defines.append("TINYCOLORMAP_WITH_EIGEN") | ||
self.cpp_info.requires.append("eigen::eigen") | ||
if self.options.with_qt: | ||
self.cpp_info.defines.append("TINYCOLORMAP_WITH_QT5") | ||
self.cpp_info.requires.append("qt::qtGui") |
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,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(tinycolormap REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE tinycolormap::tinycolormap) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
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,27 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
# It will become the standard on Conan 2.x | ||
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") |
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,10 @@ | ||
#include <tinycolormap.hpp> | ||
|
||
#include <iostream> | ||
|
||
int main() { | ||
double value = 0.75; | ||
auto color = tinycolormap::GetColor(value, tinycolormap::ColormapType::Viridis); | ||
std::cout << "Viridis RGB values at " << value << ": " | ||
<< (int)color.ri() << " " << (int)color.gi() << " " << (int)color.bi() << std::endl; | ||
} |
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: | ||
"cci.20230223": | ||
folder: all |