Skip to content

Add -Ofast and -march=native if no AVX #109

Add -Ofast and -march=native if no AVX

Add -Ofast and -march=native if no AVX #109

Workflow file for this run

name: CMake
on:
push:
branches:
- '*'
- '!main'
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- { os: 'ubuntu-latest', instructions: 'avx' }
- { os: 'ubuntu-latest', instructions: 'avx2' }
- { os: 'macos-latest', instructions: 'avx' }
- { os: 'macos-latest', instructions: 'avx2' }
- { os: 'windows-latest', build: 'msvc', instructions: 'avx' }
- { os: 'windows-latest', build: 'msvc', instructions: 'avx2' }
- { os: 'windows-latest', build: 'mingw', instructions: 'avx' }
- { os: 'windows-latest', build: 'mingw', instructions: 'avx2' }
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure CMake
if: matrix.build == 'msvc'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
if: matrix.build == 'msvc'
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
if: matrix.build == 'msvc'
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
- name: Prepare binary
if: matrix.build == 'msvc'
run: |
if ("${{ matrix.os }}" -eq "windows-latest") {
cp ${{github.workspace}}\build\bin\Release\chat.exe chat-msvc.exe
mv chat-msvc.exe chat-windows-latest-msvc.exe
}
shell: pwsh
- name: Setup MinGW
if: matrix.os == 'windows-latest'
run: |
choco install mingw -y -libwinpthread
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure CMake
run: |
if ("${{ matrix.os }}" -eq "windows-latest") {
$env:PATH += ";C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin"
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DAVX2=${{ matrix.instructions == 'avx2' && 'ON' || 'OFF' }} -G "MinGW Makefiles"
} elseif ("${{ matrix.arch }}" -eq "aarch64") {
} else {
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DAVX2=${{ matrix.instructions == 'avx2' && 'ON' || 'OFF' }}
}
shell: pwsh
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}