introduce functions to detect build features

This commit is contained in:
Stefano Sinigardi
2019-07-18 10:48:19 +02:00
parent 2c4c96f50c
commit b9e7cd3d35
3 changed files with 39 additions and 5 deletions

6
.gitignore vendored
View File

@ -23,6 +23,12 @@ build_*/
!build/darknet/YoloWrapper.cs
.fuse*
*.weights
build/*.cmake
build/*.ninja
build/*.txt
build/*.json
build/CMakeFiles/
build/detect_cuda_compute_capabilities.cu
# OS Generated #
.DS_Store*

View File

@ -62,6 +62,9 @@ extern "C" LIB_API int detect_mat(const uint8_t* data, const size_t data_length,
extern "C" LIB_API int dispose();
extern "C" LIB_API int get_device_count();
extern "C" LIB_API int get_device_name(int gpu, char* deviceName);
extern "C" LIB_API bool built_with_cuda();
extern "C" LIB_API bool built_with_cudnn();
extern "C" LIB_API bool built_with_opencv();
extern "C" LIB_API void send_json_custom(char const* send_buf, int port, int timeout);
class Detector {

View File

@ -72,6 +72,31 @@ int get_device_count() {
#endif // GPU
}
bool built_with_cuda(){
#ifdef GPU
return true;
#else
return false;
#endif
}
bool built_with_cudnn(){
#ifdef CUDNN
return true;
#else
return false;
#endif
}
bool built_with_opencv(){
#ifdef OPENCV
return true;
#else
return false;
#endif
}
int get_device_name(int gpu, char* deviceName) {
#ifdef GPU
cudaDeviceProp prop;