MCPcopy Create free account
hub / github.com/Kitware/CMake / GetCudaCompileMode

Method GetCudaCompileMode

Source/cmFastbuildNormalTargetGenerator.cxx:695–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693 return result;
694}
695std::string cmFastbuildNormalTargetGenerator::GetCudaCompileMode() const
696{
697 if (Languages.find("CUDA") == Languages.end()) {
698 return {};
699 }
700 // TODO: unify it with makefile / ninja generators.
701 std::string cudaCompileMode;
702 if (this->GeneratorTarget->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION")) {
703 std::string const& rdcFlag =
704 this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_RDC_FLAG");
705 cudaCompileMode = cmStrCat(cudaCompileMode, rdcFlag, ' ');
706 }
707 static std::array<cm::string_view, 4> const compileModes{
708 { "PTX"_s, "CUBIN"_s, "FATBIN"_s, "OPTIX"_s }
709 };
710 bool useNormalCompileMode = true;
711 for (cm::string_view mode : compileModes) {
712 auto propName = cmStrCat("CUDA_", mode, "_COMPILATION");
713 auto defName = cmStrCat("_CMAKE_CUDA_", mode, "_FLAG");
714 if (this->GeneratorTarget->GetPropertyAsBool(propName)) {
715 std::string const& flag = this->Makefile->GetRequiredDefinition(defName);
716 cudaCompileMode = cmStrCat(cudaCompileMode, flag);
717 useNormalCompileMode = false;
718 break;
719 }
720 }
721 if (useNormalCompileMode) {
722 std::string const& wholeFlag =
723 this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_WHOLE_FLAG");
724 cudaCompileMode = cmStrCat(cudaCompileMode, wholeFlag);
725 }
726 return cudaCompileMode;
727}
728
729std::string cmFastbuildNormalTargetGenerator::GetLinkCommand() const
730{

Callers 1

Calls 4

cmStrCatFunction · 0.70
findMethod · 0.45
endMethod · 0.45
GetPropertyAsBoolMethod · 0.45

Tested by

no test coverage detected