1
0

prepare cuda deliver dev

This commit is contained in:
2026-01-10 21:49:29 +08:00
parent ab79440adc
commit e3b454ea46
7 changed files with 80 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
# if (BASALT_CUDA_DELIVER)
# add_subdirectory(CudaDeliver)
# endif ()
if (BASALT_CUDA_DELIVER)
add_subdirectory(CudaDeliver)
endif ()
# if (BASALT_ROCM_DELIVER)
# add_subdirectory(RocmDeliver)
# endif ()

View 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"
)

View 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));
}

View File

@@ -1,9 +1,23 @@
#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() {
return nullptr;
return static_cast<IDeliver*>(new PipeDeliver());
}
BS_EXPORT void BSDestroyInstance(void* instance) {
return;
delete dynamic_cast<PipeDeliver*>(static_cast<IDeliver*>(instance));
}