Skip to content

Commit

Permalink
change method of finding Python for robustness, enhance CI to cover i…
Browse files Browse the repository at this point in the history
…ssues
  • Loading branch information
jeffamstutz committed Jan 10, 2025
1 parent e7d5b0b commit 1aac72d
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 76 deletions.
49 changes: 49 additions & 0 deletions .github/actions/configure_and_build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## 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
runs:
using: "composite"
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Configure CMake
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=ON
-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
run: cmake --build ${{ inputs.workspace }}/build --config ${{ inputs.config }} --target install

- name: Unit Tests
working-directory: ${{ inputs.workspace }}/build
run: ctest -R unit_test -C ${{ inputs.config }}

- name: Render Tests
working-directory: ${{inputs.workspace}}/build
run: ctest -R render_test -C ${{ inputs.config }}

- name: Tutorial Tests
working-directory: ${{inputs.workspace}}/build
run: ctest -R anariTutorial -C ${{ inputs.config }}
98 changes: 32 additions & 66 deletions .github/workflows/anari_sdk_ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Copyright 2021-2024 The Khronos Group
## SPDX-License-Identifier: Apache-2.0

name: ANARI-SDK CI

on:
Expand All @@ -10,85 +13,48 @@ 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 }}
- name: Build and test
uses: ./.github/actions/configure_and_build
with:
workspace: ${{ github.workspace }}
config: ${{ matrix.config }}
os: ${{ matrix.os }}

build-windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
config: [Release, Debug]
steps:
- name: Build and test
uses: ./.github/actions/configure_and_build
with:
workspace: ${{ github.workspace }}
config: ${{ matrix.config }}
os: ${{ matrix.os }}

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: Build and test
uses: ./.github/actions/configure_and_build
with:
workspace: ${{ github.workspace }}
config: ${{ matrix.config }}
os: ${{ matrix.os }}
8 changes: 2 additions & 6 deletions cmake/anari_generate_codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ function(anari_generate_queries)
return()
endif()

find_package(Python3 REQUIRED COMPONENTS Interpreter)

cmake_parse_arguments(
# prefix
"GENERATE"
Expand All @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions code_gen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
13 changes: 11 additions & 2 deletions src/devices/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 1aac72d

Please sign in to comment.