Skip to content

Commit

Permalink
feat(build/options): add --optimize and related flags (#119)
Browse files Browse the repository at this point in the history
Allow setting -march=native -mtune=native and -fomit-frame-pointer all
in one go, but also control each individually with new flags for each.
  • Loading branch information
jimeh authored Nov 25, 2024
1 parent 5c513ce commit 8267ac1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions build-emacs-for-macos
Original file line number Diff line number Diff line change
Expand Up @@ -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 += [
Expand Down Expand Up @@ -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 ' \
Expand Down

0 comments on commit 8267ac1

Please sign in to comment.