diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 7 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 28 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 15 |
4 files changed, 36 insertions, 16 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8eac90d..0d730eb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 20201207) +set(CMake_VERSION_PATCH 20201209) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 12f8e44..b444edd 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5086,9 +5086,14 @@ void cmGeneratorTarget::GetTargetObjectNames( objects.push_back(map_it->second); } + // We need to compute the relative path from the root of + // of the object directory to handle subdirectory paths + std::string rootObjectDir = this->GetObjectDirectory(config); + rootObjectDir = cmSystemTools::CollapseFullPath(rootObjectDir); auto ispcObjects = this->GetGeneratedISPCObjects(config); for (std::string const& output : ispcObjects) { - objects.push_back(cmSystemTools::GetFilenameName(output)); + auto relativePathFromObjectDir = output.substr(rootObjectDir.size()); + objects.push_back(relativePathFromObjectDir); } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d9b7926..c9dfdea 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3,6 +3,7 @@ #include "cmLocalGenerator.h" #include <algorithm> +#include <array> #include <cassert> #include <cstdio> #include <cstdlib> @@ -2431,9 +2432,10 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target) this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); for (std::string const& config : configsList) { - std::string perConfigDir = target->GetObjectDirectory(config); + std::string rootObjectDir = target->GetObjectDirectory(config); + std::string headerDir = rootObjectDir; if (cmProp prop = target->GetProperty("ISPC_HEADER_DIRECTORY")) { - perConfigDir = cmSystemTools::CollapseFullPath( + headerDir = cmSystemTools::CollapseFullPath( cmStrCat(this->GetBinaryDirectory(), '/', *prop)); } @@ -2450,11 +2452,11 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target) std::string ispcSource = cmSystemTools::GetFilenameWithoutLastExtension(objectName); - auto headerPath = cmStrCat(perConfigDir, '/', ispcSource, ".h"); + auto headerPath = cmStrCat(headerDir, '/', ispcSource, ".h"); target->AddISPCGeneratedHeader(headerPath, config); if (extra_objects) { std::vector<std::string> objs = detail::ComputeISPCExtraObjects( - objectName, perConfigDir, ispcSuffixes); + objectName, rootObjectDir, ispcSuffixes); target->AddISPCGeneratedObject(std::move(objs), config); } } @@ -2474,8 +2476,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) target->GetSourceFiles(sources, config); const std::string configUpper = cmSystemTools::UpperCase(config); + static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC", + "OBJCXX" } }; - for (const std::string& lang : { "C", "CXX", "OBJC", "OBJCXX" }) { + for (const std::string& lang : langs) { auto langSources = std::count_if( sources.begin(), sources.end(), [lang](cmSourceFile* sf) { return lang == sf->GetLanguage() && @@ -4098,15 +4102,23 @@ std::vector<std::string> ComputeISPCExtraObjects( std::string const& objectName, std::string const& buildDirectory, std::vector<std::string> const& ispcSuffixes) { + auto normalizedDir = cmSystemTools::CollapseFullPath(buildDirectory); std::vector<std::string> computedObjects; computedObjects.reserve(ispcSuffixes.size()); auto extension = cmSystemTools::GetFilenameLastExtension(objectName); - auto objNameNoExt = - cmSystemTools::GetFilenameWithoutLastExtension(objectName); + + // We can't use cmSystemTools::GetFilenameWithoutLastExtension as it + // drops any directories in objectName + auto objNameNoExt = objectName; + std::string::size_type dot_pos = objectName.rfind('.'); + if (dot_pos != std::string::npos) { + objNameNoExt.resize(dot_pos); + } + for (const auto& ispcTarget : ispcSuffixes) { computedObjects.emplace_back( - cmStrCat(buildDirectory, "/", objNameNoExt, "_", ispcTarget, extension)); + cmStrCat(normalizedDir, "/", objNameNoExt, "_", ispcTarget, extension)); } return computedObjects; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6edbf82..838cf4c 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1357,15 +1357,16 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( std::string ispcSource = cmSystemTools::GetFilenameWithoutLastExtension(objectName); - std::string ispcDirectory = objectFileDir; + std::string ispcHeaderDirectory = + this->GeneratorTarget->GetObjectDirectory(config); if (cmProp prop = this->GeneratorTarget->GetProperty("ISPC_HEADER_DIRECTORY")) { - ispcDirectory = *prop; + ispcHeaderDirectory = + cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', *prop); } - ispcDirectory = - cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', ispcDirectory); - std::string ispcHeader = cmStrCat(ispcDirectory, '/', ispcSource, ".h"); + std::string ispcHeader = + cmStrCat(ispcHeaderDirectory, '/', ispcSource, ".h"); ispcHeader = this->ConvertToNinjaPath(ispcHeader); // Make sure ninja knows what command generates the header @@ -1377,8 +1378,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( auto ispcSuffixes = detail::ComputeISPCObjectSuffixes(this->GeneratorTarget); if (ispcSuffixes.size() > 1) { + std::string rootObjectDir = + this->GeneratorTarget->GetObjectDirectory(config); auto ispcSideEfffectObjects = detail::ComputeISPCExtraObjects( - objectName, ispcDirectory, ispcSuffixes); + objectName, rootObjectDir, ispcSuffixes); for (auto sideEffect : ispcSideEfffectObjects) { sideEffect = this->ConvertToNinjaPath(sideEffect); |