prepare cuda deliver dev
This commit is contained in:
@@ -43,7 +43,7 @@ set(CMAKE_MODULE_PATH
|
|||||||
# Find required packages based on options
|
# Find required packages based on options
|
||||||
find_package(spdlog REQUIRED)
|
find_package(spdlog REQUIRED)
|
||||||
if (BASALT_CUDA_DELIVER)
|
if (BASALT_CUDA_DELIVER)
|
||||||
find_package(CUDA REQUIRED)
|
find_package(CUDAToolkit REQUIRED)
|
||||||
endif ()
|
endif ()
|
||||||
if (BASALT_DIRECTX11_ENGINE)
|
if (BASALT_DIRECTX11_ENGINE)
|
||||||
find_package(DirectX11 REQUIRED)
|
find_package(DirectX11 REQUIRED)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# if (BASALT_CUDA_DELIVER)
|
if (BASALT_CUDA_DELIVER)
|
||||||
# add_subdirectory(CudaDeliver)
|
add_subdirectory(CudaDeliver)
|
||||||
# endif ()
|
endif ()
|
||||||
# if (BASALT_ROCM_DELIVER)
|
# if (BASALT_ROCM_DELIVER)
|
||||||
# add_subdirectory(RocmDeliver)
|
# add_subdirectory(RocmDeliver)
|
||||||
# endif ()
|
# endif ()
|
||||||
|
|||||||
28
BasaltPresenter/Plugins/Deliver/CudaDeliver/CMakeLists.txt
Normal file
28
BasaltPresenter/Plugins/Deliver/CudaDeliver/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Create shared library
|
||||||
|
add_library(BasaltCudaDeliver SHARED "")
|
||||||
|
# Setup sources
|
||||||
|
target_sources(BasaltCudaDeliver
|
||||||
|
PRIVATE
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
# Setup header infomation
|
||||||
|
target_include_directories(BasaltCudaDeliver
|
||||||
|
PRIVATE
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}"
|
||||||
|
)
|
||||||
|
# Setup linked library infomation
|
||||||
|
target_link_libraries(BasaltCudaDeliver
|
||||||
|
PRIVATE
|
||||||
|
BasaltShared
|
||||||
|
CUDA::cudart
|
||||||
|
)
|
||||||
|
# Enable export macro
|
||||||
|
target_compile_definitions(BasaltCudaDeliver
|
||||||
|
PRIVATE
|
||||||
|
BS_EXPORTING
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install BasaltCudaDeliver only on Release mode
|
||||||
|
install(TARGETS BasaltCudaDeliver
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/plugin/deliver"
|
||||||
|
)
|
||||||
23
BasaltPresenter/Plugins/Deliver/CudaDeliver/main.cpp
Normal file
23
BasaltPresenter/Plugins/Deliver/CudaDeliver/main.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include <basalt/export_macro.hpp>
|
||||||
|
#include <basalt/deliver.hpp>
|
||||||
|
|
||||||
|
namespace deliver = ::basalt::shared::deliver;
|
||||||
|
using deliver::DeliverConfig;
|
||||||
|
using deliver::IDeliver;
|
||||||
|
|
||||||
|
class CudaDeliver : public IDeliver {
|
||||||
|
public:
|
||||||
|
CudaDeliver() {}
|
||||||
|
virtual ~CudaDeliver() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
BS_EXPORT void* BSCreateInstance() {
|
||||||
|
return static_cast<IDeliver*>(new CudaDeliver());
|
||||||
|
}
|
||||||
|
|
||||||
|
BS_EXPORT void BSDestroyInstance(void* instance) {
|
||||||
|
delete dynamic_cast<CudaDeliver*>(static_cast<IDeliver*>(instance));
|
||||||
|
}
|
||||||
@@ -1,9 +1,23 @@
|
|||||||
#include <basalt/export_macro.hpp>
|
#include <basalt/export_macro.hpp>
|
||||||
|
#include <basalt/deliver.hpp>
|
||||||
|
|
||||||
|
namespace deliver = ::basalt::shared::deliver;
|
||||||
|
using deliver::DeliverConfig;
|
||||||
|
using deliver::IDeliver;
|
||||||
|
|
||||||
|
class PipeDeliver : public IDeliver {
|
||||||
|
public:
|
||||||
|
PipeDeliver() {}
|
||||||
|
virtual ~PipeDeliver() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
BS_EXPORT void* BSCreateInstance() {
|
BS_EXPORT void* BSCreateInstance() {
|
||||||
return nullptr;
|
return static_cast<IDeliver*>(new PipeDeliver());
|
||||||
}
|
}
|
||||||
|
|
||||||
BS_EXPORT void BSDestroyInstance(void* instance) {
|
BS_EXPORT void BSDestroyInstance(void* instance) {
|
||||||
return;
|
delete dynamic_cast<PipeDeliver*>(static_cast<IDeliver*>(instance));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -424,4 +424,4 @@ BS_EXPORT void* BSCreateInstance() {
|
|||||||
|
|
||||||
BS_EXPORT void BSDestroyInstance(void* instance) {
|
BS_EXPORT void BSDestroyInstance(void* instance) {
|
||||||
delete dynamic_cast<DirectX11Engine*>(static_cast<IEngine*>(instance));
|
delete dynamic_cast<DirectX11Engine*>(static_cast<IEngine*>(instance));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,19 @@
|
|||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
* CUDA
|
||||||
* [spdlog](https://github.com/gabime/spdlog)
|
* [spdlog](https://github.com/gabime/spdlog)
|
||||||
* [tinyobjloader](https://github.com/tinyobjloader/tinyobjloader)
|
* [tinyobjloader](https://github.com/tinyobjloader/tinyobjloader)
|
||||||
* [cgltf](https://github.com/jkuhlmann/cgltf)
|
<!-- * [cgltf](https://github.com/jkuhlmann/cgltf) -->
|
||||||
|
|
||||||
We assume that you executing following commands in the root directory of `BasaltPresenter` project.
|
We assume that you executing following commands in the root directory of `BasaltPresenter` project.
|
||||||
|
|
||||||
|
### CUDA
|
||||||
|
|
||||||
|
##### Usage
|
||||||
|
|
||||||
|
Use `-DCUDAToolkit_ROOT=<path to CUDA install directory>` in cmake when you configure this project.
|
||||||
|
|
||||||
### spdlog
|
### spdlog
|
||||||
|
|
||||||
##### Build
|
##### Build
|
||||||
|
|||||||
Reference in New Issue
Block a user