From 77ad1f5042e6b771808ae3bc5db77b11fccd1127 Mon Sep 17 00:00:00 2001 From: Jefferson Amstutz Date: Fri, 10 Jan 2025 17:42:25 -0600 Subject: [PATCH] change method of finding Python for robustness, enhance CI to cover issues --- .../actions/configure_and_build/action.yml | 54 +++++++++ .github/workflows/anari_sdk_ci.yml | 109 +++++++----------- cmake/anari_generate_codegen.cmake | 8 +- code_gen/CMakeLists.txt | 3 +- src/devices/CMakeLists.txt | 13 ++- 5 files changed, 110 insertions(+), 77 deletions(-) create mode 100644 .github/actions/configure_and_build/action.yml diff --git a/.github/actions/configure_and_build/action.yml b/.github/actions/configure_and_build/action.yml new file mode 100644 index 00000000..eb20f7fa --- /dev/null +++ b/.github/actions/configure_and_build/action.yml @@ -0,0 +1,54 @@ +## Copyright 2021-2024 The Khronos Group +## SPDX-License-Identifier: Apache-2.0 + +name: "Configure, build, and test ANARI-SDK" +description: "Runs cmake to configure, build, and test the ANARI-SDK" +inputs: + workspace: + description: "Main working directory" + required: true + config: + description: "Build configuration" + required: true + os: + description: "Operating system" + required: true + shell: + description: "Operating system" + required: true +runs: + using: "composite" + steps: + - name: Configure CMake + shell: ${{ inputs.shell }} + run: > + cmake -LA -B ${{ inputs.workspace }}/build + -DCMAKE_BUILD_TYPE=${{ inputs.config }} + -DCMAKE_INSTALL_PREFIX=${{ inputs.workspace }}/build/install + -DBUILD_SHARED_LIBS=ON + -DBUILD_CTS=${{ inputs.os != 'ubuntu-20.04' }} + -DBUILD_EXAMPLES=ON + -DBUILD_HDANARI=OFF + -DBUILD_HELIDE_DEVICE=ON + -DBUILD_REMOTE_DEVICE=${{ inputs.os == 'ubuntu-latest' }} + -DBUILD_TESTING=ON + -DBUILD_VIEWER=OFF + + - name: Build + shell: ${{ inputs.shell }} + run: cmake --build ${{ inputs.workspace }}/build --config ${{ inputs.config }} --target install + + - name: Unit Tests + shell: ${{ inputs.shell }} + working-directory: ${{ inputs.workspace }}/build + run: ctest -R unit_test -C ${{ inputs.config }} + + - name: Render Tests + shell: ${{ inputs.shell }} + working-directory: ${{inputs.workspace}}/build + run: ctest -R render_test -C ${{ inputs.config }} + + - name: Tutorial Tests + shell: ${{ inputs.shell }} + working-directory: ${{inputs.workspace}}/build + run: ctest -R anariTutorial -C ${{ inputs.config }} diff --git a/.github/workflows/anari_sdk_ci.yml b/.github/workflows/anari_sdk_ci.yml index a17def4f..23211a6e 100644 --- a/.github/workflows/anari_sdk_ci.yml +++ b/.github/workflows/anari_sdk_ci.yml @@ -1,3 +1,6 @@ +## Copyright 2021-2024 The Khronos Group +## SPDX-License-Identifier: Apache-2.0 + name: ANARI-SDK CI on: @@ -10,85 +13,57 @@ env: ANARI_LIBRARY: helide jobs: - build: + build-linux: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] config: [Release, Debug] - steps: - - uses: actions/checkout@v3 - - name: Install Packages - if: ${{ matrix.os == 'ubuntu-latest' }} - run: sudo apt install -y libboost-system-dev - - - name: Configure CMake - run: > - cmake -LA -B ${{ github.workspace }}/build - -DCMAKE_BUILD_TYPE=${{ matrix.config }} - -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install - -DBUILD_SHARED_LIBS=ON - -DBUILD_CTS=ON - -DBUILD_EXAMPLES=ON - -DBUILD_HDANARI=OFF - -DBUILD_HELIDE_DEVICE=ON - -DBUILD_REMOTE_DEVICE=${{ matrix.os == 'ubuntu-latest' }} - -DBUILD_TESTING=ON - -DBUILD_VIEWER=OFF - - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{ matrix.config }} --target install - - - name: Unit Tests - working-directory: ${{ github.workspace }}/build - run: ctest -R unit_test -C ${{ matrix.config }} - - - name: Render Tests - working-directory: ${{github.workspace}}/build - run: ctest -R render_test -C ${{ matrix.config }} - - - name: Tutorial Tests - working-directory: ${{github.workspace}}/build - run: ctest -R anariTutorial -C ${{ matrix.config }} + run: sudo apt install -y libboost-system-dev libpython3-dev + - name: Check out code + uses: actions/checkout@v3 + - name: Build and test + uses: ./.github/actions/configure_and_build + with: + workspace: ${{ github.workspace }} + config: ${{ matrix.config }} + os: ${{ matrix.os }} + shell: bash + + build-windows: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest] + config: [Release, Debug] + steps: + - name: Check out code + uses: actions/checkout@v3 + - name: Build and test + uses: ./.github/actions/configure_and_build + with: + workspace: ${{ github.workspace }} + config: ${{ matrix.config }} + os: ${{ matrix.os }} + shell: pwsh build-macos: # iOS is 10x expensive to run on GitHub machines, so only run if we know something else passed as well - needs: build + needs: [build-linux, build-windows] runs-on: ${{ matrix.os }} strategy: matrix: os: [macos-latest] config: [Release] - steps: - - uses: actions/checkout@v3 - - - name: Configure CMake - run: > - cmake -LA -B ${{ github.workspace }}/build - -DCMAKE_BUILD_TYPE=${{ matrix.config }} - -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install - -DBUILD_SHARED_LIBS=ON - -DBUILD_EXAMPLES=ON - -DBUILD_HDANARI=OFF - -DBUILD_HELIDE_DEVICE=ON - -DBUILD_REMOTE_DEVICE=OFF - -DBUILD_TESTING=ON - -DBUILD_VIEWER=OFF - - - name: Build - run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.config }} --target install - - - name: Unit Tests - working-directory: ${{ github.workspace }}/build - run: ctest -R unit_test -C ${{ matrix.config }} - - - name: Render Tests - working-directory: ${{ github.workspace }}/build - run: ctest -R render_test -C ${{ matrix.config }} - - - name: Tutorial Tests - working-directory: ${{ github.workspace }}/build - run: ctest -R anariTutorial -C ${{ matrix.config }} + - name: Check out code + uses: actions/checkout@v3 + - name: Build and test + uses: ./.github/actions/configure_and_build + with: + workspace: ${{ github.workspace }} + config: ${{ matrix.config }} + os: ${{ matrix.os }} + shell: bash diff --git a/cmake/anari_generate_codegen.cmake b/cmake/anari_generate_codegen.cmake index 20e9da9e..a4219075 100644 --- a/cmake/anari_generate_codegen.cmake +++ b/cmake/anari_generate_codegen.cmake @@ -6,6 +6,8 @@ function(anari_generate_queries) return() endif() + find_package(Python3 REQUIRED COMPONENTS Interpreter) + cmake_parse_arguments( # prefix "GENERATE" @@ -21,12 +23,6 @@ function(anari_generate_queries) file(GLOB_RECURSE CORE_JSONS ${ANARI_CODE_GEN_ROOT}/api/*.json) - find_package(Python3 OPTIONAL_COMPONENTS Interpreter) - if (NOT TARGET Python3::Interpreter) - message(WARNING "Unable to find python interpreter, skipping code-gen targets") - return() - endif() - if (NOT DEFINED GENERATE_DEVICE_TARGET) message(FATAL_ERROR "DEVICE_TARGET option required for anari_generate_queries()") endif() diff --git a/code_gen/CMakeLists.txt b/code_gen/CMakeLists.txt index 67cb7de1..9fc149e1 100644 --- a/code_gen/CMakeLists.txt +++ b/code_gen/CMakeLists.txt @@ -24,8 +24,6 @@ if(CMAKE_VERSION VERSION_LESS "3.12") return() endif() -find_package(Python3 OPTIONAL_COMPONENTS Interpreter Development.Module) - if (NOT TARGET Python3::Interpreter) message(WARNING "Unable to find python interpreter, skipping code-gen + API bindings") return() @@ -71,6 +69,7 @@ add_custom_target(generate_headers DEPENDS add_dependencies(generate_all generate_headers) +find_package(Python3 QUIET COMPONENTS Interpreter Development.Module) if (NOT TARGET Python3::Module) message(WARNING "Unable to find python Module, skipping python bindings") return() diff --git a/src/devices/CMakeLists.txt b/src/devices/CMakeLists.txt index 7f71c715..e3d97b9a 100644 --- a/src/devices/CMakeLists.txt +++ b/src/devices/CMakeLists.txt @@ -1,8 +1,17 @@ ## Copyright 2021-2024 The Khronos Group ## SPDX-License-Identifier: Apache-2.0 -add_subdirectory(debug) -add_subdirectory(sink) +option(BUILD_DEBUG_DEVICE "Build debug device layer" ON) +mark_as_advanced(BUILD_DEBUG_DEVICE) +if (BUILD_DEBUG_DEVICE) + add_subdirectory(debug) +endif() + +option(BUILD_SINK_DEVICE "Build the sink device" ON) +mark_as_advanced(BUILD_SINK_DEVICE) +if (BUILD_SINK_DEVICE) + add_subdirectory(sink) +endif() option(BUILD_HELIDE_DEVICE "Build example 'helide' device" ON) if (BUILD_HELIDE_DEVICE)