feat(build/options): add --optimize and related flags (#119)

Allow setting -march=native -mtune=native and -fomit-frame-pointer all
in one go, but also control each individually with new flags for each.
This commit is contained in:
2024-11-25 02:45:06 +00:00
committed by GitHub
parent 5c513ce2e7
commit 8267ac1662

View File

@@ -502,6 +502,8 @@ class Build
end
env << '-march=native' if options[:native_march]
env << '-mtune=native' if options[:native_mtune]
env << '-fomit-frame-pointer' if options[:fomit_frame_pointer]
if options[:fd_setsize].respond_to?(:>=) && options[:fd_setsize] >= 1024
env += [
@@ -1845,12 +1847,34 @@ if __FILE__ == $PROGRAM_NAME
'(default: enabled if supported)'
) { |v| cli_options[:native_comp] = v }
opts.on(
'--optimize',
'Shorthand for --native-march --native-mtune --fomit-frame-pointer' \
'(default: disabled)'
) do
cli_options[:native_march] = true
cli_options[:native_mtune] = true
cli_options[:fomit_frame_pointer] = true
end
opts.on(
'--[no-]native-march',
'Enable/disable -march=native CFLAG' \
'(default: disabled)'
) { |v| cli_options[:native_march] = v }
opts.on(
'--[no-]native-mtune',
'Enable/disable -mtune=native CFLAG' \
'(default: disabled)'
) { |v| cli_options[:native_mtune] = v }
opts.on(
'--[no-]fomit-frame-pointer',
'Enable/disable -fomit-frame-pointer CFLAG' \
'(default: disabled)'
) { |v| cli_options[:fomit_frame_pointer] = v }
opts.on(
'--[no-]native-full-aot',
'Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation ' \