Add rustflags_target_cpu method
This commit is contained in:
parent
a0725083f1
commit
066a88855b
@ -24,4 +24,20 @@ module Hardware
|
|||||||
generic_oldest_cpu
|
generic_oldest_cpu
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Override
|
||||||
|
# Mirrors version-dependent logic of oldest_cpu
|
||||||
|
sig { params(version: T.nilable(Version)).returns(String) } # FIXME: Version, String or Symbol?
|
||||||
|
def self.rustflags_target_cpu(version = nil)
|
||||||
|
version = if version
|
||||||
|
MacOSVersion.new(version.to_s)
|
||||||
|
else
|
||||||
|
MacOS.version
|
||||||
|
end
|
||||||
|
if Hardware::CPU.intel? && version >= :mojave
|
||||||
|
"-Ctarget-cpu=nehalem"
|
||||||
|
else
|
||||||
|
generic_rustflags_target_cpu
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -214,6 +214,18 @@ module Hardware
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias generic_oldest_cpu oldest_cpu
|
alias generic_oldest_cpu oldest_cpu
|
||||||
|
|
||||||
|
# Returns a _full_ rustflag to set target cpu, if necessary;
|
||||||
|
# Falls back to empty string
|
||||||
|
# This mirrors the logic of `oldest_cpu`,
|
||||||
|
# But only where it is version dependent.
|
||||||
|
# Rust already defaults to the oldest supported cpu for the target-triple
|
||||||
|
# Including apple-m1 since 1.71.
|
||||||
|
sig { params(_version: T.nilable(Version)).returns(String) } # FIXME: Version, String or Symbol?
|
||||||
|
def rustflags_target_cpu(_version = nil)
|
||||||
|
""
|
||||||
|
end
|
||||||
|
alias generic_rustflags_target_cpu rustflags_target_cpu
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user