Skip to content

GitHub action to setup C/C++ compiler of choice for job

License

Notifications You must be signed in to change notification settings

rlalik/setup-cpp-compiler

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test

This GitHub action sets up selected C/C++ compiler in your workflow run.

The action requires specyfing compiler version using compiler input.

Use it in your workflow like this:

    - name: Install compiler
      id: install_cc
      uses: rlalik/setup-cpp-compiler@master
      with:
        compiler: latest

Output variables:

  • cc - holds C compiler
  • cxx - holds C++ compiler

Example usage:

    - name: Use compiler
        shell: bash
        env:
            CC: ${{ steps.install_cc.outputs.cc }}
            CXX: ${{ steps.install_cc.outputs.cxx }}

OS selection

Currently only Ubuntu and Windows are fully supported. For MacOS it is possible to install selected gcc however clang will always fallback to system default.

Compiler selection

The input compiler can take following names:

  • latest - resolves to the default gcc on a given system
  • gcc or gcc-latest - resolves to the default gcc on a given system
  • clang or clang-latest - resolves to the default clang on a given system
  • other values - depending on selected OS, see sections below.

Exceptions:

  • on MacOS, each gcc must have specified version, thus latest, gcc, gcc-latest are not allowed
  • on MacOS, clang versions are not supported

Available compilers

The available compilers are specific to the selected operating system.

You can check available versions here:

Example values of complilers

      matrix:
        os-version: [ ubuntu-latest ]
        compiler: [ latest, gcc-latest, gcc-9, gcc-10, g++-11, clang, clang-10, clang-11, clang++-12 ]
      matrix:
        os-version: [ windows-latest ]
        compiler: [ latest, gcc-latest, gcc-6.4.0, gcc-10.2.0, g++-11.2.0, clang, clang-8.0.0, clang-11.1.0, clang++-12.0.1 ]

About

GitHub action to setup C/C++ compiler of choice for job

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages