-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #468 from CesiumGS/createTestsExtension
Set up basic tests extension to test c++ code
- Loading branch information
Showing
20 changed files
with
427 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
title = "Cesium For Omniverse Tests App" | ||
version = "0.0.0" | ||
app = true | ||
|
||
[dependencies] | ||
"cesium.omniverse.dev" = {} | ||
"cesium.omniverse.cpp.tests" = {} | ||
|
||
[settings] | ||
app.window.title = "Cesium for Omniverse Tests App" | ||
|
||
[settings.app.exts] | ||
folders.'++' = [ | ||
"${app}", # Find other applications in this folder | ||
"${app}/exts", # Find extensions in this folder | ||
"${app}/../exts", # Find cesium.omniverse and cesium.usd.schemas | ||
"${app}/../extern/nvidia/app/extscache" # Find omni.kit.window.material_graph | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_subdirectory(bindings) | ||
add_subdirectory(public) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
include(Macros) | ||
|
||
glob_files(SOURCES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") | ||
|
||
# cmake-format: off | ||
setup_python_module( | ||
PYTHON_DIR | ||
# Use the same Python version as Omniverse (Python 3.10) | ||
"${PROJECT_SOURCE_DIR}/extern/nvidia/_build/target-deps/python" | ||
TARGET_NAME | ||
CesiumOmniverseCppTestsPythonBindings | ||
SOURCES | ||
${SOURCES} | ||
LIBRARIES | ||
cesium.omniverse.cpp.tests.plugin | ||
CXX_FLAGS | ||
${CESIUM_OMNI_CXX_FLAGS} | ||
CXX_FLAGS_DEBUG | ||
${CESIUM_OMNI_CXX_FLAGS_DEBUG} | ||
CXX_DEFINES | ||
${CESIUM_OMNI_CXX_DEFINES} | ||
CXX_DEFINES_DEBUG | ||
${CESIUM_OMNI_CXX_DEFINES_DEBUG} | ||
) | ||
# cmake-format: on |
22 changes: 22 additions & 0 deletions
22
cesiumOmniverseCppTestsExtension/bindings/PythonBindings.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "CesiumOmniverseCppTests.h" | ||
|
||
#include <carb/BindingsPythonUtils.h> | ||
|
||
// NOLINTNEXTLINE | ||
CARB_BINDINGS("cesium.omniverse.cpp.tests.python") | ||
DISABLE_PYBIND11_DYNAMIC_CAST(cesium::omniverse::tests::ICesiumOmniverseCppTestsInterface) | ||
|
||
PYBIND11_MODULE(CesiumOmniverseCppTestsPythonBindings, m) { | ||
|
||
using namespace cesium::omniverse::tests; | ||
|
||
m.doc() = "pybind11 cesium.omniverse.cpp.tests bindings"; | ||
|
||
// clang-format off | ||
carb::defineInterfaceClass<ICesiumOmniverseCppTestsInterface>( | ||
m, "ICesiumOmniverseCppTestsInterface", "acquire_cesium_omniverse_tests_interface", "release_cesium_omniverse_tests_interface") | ||
.def("run_all_tests", &ICesiumOmniverseCppTestsInterface::run_all_tests) | ||
.def("on_startup", &ICesiumOmniverseCppTestsInterface::onStartup) | ||
.def("on_shutdown", &ICesiumOmniverseCppTestsInterface::onShutdown); | ||
// clang-format on | ||
} |
24 changes: 24 additions & 0 deletions
24
cesiumOmniverseCppTestsExtension/include/CesiumOmniverseCppTests.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
#include <carb/Interface.h> | ||
|
||
namespace cesium::omniverse::tests { | ||
|
||
class ICesiumOmniverseCppTestsInterface { | ||
public: | ||
CARB_PLUGIN_INTERFACE("cesium::omniverse::tests::ICesiumOmniverseCppTestsInterface", 0, 0); | ||
/** | ||
* @brief Call this on extension startup. | ||
* | ||
* @param cesiumExtensionLocation Path to the Cesium Omniverse extension location. | ||
*/ | ||
virtual void onStartup(const char* cesiumExtensionLocation) noexcept = 0; | ||
|
||
/** | ||
* @brief Call this on extension shutdown. | ||
*/ | ||
virtual void onShutdown() noexcept = 0; | ||
|
||
virtual void run_all_tests(long int stage_id) noexcept = 0; | ||
}; | ||
|
||
} // namespace cesium::omniverse::tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
include(Macros) | ||
|
||
glob_files(SOURCES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") | ||
|
||
get_property(ADDITIONAL_LIBRARIES GLOBAL PROPERTY NVIDIA_ADDITIONAL_LIBRARIES_PROPERTY) | ||
|
||
# cmake-format: off | ||
setup_lib( | ||
TARGET_NAME | ||
cesium.omniverse.cpp.tests.plugin | ||
TYPE | ||
# Carbonite Plugins needs to be shared libraries | ||
SHARED | ||
SOURCES | ||
${SOURCES} | ||
INCLUDE_DIRS | ||
"${PROJECT_SOURCE_DIR}/cesiumOmniverseCppTestsExtension/include" | ||
LIBRARIES | ||
CesiumOmniverseCore | ||
doctest::doctest | ||
ADDITIONAL_LIBRARIES | ||
# Unfortunately we need this in both cesium.omniverse.plugin and CesiumOmniverseCore because we're bypassing | ||
# CMake's built-in dependency system | ||
"${ADDITIONAL_LIBRARIES}" | ||
CXX_FLAGS | ||
${CESIUM_OMNI_CXX_FLAGS} | ||
CXX_FLAGS_DEBUG | ||
${CESIUM_OMNI_CXX_FLAGS_DEBUG} | ||
CXX_DEFINES | ||
${CESIUM_OMNI_CXX_DEFINES} | ||
CXX_DEFINES_DEBUG | ||
${CESIUM_OMNI_CXX_DEFINES_DEBUG} | ||
) | ||
# cmake-format: on |
Oops, something went wrong.