> If a .cpp file is added to library, then it won't work. If this is occurring it is a bug. Can you fill a bug report at: https://gitlab.kitware.com/cmake/cmake
> CUDA_PROPAGATE_HOST_FLAGS CUDA as a first class language propagates zero C++ flags as it is a separate language, and we expect people to set CXX_FLAGS and CUDA_FLAGS On Wed, Dec 20, 2017 at 3:46 PM, Crni Gorac <cgo...@gmail.com> wrote: > Thanks for your reply. > > That seems to work, but only if the library consist solely of .cu > files. If a .cpp file is added to library, then it won't work. Is > this a known limitation? > > On a related note: what is the equivalent of > "set(CUDA_PROPAGATE_HOST_FLAGS OFF)" now? > > Regards. > > On Tue, Dec 19, 2017 at 11:47 PM, Robert Maynard > <robert.mayn...@kitware.com> wrote: >> Hi, >> >> The CUDA_RESOLVE_DEVICE_SYMBOLS property was added for this exact >> situation. You can find it documented at >> https://cmake.org/cmake/help/v3.10/prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS.html >> >> Here is an example of it being used: >> https://gitlab.kitware.com/cmake/cmake/commit/493671a5212c6548b2d7376c7065f5f76692a792#0eb128c2e695da6e4cedb9a408b108f117bd4fe3 >> >> On Tue, Dec 19, 2017 at 3:14 PM, Crni Gorac <cgo...@gmail.com> wrote: >>> Hello, >>> >>> My project is alike for what is described by following CMakeLists.txt >>> for Cuda/Complex test case from CMake source distribution: >>> >>> ######################### >>> cmake_minimum_required(VERSION 3.8) >>> project (CudaComplex CXX CUDA) >>> >>> string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") >>> set(CMAKE_CUDA_STANDARD 11) >>> set(CMAKE_CXX_STANDARD 11) >>> set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) >>> set(CMAKE_CXX_STANDARD_REQUIRED TRUE) >>> >>> add_library(CudaLib STATIC dynamic.cu file1.cu file2.cu file3.cu mixed.cu) >>> set_target_properties(CudaLib PROPERTIES CUDA_SEPARABLE_COMPILATION OFF) >>> set_target_properties(CudaLib PROPERTIES POSITION_INDEPENDENT_CODE OFF) >>> >>> add_library(CppLib STATIC dynamic.cpp mixed.cpp) >>> >>> add_executable(CudaComplex main.cpp) >>> target_link_libraries(CudaComplex PUBLIC CudaLib CppLib) >>> ######################### >>> >>> So basically I want to build all my .cu files into one static library, >>> and all my .cpp files (except for main.cpp) into another static >>> library. These two libraries are then linked into main.cpp above. This >>> works fine, and make output is: >>> >>> ######################### >>> Scanning dependencies of target CppLib >>> Scanning dependencies of target CudaLib >>> [ 8%] Building CXX object CMakeFiles/CppLib.dir/mixed.cpp.o >>> [ 25%] Building CUDA object CMakeFiles/CudaLib.dir/file1.cu.o >>> [ 25%] Building CUDA object CMakeFiles/CudaLib.dir/file2.cu.o >>> [ 33%] Building CXX object CMakeFiles/CppLib.dir/dynamic.cpp.o >>> [ 41%] Building CUDA object CMakeFiles/CudaLib.dir/dynamic.cu.o >>> [ 50%] Building CUDA object CMakeFiles/CudaLib.dir/file3.cu.o >>> [ 58%] Building CUDA object CMakeFiles/CudaLib.dir/mixed.cu.o >>> [ 66%] Linking CXX static library libCppLib.a >>> [ 66%] Built target CppLib >>> [ 75%] Linking CUDA static library libCudaLib.a >>> [ 75%] Built target CudaLib >>> Scanning dependencies of target CudaComplex >>> [ 83%] Building CXX object CMakeFiles/CudaComplex.dir/main.cpp.o >>> [ 91%] Linking CUDA device code >>> CMakeFiles/CudaComplex.dir/cmake_device_link.o >>> [100%] Linking CXX executable CudaComplex >>> ######################### >>> >>> However, in my case these static libraries are actually to be >>> delivered to a client. The problem is that the dynamic linking of >>> CUDA code (this is this line "Linking CUDA device code >>> CMakeFiles/CudaComplex.dir/cmake_device_link.o" in the make output >>> above) would still have to get done on client side, i.e. they would >>> have to install CUDA SDK and provide that this step is accomplished >>> through their build system. So my question is: is it possible to >>> somehow generate static library with CUDA code, using this new >>> "...LANGUAGE CUDA..." CMake functionality, but that CUDA linking is >>> completed on my side (note that on client side no CUDA code will be >>> added to project)? >>> >>> Thanks. >>> -- >>> >>> Powered by www.kitware.com >>> >>> Please keep messages on-topic and check the CMake FAQ at: >>> http://www.cmake.org/Wiki/CMake_FAQ >>> >>> Kitware offers various services to support the CMake community. For more >>> information on each offering, please visit: >>> >>> CMake Support: http://cmake.org/cmake/help/support.html >>> CMake Consulting: http://cmake.org/cmake/help/consulting.html >>> CMake Training Courses: http://cmake.org/cmake/help/training.html >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Follow this link to subscribe/unsubscribe: >>> https://cmake.org/mailman/listinfo/cmake > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake