Skip to content

Commit

Permalink
(#21521) morton-nd: add package_type
Browse files Browse the repository at this point in the history
* add package_type & simplify test_v1_package

* morton-nd: add missing include to cstdint

---------

Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>
  • Loading branch information
SpaceIm and jcar87 authored May 7, 2024
1 parent 736ecb3 commit 0243035
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 24 deletions.
7 changes: 7 additions & 0 deletions recipes/morton-nd/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ sources:
"3.0.0":
url: "https://github.com/kevinhartman/morton-nd/archive/v3.0.0.tar.gz"
sha256: "ba57df04a2e1e73709f55fd3fee71082750013c5792de3c6eb84a8c87d40d781"
patches:
"4.0.0":
- patch_file: "patches/0001-v4.0.0-fix-include-cstdint.patch"
patch_type: "portability"
"3.0.0":
- patch_file: "patches/0001-v3.0.0-fix-include-cstdint.patch"
patch_type: "portability"
22 changes: 11 additions & 11 deletions recipes/morton-nd/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.files import copy, get
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
from conan.tools.layout import basic_layout
from conan.tools.scm import Version
import os
Expand All @@ -14,9 +14,10 @@ class MortonndConan(ConanFile):
description = "A header-only Morton encode/decode library (C++14) capable " \
"of encoding from and decoding to N-dimensional space."
license = "MIT"
topics = ("morton-nd", "morton", "encoding", "decoding", "n-dimensional")
topics = ("morton", "encoding", "decoding", "n-dimensional")
homepage = "https://github.com/kevinhartman/morton-nd"
url = "https://github.com/conan-io/conan-center-index"
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True

Expand All @@ -34,6 +35,9 @@ def _compilers_minimum_version(self):
"apple-clang": "5.1",
}

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

def package_id(self):
self.info.clear()

Expand All @@ -45,13 +49,13 @@ def validate(self):
raise ConanInvalidConfiguration(
f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.",
)

def layout(self):
basic_layout(self, src_folder="src")
def export_sources(self):
export_conandata_patches(self)

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)
apply_conandata_patches(self)

def build(self):
pass
Expand All @@ -64,9 +68,7 @@ def package_info(self):
self.cpp_info.set_property("cmake_file_name", "morton-nd")
self.cpp_info.set_property("cmake_target_name", "morton-nd::MortonND")
self.cpp_info.bindirs = []
self.cpp_info.frameworkdirs = []
self.cpp_info.libdirs = []
self.cpp_info.resdirs = []

# TODO: to remove in conan v2 once legacy generators removed
self.cpp_info.names["cmake_find_package"] = "morton-nd"
Expand All @@ -75,6 +77,4 @@ def package_info(self):
self.cpp_info.components["mortonnd"].names["cmake_find_package_multi"] = "MortonND"
self.cpp_info.components["mortonnd"].set_property("cmake_target_name", "morton-nd::MortonND")
self.cpp_info.components["mortonnd"].bindirs = []
self.cpp_info.components["mortonnd"].frameworkdirs = []
self.cpp_info.components["mortonnd"].libdirs = []
self.cpp_info.components["mortonnd"].resdirs = []
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/include/morton-nd/mortonND_BMI2.h b/include/morton-nd/mortonND_BMI2.h
index b99d2c0..63d89f2 100644
--- a/include/morton-nd/mortonND_BMI2.h
+++ b/include/morton-nd/mortonND_BMI2.h
@@ -17,6 +17,7 @@
#include <tuple>
#include <type_traits>
#include <immintrin.h>
+#include <cstdint>

namespace mortonnd {

diff --git a/include/morton-nd/mortonND_LUT_encoder.h b/include/morton-nd/mortonND_LUT_encoder.h
index 5d75cb2..575c898 100644
--- a/include/morton-nd/mortonND_LUT_encoder.h
+++ b/include/morton-nd/mortonND_LUT_encoder.h
@@ -13,6 +13,7 @@
#include <tuple>
#include <type_traits>
#include <limits>
+#include <cstdint>

namespace mortonnd {

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/include/morton-nd/mortonND_BMI2.h b/include/morton-nd/mortonND_BMI2.h
index b99d2c0..63d89f2 100644
--- a/include/morton-nd/mortonND_BMI2.h
+++ b/include/morton-nd/mortonND_BMI2.h
@@ -17,6 +17,7 @@
#include <tuple>
#include <type_traits>
#include <immintrin.h>
+#include <cstdint>

namespace mortonnd {

diff --git a/include/morton-nd/mortonND_LUT.h b/include/morton-nd/mortonND_LUT.h
index 110ad63..fb3777b 100644
--- a/include/morton-nd/mortonND_LUT.h
+++ b/include/morton-nd/mortonND_LUT.h
@@ -13,6 +13,7 @@
#include <tuple>
#include <type_traits>
#include <limits>
+#include <cstdint>

namespace mortonnd {

7 changes: 4 additions & 3 deletions recipes/morton-nd/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
14 changes: 4 additions & 10 deletions recipes/morton-nd/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES CXX)
cmake_minimum_required(VERSION 3.15)
project(test_package)

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

find_package(morton-nd REQUIRED CONFIG)

add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE morton-nd::MortonND)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
if(morton-nd_VERSION VERSION_LESS "4.0.0")
target_compile_definitions(${PROJECT_NAME} PRIVATE "MORTONND_LESS_4_0_0")
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)

0 comments on commit 0243035

Please sign in to comment.