Repository: conan-io/conan-center-index

Issue:
[request] spix/0.5
### Package Name/Version

spix/0.5

### Changelog

https://github.com/faaxm/spix/releases/tag/v0.5

### Context about the new update

I will push a PR for this version


Discussion:

Resolving patch:
diff --git a/recipes/spix/all/conanfile.py b/recipes/spix/all/conanfile.py
--- a/recipes/spix/all/conanfile.py
+++ b/recipes/spix/all/conanfile.py
@@ -7,7 +7,7 @@
 import os
 
 
-required_conan_version = ">=1.52.0"
+required_conan_version = ">=1.53.0"
 
 
 class SpixConan(ConanFile):
@@ -29,16 +29,26 @@ class SpixConan(ConanFile):
 
     @property
     def _minimum_cpp_standard(self):
-        return 14
+        return 14 if self.version == "0.4" else 17
 
     @property
     def _compilers_minimum_version(self):
-        return {
-            "Visual Studio": "14",
-            "gcc": "5",
-            "clang": "3.4",
-            "apple-clang": "10"
-        }
+        if self.version == "0.4":
+            return {
+                "Visual Studio": "14",
+                "msvc": "190",
+                "gcc": "5",
+                "clang": "3.4",
+                "apple-clang": "10"
+            }
+        else:
+            return {
+                "Visual Studio": "15.7",
+                "msvc": "192", # FIXME: 15.7 is actually 1914 but needs to be tested
+                "gcc": "7",
+                "clang": "5",
+                "apple-clang": "10",
+            }
 
     def export_sources(self):
         export_conandata_patches(self)
@@ -49,24 +59,20 @@ def config_options(self):
 
     def configure(self):
         if self.options.shared:
-            try:
-                del self.options.fPIC
-            except Exception:
-                pass
+            self.options.rm_safe("fPIC")
 
     def layout(self):
         cmake_layout(self, src_folder="src")
 
     def requirements(self):
         self.requires("anyrpc/1.0.2")
-        self.requires("qt/6.3.1")
-        self.requires("expat/2.4.9")
+        self.requires("qt/6.4.2")
         
     def validate(self):
-        if self.info.settings.compiler.cppstd:
+        if self.settings.compiler.cppstd:
             check_min_cppstd(self, self._minimum_cpp_standard)
-        minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False)
-        if minimum_version and Version(self.info.settings.compiler.version) < minimum_version:
+        minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
+        if minimum_version and Version(self.settings.compiler.version) < minimum_version:
             raise ConanInvalidConfiguration(
                 f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support."
             )
@@ -77,7 +83,7 @@ def validate(self):
             raise ConanInvalidConfiguration(f"{self.ref} requires qt:gui and qt:qtdeclarative to get the Quick module")
 
     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)
@@ -87,11 +93,13 @@ def generate(self):
         tc.generate()
 
         deps = CMakeDeps(self)
+        deps.set_property("anyrpc", "cmake_file_name", "AnyRPC")
+        deps.set_property("anyrpc", "cmake_target_name", "AnyRPC::anyrpc")
         deps.generate()
 
     def _patch_sources(self):
         apply_conandata_patches(self)
-        if Version(self.deps_cpp_info["qt"].version).major == 6:
+        if self.version == "0.4" and Version(self.dependencies["qt"].ref.version).major == 6:
             replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_CXX_STANDARD 14)", "set(CMAKE_CXX_STANDARD 17)")
 
     def build(self):


Test patch:
diff --git a/recipes/spix/all/test_package/CMakeLists.txt b/recipes/spix/all/test_package/CMakeLists.txt
--- a/recipes/spix/all/test_package/CMakeLists.txt
+++ b/recipes/spix/all/test_package/CMakeLists.txt
@@ -6,4 +6,4 @@ find_package(Spix REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_spix.cpp)
 target_link_libraries(${PROJECT_NAME} PRIVATE Spix::Spix)
-target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
diff --git a/recipes/spix/all/test_package/conanfile.py b/recipes/spix/all/test_package/conanfile.py
--- a/recipes/spix/all/test_package/conanfile.py
+++ b/recipes/spix/all/test_package/conanfile.py
@@ -1,8 +1,6 @@
 from conan import ConanFile
 from conan.tools.build import can_run
 from conan.tools.cmake import cmake_layout, CMake
-from conan.tools.files import replace_in_file
-from conan.tools.scm import Version
 import os
 
 
@@ -17,12 +15,7 @@ def requirements(self):
     def layout(self):
         cmake_layout(self)
 
-    def _patch_sources(self):
-        if Version(self.deps_cpp_info["qt"].version).major == 6:
-            replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "cxx_std_14", "cxx_std_17")
-
     def build(self):
-        self._patch_sources()
         cmake = CMake(self)
         cmake.configure()
         cmake.build()
diff --git a/recipes/spix/all/test_v1_package/conanfile.py b/recipes/spix/all/test_v1_package/conanfile.py
--- a/recipes/spix/all/test_v1_package/conanfile.py
+++ b/recipes/spix/all/test_v1_package/conanfile.py
@@ -1,7 +1,5 @@
 from conans import ConanFile, CMake
 from conan.tools.build import cross_building
-from conan.tools.files import replace_in_file
-from conan.tools.scm import Version
 import os
 
 
@@ -9,12 +7,7 @@ class TestSpixV1Conan(ConanFile):
     settings = "os", "arch", "compiler", "build_type"
     generators = "cmake", "cmake_find_package_multi"
 
-    def _patch_sources(self):
-        if Version(self.deps_cpp_info["qt"].version).major == 6:
-            replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "cxx_std_14", "cxx_std_17")
-
     def build(self):
-        self._patch_sources()
         cmake = CMake(self)
         cmake.configure()
         cmake.build()