Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Split optimizations into different options
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Jun 22, 2022
1 parent 0735e7b commit df21b91
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 117 deletions.
118 changes: 59 additions & 59 deletions .github/workflows/build.yml
Expand Up @@ -15,13 +15,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
build
key: linux-arm64-v${{ env.CACHE_VERSION }}
#- name: Set up cache
#id: cache
#uses: actions/cache@v2
#with:
#path: |
#build
#key: linux-arm64-v${{ env.CACHE_VERSION }}
- name: Fix GitHub's mess
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
Expand All @@ -48,7 +48,7 @@ jobs:
LDFLAGS: -static-libgcc -static-libstdc++
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
run: |
meson build --buildtype=release --prefix=/usr
meson build --buildtype=release --prefix=/usr -Dsse-optimizations=false
ninja -C build
- name: Install linux armhf
run: |
Expand Down Expand Up @@ -86,13 +86,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
build
key: linux-armhf-v${{ env.CACHE_VERSION }}
#- name: Set up cache
#id: cache
#uses: actions/cache@v2
#with:
#path: |
#build
#key: linux-armhf-v${{ env.CACHE_VERSION }}
- name: Fix GitHub's mess
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
LDFLAGS: -static-libgcc -static-libstdc++
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig
run: |
meson build --buildtype=release --prefix=/usr
meson build --buildtype=release --prefix=/usr -Dsse-optimizations=false
ninja -C build
- name: Install linux armhf
run: |
Expand Down Expand Up @@ -159,13 +159,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
build
key: linux-i686-v${{ env.CACHE_VERSION }}
#- name: Set up cache
#id: cache
#uses: actions/cache@v2
#with:
#path: |
#build
#key: linux-i686-v${{ env.CACHE_VERSION }}
- name: Fix GitHub's mess
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
Expand Down Expand Up @@ -222,13 +222,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
build
key: linux-x86_64-v${{ env.CACHE_VERSION }}
#- name: Set up cache
#id: cache
#uses: actions/cache@v2
#with:
#path: |
#build
#key: linux-x86_64-v${{ env.CACHE_VERSION }}
- name: Set up dependencies
run: |
sudo apt-get update -qq
Expand Down Expand Up @@ -320,20 +320,20 @@ jobs:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
build
key: macos-intel-v${{ env.CACHE_VERSION }}
#- name: Set up cache
#id: cache
#uses: actions/cache@v2
#with:
#path: |
#build
#key: macos-intel-v${{ env.CACHE_VERSION }}
- name: Set up dependencies
run: |
brew install meson
- name: Build macOS intel
env:
CFLAGS: -arch x86_64 -mmacosx-version-min=10.8 -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_8 -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_8
CXXFLAGS: -arch x86_64 -mmacosx-version-min=10.8 -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_8 -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_8
CXXFLAGS: -arch x86_64 -mmacosx-version-min=10.8 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_8 -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_8
LDFLAGS: -arch x86_64 -mmacosx-version-min=10.8 -stdlib=libc++
run: |
meson build --buildtype=release --prefix=/usr
Expand Down Expand Up @@ -365,13 +365,13 @@ jobs:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
build
key: macos-universal-v${{ env.CACHE_VERSION }}
#- name: Set up cache
#id: cache
#uses: actions/cache@v2
#with:
#path: |
#build
#key: macos-universal-v${{ env.CACHE_VERSION }}
- name: Fix up Xcode
run: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*
Expand Down Expand Up @@ -414,13 +414,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
build
key: win32-v${{ env.CACHE_VERSION }}
#- name: Set up cache
#id: cache
#uses: actions/cache@v2
#with:
#path: |
#build
#key: win32-v${{ env.CACHE_VERSION }}
- name: Fix GitHub's mess
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
Expand Down Expand Up @@ -463,13 +463,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up cache
id: cache
uses: actions/cache@v2
with:
path: |
build
key: win64-v${{ env.CACHE_VERSION }}
#- name: Set up cache
#id: cache
#uses: actions/cache@v2
#with:
#path: |
#build
#key: win64-v${{ env.CACHE_VERSION }}
- name: Fix GitHub's mess
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
Expand Down
37 changes: 24 additions & 13 deletions meson.build
Expand Up @@ -26,6 +26,8 @@ build_juce6_only = get_option('build-juce6-only')
build_juce7_only = get_option('build-juce7-only')
build_universal = get_option('build-universal')
optimizations = get_option('optimizations') and buildtype != 'debug'
lto_optimizations = get_option('lto-optimizations') and buildtype != 'debug'
sse_optimizations = get_option('sse-optimizations') and buildtype != 'debug'

