diff --git a/libtcc/CMakeLists.txt b/libtcc/CMakeLists.txt index e3bf9992579b788c6d27737df152e3f06fdb6675..3c89eac3efeba2579152a04532bac920c1f65839 100644 --- a/libtcc/CMakeLists.txt +++ b/libtcc/CMakeLists.txt @@ -10,6 +10,7 @@ target_include_directories( $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>) # Add links target_link_libraries(tcc PRIVATE cudawrappers::cu cudawrappers::nvrtc) +target_embed_source(tcc kernel/TCCorrelator.cu) # Install libraries and headers install( TARGETS tcc @@ -20,7 +21,4 @@ install( install( EXPORT tcc-config NAMESPACE ${PROJECT_NAME}:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) -# Embed CUDA code -include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake) -include_cuda_code(tcc kernel/TCCorrelator.cu) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) \ No newline at end of file diff --git a/libtcc/Correlator.cc b/libtcc/Correlator.cc index 09e54520be5721ffc7ccd4be62d7ce90d6919abc..53c06809eae23bcfb49510e06d77e0cc71734f13 100644 --- a/libtcc/Correlator.cc +++ b/libtcc/Correlator.cc @@ -7,7 +7,7 @@ #include <link.h> -extern const char _binary_libtcc_TCCorrelator_cu_start, _binary_libtcc_TCCorrelator_cu_end; +extern const char _binary_kernel_TCCorrelator_cu_start, _binary_kernel_TCCorrelator_cu_end; namespace tcc { @@ -78,17 +78,8 @@ cu::Module Correlator::compileModule(unsigned nrBits, //std::for_each(options.begin(), options.end(), [] (const std::string &e) { std::cout << e << ' '; }); std::cout << std::endl; -#if 0 - nvrtc::Program program("tcc/TCCorrelator.cu"); -#else - // embed the CUDA source code in libtcc.so, so that it need not be installed separately - // for runtime compilation - // copy into std::string for '\0' termination - const std::string source = -#include "TCCorrelator.cu" - ; + const std::string source(_binary_kernel_TCCorrelator_cu_start, _binary_kernel_TCCorrelator_cu_end); nvrtc::Program program(source, "TCCorrelator.cu"); -#endif try { program.compile(options);