From fde8a1296f09fffcf4ca9e84cda964d7183edca6 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 29 Dec 2023 03:38:49 +0200 Subject: [PATCH 1/4] vc: add v1.4.4 --- recipes/vc/all/conandata.yml | 3 +++ recipes/vc/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/vc/all/conandata.yml b/recipes/vc/all/conandata.yml index ef285ad3397b4..d9d4a0eedacb9 100644 --- a/recipes/vc/all/conandata.yml +++ b/recipes/vc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.4": + url: "https://github.com/VcDevel/Vc/archive/1.4.4.tar.gz" + sha256: "5933108196be44c41613884cd56305df320263981fe6a49e648aebb3354d57f3" "1.4.3": url: "https://github.com/VcDevel/Vc/archive/1.4.3.tar.gz" sha256: "988ea0053f3fbf17544ca776a2749c097b3139089408b0286fa4e9e8513e037f" diff --git a/recipes/vc/config.yml b/recipes/vc/config.yml index f5a2ce84083be..ec43017157e97 100644 --- a/recipes/vc/config.yml +++ b/recipes/vc/config.yml @@ -1,4 +1,6 @@ versions: + "1.4.4": + folder: all "1.4.3": folder: all "1.4.2": From c4a518309ce9f2aa1be83d6ae065354c28e11c76 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 26 May 2024 17:07:01 +0300 Subject: [PATCH 2/4] vc: replace automatic CPU feature handling with options --- recipes/vc/all/conanfile.py | 49 ++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/recipes/vc/all/conanfile.py b/recipes/vc/all/conanfile.py index 12e8e45ebe604..b7bf357bd503f 100644 --- a/recipes/vc/all/conanfile.py +++ b/recipes/vc/all/conanfile.py @@ -6,6 +6,30 @@ required_conan_version = ">=1.50.0" +# https://github.com/VcDevel/Vc/blob/1.4.4/cmake/OptimizeForArchitecture.cmake#L493-L513 +cpu_features = [ + "sse2", + "sse3", + "ssse3", + "sse4_1", + "sse4_2", + "sse4a", + "avx", + "fma", + "bmi2", + "avx2", + "xop", + "fma4", + "avx512f", + "avx512vl", + "avx512pf", + "avx512er", + "avx512cd", + "avx512dq", + "avx512bw", + "avx512ifma", + "avx512vbmi", +] class VcConan(ConanFile): name = "vc" @@ -22,10 +46,28 @@ class VcConan(ConanFile): default_options = { "fPIC": True, } + # See https://github.com/VcDevel/Vc/blob/1.4.4/cmake/OptimizeForArchitecture.cmake for details. + # Defaults are based on Steam Hardware survey as of 2024-05 and the common subset of features supported by both + # Intel Skylake (2015+) and AMD Piledriver (2012+) architectures. + options.update({f"use_{feature}": [True, False] for feature in cpu_features}) + default_options.update({f"use_{feature}": False for feature in cpu_features}) + default_options.update({ + "use_sse2": True, + "use_sse3": True, + "use_ssse3": True, + "use_sse4_1": True, + "use_sse4_2": True, + "use_sse4a": False, + "use_avx": True, + "use_fma": True, + }) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.settings.arch not in ["x86", "x86_64"]: + for feature in cpu_features: + self.options.rm_safe(f"use_{feature}") def layout(self): cmake_layout(self, src_folder="src") @@ -39,11 +81,16 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + # Set TARGET_ARCHITECTURE to generic to avoid automatic detection of the target architecture. + tc.variables["TARGET_ARCHITECTURE"] = "generic" + for feature in cpu_features: + tc.variables[f"USE_{feature.upper()}"] = self.options.get_safe(f"use_{feature}", False) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def _patch_sources(self): cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") - replace_in_file(self, cmakelists, "AddCompilerFlag(\"-fPIC\" CXX_FLAGS libvc_compile_flags)", "") + replace_in_file(self, cmakelists, 'AddCompilerFlag("-fPIC" CXX_FLAGS libvc_compile_flags)', "") def build(self): self._patch_sources() From e81b66a7263069003809c530790052c817bdd7e1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 26 May 2024 18:03:02 +0300 Subject: [PATCH 3/4] vc: cpu_architecture option --- recipes/vc/all/conanfile.py | 64 +++++++++++-------------------------- 1 file changed, 19 insertions(+), 45 deletions(-) diff --git a/recipes/vc/all/conanfile.py b/recipes/vc/all/conanfile.py index b7bf357bd503f..88b94ad21adf4 100644 --- a/recipes/vc/all/conanfile.py +++ b/recipes/vc/all/conanfile.py @@ -1,4 +1,5 @@ from conan import ConanFile +from conan.tools.apple import is_apple_os from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, replace_in_file, rmdir @@ -6,30 +7,6 @@ required_conan_version = ">=1.50.0" -# https://github.com/VcDevel/Vc/blob/1.4.4/cmake/OptimizeForArchitecture.cmake#L493-L513 -cpu_features = [ - "sse2", - "sse3", - "ssse3", - "sse4_1", - "sse4_2", - "sse4a", - "avx", - "fma", - "bmi2", - "avx2", - "xop", - "fma4", - "avx512f", - "avx512vl", - "avx512pf", - "avx512er", - "avx512cd", - "avx512dq", - "avx512bw", - "avx512ifma", - "avx512vbmi", -] class VcConan(ConanFile): name = "vc" @@ -42,32 +19,31 @@ class VcConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], + # https://github.com/VcDevel/Vc/blob/1.4.4/cmake/OptimizeForArchitecture.cmake + "cpu_architecture": [ + "auto", "generic", "none", "x86-64", "x86-64-v2", "x86-64-v3", "x86-64-v4", + # Intel + "core", "merom", "penryn", "nehalem", "westmere", "sandy-bridge", "ivy-bridge", "haswell", + "broadwell", "skylake", "skylake-xeon", "kaby-lake", "cannonlake", "silvermont", "goldmont", + "knl", "atom", + # AMD + "k8", "k8-sse3", "barcelona", "istanbul", "magny-cours", "bulldozer", "interlagos", + "piledriver", "AMD 14h", "AMD 16h", "zen", "zen3" + ], } default_options = { "fPIC": True, + "cpu_architecture": "sandy-bridge", # sse sse2 sse3 ssse3 sse4.1 sse4.2 avx } - # See https://github.com/VcDevel/Vc/blob/1.4.4/cmake/OptimizeForArchitecture.cmake for details. - # Defaults are based on Steam Hardware survey as of 2024-05 and the common subset of features supported by both - # Intel Skylake (2015+) and AMD Piledriver (2012+) architectures. - options.update({f"use_{feature}": [True, False] for feature in cpu_features}) - default_options.update({f"use_{feature}": False for feature in cpu_features}) - default_options.update({ - "use_sse2": True, - "use_sse3": True, - "use_ssse3": True, - "use_sse4_1": True, - "use_sse4_2": True, - "use_sse4a": False, - "use_avx": True, - "use_fma": True, - }) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if is_apple_os(self): + # sse sse2 sse3 ssse3 sse4.1 sse4.2, no avx + self.options.cpu_architecture = "westmere" if self.settings.arch not in ["x86", "x86_64"]: - for feature in cpu_features: - self.options.rm_safe(f"use_{feature}") + del self.options.cpu_architecture def layout(self): cmake_layout(self, src_folder="src") @@ -81,10 +57,8 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - # Set TARGET_ARCHITECTURE to generic to avoid automatic detection of the target architecture. - tc.variables["TARGET_ARCHITECTURE"] = "generic" - for feature in cpu_features: - tc.variables[f"USE_{feature.upper()}"] = self.options.get_safe(f"use_{feature}", False) + # https://github.com/openMVG/openMVG/blob/v2.1/src/cmakeFindModules/OptimizeForArchitecture.cmake + tc.variables["TARGET_ARCHITECTURE"] = self.options.get_safe("cpu_architecture", "none") tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() From 3321ba9b7e4d7dea00df729db61a5734035e2a92 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 3 Jul 2024 19:43:10 +0300 Subject: [PATCH 4/4] vc: bump to v1.4.5 --- recipes/vc/all/conandata.yml | 6 +++--- recipes/vc/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/vc/all/conandata.yml b/recipes/vc/all/conandata.yml index d9d4a0eedacb9..1729ef3b5cafd 100644 --- a/recipes/vc/all/conandata.yml +++ b/recipes/vc/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "1.4.4": - url: "https://github.com/VcDevel/Vc/archive/1.4.4.tar.gz" - sha256: "5933108196be44c41613884cd56305df320263981fe6a49e648aebb3354d57f3" + "1.4.5": + url: "https://github.com/VcDevel/Vc/archive/1.4.5.tar.gz" + sha256: "eb734ef4827933fcd67d4c74aef54211b841c350a867c681c73003eb6d511a48" "1.4.3": url: "https://github.com/VcDevel/Vc/archive/1.4.3.tar.gz" sha256: "988ea0053f3fbf17544ca776a2749c097b3139089408b0286fa4e9e8513e037f" diff --git a/recipes/vc/config.yml b/recipes/vc/config.yml index ec43017157e97..5c5a6b4134128 100644 --- a/recipes/vc/config.yml +++ b/recipes/vc/config.yml @@ -1,5 +1,5 @@ versions: - "1.4.4": + "1.4.5": folder: all "1.4.3": folder: all