Skip to content

Commit

Permalink
Merge branch 'main' into tileset-material-nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Oct 17, 2023
2 parents 54e93e8 + 9137f54 commit fe8805a
Show file tree
Hide file tree
Showing 79 changed files with 2,724 additions and 460 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ jobs:
if: matrix.config.name != 'CentOS 7 - GCC'
run: cmake --build build --config ${{ matrix.config.build-type }} --parallel ${{ steps.cpu-cores.outputs.count }}

- name: Tests
if: matrix.config.name != 'CentOS 7 - GCC'
run: ctest --test-dir build --output-on-failure

- name: Coverage
if: matrix.config.coverage == 'true'
run: cmake --build build --target generate-coverage --config ${{ matrix.config.build-type }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ exts/cesium.omniverse/certs/cacert.pem
_testoutput

# Test utils header has components generated by CMake
tests/testUtils.h
tests/include/testUtils.h

# Packman user files
*.user
Expand Down
32 changes: 31 additions & 1 deletion .vscode/launch.linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,36 @@
"request": "attach",
"port": 3000,
"host": "localhost"
},
{
"name": "Tests Extension",
"preLaunchTask": "Build Only (debug)",
"program": "${workspaceFolder}/extern/nvidia/_build/target-deps/kit-sdk/kit",
"args": [
"${workspaceFolder}/apps/cesium.omniverse.cpp.tests.runner.kit"
],
"env": {
// Disable LSAN when debugging since it doesn't work with GDB and prints harmless but annoying warning messages
"ASAN_OPTIONS": "detect_leaks=0",
"UBSAN_OPTIONS": "print_stacktrace=1"
},
"cwd": "${workspaceFolder}",
"type": "cppdbg",
"request": "launch",
"MIMode": "gdb",
"setupCommands": [
{
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"text": "set print elements 0"
}
],
"symbolLoadInfo": {
"loadAll": false,
"exceptionList": "libcesium.omniverse.plugin.so;libcesium.omniverse.cpp.tests.plugin.so"
}
}
]
}
}
13 changes: 12 additions & 1 deletion .vscode/launch.windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
"request": "attach",
"port": 3000,
"host": "localhost"
},
{
"name": "Tests Extension",
"preLaunchTask": "Build Only (debug)",
"program": "${workspaceFolder}/extern/nvidia/_build/target-deps/kit-sdk/kit.exe",
"args": [
"${workspaceFolder}/apps/cesium.omniverse.cpp.tests.runner.kit"
],
"cwd": "${workspaceFolder}",
"type": "cppvsdbg",
"request": "launch"
}
]
}
}
15 changes: 1 addition & 14 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,6 @@
"command": "python3 scripts/vscode_build.py clean ${input:build-type} ${input:compiler}"
}
},
{
"label": "Test",
"type": "shell",
"group": "build",
"problemMatcher": "$gcc",
"windows": {
"problemMatcher": "$msCompile",
"command": "scripts/vscode_build_launcher.bat test ${input:build-type} ${input:compiler}"
},
"linux": {
"command": "python3 scripts/vscode_build.py test ${input:build-type} ${input:compiler}"
}
},
{
"label": "Coverage",
"type": "shell",
Expand Down Expand Up @@ -248,4 +235,4 @@
}
}
]
}
}
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ set(LINT_SOURCE_DIRECTORIES
"${PROJECT_SOURCE_DIR}/src/bindings"
"${PROJECT_SOURCE_DIR}/src/core"
"${PROJECT_SOURCE_DIR}/src/public"
"${PROJECT_SOURCE_DIR}/tests"
"${PROJECT_SOURCE_DIR}/cesiumOmniverseCppTestsExtension")
"${PROJECT_SOURCE_DIR}/tests")

# Source directories for coverage
set(COVERAGE_SOURCE_DIRECTORIES "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src")
Expand Down Expand Up @@ -325,7 +324,7 @@ if(CESIUM_OMNI_ENABLE_COVERAGE)
-DPROJECT_BUILD_DIRECTORY=${PROJECT_BINARY_DIR}
-DPROJECT_SOURCE_DIRECTORIES=${COVERAGE_SOURCE_DIRECTORIES_FORMATTED}
-DOUTPUT_DIRECTORY=${PROJECT_BINARY_DIR}/coverage -P ${PROJECT_SOURCE_DIR}/cmake/GenerateCoverage.cmake
DEPENDS $<TARGET_FILE:tests>
DEPENDS $<TARGET_FILE:cesium.omniverse.cpp.tests.plugin>
VERBATIM)
endif()

Expand Down Expand Up @@ -438,7 +437,6 @@ add_subdirectory(src)
if(CESIUM_OMNI_ENABLE_TESTS)
enable_testing()
add_subdirectory(tests)
add_subdirectory(cesiumOmniverseCppTestsExtension)
endif()

# Ninja and various Makefiles generators support generating compile_commands.json
Expand Down Expand Up @@ -669,7 +667,6 @@ install(
COMPONENT library
EXCLUDE_FROM_ALL)


