Skip to content

Commit

Permalink
Merge branch 'next_release'
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffamstutz committed Nov 27, 2023
2 parents 286e28b + d95b167 commit d17fcf9
Show file tree
Hide file tree
Showing 548 changed files with 20,234 additions and 2,385 deletions.
15 changes: 4 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)

## Establish project

project(anari VERSION 0.7.2 LANGUAGES C CXX)
project(anari VERSION 0.8.0 LANGUAGES C CXX)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
Expand All @@ -51,12 +51,9 @@ cmake_dependent_option(BUILD_VIEWER
"BUILD_EXAMPLES"
OFF
)
cmake_dependent_option(INSTALL_VIEWER_LIBRARY
"Install anari::anari_viewer library target"
OFF
"BUILD_EXAMPLES;BUILD_VIEWER"
OFF
)
option(INSTALL_VIEWER_LIBRARY "Install anari::anari_viewer library target" ON)
option(INSTALL_VIEWER "Install anariViewer app" OFF)
mark_as_advanced(INSTALL_VIEWER)

## The generate_all targets collects all offline code generation targets

Expand All @@ -69,10 +66,6 @@ include(cmake/anari_sdk_fetch_project.cmake)

## Add library and executable targets

set(glm_DIR ${CMAKE_CURRENT_LIST_DIR}/external/glm/lib/cmake/glm)
find_package(glm REQUIRED)
mark_as_advanced(glm_DIR)

add_subdirectory(libs)
add_subdirectory(external)
add_subdirectory(code_gen)
Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ ANARI-SDK

This repository contains the source for the ANARI API SDK. This includes:

- [Front-end library](libs/anari)
- [Front-end library + implementation guide](libs/anari)
- [Device implementation utilties for implementations](libs/helium)
- [Example device implementation](libs/helide) (not intended for production use)
- [Example applications](examples/)
- [Interactive sample viewer](examples/viewer)
- [Unit tests](tests/unit)
- [Render tests](tests/render)

The 1.0 ANARI specification can be found on the Khronos website
Expand Down Expand Up @@ -77,6 +76,20 @@ These targets can be found with CMake via `find_package(anari)`. The examples
are written such that they can be built stand alone from the SDK source tree.
The simplest usage can be found [here](examples/simple).

The follwoing additional helper library components can be requested by listing
them under `find_pacakge(anari)`:

- `viewer` : Source library target `anari::anari_viewer` for building small viewer apps
- `code_gen` : Enable the use of code generation CMake functions downstream

Both of these libraries are both optionally installed and are not available
to downstream projects unless they are explicitly requested. To request one of
these components, simply add them to the `COMPONENTS` portion of `find_package`:

```cmake
find_package(anari COMPONENTS viewer code_gen)
```

## Running the examples

The basic tutorial app (built by default) uses the `helide` device as an
Expand All @@ -95,7 +108,7 @@ get the library to load. For example it can be run with:

```bash
% export ANARI_LIBRARY=helide
% ./anariViewer /path/to/some/file.obj
% ./anariViewer
```

Alternatively, either `--library` or `-l` can be used on the viewer's command
Expand Down
21 changes: 13 additions & 8 deletions cmake/anariConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@

include(CMakeFindDependencyMacro)

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_dependency(Threads)

include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Exports.cmake)

check_required_components(@PROJECT_NAME@)

