-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vc: add v1.4.5 #22064
base: master
Are you sure you want to change the base?
vc: add v1.4.5 #22064
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -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 | ||||||||
|
@@ -18,14 +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 | ||||||||
} | ||||||||
|
||||||||
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"]: | ||||||||
del self.options.cpu_architecture | ||||||||
|
||||||||
def layout(self): | ||||||||
cmake_layout(self, src_folder="src") | ||||||||
|
@@ -39,11 +57,14 @@ def source(self): | |||||||
|
||||||||
def generate(self): | ||||||||
tc = CMakeToolchain(self) | ||||||||
# 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" | ||||||||
Comment on lines
+61
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modifying
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've seen discussions on whether I've personally preferred There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using cache variables as a default approach is what we recommend in the documentation since Nov 2022: https://docs.conan.io/2/reference/tools/cmake/cmaketoolchain.html#variables
There was never an internal discussion - this was the conclusion of this issue reported here: conan-io/conan#11937 - which is detailed and discussed in the open. The conclusion was that unless it's a variable CMake expects to be defined in a toolchain file, passing it as a As for other recipes having it - a lot of recipes used |
||||||||
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() | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
versions: | ||
"1.4.5": | ||
folder: all | ||
"1.4.3": | ||
folder: all | ||
"1.4.2": | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this not be detected from the host profile? Wouldn't that make a bit more sense? It might not be possible but just thinking out loud
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's a very good point. Not with the current settings, but this could well be a separate
arch.microarchitecture
or something similar. It could even set the appropriate-march=...
automatically, probably.Many projects provide an option to set
-march=native
, but this always gets disabled by package managers to build for the lowest common denominator. This is a place where the precise host profile capabilities of Conan could really shine.Also, duplicating these options across packages is not ideal either. I applied the exact same logic in the OpenMVG recipe as well: #23836.