From 2a036dc9afa3c371200719a29b988ba84834029e Mon Sep 17 00:00:00 2001 From: nine Date: Tue, 13 Aug 2024 14:32:27 +0200 Subject: [PATCH] (#24894) (#24893) magic_enum/0.9.6: fixes install dir * (#24893) magic_enum/0.9.6: fixes install dir * (#24893) magic_enum/0.9.6: create package using CMake install target * (#24893) magic_enum/0.9.6: set src_dir layout method * (#24893) magic_enum/0.9.6: add legacy include directory --- recipes/magic_enum/all/conanfile.py | 23 +++++++++++++++---- .../all/test_package/CMakeLists.txt | 4 ---- .../all/test_package/test_package.cpp | 6 +---- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/recipes/magic_enum/all/conanfile.py b/recipes/magic_enum/all/conanfile.py index 5d4edee82bb6d..9b0f3868a9d81 100644 --- a/recipes/magic_enum/all/conanfile.py +++ b/recipes/magic_enum/all/conanfile.py @@ -1,8 +1,8 @@ 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.layout import basic_layout +from conan.tools.files import copy, get, mkdir, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.scm import Version import os @@ -39,7 +39,7 @@ def _compilers_minimum_version(self): } def layout(self): - basic_layout(self, src_folder="src") + cmake_layout(self, src_folder="src") def package_id(self): self.info.clear() @@ -56,12 +56,25 @@ def validate(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + def build(self): - pass + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + cmake = CMake(self) + cmake.install() + if Version(self.version) >= "0.9.4" and Version(self.version) <= "0.9.6": + mkdir(self, os.path.join(self.package_folder, "include/magic_enum")) + copy(self, "*", src=os.path.join(self.package_folder, "include"), dst=os.path.join(self.package_folder, "include/magic_enum")) copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "magic_enum") diff --git a/recipes/magic_enum/all/test_package/CMakeLists.txt b/recipes/magic_enum/all/test_package/CMakeLists.txt index f5917740f5800..c185d76435a4f 100644 --- a/recipes/magic_enum/all/test_package/CMakeLists.txt +++ b/recipes/magic_enum/all/test_package/CMakeLists.txt @@ -6,7 +6,3 @@ find_package(magic_enum REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE magic_enum::magic_enum) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) - -if(magic_enum_VERSION VERSION_GREATER_EQUAL "0.9.4") - target_compile_definitions(${PROJECT_NAME} PRIVATE MAGIC_ENUM_INCLUDE_WITH_FOLDER) -endif() diff --git a/recipes/magic_enum/all/test_package/test_package.cpp b/recipes/magic_enum/all/test_package/test_package.cpp index 208a3dd5fc806..fcb911e1f966e 100644 --- a/recipes/magic_enum/all/test_package/test_package.cpp +++ b/recipes/magic_enum/all/test_package/test_package.cpp @@ -1,8 +1,4 @@ -#ifdef MAGIC_ENUM_INCLUDE_WITH_FOLDER -# include -#else -# include -#endif +#include #include #include