I am trying to use CMake to generate a Xcode project and build a CUDA library with it. The code I used for collecting & building CUDA library "caffe2_cpp_gpu" is as follows:
list(APPEND CUDA_NVCC_FLAGS "-std=c++11" "-Wno-deprecated-gpu-targets")
file(GLOB CUDA_SOURCES "${PROJECT_SOURCE_DIR}/source/caffe2/operator/*.cu" )
cuda_add_library(caffe2_cpp_gpu STATIC ${CUDA_SOURCES})
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang++" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
list(APPEND ALL_LIBRARIES -Wl,-force_load caffe2_cpp_gpu)
else()
list(APPEND ALL_LIBRARIES -Wl,--whole-archive caffe2_cpp_gpu -Wl,--no-whole-archive)
endif()
Note that this code can be run if Unix Makefile is used.
But cannot run if Xcode is used.
In the project it shows a file is missing:
missing file
And the CUDA library "caffe2_cpp_gpu" cannot be created.
Does anyone know how to solve it?