if (NOT TARGET anari::anari)
message(FATAL_ERROR "CMAKE_PREFIX_PATH or anari_DIR are pointing to an \
ANARI-SDK build directory. Please do a full install of the SDK \
Expand All @@ -29,16 +23,27 @@ if (@INSTALL_CODE_GEN_SCRIPTS@)
set(ANARI_CODE_GEN_ROOT ${ANARI_DATAROOTDIR}/code_gen)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/anari_generate_frontend.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/anari_generate_codegen.cmake)
set(anari_code_gen_FOUND 1)
elseif(anari_FIND_REQUIRED_code_gen)
message(ERROR "The 'code_gen' component was requested but not found. To
enable this component, the SDK must be built with \
INSTALL_CODE_GEN_SCRIPTS=ON")
endif()

include(${CMAKE_CURRENT_LIST_DIR}/cmake/anari_sdk_fetch_project.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/cmake_project_commands.cmake)

if (@INSTALL_VIEWER_LIBRARY@ AND NOT TARGET anari_viewer)
if (TARGET anari::anari_viewer)
set(anari_viewer_FOUND 1)
elseif (anari_FIND_REQUIRED_viewer AND @INSTALL_VIEWER_LIBRARY@)
add_subdirectory(
${ANARI_DATAROOTDIR}/anari_viewer
${CMAKE_CURRENT_BINARY_DIR}/anari_viewer
)
set(anari_viewer_FOUND 1)
elseif(anari_FIND_REQUIRED_viewer)
message(ERROR "The 'viewer' component was requested but not found. To
enable this component, the SDK must be built with INSTALL_VIEWER_LIBRARY=ON")
endif()

set(ANARI_FOUND TRUE)
check_required_components(@PROJECT_NAME@)
1 change: 1 addition & 0 deletions code_gen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
if (INSTALL_CODE_GEN_SCRIPTS)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/anari
COMPONENT code_gen
FILES_MATCHING
PATTERN *.py
PATTERN *.h
Expand Down
21 changes: 21 additions & 0 deletions code_gen/api/khr_frame_accumulation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"info" : {
"name" : "KHR_FRAME_ACCUMULATION",
"type" : "extension",
"dependencies" : ["anari_core_1_0"]
},

"objects" : [
{
"type" : "ANARI_FRAME",
"parameters" : [
{
"name" : "accumulation",
"types" : ["ANARI_BOOL"],
"tags" : [],
"description" : "enable device internal buffers for frame accumulation"
}
]
}
]
}
1 change: 1 addition & 0 deletions code_gen/devices/experimental_device.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"khr_camera_rolling_shutter",
"khr_camera_stereo",
"khr_device_synchronization",
"khr_frame_accumulation",
"khr_frame_channel_albedo",
"khr_frame_channel_instance_id",
"khr_frame_channel_normal",
Expand Down
14 changes: 8 additions & 6 deletions code_gen/pyanari_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ def _from_type_list(x):
def _from_parameter_list(x):
result = []
if x != ffi.NULL:
print(x)
print(x[0].name)
i = 0
while x[i].name != ffi.NULL:
result.append((str(ffi.string(x[i].name), 'utf-8'), x[i].type))
Expand All @@ -189,7 +187,7 @@ def _convert_pointer(dataType, x):
elif dataType == lib.ANARI_PARAMETER_LIST:
return _from_parameter_list(x)
elif dataType == lib.ANARI_STRING:
return str(ffi.string(x[i]), 'utf-8')
return str(ffi.string(x), 'utf-8')
elif _elements[dataType]==1:
return x[0]
elif _elements[dataType]==2:
Expand Down Expand Up @@ -219,9 +217,13 @@ def _convert_pointer(dataType, x):
''',
'anariLoadLibrary' :
'''def anariLoadLibrary(name, callback):
device = lib.anariLoadLibrary(name.encode('utf-8'), lib.ANARIStatusCallback_python, callback)
return ffi.gc(device, lib.anariUnloadLibrary)
'''def anariLoadLibrary(name, callback = ffi.NULL):
cbwrapper = ffi.NULL if callback == ffi.NULL else lib.ANARIStatusCallback_python
device = lib.anariLoadLibrary(name.encode('utf-8'), cbwrapper, callback)
if device == ffi.NULL:
return None
else:
return ffi.gc(device, lib.anariUnloadLibrary)
''',
'anariNewArray1D' :
Expand Down
6 changes: 5 additions & 1 deletion cts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ set(REFERENCE_LIB helide)

project(anariCTSBackend LANGUAGES CXX)

set(glm_DIR ${CMAKE_CURRENT_LIST_DIR}/external/glm/lib/cmake/glm)
find_package(glm REQUIRED)
mark_as_advanced(glm_DIR)

find_package(anari REQUIRED)
include(pybind11.cmake)

Expand All @@ -38,7 +42,7 @@ PUBLIC

target_link_libraries(${PROJECT_NAME} PUBLIC glm::glm helium anari_test_scenes)

find_package(Python3 REQUIRED COMPONENTS Interpreter)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)

file(GLOB python_files ${CMAKE_CURRENT_LIST_DIR}/*.py)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d17fcf9

Please sign in to comment.