From 3a1043946a13771ba496071df5ce7d9fde99ffef Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 3 Nov 2023 17:51:22 +0900 Subject: [PATCH 01/19] simd: add recipe --- recipes/simd/all/conandata.yml | 4 ++ recipes/simd/all/conanfile.py | 69 +++++++++++++++++++ recipes/simd/all/test_package/CMakeLists.txt | 8 +++ recipes/simd/all/test_package/conanfile.py | 26 +++++++ .../simd/all/test_package/test_package.cpp | 7 ++ recipes/simd/config.yml | 3 + 6 files changed, 117 insertions(+) create mode 100644 recipes/simd/all/conandata.yml create mode 100644 recipes/simd/all/conanfile.py create mode 100644 recipes/simd/all/test_package/CMakeLists.txt create mode 100644 recipes/simd/all/test_package/conanfile.py create mode 100644 recipes/simd/all/test_package/test_package.cpp create mode 100644 recipes/simd/config.yml diff --git a/recipes/simd/all/conandata.yml b/recipes/simd/all/conandata.yml new file mode 100644 index 0000000000000..2a8d736c26bbc --- /dev/null +++ b/recipes/simd/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "5.3.131": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v5.3.131.tar.gz" + sha256: "d07a6eb6427fbef507d6d2ef1ad7aa225d344afb172b2265f1eeffb7638d297a" diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py new file mode 100644 index 0000000000000..bf95fa6468e3a --- /dev/null +++ b/recipes/simd/all/conanfile.py @@ -0,0 +1,69 @@ +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class SimdConan(ConanFile): + name = "simd" + description = "C++ image processing and machine learning library with using of SIMD" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ermig1979/Simd" + topics = ("simd", "sse", "avx", "avx-512", "amx", "vmx", "vsx", "neon") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 11 + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + 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): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "prj", "cmake")) + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.libs = ["Simd"] + self.cpp_info.set_property("cmake_file_name", "Simd") + self.cpp_info.set_property("cmake_target_name", "Simd::Simd") diff --git a/recipes/simd/all/test_package/CMakeLists.txt b/recipes/simd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..eef0ed5180fa2 --- /dev/null +++ b/recipes/simd/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Simd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Simd::Simd) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/simd/all/test_package/conanfile.py b/recipes/simd/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/simd/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + 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") diff --git a/recipes/simd/all/test_package/test_package.cpp b/recipes/simd/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..20f9d8a28f25a --- /dev/null +++ b/recipes/simd/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include +#include +#include "Simd/SimdLib.hpp" + +int main(void) { + Simd::PrintInfo(std::cout); +} diff --git a/recipes/simd/config.yml b/recipes/simd/config.yml new file mode 100644 index 0000000000000..a9c8a757252b6 --- /dev/null +++ b/recipes/simd/config.yml @@ -0,0 +1,3 @@ +versions: + "5.3.131": + folder: all From e3d28eb26c4e16fbd727b0b26fb043f083f03194 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 3 Nov 2023 21:29:49 +0900 Subject: [PATCH 02/19] link pthread --- recipes/simd/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index bf95fa6468e3a..872d33b8a52a7 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -67,3 +67,6 @@ def package_info(self): self.cpp_info.libs = ["Simd"] self.cpp_info.set_property("cmake_file_name", "Simd") self.cpp_info.set_property("cmake_target_name", "Simd::Simd") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") From f092c29d9f583843a0ea72fc80ec47549963a497 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 3 Nov 2023 22:30:23 +0900 Subject: [PATCH 03/19] support shard build --- recipes/simd/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 872d33b8a52a7..d449524bc0665 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -50,6 +50,8 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + tc.variables["SIMD_TEST"] = False + tc.variables["SIMD_SHARED"] = self.options.shared tc.generate() def build(self): From 80cf49c1ea159cb3d40743a1ba443948741e154d Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 4 Nov 2023 01:31:06 +0900 Subject: [PATCH 04/19] link math lib --- recipes/simd/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index d449524bc0665..c972e5ecb1d2e 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -72,3 +72,4 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("m") From 7d6d784fd0c7e568ece0e409646dfb7e9df10496 Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 4 Nov 2023 03:05:16 +0900 Subject: [PATCH 05/19] drop support gcc < 10 --- recipes/simd/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index c972e5ecb1d2e..ae6a638ec1967 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -2,6 +2,7 @@ from conan.tools.files import get, copy, rmdir from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conans.errors import ConanInvalidConfiguration import os @@ -44,6 +45,8 @@ def layout(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) + if self.settings.compiler == "gcc" and self.settings.compiler.version.major < 10: + raise ConanInvalidConfiguration(f"{self.ref} isn't compiled correctly with gcc < 10 ") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 06e16292c040915bbb6b89398f34badee1b6c5bc Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 4 Nov 2023 09:48:35 +0900 Subject: [PATCH 06/19] fix syntax error --- recipes/simd/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index ae6a638ec1967..e7cd8094ca0b0 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -1,8 +1,9 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.files import get, copy, rmdir from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conans.errors import ConanInvalidConfiguration +from conan.tools.scm import Version import os @@ -45,7 +46,7 @@ def layout(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if self.settings.compiler == "gcc" and self.settings.compiler.version.major < 10: + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "10.0": raise ConanInvalidConfiguration(f"{self.ref} isn't compiled correctly with gcc < 10 ") def source(self): From acff35e0a0ecf5fea6bb9f0ae5edf989cf74cc29 Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 5 Nov 2023 14:07:44 +0900 Subject: [PATCH 07/19] add with_avx512 option --- recipes/simd/all/conanfile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index e7cd8094ca0b0..3b2230a73a3ba 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -22,10 +22,12 @@ class SimdConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "with_avx512": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_avx512": False, } @property @@ -54,6 +56,9 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + tc.variables["SIMD_AVX512"] = self.options.with_avx512 + tc.variables["SIMD_AVX512VNNI"] = self.options.with_avx512 + tc.variables["SIMD_AVX512BF16"] = self.options.with_avx512 tc.variables["SIMD_TEST"] = False tc.variables["SIMD_SHARED"] = self.options.shared tc.generate() From e4395b07679a47245dcd8419fd74d3a76102da63 Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 5 Nov 2023 23:47:47 +0900 Subject: [PATCH 08/19] remove gcc version check --- recipes/simd/all/conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 3b2230a73a3ba..713fc168f86c2 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -48,8 +48,6 @@ def layout(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "10.0": - raise ConanInvalidConfiguration(f"{self.ref} isn't compiled correctly with gcc < 10 ") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 430424e1b811c1ca752f764e73df8502dbf436a4 Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 12 Nov 2023 12:30:01 +0900 Subject: [PATCH 09/19] remove uwebsockets --- recipes/simd/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 713fc168f86c2..22cb2747599c5 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -3,7 +3,6 @@ from conan.tools.files import get, copy, rmdir from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.scm import Version import os @@ -48,6 +47,8 @@ def layout(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) + if self.settings.compiler == "clang": + raise ConanInvalidConfiguration(f"{self.ref} don't support clang. (yet)") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 24e3173b48aaaa130c0f11cff8010e49cbf04979 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 23 Nov 2023 23:43:32 +0900 Subject: [PATCH 10/19] drop support msvc --- recipes/simd/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 22cb2747599c5..1922c39c443ad 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -3,6 +3,7 @@ from conan.tools.files import get, copy, rmdir from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc import os @@ -49,6 +50,8 @@ def validate(self): check_min_cppstd(self, self._min_cppstd) if self.settings.compiler == "clang": raise ConanInvalidConfiguration(f"{self.ref} don't support clang. (yet)") + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} don't support msvc. (yet)") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 830057fb3e5835cee99d8e3db63485958ef7387f Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 26 Feb 2024 13:26:23 +0900 Subject: [PATCH 11/19] update 6.0.134, support clang, msvc --- recipes/simd/all/conandata.yml | 6 ++--- recipes/simd/all/conanfile.py | 46 ++++++++++++++++++++-------------- recipes/simd/config.yml | 2 +- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/recipes/simd/all/conandata.yml b/recipes/simd/all/conandata.yml index 2a8d736c26bbc..9edd4fcef0fad 100644 --- a/recipes/simd/all/conandata.yml +++ b/recipes/simd/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "5.3.131": - url: "https://github.com/ermig1979/Simd/archive/refs/tags/v5.3.131.tar.gz" - sha256: "d07a6eb6427fbef507d6d2ef1ad7aa225d344afb172b2265f1eeffb7638d297a" + "6.0.134": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.0.134.tar.gz" + sha256: "fddb2073e6b0b17ac6c08e9d7881503618450353e84c364488f53eb6e063a386" diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 1922c39c443ad..efd771518a0c9 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -1,9 +1,8 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration from conan.tools.files import get, copy, rmdir from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.microsoft import is_msvc +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain import os @@ -48,33 +47,42 @@ def layout(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if self.settings.compiler == "clang": - raise ConanInvalidConfiguration(f"{self.ref} don't support clang. (yet)") - if is_msvc(self): - raise ConanInvalidConfiguration(f"{self.ref} don't support msvc. (yet)") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): - tc = CMakeToolchain(self) - tc.variables["SIMD_AVX512"] = self.options.with_avx512 - tc.variables["SIMD_AVX512VNNI"] = self.options.with_avx512 - tc.variables["SIMD_AVX512BF16"] = self.options.with_avx512 - tc.variables["SIMD_TEST"] = False - tc.variables["SIMD_SHARED"] = self.options.shared - tc.generate() + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + else: + tc = CMakeToolchain(self) + tc.variables["SIMD_AVX512"] = self.options.with_avx512 + tc.variables["SIMD_AVX512VNNI"] = self.options.with_avx512 + tc.variables["SIMD_AVX512BF16"] = self.options.with_avx512 + tc.variables["SIMD_TEST"] = False + tc.variables["SIMD_SHARED"] = self.options.shared + tc.generate() def build(self): - cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, "prj", "cmake")) - cmake.build() + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.build(os.path.join(self.source_folder, "prj", "vs2022", "Simd.vcxproj")) + else: + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "prj", "cmake")) + cmake.build() def package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - cmake = CMake(self) - cmake.install() - rmdir(self, os.path.join(self.package_folder, "share")) + if is_msvc(self): + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "Simd"), src=os.path.join(self.source_folder, "src", "Simd"), keep_path=True) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) + copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False) + else: + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["Simd"] diff --git a/recipes/simd/config.yml b/recipes/simd/config.yml index a9c8a757252b6..c2000336a06e0 100644 --- a/recipes/simd/config.yml +++ b/recipes/simd/config.yml @@ -1,3 +1,3 @@ versions: - "5.3.131": + "6.0.134": folder: all From 86420d93af64abd666ba86b344b18cc1db836c9e Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 6 Mar 2024 02:42:17 +0900 Subject: [PATCH 12/19] set CMP0077 policy Co-authored-by: Martin Valgur --- recipes/simd/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index efd771518a0c9..8a39883d8fa4a 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -62,6 +62,7 @@ def generate(self): tc.variables["SIMD_AVX512BF16"] = self.options.with_avx512 tc.variables["SIMD_TEST"] = False tc.variables["SIMD_SHARED"] = self.options.shared + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): From 326e524ad1985fb9a662a7b5421a0e0263627664 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 6 Mar 2024 02:43:05 +0900 Subject: [PATCH 13/19] fix include order Co-authored-by: Martin Valgur --- recipes/simd/all/test_package/test_package.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/simd/all/test_package/test_package.cpp b/recipes/simd/all/test_package/test_package.cpp index 20f9d8a28f25a..d5cd9404a9a65 100644 --- a/recipes/simd/all/test_package/test_package.cpp +++ b/recipes/simd/all/test_package/test_package.cpp @@ -1,7 +1,7 @@ -#include -#include #include "Simd/SimdLib.hpp" +#include + int main(void) { Simd::PrintInfo(std::cout); } From 93b7640ab416913a7ffd9a9369a72cf4e1286e7c Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 6 Mar 2024 02:44:57 +0900 Subject: [PATCH 14/19] fix description --- recipes/simd/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 8a39883d8fa4a..4218bdf6eb7b9 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -11,7 +11,7 @@ class SimdConan(ConanFile): name = "simd" - description = "C++ image processing and machine learning library with using of SIMD" + description = "C++ image processing and machine learning library with SIMD" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ermig1979/Simd" From 6113b7fbfa15a2fadd4ee85f1f841ebf6310d4c7 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 6 Mar 2024 02:48:48 +0900 Subject: [PATCH 15/19] update 6.1.135 --- recipes/simd/all/conandata.yml | 6 +++--- recipes/simd/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/simd/all/conandata.yml b/recipes/simd/all/conandata.yml index 9edd4fcef0fad..9b3b8eb09d488 100644 --- a/recipes/simd/all/conandata.yml +++ b/recipes/simd/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "6.0.134": - url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.0.134.tar.gz" - sha256: "fddb2073e6b0b17ac6c08e9d7881503618450353e84c364488f53eb6e063a386" + "6.1.135": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.135.tar.gz" + sha256: "e430b3ae1ed86e4f6fdfe5936ec7656c4f0305abcd1b1e05aa98e07df95b26c4" diff --git a/recipes/simd/config.yml b/recipes/simd/config.yml index c2000336a06e0..5dce08b307c50 100644 --- a/recipes/simd/config.yml +++ b/recipes/simd/config.yml @@ -1,3 +1,3 @@ versions: - "6.0.134": + "6.1.135": folder: all From 503b39c64e8797cb76ee1991607a6469f470bd81 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 3 Apr 2024 09:49:21 +0900 Subject: [PATCH 16/19] update 6.1.136 --- recipes/simd/all/conandata.yml | 6 +++--- recipes/simd/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/simd/all/conandata.yml b/recipes/simd/all/conandata.yml index 9b3b8eb09d488..01b2df1c7fe1e 100644 --- a/recipes/simd/all/conandata.yml +++ b/recipes/simd/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "6.1.135": - url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.135.tar.gz" - sha256: "e430b3ae1ed86e4f6fdfe5936ec7656c4f0305abcd1b1e05aa98e07df95b26c4" + "6.1.136": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.136.tar.gz" + sha256: "194af906cb19aeba73093f1d4b9a1cf8cfd35af6da10411630b972c5dbe7262d" diff --git a/recipes/simd/config.yml b/recipes/simd/config.yml index 5dce08b307c50..cb61315ef17ef 100644 --- a/recipes/simd/config.yml +++ b/recipes/simd/config.yml @@ -1,3 +1,3 @@ versions: - "6.1.135": + "6.1.136": folder: all From 0f256248ecda46247b572bb7e5e8508b131d1013 Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 4 May 2024 00:18:30 +0900 Subject: [PATCH 17/19] update 6.1.137 --- recipes/simd/all/conandata.yml | 6 +++--- recipes/simd/all/conanfile.py | 2 +- recipes/simd/config.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/simd/all/conandata.yml b/recipes/simd/all/conandata.yml index 01b2df1c7fe1e..9a546918a8469 100644 --- a/recipes/simd/all/conandata.yml +++ b/recipes/simd/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "6.1.136": - url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.136.tar.gz" - sha256: "194af906cb19aeba73093f1d4b9a1cf8cfd35af6da10411630b972c5dbe7262d" + "6.1.137": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.137.tar.gz" + sha256: "d86bd005c54370f53656c9b622c34c75fd89fa15909b1aaab29b1ec55a38a683" diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 4218bdf6eb7b9..8cf90c1406079 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -15,7 +15,7 @@ class SimdConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ermig1979/Simd" - topics = ("simd", "sse", "avx", "avx-512", "amx", "vmx", "vsx", "neon") + topics = ("sse", "avx", "avx-512", "amx", "vmx", "vsx", "neon") package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { diff --git a/recipes/simd/config.yml b/recipes/simd/config.yml index cb61315ef17ef..02375b1c2c97e 100644 --- a/recipes/simd/config.yml +++ b/recipes/simd/config.yml @@ -1,3 +1,3 @@ versions: - "6.1.136": + "6.1.137": folder: all From 0ca579531faa678f6180f8242a25c181ed13d847 Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Mon, 17 Jun 2024 16:36:59 +0200 Subject: [PATCH 18/19] Added latest SIMD version. Fixed Windows. Added extra validations. Removed option for now --- recipes/simd/all/conandata.yml | 6 +- recipes/simd/all/conanfile.py | 65 ++++++++++++++----- recipes/simd/all/test_package/conanfile.py | 3 +- .../simd/all/test_package/test_package.cpp | 3 +- recipes/simd/config.yml | 2 +- 5 files changed, 54 insertions(+), 25 deletions(-) diff --git a/recipes/simd/all/conandata.yml b/recipes/simd/all/conandata.yml index 9a546918a8469..93a1a396f05ce 100644 --- a/recipes/simd/all/conandata.yml +++ b/recipes/simd/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "6.1.137": - url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.137.tar.gz" - sha256: "d86bd005c54370f53656c9b622c34c75fd89fa15909b1aaab29b1ec55a38a683" + "6.1.138": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.138.tar.gz" + sha256: "5090e4879d48851d5d7d9605485f517dea9a27d9431ec2d54a74a6f04cf3ba00" diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 8cf90c1406079..4fe4d26f0e0fc 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -1,12 +1,13 @@ +import os + from conan import ConanFile -from conan.tools.files import get, copy, rmdir +from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain -import os +from conan.tools.files import get, copy, rmdir, replace_in_file, collect_libs +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain, is_msvc_static_runtime, msvs_toolset - -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.59.0" class SimdConan(ConanFile): @@ -20,13 +21,11 @@ class SimdConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False], - "with_avx512": [True, False], + "fPIC": [True, False] } default_options = { "shared": False, - "fPIC": True, - "with_avx512": False, + "fPIC": True } @property @@ -47,6 +46,10 @@ def layout(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) + if self.settings.os == "Windows" and self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration("Windows only supports x86/x64 architectures.") + if is_msvc(self) and self.settings.arch == "armv8": + raise ConanInvalidConfiguration("ARM64 building with MSVC is not supported.") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -57,18 +60,44 @@ def generate(self): tc.generate() else: tc = CMakeToolchain(self) - tc.variables["SIMD_AVX512"] = self.options.with_avx512 - tc.variables["SIMD_AVX512VNNI"] = self.options.with_avx512 - tc.variables["SIMD_AVX512BF16"] = self.options.with_avx512 tc.variables["SIMD_TEST"] = False tc.variables["SIMD_SHARED"] = self.options.shared tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() + @property + def vs_proj_folder(self): + toolset = msvs_toolset(self) + # By default, v2022 folder + return {"v140": "vs2015", + "v141": "vs2017", + "v142": "vs2019"}.get(toolset, "vs2022") + + def _patch_sources(self): + if is_msvc(self): + if not self.options.shared: + replace_in_file(self, os.path.join(self.source_folder, "src", "Simd", "SimdConfig.h"), "//#define SIMD_STATIC", "#define SIMD_STATIC") + replace_in_file(self, os.path.join(self.source_folder, "prj", self.vs_proj_folder, "Simd.vcxproj"), + "DynamicLibrary", + "StaticLibrary") + for prj in ("AmxBf16", "Avx2", "Avx512bw", "Avx512vnni", "Base", "Neon", "Simd", "Sse41"): + replace_in_file(self, os.path.join(self.source_folder, "prj", self.vs_proj_folder, f"{prj}.vcxproj"), + " ", + " OldStyle\n ") + + if not is_msvc_static_runtime(self): + for prj in ("AmxBf16", "Avx2", "Avx512bw", "Avx512vnni", "Base", "Neon", "Simd", "Sse41"): + replace_in_file(self, os.path.join(self.source_folder, "prj", self.vs_proj_folder, f"{prj}.vcxproj"), + " ", + " MultiThreadedDebugDLL\n" + " MultiThreadedDLL\n" + " ") + def build(self): + self._patch_sources() if is_msvc(self): msbuild = MSBuild(self) - msbuild.build(os.path.join(self.source_folder, "prj", "vs2022", "Simd.vcxproj")) + msbuild.build(os.path.join(self.source_folder, "prj", self.vs_proj_folder, "Simd.vcxproj")) else: cmake = CMake(self) cmake.configure(build_script_folder=os.path.join(self.source_folder, "prj", "cmake")) @@ -77,7 +106,7 @@ def build(self): def package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if is_msvc(self): - copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "Simd"), src=os.path.join(self.source_folder, "src", "Simd"), keep_path=True) + copy(self, pattern="*.h*", dst=os.path.join(self.package_folder, "include", "Simd"), src=os.path.join(self.source_folder, "src", "Simd"), keep_path=True) copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False) else: @@ -86,10 +115,10 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = ["Simd"] + self.cpp_info.libs = collect_libs(self) self.cpp_info.set_property("cmake_file_name", "Simd") self.cpp_info.set_property("cmake_target_name", "Simd::Simd") - + if not self.options.shared and is_msvc(self): + self.cpp_info.defines.append("SIMD_STATIC") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") - self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.extend(["pthread", "m"]) diff --git a/recipes/simd/all/test_package/conanfile.py b/recipes/simd/all/test_package/conanfile.py index ef5d7042163ec..d7de1f914ce42 100644 --- a/recipes/simd/all/test_package/conanfile.py +++ b/recipes/simd/all/test_package/conanfile.py @@ -1,7 +1,8 @@ +import os + from conan import ConanFile from conan.tools.build import can_run from conan.tools.cmake import cmake_layout, CMake -import os class TestPackageConan(ConanFile): diff --git a/recipes/simd/all/test_package/test_package.cpp b/recipes/simd/all/test_package/test_package.cpp index d5cd9404a9a65..9618b4bc617e4 100644 --- a/recipes/simd/all/test_package/test_package.cpp +++ b/recipes/simd/all/test_package/test_package.cpp @@ -1,6 +1,5 @@ -#include "Simd/SimdLib.hpp" - #include +#include "Simd/SimdLib.hpp" int main(void) { Simd::PrintInfo(std::cout); diff --git a/recipes/simd/config.yml b/recipes/simd/config.yml index 02375b1c2c97e..cade1c07e0823 100644 --- a/recipes/simd/config.yml +++ b/recipes/simd/config.yml @@ -1,3 +1,3 @@ versions: - "6.1.137": + "6.1.138": folder: all From 384a17de7402ace09d74f4bcd5e71fc6da07cfb5 Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Tue, 18 Jun 2024 09:38:05 +0200 Subject: [PATCH 19/19] Added docstring --- recipes/simd/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py index 4fe4d26f0e0fc..f5a7dce572f35 100644 --- a/recipes/simd/all/conanfile.py +++ b/recipes/simd/all/conanfile.py @@ -67,6 +67,7 @@ def generate(self): @property def vs_proj_folder(self): + """Return the vsXXXX/ folder given the MSVC compiler version""" toolset = msvs_toolset(self) # By default, v2022 folder return {"v140": "vs2015",