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..9f8783120 100644 --- a/meson.build +++ b/meson.build @@ -8,9 +8,56 @@ project('rivet', 'cpp', ], meson_version: '>=1.2.1') - compiler = meson.get_compiler('cpp') +if get_option('buildtype') == 'custom' + 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']) + opt_args += ['-mllvm', '-polly'] + + if compiler.compiles('void test() { }', name: 'has polly vectorizer', 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']) + opt_args += ['-mllvm', '-polly-parallel'] + endif + + if compiler.compiles('void test() { }', name: 'has polly omp backend', 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']) + opt_args += ['-mllvm', '-polly-num-threads=24'] + endif + + if compiler.compiles('void test() { }', name: 'has polly scheduling', 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']) + opt_args += ['-mllvm', '-polly-scheduling-chunksize=1'] + endif + endif + else + if compiler.get_id() == 'msvc' + opt_args += ['/Ox'] + else + opt_args += ['-O2'] + endif + endif + + add_global_arguments(opt_args, language: 'cpp') +endif + # public dependencies deps = [] if not compiler.check_header('ankerl/unordered_dense.h') @@ -66,46 +113,6 @@ cpp_args = compiler.get_supported_arguments( '-fcoroutines' ) -if get_option('buildtype') == 'custom' - cpp_args += compiler.get_supported_arguments( - '-march=native', - '-mtune=native', - '-fopenmp' - ) - - if compiler.get_id() == 'clang' - if compiler.compiles('void test() { }', name: 'has polly', args: ['-mllvm', '-polly']) - cpp_args += ['-mllvm', '-polly'] - - if compiler.compiles('void test() { }', name: 'has polly vectorizer', args: ['-mllvm', '-polly-vectorizer=stripmine']) - cpp_args += ['-mllvm', '-polly-vectorizer=stripmine'] - endif - - if compiler.compiles('void test() { }', name: 'has polly parallel', args: ['-mllvm', '-polly-parallel']) - cpp_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'] - endif - - if compiler.compiles('void test() { }', name: 'has polly num threads', args: ['-mllvm', '-polly-num-threads=24']) - cpp_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'] - endif - - if compiler.compiles('void test() { }', name: 'has polly scheduling chunksize', args: ['-mllvm', '-polly-scheduling-chunksize=1']) - cpp_args += ['-mllvm', '-polly-scheduling-chunksize=1'] - endif - - add_project_arguments('-O3', language: 'cpp') - endif - endif -endif - add_project_arguments(cpp_args, language: 'cpp') icon_sources = []