From 64a8aaaf422fd182acbd00395e22af01b1e75256 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 10 Jun 2022 16:53:15 +0800 Subject: [PATCH] fix(build): remove ununsed functions when cuda disabled GitOrigin-RevId: 03f50683f68e47866f7dc5c8609d1d15251818c5 --- src/core/impl/utils/cuda_helper.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/core/impl/utils/cuda_helper.cpp b/src/core/impl/utils/cuda_helper.cpp index 8f49f9b6..30793bf9 100644 --- a/src/core/impl/utils/cuda_helper.cpp +++ b/src/core/impl/utils/cuda_helper.cpp @@ -7,8 +7,6 @@ #include #include -using namespace mgb; - #ifdef WIN32 #include #include @@ -17,6 +15,8 @@ using namespace mgb; #include #endif +#if MGB_CUDA + namespace { #ifndef PATH_MAX @@ -51,11 +51,6 @@ void* dlerror() { return const_cast(errmsg); } -void* dlsym(void* handle, char* name) { - FARPROC symbol = GetProcAddress((HMODULE)handle, name); - return reinterpret_cast(symbol); -} - int check_file_exist(const char* path, int mode) { return _access(path, mode); } @@ -121,7 +116,6 @@ std::string get_nvcc_root_path() { } // namespace std::vector mgb::get_cuda_include_path() { -#if MGB_CUDA std::vector paths; // 1. use CUDA_BIN_PATH auto cuda_path = getenv("CUDA_BIN_PATH"); @@ -163,7 +157,12 @@ std::vector mgb::get_cuda_include_path() { "2. add nvcc path in PATH " "3. add libcudart.so path in LD_LIBRARY_PATH"); return paths; +} + #else + +std::vector mgb::get_cuda_include_path() { mgb_throw(MegBrainError, "cuda disabled at compile time"); -#endif } + +#endif