if(CESIUM_OMNI_ENABLE_TESTS)
install(
TARGETS cesium.omniverse.cpp.tests.plugin
Expand Down
2 changes: 0 additions & 2 deletions cesiumOmniverseCppTestsExtension/CMakeLists.txt

This file was deleted.

This file was deleted.

15 changes: 1 addition & 14 deletions docs/developer-setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,7 @@ cmake --build build --config Release --parallel 8

## Unit Tests

```sh
cmake -B build
cmake --build build --target tests
ctest --test-dir build
```

Or run the doctest executable directly

```sh
cmake -B build
cmake --build build --target tests
./build/bin/tests
```
Unit tests can be run by starting the Cesium Omniverse Tests extension inside Omniverse.

## Coverage

Expand Down Expand Up @@ -506,7 +494,6 @@ Each workspace contains recommended extensions and settings for VSCode developme
- Build Only (debug) - builds the project in debug mode with the default compiler
- Build Only (release) - builds the project in release mode with the default compiler
- Clean - cleans the build directory
- Test - runs unit tests
- Coverage - generates a coverage report and opens a web browser showing the results
- Documentation - generates documentation and opens a web browser showing the results
- Format - formats the code with clang-format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import omni.ext
import omni.usd
import omni.kit.ui
import omni.kit.app
from .bindings import acquire_cesium_omniverse_tests_interface, release_cesium_omniverse_tests_interface


Expand All @@ -14,15 +16,27 @@ def on_startup(self):
global tests_interface
tests_interface = acquire_cesium_omniverse_tests_interface()

tests_interface.on_startup("exts/cesium.omniverse")
tests_interface.on_startup(os.path.join(os.path.dirname(__file__), "../../../../../cesium.omniverse"))

# TODO ensure the stage has been set up before getting stage id
stageId = omni.usd.get_context().get_stage_id()
update_stream = omni.kit.app.get_app().get_update_event_stream()

tests_interface.run_all_tests(stageId)
# To ensure the tests only run after the stage has been opened, we
# attach a handler to an event that occurs every frame. That handler
# checks if the stage has opened, runs once, then detaches itself
self._run_once_sub = update_stream.create_subscription_to_pop(
self.run_once_after_stage_opens, name="Run once after stage opens"
)

print("Started Cesium Tests Extension.")

def run_once_after_stage_opens(self, _):
if omni.usd.get_context().get_stage_state() == omni.usd.StageState.OPENED:
print("Beginning Cesium Tests Extension tests")
stageId = omni.usd.get_context().get_stage_id()
tests_interface.run_all_tests(stageId)
print("Cesium Tests Extension tests complete")
self._run_once_sub.unsubscribe()

def on_shutdown(self):
print("Stopping Cesium Tests Extension...")
release_cesium_omniverse_tests_interface(tests_interface)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Connection:

class ICesiumOmniverseInterface:
def __init__(self, *args, **kwargs) -> None: ...
def add_global_anchor_to_prim(self, arg0: str) -> None: ...
def connect_to_ion(self) -> None: ...
def create_token(self, arg0: str) -> None: ...
def credits_available(self) -> bool: ...
Expand Down
8 changes: 8 additions & 0 deletions exts/cesium.omniverse/cesium/omniverse/extension.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .bindings import acquire_cesium_omniverse_interface, release_cesium_omniverse_interface, Viewport
from .ui.add_menu_controller import CesiumAddMenuController
from .install import perform_vendor_install
from .utils import wait_n_frames, dock_window_async, perform_action_after_n_frames_async
from .usdUtils import add_tileset_ion, add_imagery_ion
Expand Down Expand Up @@ -55,6 +56,7 @@ def __init__(self) -> None:
self._adding_assets = False
self._attributes_widget_controller: Optional[CesiumAttributesWidgetController] = None
self._credits_viewport_controller: Optional[CreditsViewportController] = None
self._add_menu_controller: Optional[CesiumAddMenuController] = None
self._logger: logging.Logger = logging.getLogger(__name__)
self._menus = []
self._num_credits_viewport_frames: int = 0
Expand Down Expand Up @@ -90,6 +92,8 @@ def on_startup(self):

self._credits_viewport_controller = CreditsViewportController(_cesium_omniverse_interface)

self._add_menu_controller = CesiumAddMenuController(_cesium_omniverse_interface)

# Subscribe to stage event stream
usd_context = omni.usd.get_context()
if usd_context.get_stage_state() == omni.usd.StageState.OPENED:
Expand Down Expand Up @@ -185,6 +189,10 @@ def on_shutdown(self):
self._attributes_widget_controller.destroy()
self._attributes_widget_controller = None

if self._add_menu_controller is not None:
self._add_menu_controller.destroy()
self._add_menu_controller = None

self._destroy_credits_viewport_frames()

self._logger.info("CesiumOmniverse shutdown")
Expand Down
1 change: 1 addition & 0 deletions exts/cesium.omniverse/cesium/omniverse/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
from .statistics_widget import CesiumOmniverseStatisticsWidget # noqa: F401
from .models import * # noqa: F401 F403
from .credits_viewport_controller import CreditsViewportController # noqa: F401
from .add_menu_controller import CesiumAddMenuController # noqa: F401
Loading

0 comments on commit fe8805a

Please sign in to comment.