CMake Vcpkg
set(CMAKE_TOOLCHAIN_FILE "D:/SoftwareData/vcpkg/scripts/buildsystems/vcpkg.cmake")
CMake 引入包
CUDA TensorRT TensorRT和CUDA放到一起
find_package(CUDA REQUIRED) include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include") link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib")
OpenCV
find_package(OpenCV REQUIRED) include_directories( ${OpenCV_INCLUDE_DIRS} ) add_executable(test main.cpp) target_link_libraries( test ${OpenCV_LIBS} )
Eigen3
set(Eigen3_DIR "D:/SoftwareData/vcpkg/packages/eigen3_x86-windows/share/eigen3") find_package(Eigen3 CONFIG REQUIRED) target_link_libraries(main PRIVATE Eigen3::Eigen)
Thread
set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) target_link_libraries(test PUBLIC Threads::Threads)
Boost
sudo apt-get install libboost-all-dev
find_package(Boost REQUIRED) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) endif() SET(${Boost_LIBRARIES})
MYSQL
sudo apt install mysql-server mysql-client libmysqlclient-dev
find_package(MySQL REQUIRED) if(MYSQL_FOUND) include_directories(${MYSQL_INCLUDE_DIR}) endif() SET(LIBS mysqlclient_r)
Protobuf
sudo apt install libprotobuf-dev protobuf-compiler
find_package(Protobuf REQUIRED) function(proto2cpp PROTO_FILE CPP_DIR) execute_process(COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FILE} --cpp_out=. --proto_path=${CPP_DIR} WORKING_DIRECTORY ${CPP_DIR}) message("${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FILE} --cpp_out=${CPP_DIR} --proto_path=${CPP_DIR}") endfunction() proto2cpp("${CMAKE_CURRENT_SOURCE_DIR}/example/user.proto" "${CMAKE_CURRENT_SOURCE_DIR}/example") add_executable(mprpc main.cpp) target_link_libraries(mprpc protobuf)