diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmExtraCodeLiteGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 31 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 160 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorMocUic.cxx | 46 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorMocUic.h | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 6 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 2 | ||||
-rw-r--r-- | Source/kwsys/SystemInformation.cxx | 3 |
10 files changed, 137 insertions, 119 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0d1fb40..324d825 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 13) -set(CMake_VERSION_PATCH 20190204) +set(CMake_VERSION_PATCH 20190206) #set(CMake_VERSION_RC 1) diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 2fa593c..0773edc 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -223,7 +223,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( for (cmSourceFile* s : sources) { // check whether it is a source or a include file // then put it accordingly into one of the two containers - switch (cmSystemTools::GetFileFormat(s->GetExtension().c_str())) { + switch (cmSystemTools::GetFileFormat(s->GetExtension())) { case cmSystemTools::C_FILE_FORMAT: case cmSystemTools::CXX_FILE_FORMAT: case cmSystemTools::CUDA_FILE_FORMAT: diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 77be592..1922906 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -813,7 +813,6 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly( cmGeneratorTarget const* gt) { // check to see if this is a fortran build - std::set<std::string> languages; { // Issue diagnostic if the source files depend on the config. std::vector<cmSourceFile*> sources; @@ -821,27 +820,21 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly( return false; } } + // If there's only one source language, Fortran has to be used // in order for the sources to compile. - // Note: Via linker propagation, LINKER_LANGUAGE could become CXX in - // this situation and mismatch from the actual language of the linker. + std::set<std::string> languages; gt->GetLanguages(languages, ""); - if (languages.size() == 1) { - if (*languages.begin() == "Fortran") { - return true; - } - } - - // In the case of mixed object files or sources mixed with objects, - // decide the language based on the value of LINKER_LANGUAGE. - // This will not make it possible to mix source files of different - // languages, but object libraries will be linked together in the - // same fashion as other generators do. - if (gt->GetLinkerLanguage("") == "Fortran") { - return true; - } - - return false; + // Consider an explicit linker language property, but *not* the + // computed linker language that may depend on linked targets. + // This allows the project to control the language choice in + // a target with none of its own sources, e.g. when also using + // object libraries. + const char* linkLang = gt->GetProperty("LINKER_LANGUAGE"); + if (linkLang && *linkLang) { + languages.insert(linkLang); + } + return languages.size() == 1 && *languages.begin() == "Fortran"; } bool cmGlobalVisualStudioGenerator::TargetCompare::operator()( diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b428ae1..16f8a0e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3142,6 +3142,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( if (const char* vers = this->CurrentMakefile->GetDefinition( "CMAKE_Swift_LANGUAGE_VERSION")) { swiftVersion = vers; + } else if (this->XcodeVersion >= 102) { + swiftVersion = "4.0"; } else if (this->XcodeVersion >= 83) { swiftVersion = "3.0"; } else { diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 41d29e8..a96d574 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -616,40 +616,6 @@ bool cmQtAutoGenInitializer::InitUic() } } } - // .ui files skip and options - { - std::string const uiExt = "ui"; - std::string pathError; - for (cmSourceFile* sf : makefile->GetSourceFiles()) { - // sf->GetExtension() is only valid after sf->GetFullPath() ... - // Since we're iterating over source files that might be not in the - // target we need to check for path errors (not existing files). - std::string const& fPath = sf->GetFullPath(&pathError); - if (!pathError.empty()) { - pathError.clear(); - continue; - } - if (sf->GetExtension() == uiExt) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); - // Check if the .ui file should be skipped - if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || - sf->GetPropertyAsBool("SKIP_AUTOGEN")) { - this->Uic.Skip.insert(absFile); - } - // Check if the .ui file has uic options - std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); - if (!uicOpts.empty()) { - // Check if file isn't skipped - if (this->Uic.Skip.count(absFile) == 0) { - this->Uic.FileFiles.push_back(absFile); - std::vector<std::string> optsVec; - cmSystemTools::ExpandListArgument(uicOpts, optsVec); - this->Uic.FileOptions.push_back(std::move(optsVec)); - } - } - } - } - } // Uic executable return GetUicExecutable(); @@ -664,27 +630,41 @@ bool cmQtAutoGenInitializer::InitScanFiles() { cmMakefile* makefile = this->Target->Target->GetMakefile(); + // String constants + std::string const SKIP_AUTOGEN_str = "SKIP_AUTOGEN"; + std::string const SKIP_AUTOMOC_str = "SKIP_AUTOMOC"; + std::string const SKIP_AUTOUIC_str = "SKIP_AUTOUIC"; + // Scan through target files { - std::string const qrcExt = "qrc"; + // String constants + std::string const qrc_str = "qrc"; + std::string const SKIP_AUTORCC_str = "SKIP_AUTORCC"; + std::string const AUTORCC_OPTIONS_str = "AUTORCC_OPTIONS"; + + // Scan through target files std::vector<cmSourceFile*> srcFiles; this->Target->GetConfigCommonSourceFiles(srcFiles); for (cmSourceFile* sf : srcFiles) { - if (sf->GetPropertyAsBool("SKIP_AUTOGEN")) { + if (sf->GetPropertyAsBool(SKIP_AUTOGEN_str)) { continue; } + // sf->GetExtension() is only valid after sf->GetFullPath() ... std::string const& fPath = sf->GetFullPath(); std::string const& ext = sf->GetExtension(); + // Register generated files that will be scanned by moc or uic if (this->Moc.Enabled || this->Uic.Enabled) { cmSystemTools::FileFormat const fileType = - cmSystemTools::GetFileFormat(ext.c_str()); + cmSystemTools::GetFileFormat(ext); if ((fileType == cmSystemTools::CXX_FILE_FORMAT) || (fileType == cmSystemTools::HEADER_FILE_FORMAT)) { std::string const absPath = cmSystemTools::GetRealPath(fPath); - if ((this->Moc.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) || - (this->Uic.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) { + if ((this->Moc.Enabled && + !sf->GetPropertyAsBool(SKIP_AUTOMOC_str)) || + (this->Uic.Enabled && + !sf->GetPropertyAsBool(SKIP_AUTOUIC_str))) { // Register source const bool generated = sf->GetIsGenerated(); if (fileType == cmSystemTools::HEADER_FILE_FORMAT) { @@ -704,10 +684,9 @@ bool cmQtAutoGenInitializer::InitScanFiles() } } // Register rcc enabled files - if (this->Rcc.Enabled && (ext == qrcExt) && - !sf->GetPropertyAsBool("SKIP_AUTORCC")) { - // Register qrc file - { + if (this->Rcc.Enabled) { + if ((ext == qrc_str) && !sf->GetPropertyAsBool(SKIP_AUTORCC_str)) { + // Register qrc file Qrc qrc; qrc.QrcFile = cmSystemTools::GetRealPath(fPath); qrc.QrcName = @@ -715,7 +694,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() qrc.Generated = sf->GetIsGenerated(); // RCC options { - std::string const opts = sf->GetSafeProperty("AUTORCC_OPTIONS"); + std::string const opts = sf->GetSafeProperty(AUTORCC_OPTIONS_str); if (!opts.empty()) { cmSystemTools::ExpandListArgument(opts, qrc.Options); } @@ -731,43 +710,65 @@ bool cmQtAutoGenInitializer::InitScanFiles() // mocs_compilation.cpp source acknowledged by this target. this->Target->ClearSourcesCache(); + // Scan through all source files in the makefile to extract moc and uic + // parameters. Historically we support non target source file parameters. + // The reason is that their file names might be discovered from source files + // at generation time. if (this->Moc.Enabled || this->Uic.Enabled) { - // Read skip files from makefile sources - { + // String constants + std::string const ui_str = "ui"; + std::string const AUTOUIC_OPTIONS_str = "AUTOUIC_OPTIONS"; + + for (cmSourceFile* sf : makefile->GetSourceFiles()) { + // sf->GetExtension() is only valid after sf->GetFullPath() ... + // Since we're iterating over source files that might be not in the + // target we need to check for path errors (not existing files). std::string pathError; - for (cmSourceFile* sf : makefile->GetSourceFiles()) { - // sf->GetExtension() is only valid after sf->GetFullPath() ... - // Since we're iterating over source files that might be not in the - // target we need to check for path errors (not existing files). - std::string const& fPath = sf->GetFullPath(&pathError); - if (!pathError.empty()) { - pathError.clear(); - continue; + std::string const& fullPath = sf->GetFullPath(&pathError); + if (!pathError.empty() || fullPath.empty()) { + continue; + } + + // Check file type + auto const fileType = cmSystemTools::GetFileFormat(sf->GetExtension()); + bool const isSource = (fileType == cmSystemTools::CXX_FILE_FORMAT) || + (fileType == cmSystemTools::HEADER_FILE_FORMAT); + bool const isUi = (this->Moc.Enabled && sf->GetExtension() == ui_str); + + // Process only certain file types + if (isSource || isUi) { + std::string const absFile = cmSystemTools::GetRealPath(fullPath); + // Acquire file properties + bool const skipAUTOGEN = sf->GetPropertyAsBool(SKIP_AUTOGEN_str); + bool const skipMoc = (this->Moc.Enabled && isSource) && + (skipAUTOGEN || sf->GetPropertyAsBool(SKIP_AUTOMOC_str)); + bool const skipUic = this->Uic.Enabled && + (skipAUTOGEN || sf->GetPropertyAsBool(SKIP_AUTOUIC_str)); + + // Register moc and uic skipped file + if (skipMoc) { + this->Moc.Skip.insert(absFile); } - cmSystemTools::FileFormat const fileType = - cmSystemTools::GetFileFormat(sf->GetExtension().c_str()); - if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) && - !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) { - continue; + if (skipUic) { + this->Uic.Skip.insert(absFile); } - const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN"); - const bool mocSkip = this->Moc.Enabled && - (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); - const bool uicSkip = this->Uic.Enabled && - (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); - if (mocSkip || uicSkip) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); - if (mocSkip) { - this->Moc.Skip.insert(absFile); - } - if (uicSkip) { - this->Uic.Skip.insert(absFile); + + // Check if the .ui file has uic options + if (isUi && !skipUic) { + std::string const uicOpts = sf->GetSafeProperty(AUTOUIC_OPTIONS_str); + if (!uicOpts.empty()) { + this->Uic.FileFiles.push_back(absFile); + std::vector<std::string> optsVec; + cmSystemTools::ExpandListArgument(uicOpts, optsVec); + this->Uic.FileOptions.push_back(std::move(optsVec)); } } } } + } - // Process GENERATED sources and headers + // Process GENERATED sources and headers + if (this->Moc.Enabled || this->Uic.Enabled) { if (!this->AutogenTarget.SourcesGenerated.empty() || !this->AutogenTarget.HeadersGenerated.empty()) { // Check status of policy CMP0071 @@ -843,13 +844,14 @@ bool cmQtAutoGenInitializer::InitScanFiles() } } } - // Sort headers and sources - if (this->Moc.Enabled || this->Uic.Enabled) { - std::sort(this->AutogenTarget.Headers.begin(), - this->AutogenTarget.Headers.end()); - std::sort(this->AutogenTarget.Sources.begin(), - this->AutogenTarget.Sources.end()); - } + } + + // Sort headers and sources + if (this->Moc.Enabled || this->Uic.Enabled) { + std::sort(this->AutogenTarget.Headers.begin(), + this->AutogenTarget.Headers.end()); + std::sort(this->AutogenTarget.Sources.begin(), + this->AutogenTarget.Sources.end()); } // Process qrc files diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 0ba5224..ddff4cf 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -678,19 +678,21 @@ void cmQtAutoGeneratorMocUic::JobMocT::Process(WorkerT& wrk) BuildFile += '/'; BuildFile += IncludeString; } else { - std::string rel = wrk.FileSys().GetFilePathChecksum(SourceFile); - rel += "/moc_"; - rel += wrk.FileSys().GetFilenameWithoutLastExtension(SourceFile); - rel += ".cpp"; - // Register relative file path - wrk.Gen().ParallelMocAutoRegister(rel); + // Relative build path + std::string relPath = wrk.FileSys().GetFilePathChecksum(SourceFile); + relPath += "/moc_"; + relPath += wrk.FileSys().GetFilenameWithoutLastExtension(SourceFile); + + // Register relative file path with duplication check + relPath = wrk.Gen().ParallelMocAutoRegister(relPath); + // Absolute build path if (wrk.Base().MultiConfig) { BuildFile = wrk.Base().AutogenIncludeDir; BuildFile += '/'; - BuildFile += rel; + BuildFile += relPath; } else { - BuildFile = wrk.Base().AbsoluteBuildPath(rel); + BuildFile = wrk.Base().AbsoluteBuildPath(relPath); } } @@ -1953,11 +1955,31 @@ bool cmQtAutoGeneratorMocUic::ParallelMocIncluded( return (MocIncludedFiles_.find(sourceFile) != MocIncludedFiles_.end()); } -void cmQtAutoGeneratorMocUic::ParallelMocAutoRegister( - std::string const& mocFile) +std::string cmQtAutoGeneratorMocUic::ParallelMocAutoRegister( + std::string const& baseName) { - std::lock_guard<std::mutex> mocLock(JobsMutex_); - MocAutoFiles_.emplace(mocFile); + std::string res; + { + std::lock_guard<std::mutex> mocLock(JobsMutex_); + res = baseName; + res += ".cpp"; + if (MocAutoFiles_.find(res) == MocAutoFiles_.end()) { + MocAutoFiles_.emplace(res); + } else { + // Append number suffix to the file name + for (unsigned int ii = 2; ii != 1024; ++ii) { + res = baseName; + res += '_'; + res += std::to_string(ii); + res += ".cpp"; + if (MocAutoFiles_.find(res) == MocAutoFiles_.end()) { + MocAutoFiles_.emplace(res); + break; + } + } + } + } + return res; } void cmQtAutoGeneratorMocUic::ParallelMocAutoUpdated() diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index 32a6006..c22df29 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -389,7 +389,7 @@ public: bool ParallelJobPushMoc(JobHandleT& jobHandle); bool ParallelJobPushUic(JobHandleT& jobHandle); bool ParallelMocIncluded(std::string const& sourceFile); - void ParallelMocAutoRegister(std::string const& mocFile); + std::string ParallelMocAutoRegister(std::string const& baseName); void ParallelMocAutoUpdated(); private: diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 5d8c079..1d20e2f 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1330,13 +1330,11 @@ bool cmSystemTools::SimpleGlob(const std::string& glob, return res; } -cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext) +cmSystemTools::FileFormat cmSystemTools::GetFileFormat(std::string const& ext) { - if (!cext || *cext == 0) { + if (ext.empty()) { return cmSystemTools::NO_FILE_FORMAT; } - // std::string ext = cmSystemTools::LowerCase(cext); - std::string ext = cext; if (ext == "c" || ext == ".c" || ext == "m" || ext == ".m") { return cmSystemTools::C_FILE_FORMAT; } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index fcb2cce..0f92fe2 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -334,7 +334,7 @@ public: /** * Determine the file type based on the extension */ - static FileFormat GetFileFormat(const char* ext); + static FileFormat GetFileFormat(std::string const& ext); /** Windows if this is true, the CreateProcess in RunCommand will * not show new console windows when running programs. diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 6c12355..f323efc 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -4424,7 +4424,8 @@ bool SystemInformationImplementation::ParseSysCtl() &count) == KERN_SUCCESS) { len = sizeof(value); err = sysctlbyname("hw.pagesize", &value, &len, KWSYS_NULLPTR, 0); - int64_t available_memory = vmstat.free_count * value; + int64_t available_memory = + (vmstat.free_count + vmstat.inactive_count) * value; this->AvailablePhysicalMemory = static_cast<size_t>(available_memory / 1048576); } |