Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build custom project on cmake? #11

Open
KevinRK27 opened this issue Jul 7, 2022 · 1 comment
Open

How to build custom project on cmake? #11

KevinRK27 opened this issue Jul 7, 2022 · 1 comment

Comments

@KevinRK27
Copy link

I've built the library and i can run the example program. But i can't link the library on my custom project on cmake. It can't find the -lncnn. How to fix this?

@KevinRK27
Copy link
Author

cmake_minimum_required(VERSION 3.16)
project(main)
set(CMAKE_CXX_STANDARD 17)
set(ncnn_DIR "/temp_/ncnn-with-cuda/build/install/lib/cmake/ncnn" PATH)

set(SOURCES main.cpp)
set(NCNN_CUDA ON)
find_package(OpenCV REQUIRED)
find_package(CUDA REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS} /temp_/ncnn-with-cuda/build/install/include/ncnn)
add_executable(main ${SOURCES})
target_link_libraries(main ${CUDA_LIBS} /temp_/ncnn-with-cuda/build/install/lib/libncnn_cuda_lib.a /temp_/ncnn-with-cuda/build/install/lib/libncnn.a ${OpenCV_LIBS})

this is my CMakelists.txt

And now i got the error like
/usr/bin/ld: /temp_/ncnn-with-cuda/build/install/lib/libncnn.a(allocator.cpp.o): in function void check<cudaError>(cudaError, char const*, char const*, int) [clone .part.0] [clone .constprop.0]': allocator.cpp:(.text+0x9f): undefined reference to cudaGetErrorString'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant