cmake.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. name: CMake
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - '.github/workflows/cmake.yml'
  7. - 'src/**'
  8. - 'CMakeModules/**'
  9. - CMakeLists.txt
  10. - 'protocols/**'
  11. branches: [ "main" ]
  12. pull_request:
  13. paths:
  14. - '.github/workflows/cmake.yml'
  15. - 'src/**'
  16. - 'CMakeModules/**'
  17. - CMakeLists.txt
  18. - 'protocols/**'
  19. branches: [ "main" ]
  20. jobs:
  21. build-x11:
  22. strategy:
  23. matrix:
  24. os: [ubuntu-22.04, ubuntu-24.04]
  25. build_type: [Release, Debug]
  26. # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
  27. # You can convert this to a matrix build if you need cross-platform coverage.
  28. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
  29. runs-on: ${{ matrix.os }}
  30. steps:
  31. - uses: actions/checkout@v3
  32. with:
  33. submodules: true
  34. # cache some build information
  35. - name: ccache
  36. uses: hendrikmuhs/ccache-action@v1.2
  37. with:
  38. key: ${{ github.job }}-${{ matrix.os }} # Eg. "some_build-ubuntu-latest"
  39. - name: Install dependencies
  40. if: matrix.os == 'ubuntu-22.04'
  41. run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv1 libpulse-dev libpulse0 libfftw3-dev
  42. - name: Install dependencies
  43. if: matrix.os == 'ubuntu-24.04'
  44. run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libpulse-dev libpulse0 libfftw3-dev
  45. - name: Configure CMake
  46. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  47. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  48. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache'
  49. - name: Build
  50. # Build your program with the given configuration
  51. run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}
  52. build-x11-wayland:
  53. permissions:
  54. actions: read
  55. contents: read
  56. security-events: write
  57. strategy:
  58. matrix:
  59. os: [ubuntu-22.04, ubuntu-24.04]
  60. build_type: [Release, Debug]
  61. # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
  62. # You can convert this to a matrix build if you need cross-platform coverage.
  63. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
  64. runs-on: ${{ matrix.os }}
  65. steps:
  66. - uses: actions/checkout@v3
  67. with:
  68. submodules: true
  69. - name: ccache
  70. uses: hendrikmuhs/ccache-action@v1.2
  71. with:
  72. key: ${{ github.job }}-${{ matrix.os }} # Eg. "some_build-ubuntu-latest"
  73. - name: Initialize CodeQL
  74. # Initializes the CodeQL tools for scanning.
  75. uses: github/codeql-action/init@v3
  76. if: matrix.os == 'ubuntu-24.04'
  77. with:
  78. languages: 'cpp'
  79. - name: Install dependencies
  80. if: matrix.os == 'ubuntu-22.04'
  81. run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv1 libpulse-dev libpulse0 libfftw3-dev wayland-scanner++ wayland-protocols libwayland-dev
  82. - name: Install dependencies
  83. if: matrix.os == 'ubuntu-24.04'
  84. run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libpulse-dev libpulse0 libfftw3-dev wayland-scanner++ wayland-protocols libwayland-dev
  85. - name: Configure CMake
  86. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  87. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  88. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache'
  89. - name: Build
  90. # Build your program with the given configuration
  91. run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}
  92. - name: Perform CodeQL Analysis
  93. if: matrix.os == 'ubuntu-24.04'
  94. uses: github/codeql-action/analyze@v3
  95. build-wayland:
  96. strategy:
  97. matrix:
  98. os: [ubuntu-22.04, ubuntu-24.04]
  99. build_type: [Release, Debug]
  100. # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
  101. # You can convert this to a matrix build if you need cross-platform coverage.
  102. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
  103. runs-on: ${{ matrix.os }}
  104. steps:
  105. - uses: actions/checkout@v3
  106. with:
  107. submodules: true
  108. - name: ccache
  109. uses: hendrikmuhs/ccache-action@v1.2
  110. with:
  111. key: ${{ github.job }}-${{ matrix.os }} # Eg. "some_build-ubuntu-latest"
  112. - name: Install dependencies
  113. if: matrix.os == 'ubuntu-22.04'
  114. run: sudo apt-get update && sudo apt-get -y install wayland-scanner++ wayland-protocols libwayland-dev libwayland-egl-backend-dev libglfw3-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libglm-dev libmpv-dev mpv libmpv1 libpulse-dev libpulse0 libfftw3-dev
  115. - name: Install dependencies
  116. if: matrix.os == 'ubuntu-24.04'
  117. run: sudo apt-get update && sudo apt-get -y install wayland-scanner++ wayland-protocols libwayland-dev libwayland-egl-backend-dev libglfw3-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libglm-dev libmpv-dev mpv libmpv2 libpulse-dev libpulse0 libfftw3-dev
  118. - name: Configure CMake
  119. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  120. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  121. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache'
  122. - name: Build
  123. # Build your program with the given configuration
  124. run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}