mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
2 files changed
+19
-6
No files matched your search
@@ -134,18 +134,14 @@ if(CMAKE_SYCL_DEVICE_LINK_OPTIONS)
|
||||
string(JOIN " " pic_options ${CMAKE_SYCL_COMPILE_OPTIONS_PIC})
|
||||
string(JOIN " " device_pic_options ${CMAKE_SYCL_DEVICE_LINK_OPTIONS_PIC})
|
||||
string(JOIN " " device_options ${CMAKE_SYCL_DEVICE_LINK_OPTIONS})
|
||||
string(JOIN " " whole_archive ${CMAKE_SYCL_DEVICE_LINK_OPTIONS_WHOLE_ARCHIVE})
|
||||
string(JOIN " " no_whole_archive ${CMAKE_SYCL_DEVICE_LINK_OPTIONS_NO_WHOLE_ARCHIVE})
|
||||
if(NOT CMAKE_SYCL_DEVICE_LINK_LIBRARY)
|
||||
set(CMAKE_SYCL_DEVICE_LINK_LIBRARY
|
||||
"<CMAKE_SYCL_COMPILER> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${pic_options} ${device_options} ${device_pic_options} -o <TARGET> ${whole_archive} <OBJECTS> <LINK_LIBRARIES> ${no_whole_archive}")
|
||||
"<CMAKE_SYCL_COMPILER> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${pic_options} ${device_options} ${device_pic_options} -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
if(NOT CMAKE_SYCL_DEVICE_LINK_EXECUTABLE)
|
||||
set(CMAKE_SYCL_DEVICE_LINK_EXECUTABLE "${CMAKE_SYCL_DEVICE_LINK_LIBRARY}")
|
||||
endif()
|
||||
unset(device_options)
|
||||
unset(whole_archive)
|
||||
unset(no_whole_archive)
|
||||
unset(pic_options)
|
||||
unset(device_pic_options)
|
||||
endif()
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmLinkItem.h"
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
@@ -109,6 +110,16 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
|
||||
ItemVector const& items = cli.GetItems();
|
||||
std::string config = cli.GetConfig();
|
||||
bool skipItemAfterFramework = false;
|
||||
auto const librariesBegin = linkLibraries.size();
|
||||
cmMakefile const* mf = cli.GetTarget()->Makefile;
|
||||
std::string const wholeArchive =
|
||||
cmJoin(cmList(mf->GetSafeDefinition(cmStrCat(
|
||||
"CMAKE_", this->Language, "_DEVICE_LINK_OPTIONS_WHOLE_ARCHIVE"))),
|
||||
" ");
|
||||
std::string const noWholeArchive = cmJoin(
|
||||
cmList(mf->GetSafeDefinition(cmStrCat(
|
||||
"CMAKE_", this->Language, "_DEVICE_LINK_OPTIONS_NO_WHOLE_ARCHIVE"))),
|
||||
" ");
|
||||
|
||||
for (auto const& item : items) {
|
||||
if (skipItemAfterFramework) {
|
||||
@@ -161,7 +172,7 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
|
||||
linkLib.Value = item.Value.Value;
|
||||
}
|
||||
|
||||
if (emitted.insert(linkLib.Value).second) {
|
||||
if (!linkLib.Value.empty() && emitted.insert(linkLib.Value).second) {
|
||||
linkLib.Value += " ";
|
||||
|
||||
cmLinkImplementation const* linkImpl =
|
||||
@@ -186,6 +197,12 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
|
||||
if (!stdLibString.empty()) {
|
||||
linkLibraries.emplace_back(cmStrCat(stdLibString, ' '));
|
||||
}
|
||||
|
||||
if (linkLibraries.size() > librariesBegin && !wholeArchive.empty()) {
|
||||
linkLibraries.insert(linkLibraries.begin() + librariesBegin,
|
||||
BT<std::string>(cmStrCat(wholeArchive, ' ')));
|
||||
linkLibraries.emplace_back(cmStrCat(noWholeArchive, ' '));
|
||||
}
|
||||
}
|
||||
|
||||
std::string cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*,
|
||||
|
||||
Reference in new issue
Block a user