From b19255d862e71a62bc69c52f712ed6428d8ade5e Mon Sep 17 00:00:00 2001 From: Ada Date: Fri, 29 Sep 2023 23:22:49 +0100 Subject: [PATCH] optimized builds --- .github/workflows/build-rivet.yml | 5 +++-- meson.build | 32 +++++++++++++++++++------------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-rivet.yml b/.github/workflows/build-rivet.yml index 8eadf801a..8e93c673e 100644 --- a/.github/workflows/build-rivet.yml +++ b/.github/workflows/build-rivet.yml @@ -17,6 +17,7 @@ jobs: build: strategy: matrix: + type: [release, custom] os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: @@ -52,7 +53,7 @@ jobs: run: | mkdir build cd build - meson setup .. + meson setup .. --buildtype=${{matrix.type}} cd .. - name: Fix Ninja script for LLVM on Windows if: runner.os == 'Windows' @@ -67,5 +68,5 @@ jobs: - name: Upload build uses: actions/upload-artifact@v3 with: - name: build-${{matrix.os}} + name: rivet-${{runner.os}}-${{matrix.type}} path: build/staging diff --git a/meson.build b/meson.build index 4cf81fbc5..c70bc22db 100644 --- a/meson.build +++ b/meson.build @@ -67,43 +67,51 @@ cpp_args = compiler.get_supported_arguments( ) if get_option('buildtype') == 'custom' - cpp_args += compiler.get_supported_arguments( - '-march=native', - '-mtune=native', + opt_args = compiler.get_supported_arguments( + '-march=knl', + '-mtune=knl', '-fopenmp' ) if compiler.get_id() == 'clang' + add_project_arguments('-Ofast', language: 'cpp') + if compiler.compiles('void test() { }', name: 'has polly', args: ['-mllvm', '-polly']) - cpp_args += ['-mllvm', '-polly'] + opt_args += ['-mllvm', '-polly'] if compiler.compiles('void test() { }', name: 'has polly vectorizer', args: ['-mllvm', '-polly-vectorizer=stripmine']) - cpp_args += ['-mllvm', '-polly-vectorizer=stripmine'] + opt_args += ['-mllvm', '-polly-vectorizer=stripmine'] endif if compiler.compiles('void test() { }', name: 'has polly parallel', args: ['-mllvm', '-polly-parallel']) - cpp_args += ['-mllvm', '-polly-parallel'] + opt_args += ['-mllvm', '-polly-parallel'] endif if compiler.compiles('void test() { }', name: 'has polly omp backend', args: ['-mllvm', '-polly-omp-backend=LLVM']) - cpp_args += ['-mllvm', '-polly-omp-backend=LLVM'] + opt_args += ['-mllvm', '-polly-omp-backend=LLVM'] endif if compiler.compiles('void test() { }', name: 'has polly num threads', args: ['-mllvm', '-polly-num-threads=24']) - cpp_args += ['-mllvm', '-polly-num-threads=24'] + opt_args += ['-mllvm', '-polly-num-threads=24'] endif if compiler.compiles('void test() { }', name: 'has polly scheduling', args: ['-mllvm', '-polly-scheduling=dynamic']) - cpp_args += ['-mllvm', '-polly-scheduling=dynamic'] + opt_args += ['-mllvm', '-polly-scheduling=dynamic'] endif if compiler.compiles('void test() { }', name: 'has polly scheduling chunksize', args: ['-mllvm', '-polly-scheduling-chunksize=1']) - cpp_args += ['-mllvm', '-polly-scheduling-chunksize=1'] + opt_args += ['-mllvm', '-polly-scheduling-chunksize=1'] endif - - add_project_arguments('-O3', language: 'cpp') + endif + else + if compiler.get_id() == 'msvc' + opt_args += ['/Ox'] + else + opt_args += ['-O2'] endif endif + + add_global_arguments(opt_args, language: 'cpp') endif add_project_arguments(cpp_args, language: 'cpp')