cmake.yml 9.2 KB

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