###############################################################################
# set paths
Expand Down Expand Up @@ -176,28 +178,37 @@ build_flags_release_cpp = [
'-fvisibility-inlines-hidden',
]

if optimizations or sse_optimizations
build_flags_release += [
'-ffast-math',
]
endif

if optimizations
build_flags_release += [
# common
'-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-funroll-loops',
# lto
'-fno-strict-aliasing', '-flto',
'-fomit-frame-pointer', '-ftree-vectorize', '-funroll-loops',
]
if not os_darwin
# common, gcc only
build_flags_release += [
'-fprefetch-loop-arrays',
]
endif
if build_machine.cpu_family().contains('x86') or build_universal
endif

if lto_optimizations
build_flags_release += [
'-fno-strict-aliasing', '-flto',
]
endif

if sse_optimizations or build_universal
build_flags_release += [
'-mtune=generic', '-msse', '-msse2',
]
if not build_universal
build_flags_release += [
'-mtune=generic', '-msse', '-msse2',
'-mfpmath=sse',
]
if not build_universal
build_flags_release += [
'-mfpmath=sse',
]
endif
endif
endif

Expand Down Expand Up @@ -254,7 +265,7 @@ link_flags_release = [
'-ffunction-sections',
]

if optimizations
if lto_optimizations
link_flags_release += [
'-Werror=odr',
'-Werror=lto-type-mismatch',
Expand Down
14 changes: 13 additions & 1 deletion meson_options.txt
@@ -1,7 +1,19 @@
option('optimizations',
type: 'boolean',
value: true,
description: 'Enable various optimizations',
description: 'Enable various math-related optimizations',
)

option('lto-optimizations',
type: 'boolean',
value: true,
description: 'Enable LTO optimizations',
)

option('sse-optimizations',
type: 'boolean',
value: true,
description: 'Enable SSE optimizations',
)

option('linux-embed',
Expand Down
22 changes: 0 additions & 22 deletions ports-juce5/meson.build
Expand Up @@ -89,28 +89,6 @@ build_flags_plugin = [
'-Werror=deprecated-declarations',
]

build_flags_plugin_debug = [
]

build_flags_plugin_release = [
'-ffast-math',
]

if optimizations and not linux_embed
build_flags_plugin_release += [
'-mfpmath=sse',
]
endif

###############################################################################
# combine flags depending on build type

if buildtype == 'debug'
build_flags_plugin += build_flags_plugin_debug
else
build_flags_plugin += build_flags_plugin_release
endif

###############################################################################
# format-specific build flags

Expand Down
22 changes: 0 additions & 22 deletions ports-juce6/meson.build
Expand Up @@ -28,32 +28,10 @@ build_flags_plugin = [
'-Werror=deprecated-declarations',
]

build_flags_plugin_debug = [
]

build_flags_plugin_release = [
'-ffast-math',
]

build_flag_plugin_cpp = [
'-std=gnu++14',
]

if optimizations and not linux_embed
build_flags_plugin_release += [
'-mfpmath=sse',
]
endif

###############################################################################
# combine flags depending on build type

if buildtype == 'debug'
build_flags_plugin += build_flags_plugin_debug
else
build_flags_plugin += build_flags_plugin_release
endif

###############################################################################
# format-specific build flags

Expand Down

0 comments on commit df21b91

Please sign in to comment.