From 204606e96b2f1210b2e58ea13aaff3e15caa0bfc Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sun, 13 Nov 2022 15:43:59 +0100 Subject: [PATCH] Add github CI --- .github/workflows/ci.yml | 57 +++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 3 +- cmake/CompileGLSL.cmake | 8 ++++-- server/CMakeLists.txt | 3 +- server/driver/wivrn_hmd.cpp | 1 - 5 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..8679d428 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: ci + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build-server: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: > + sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr -DWIVRN_BUILD_CLIENT=OFF -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + #- name: Test + # working-directory: ${{github.workspace}}/build + # # Execute tests defined by the CMake configuration. + # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + # run: ctest -C ${{env.BUILD_TYPE}} + + # build-android: + # runs-on: ubuntu-latest + # + # steps: + # - uses: actions/checkout@v3 + # - name: set up JDK 11 + # uses: actions/setup-java@v3 + # with: + # java-version: '11' + # distribution: 'temurin' + # cache: gradle + # + # - name: Grant execute permission for gradlew + # run: chmod +x gradlew + # - name: Build with Gradle + # run: ./gradlew build diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f99396c..a7c89b97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.20) project(WiVRn VERSION 1.0 LANGUAGES C CXX) set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) @@ -29,6 +29,7 @@ endif() find_package(PkgConfig REQUIRED) find_package(Vulkan REQUIRED) +pkg_check_modules(systemd IMPORTED_TARGET systemd) if (WIVRN_BUILD_SERVER) find_package(CUDAToolkit) diff --git a/cmake/CompileGLSL.cmake b/cmake/CompileGLSL.cmake index a761839b..7ea292ec 100644 --- a/cmake/CompileGLSL.cmake +++ b/cmake/CompileGLSL.cmake @@ -5,9 +5,11 @@ function(compile_glsl_aux shader_stage shader_name glsl_filename output) add_custom_command( OUTPUT ${output} - COMMAND echo "{ \"${shader_name}\", {" >> ${output} - COMMAND Vulkan::glslc -mfmt=num -fshader-stage=${shader_stage} -D${shader_stage_upper}_SHADER ${in_file} -o - >> ${output} - COMMAND echo "}}," >> ${output} + COMMAND echo "{ \"${shader_name}\", {" >> ${output} + COMMAND echo "#include \"${shader_name}.spv\"" >> ${output} + COMMAND echo "}}," >> ${output} + + COMMAND Vulkan::glslangValidator -V -S ${shader_stage} -D${shader_stage_upper}_SHADER ${in_file} -x -o ${shader_name}.spv DEPENDS ${glsl_filename} VERBATIM APPEND diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 9ccfff75..30e89eb1 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -68,6 +68,7 @@ add_executable(wivrn-server ${WIVRN_SHADER_HEADERS} driver/yuv_converter.cpp ) +target_compile_features(wivrn-server PRIVATE cxx_std_20) target_include_directories(wivrn-server SYSTEM PRIVATE ${monado_SOURCE_DIR}/src/xrt/compositor/) @@ -108,7 +109,7 @@ target_link_libraries( xrt-external-openxr xrt-interfaces - systemd + PkgConfig::systemd Boost::pfr PkgConfig::AVAHI Eigen3::Eigen diff --git a/server/driver/wivrn_hmd.cpp b/server/driver/wivrn_hmd.cpp index c696b40f..59955e94 100644 --- a/server/driver/wivrn_hmd.cpp +++ b/server/driver/wivrn_hmd.cpp @@ -35,7 +35,6 @@ #include "util/u_time.h" #include "util/u_var.h" -#include #include #include