This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via 1f7bd0032253296413770567a90a0a88b6cccb34 (commit) via c4f2f011084a5e64e6f3745071ea56a286758682 (commit) via 4684e64c84d49d9152ebab42c8bc4ffa57652041 (commit) via 54b69bd6426bffae6ba11b4d0d95a4ad8c31b309 (commit) via cee20ad5374e2547cad9f2847006cf753c301042 (commit) via d8e323761152dcf494606ca3436637a9cbbe1741 (commit) via dca9c33abc7ce6b041b378e1ebc43c35327027b3 (commit) via c856d4556b4ec28cb818ef3c7aca1e4a30e0499d (commit) via aaf24357802f577830659a441fdf41da83642b43 (commit) via 10507c6dc0918777d43b3f961bd18162866f0bbb (commit) via 25f29b974182ae7da36ace86e846b4c0b2807a68 (commit) via ee86770a3f9700374820f90959a9c0fa39b27409 (commit) via 0ad180d71294c513270b4d97cec40ad3af504faa (commit) via 55b0532128304cb60021831cd37adbe4eb5d3650 (commit) via 2d888e339064d39ae894b4df567441539c8c65da (commit) via fe683876952ee6172e46fe770b4f3e48c69646d1 (commit) via 079b8e29168dc081f37f79f3577a5c0690bb7051 (commit) via 6e3655db2cc8202424e54bdde83e4240eb680cc3 (commit) via df0247a3714667e0f60d64da1b30ea200c43c7d5 (commit) from 2e6effd2e0d8e60ede4aa528e771430071c546b4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f7bd0032253296413770567a90a0a88b6cccb34 commit 1f7bd0032253296413770567a90a0a88b6cccb34 Merge: c4f2f01 10507c6 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 3 13:37:00 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 3 09:42:15 2019 -0400 Merge topic 'add-non-empty-configurations-getter' 10507c6dc0 cmMakefile: Add configurations getter with empty configuration default Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3759 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c4f2f011084a5e64e6f3745071ea56a286758682 commit c4f2f011084a5e64e6f3745071ea56a286758682 Merge: 4684e64 2d888e3 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 3 13:37:29 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 3 09:40:44 2019 -0400 Merge topic 'rename-mutating-getfullpath-overload' 2d888e3390 cmSourceFile: Rename mutating GetFullPath() overload Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3757 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4684e64c84d49d9152ebab42c8bc4ffa57652041 commit 4684e64c84d49d9152ebab42c8bc4ffa57652041 Merge: 54b69bd dca9c33 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 3 13:34:01 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 3 09:39:03 2019 -0400 Merge topic 'clang-ipo-support' dca9c33abc Tests: Remove old IPO test c856d4556b bindexplib: supporting llvm bitcode formats using llvm-nm 079b8e2916 Clang: prefer lld-link over link.exe 6e3655db2c Clang: add LTO support for GNU-command line clang on windows Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3527 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54b69bd6426bffae6ba11b4d0d95a4ad8c31b309 commit 54b69bd6426bffae6ba11b4d0d95a4ad8c31b309 Merge: cee20ad aaf2435 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 3 13:35:09 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 3 09:36:59 2019 -0400 Merge topic 'gtest-1.8.1' aaf2435780 FindGTest: Add support for googletest 1.8.1 folder structure Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3756 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cee20ad5374e2547cad9f2847006cf753c301042 commit cee20ad5374e2547cad9f2847006cf753c301042 Merge: d8e3237 25f29b9 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 3 13:32:02 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 3 09:34:46 2019 -0400 Merge topic 'vs-cuda-custom-dir' 25f29b9741 cuda: Adapted tests to work with modified cuda toolset ee86770a3f cuda: Added docs for extended cuda toolset 0ad180d712 cuda: Extend cuda compiler detection to work with custom cuda path 55b0532128 cuda: Extend vs10 target generator to use custom cuda path df0247a371 cuda: Extend toolset argument to accept path Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3713 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8e323761152dcf494606ca3436637a9cbbe1741 commit d8e323761152dcf494606ca3436637a9cbbe1741 Merge: 2e6effd fe68387 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 3 13:30:36 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 3 09:33:02 2019 -0400 Merge topic 'FindPkgConfig-module-name' fe68387695 FindPkgConfig: return the module found by pkg_search_module Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3749 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dca9c33abc7ce6b041b378e1ebc43c35327027b3 commit dca9c33abc7ce6b041b378e1ebc43c35327027b3 Author: Zsolt Parragi <zsolt.parr...@cancellar.hu> AuthorDate: Thu Aug 29 11:52:18 2019 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri Aug 30 11:31:06 2019 -0400 Tests: Remove old IPO test This test didn't really result in IPO compilation, there are other better tests for this. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 34858b8..03d7a7e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -416,7 +416,6 @@ if(BUILD_TESTING) ADD_TEST_MACRO(COnly COnly) ADD_TEST_MACRO(CxxOnly CxxOnly) ADD_TEST_MACRO(CxxSubdirC CxxSubdirC) - ADD_TEST_MACRO(IPO COnly/COnly) ADD_TEST_MACRO(OutDir runtime/OutDir) ADD_TEST_MACRO(OutName exe.OutName.exe) ADD_TEST_MACRO(ObjectLibrary UseCshared) diff --git a/Tests/IPO/CMakeLists.txt b/Tests/IPO/CMakeLists.txt deleted file mode 100644 index 6dabf86..0000000 --- a/Tests/IPO/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required (VERSION 2.8) -project(IPO NONE) - -set_property(DIRECTORY PROPERTY INTERPROCEDURAL_OPTIMIZATION 1) - -add_subdirectory(../COnly COnly) -add_subdirectory(../CxxOnly CxxOnly) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c856d4556b4ec28cb818ef3c7aca1e4a30e0499d commit c856d4556b4ec28cb818ef3c7aca1e4a30e0499d Author: Zsolt Parragi <zsolt.parr...@cancellar.hu> AuthorDate: Tue Aug 13 14:29:48 2019 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri Aug 30 11:30:38 2019 -0400 bindexplib: supporting llvm bitcode formats using llvm-nm diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index a107294..7e5db26 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -64,9 +64,12 @@ */ #include "bindexplib.h" +#include "cmSystemTools.h" #include "cmsys/Encoding.hxx" #include "cmsys/FStream.hxx" #include <iostream> +#include <sstream> +#include <vector> #include <windows.h> #ifndef IMAGE_FILE_MACHINE_ARM @@ -301,7 +304,63 @@ private: bool IsI386; }; -bool DumpFile(const char* filename, std::set<std::string>& symbols, +bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename, + std::set<std::string>& symbols, + std::set<std::string>& dataSymbols) +{ + std::string output; + // break up command line into a vector + std::vector<std::string> command; + command.push_back(nmPath); + command.push_back("--no-weak"); + command.push_back("--defined-only"); + command.push_back("--format=posix"); + command.push_back(filename); + + // run the command + int exit_code = 0; + cmSystemTools::RunSingleCommand(command, &output, &output, &exit_code, "", + cmSystemTools::OUTPUT_NONE); + + if (exit_code != 0) { + fprintf(stderr, "llvm-nm returned an error: %s\n", output.c_str()); + return false; + } + + std::istringstream ss(output); + std::string line; + while (std::getline(ss, line)) { + if (line.empty()) { // last line + continue; + } + size_t sym_end = line.find(" "); + if (sym_end == std::string::npos) { + fprintf(stderr, "Couldn't parse llvm-nm output line: %s\n", + line.c_str()); + return false; + } + if (line.size() < sym_end + 1) { + fprintf(stderr, "Couldn't parse llvm-nm output line: %s\n", + line.c_str()); + return false; + } + const std::string sym = line.substr(0, sym_end); + const char sym_type = line[sym_end + 1]; + switch (sym_type) { + case 'D': + dataSymbols.insert(sym); + break; + case 'T': + symbols.insert(sym); + break; + } + } + + return true; +} + +bool DumpFile(std::string const& nmPath, const char* filename, + std::set<std::string>& symbols, std::set<std::string>& dataSymbols) { HANDLE hFile; @@ -356,16 +415,26 @@ bool DumpFile(const char* filename, std::set<std::string>& symbols, (imageHeader->Machine == IMAGE_FILE_MACHINE_I386)); symbolDumper.DumpObjFile(); } else { - // check for /bigobj format + // check for /bigobj and llvm LTO format cmANON_OBJECT_HEADER_BIGOBJ* h = (cmANON_OBJECT_HEADER_BIGOBJ*)lpFileBase; if (h->Sig1 == 0x0 && h->Sig2 == 0xffff) { + // bigobj DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX> symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*)lpFileBase, symbols, dataSymbols, (h->Machine == IMAGE_FILE_MACHINE_I386)); symbolDumper.DumpObjFile(); + } else if ( + // BCexCODE - llvm bitcode + (h->Sig1 == 0x4342 && h->Sig2 == 0xDEC0) || + // 0x0B17C0DE - llvm bitcode BC wrapper + (h->Sig1 == 0x0B17 && h->Sig2 == 0xC0DE)) { + + return DumpFileWithLlvmNm(nmPath, filename, symbols, dataSymbols); + } else { - printf("unrecognized file format in '%s'\n", filename); + printf("unrecognized file format in '%s, %u'\n", filename, + imageHeader->Machine); return false; } } @@ -378,7 +447,7 @@ bool DumpFile(const char* filename, std::set<std::string>& symbols, bool bindexplib::AddObjectFile(const char* filename) { - return DumpFile(filename, this->Symbols, this->DataSymbols); + return DumpFile(NmPath, filename, this->Symbols, this->DataSymbols); } bool bindexplib::AddDefinitionFile(const char* filename) @@ -419,3 +488,8 @@ void bindexplib::WriteFile(FILE* file) fprintf(file, "\t%s\n", s.c_str()); } } + +void bindexplib::SetNmPath(std::string const& nm) +{ + NmPath = nm; +} diff --git a/Source/bindexplib.h b/Source/bindexplib.h index 3e22ac7..6c066c5 100644 --- a/Source/bindexplib.h +++ b/Source/bindexplib.h @@ -12,13 +12,16 @@ class bindexplib { public: - bindexplib() {} + bindexplib() { NmPath = "nm"; } bool AddDefinitionFile(const char* filename); bool AddObjectFile(const char* filename); void WriteFile(FILE* file); + void SetNmPath(std::string const& nm); + private: std::set<std::string> Symbols; std::set<std::string> DataSymbols; + std::string NmPath; }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f99fe4e..f84ec76 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -15,6 +15,7 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalUnixMakefileGenerator3.h" +#include "cmLocalCommonGenerator.h" #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmMakefileExecutableTargetGenerator.h" @@ -1738,6 +1739,12 @@ void cmMakefileTargetGenerator::GenDefFile( this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file), cmOutputConverter::SHELL); + const char* nm_executable = this->Makefile->GetDefinition("CMAKE_NM"); + if (nm_executable && *nm_executable) { + cmd += " --nm="; + cmd += this->LocalCommonGenerator->ConvertToOutputFormat( + nm_executable, cmOutputConverter::SHELL); + } real_link_commands.insert(real_link_commands.begin(), cmd); // create a list of obj files for the -E __create_def to read cmGeneratedFileStream fout(objlist_file); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 17a5527..df4d45d 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -20,6 +20,7 @@ #include "cmGlobalNinjaGenerator.h" #include "cmLinkLineComputer.h" #include "cmLinkLineDeviceComputer.h" +#include "cmLocalCommonGenerator.h" #include "cmLocalGenerator.h" #include "cmLocalNinjaGenerator.h" #include "cmMakefile.h" @@ -974,6 +975,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string obj_list_file = mdi->DefFile + ".objs"; cmd += this->GetLocalGenerator()->ConvertToOutputFormat( obj_list_file, cmOutputConverter::SHELL); + + const char* nm_executable = GetMakefile()->GetDefinition("CMAKE_NM"); + if (nm_executable && *nm_executable) { + cmd += " --nm="; + cmd += this->LocalCommonGenerator->ConvertToOutputFormat( + nm_executable, cmOutputConverter::SHELL); + } preLinkCmdLines.push_back(std::move(cmd)); // create a list of obj files for the -E __create_def to read diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 2be8bae..08cad7d 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -558,8 +558,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) #if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP) else if (args[1] == "__create_def") { if (args.size() < 4) { - std::cerr - << "__create_def Usage: -E __create_def outfile.def objlistfile\n"; + std::cerr << "__create_def Usage: -E __create_def outfile.def " + "objlistfile [-nm=nm-path]\n"; return 1; } FILE* fout = cmsys::SystemTools::Fopen(args[2].c_str(), "w+"); @@ -576,6 +576,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) } std::string file; bindexplib deffile; + if (args.size() >= 5) { + auto a = args[4]; + if (cmHasLiteralPrefix(a, "--nm=")) { + deffile.SetNmPath(a.substr(5)); + std::cerr << a.substr(5) << "\n"; + } else { + std::cerr << "unknown argument: " << a << "\n"; + } + } while (cmSystemTools::GetLineFromStream(fin, file)) { std::string const& ext = cmSystemTools::GetFilenameLastExtension(file); if (cmSystemTools::LowerCase(ext) == ".def") { diff --git a/Tests/Module/CheckIPOSupported-C/CMakeLists.txt b/Tests/Module/CheckIPOSupported-C/CMakeLists.txt index 4a41a98..c5cd03e 100644 --- a/Tests/Module/CheckIPOSupported-C/CMakeLists.txt +++ b/Tests/Module/CheckIPOSupported-C/CMakeLists.txt @@ -13,8 +13,18 @@ elseif(CMake_TEST_IPO_WORKS_C) endif() add_library(foo foo.c) +if(NOT CYGWIN AND (NOT WIN32 OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")) + add_library(bar SHARED bar.c) + if(WIN32) + # Bindexplib for clang supports LTO objects + set_target_properties(bar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + endif() +else() + # TODO: bindexplib doesn't support exporting IPO symbols with other compilers on Windows + add_library(bar STATIC bar.c) +endif() add_executable(CheckIPOSupported-C main.c) -target_link_libraries(CheckIPOSupported-C PUBLIC foo) +target_link_libraries(CheckIPOSupported-C PUBLIC foo bar) enable_testing() add_test(NAME CheckIPOSupported-C COMMAND CheckIPOSupported-C) diff --git a/Tests/Module/CheckIPOSupported-C/bar.c b/Tests/Module/CheckIPOSupported-C/bar.c new file mode 100644 index 0000000..680f213 --- /dev/null +++ b/Tests/Module/CheckIPOSupported-C/bar.c @@ -0,0 +1,4 @@ +int bar() +{ + return 0x42; +} diff --git a/Tests/Module/CheckIPOSupported-C/main.c b/Tests/Module/CheckIPOSupported-C/main.c index 99204ab..28ab26f 100644 --- a/Tests/Module/CheckIPOSupported-C/main.c +++ b/Tests/Module/CheckIPOSupported-C/main.c @@ -1,8 +1,9 @@ int foo(); +int bar(); int main() { - if (foo() == 0) { + if (foo() != bar()) { return 1; } return 0; diff --git a/Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt b/Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt index 1bb2b84..237bf1d 100644 --- a/Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt +++ b/Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt @@ -12,9 +12,20 @@ elseif(CMake_TEST_IPO_WORKS_CXX) message(FATAL_ERROR "IPO expected to work, but the check failed:\n ${ipo_output}") endif() -add_library(foo foo.cpp) + +add_library(foo STATIC foo.cpp) +if(NOT CYGWIN AND (NOT WIN32 OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) + add_library(bar SHARED bar.cpp) + if(WIN32) + # Bindexplib for clang supports LTO objects + set_target_properties(bar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + endif() +else() + # TODO: bindexplib doesn't support exporting IPO symbols with other compilers on Windows + add_library(bar STATIC bar.cpp) +endif() add_executable(CheckIPOSupported-CXX main.cpp) -target_link_libraries(CheckIPOSupported-CXX PUBLIC foo) +target_link_libraries(CheckIPOSupported-CXX PUBLIC foo bar) enable_testing() add_test(NAME CheckIPOSupported-CXX COMMAND CheckIPOSupported-CXX) diff --git a/Tests/Module/CheckIPOSupported-CXX/bar.cpp b/Tests/Module/CheckIPOSupported-CXX/bar.cpp new file mode 100644 index 0000000..680f213 --- /dev/null +++ b/Tests/Module/CheckIPOSupported-CXX/bar.cpp @@ -0,0 +1,4 @@ +int bar() +{ + return 0x42; +} diff --git a/Tests/Module/CheckIPOSupported-CXX/main.cpp b/Tests/Module/CheckIPOSupported-CXX/main.cpp index 99204ab..28ab26f 100644 --- a/Tests/Module/CheckIPOSupported-CXX/main.cpp +++ b/Tests/Module/CheckIPOSupported-CXX/main.cpp @@ -1,8 +1,9 @@ int foo(); +int bar(); int main() { - if (foo() == 0) { + if (foo() != bar()) { return 1; } return 0; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aaf24357802f577830659a441fdf41da83642b43 commit aaf24357802f577830659a441fdf41da83642b43 Author: Kelby Faessler <kmfaess...@gmail.com> AuthorDate: Thu Aug 29 15:27:40 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri Aug 30 11:24:27 2019 -0400 FindGTest: Add support for googletest 1.8.1 folder structure diff --git a/Help/release/dev/gtest-1.8.1.rst b/Help/release/dev/gtest-1.8.1.rst new file mode 100644 index 0000000..2e48da4 --- /dev/null +++ b/Help/release/dev/gtest-1.8.1.rst @@ -0,0 +1,5 @@ +gtest-1.8.1 +----------- + +* The :module:`FindGTest` module has been updated to recognize + MSVC build trees generated by GTest 1.8.1. diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index b0175fe..e015a98 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -160,6 +160,10 @@ if(MSVC) msvc/gtest-md/Release msvc/x64/Debug msvc/x64/Release + msvc/2010/gtest-md/Win32-Debug + msvc/2010/gtest-md/Win32-Release + msvc/2010/gtest-md/x64-Debug + msvc/2010/gtest-md/x64-Release ) elseif(GTEST_MSVC_SEARCH STREQUAL "MT") list(APPEND _gtest_libpath_suffixes @@ -167,6 +171,10 @@ if(MSVC) msvc/gtest/Release msvc/x64/Debug msvc/x64/Release + msvc/2010/gtest/Win32-Debug + msvc/2010/gtest/Win32-Release + msvc/2010/gtest/x64-Debug + msvc/2010/gtest/x64-Release ) endif() endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=10507c6dc0918777d43b3f961bd18162866f0bbb commit 10507c6dc0918777d43b3f961bd18162866f0bbb Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Fri Aug 30 11:47:37 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Fri Aug 30 13:52:13 2019 +0200 cmMakefile: Add configurations getter with empty configuration default diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 01d4c07..6bf2f2d 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -197,11 +197,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) { std::set<cmLinkItem> emitted; - std::vector<std::string> configs; - depender->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + depender->Makefile->GetGeneratorConfigs(); for (std::string const& it : configs) { std::vector<cmSourceFile const*> objectFiles; depender->GetExternalObjects(objectFiles, it); diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 08db7c7..db6d675 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -423,20 +423,17 @@ Json::Value Codemodel::DumpPaths() Json::Value Codemodel::DumpConfigurations() { - std::vector<std::string> configs; + Json::Value configurations = Json::arrayValue; cmGlobalGenerator* gg = this->FileAPI.GetCMakeInstance()->GetGlobalGenerator(); auto makefiles = gg->GetMakefiles(); if (!makefiles.empty()) { - makefiles[0]->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); + std::vector<std::string> const& configs = + makefiles[0]->GetGeneratorConfigs(); + for (std::string const& config : configs) { + configurations.append(this->DumpConfiguration(config)); } } - Json::Value configurations = Json::arrayValue; - for (std::string const& config : configs) { - configurations.append(this->DumpConfiguration(config)); - } return configurations; } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index cc37232..6de7d83 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -786,11 +786,8 @@ void cmGeneratorTarget::ComputeObjectMapping() return; } - std::vector<std::string> configs; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); for (std::string const& c : configs) { std::vector<cmSourceFile const*> sourceFiles; this->GetObjectSources(sourceFiles, c); @@ -2634,12 +2631,9 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) // Queue all the source files already specified for the target. if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { - std::vector<std::string> configs; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } std::set<cmSourceFile*> emitted; + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); for (std::string const& c : configs) { std::vector<cmSourceFile*> sources; this->GeneratorTarget->GetSourceFiles(sources, c); @@ -2825,12 +2819,9 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) } // Queue the custom command dependencies. - std::vector<std::string> configs; std::set<std::string> emitted; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); for (std::string const& conf : configs) { this->FollowCommandDepends(cc, conf, emitted); } @@ -6077,11 +6068,8 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation( bool cmGeneratorTarget::GetConfigCommonSourceFiles( std::vector<cmSourceFile*>& files) const { - std::vector<std::string> configs; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); std::vector<std::string>::const_iterator it = configs.begin(); const std::string& firstConfig = *it; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4342e9f..53ed535 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -337,12 +337,8 @@ bool cmGlobalGenerator::CheckTargetsForType() const for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::EXECUTABLE && target->GetPropertyAsBool("WIN32_EXECUTABLE")) { - std::vector<std::string> configs; - target->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } - + std::vector<std::string> const& configs = + target->Makefile->GetGeneratorConfigs(); for (std::string const& config : configs) { if (target->GetLinkerLanguage(config) == "Swift") { this->GetCMakeInstance()->IssueMessage( @@ -2963,11 +2959,8 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target) // List the source files with any per-source labels. fout << "# Source files and their labels\n"; std::vector<cmSourceFile*> sources; - std::vector<std::string> configs; - target->Target->GetMakefile()->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + target->Target->GetMakefile()->GetGeneratorConfigs(); for (std::string const& c : configs) { target->GetSourceFiles(sources, c); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7177694..155e5b8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -257,11 +257,8 @@ static void MoveSystemIncludesToEnd(std::vector<BT<std::string>>& includeDirs, void cmLocalGenerator::TraceDependencies() { - std::vector<std::string> configs; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); for (std::string const& c : configs) { this->GlobalGenerator->CreateEvaluationSourceFiles(c); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f101cdc..e65d264 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3057,6 +3057,16 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs, return buildType; } +std::vector<std::string> cmMakefile::GetGeneratorConfigs() const +{ + std::vector<std::string> configs; + GetConfigurations(configs); + if (configs.empty()) { + configs.emplace_back(); + } + return configs; +} + bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff, cmExecutionStatus& status) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index dcc4e77..6b9fa6b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -292,6 +292,9 @@ public: std::string GetConfigurations(std::vector<std::string>& configs, bool single = true) const; + /** Get the configurations for dependency checking. */ + std::vector<std::string> GetGeneratorConfigs() const; + /** * Set the name of the library. */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25f29b974182ae7da36ace86e846b4c0b2807a68 commit 25f29b974182ae7da36ace86e846b4c0b2807a68 Author: Benjamin Wozniak <benjamin.wozn...@intenta.de> AuthorDate: Fri Aug 23 08:32:28 2019 +0200 Commit: Benjamin Wozniak <benjamin.wozn...@intenta.de> CommitDate: Fri Aug 30 08:14:01 2019 +0200 cuda: Adapted tests to work with modified cuda toolset - cuda version is only recognized if it contains no other characters than "0123456789." - cuda path is only tested with dummy value . Otherwise a cuda toolkit must be copied to the integration test machine diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index ef8fd25..ae75561 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -6,12 +6,14 @@ run_cmake(NoToolset) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) - set(RunCMake_GENERATOR_TOOLSET "Test Toolset,cuda=Test Cuda") + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,cuda=0.0") run_cmake(TestToolsetCudaBoth) - set(RunCMake_GENERATOR_TOOLSET ",cuda=Test Cuda") - run_cmake(TestToolsetCudaOnly) - set(RunCMake_GENERATOR_TOOLSET "cuda=Test Cuda") - run_cmake(TestToolsetCudaOnly) + set(RunCMake_GENERATOR_TOOLSET ",cuda=0.0") + run_cmake(TestToolsetCudaVersionOnly) + set(RunCMake_GENERATOR_TOOLSET "cuda=0.0") + run_cmake(TestToolsetCudaVersionOnly) + set(RunCMake_GENERATOR_TOOLSET "cuda=C:\\dummy\\cuda") + run_cmake(TestToolsetCudaPathOnly) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[2456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(TestToolsetHostArchBoth) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt index 90503e2..f12c123 100644 --- a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt @@ -1,2 +1,2 @@ -- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset' --- CMAKE_VS_PLATFORM_TOOLSET_CUDA='Test Cuda' +-- CMAKE_VS_PLATFORM_TOOLSET_CUDA='0.0' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt new file mode 100644 index 0000000..b17745f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio .* + + given toolset + + cuda=C:\\dummy\\cuda\\ + + cannot detect Visual Studio integration files in path + + C:/dummy/cuda/CUDAVisualStudioIntegration/extras/visual_studio_integration/MSBuildExtensions diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly-stdout.txt similarity index 54% rename from Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly-stdout.txt rename to Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly-stdout.txt index 94e1e43..1717ff8 100644 --- a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly-stdout.txt +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly-stdout.txt @@ -1,2 +1,2 @@ -- CMAKE_VS_PLATFORM_TOOLSET='(v[0-9]+|Windows7.1SDK)' --- CMAKE_VS_PLATFORM_TOOLSET_CUDA='Test Cuda' +-- CMAKE_VS_PLATFORM_TOOLSET_CUDA='0.0' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly.cmake similarity index 100% rename from Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly.cmake rename to Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly.cmake https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee86770a3f9700374820f90959a9c0fa39b27409 commit ee86770a3f9700374820f90959a9c0fa39b27409 Author: Benjamin Wozniak <benjamin.wozn...@intenta.de> AuthorDate: Wed Aug 21 16:14:40 2019 +0200 Commit: Benjamin Wozniak <benjamin.wozn...@intenta.de> CommitDate: Fri Aug 30 08:14:00 2019 +0200 cuda: Added docs for extended cuda toolset diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 9ad1195..d6836b8 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -111,6 +111,7 @@ Variables that Provide Information /variable/CMAKE_VS_PLATFORM_NAME_DEFAULT /variable/CMAKE_VS_PLATFORM_TOOLSET /variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA + /variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR /variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE /variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION /variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst index a01a8b7..222824f 100644 --- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst +++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst @@ -40,10 +40,13 @@ The ``key=value`` pairs form a comma-separated list of options to specify generator-specific details of the toolset selection. Supported pairs are: -``cuda=<version>`` - Specify the CUDA toolkit version to use. Supported by VS 2010 - and above with the CUDA toolkit VS integration installed. - See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_CUDA` variable. +``cuda=<version>|<path>`` + Specify the CUDA toolkit version to use or the path to a + standalone CUDA toolkit directory. Supported by VS 2010 + and above. The version can only be used with the CUDA + toolkit VS integration globally installed. + See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_CUDA` and + :variable:`CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR` variables. ``host=<arch>`` Specify the host tools architecture as ``x64`` or ``x86``. diff --git a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA.rst b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA.rst index 1604a76..67b7f74 100644 --- a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA.rst +++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA.rst @@ -6,7 +6,9 @@ NVIDIA CUDA Toolkit version whose Visual Studio toolset to use. The :ref:`Visual Studio Generators` for VS 2010 and above support using a CUDA toolset provided by a CUDA Toolkit. The toolset version number may be specified by a field in :variable:`CMAKE_GENERATOR_TOOLSET` of -the form ``cuda=8.0``. If none is specified CMake will choose a default -version. CMake provides the selected CUDA toolset version in this variable. +the form ``cuda=8.0``. Or it is automatically detected if a path to +a standalone CUDA directory is specified in the form ``cuda=C:\path\to\cuda``. +If none is specified CMake will choose a default version. +CMake provides the selected CUDA toolset version in this variable. The value may be empty if no CUDA Toolkit with Visual Studio integration is installed. diff --git a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst new file mode 100644 index 0000000..060648a --- /dev/null +++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst @@ -0,0 +1,16 @@ +CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR +----------------------------------------- + +Path to standalone NVIDIA CUDA Toolkit (eg. extracted from installer). + +The :ref:`Visual Studio Generators` for VS 2010 and above support using +a standalone (non-installed) NVIDIA CUDA toolkit. The path +may be specified by a field in :variable:`CMAKE_GENERATOR_TOOLSET` of +the form ``cuda=C:\path\to\cuda``. The given directory must at least +contain a folder ``.\nvcc`` and must provide Visual Studio integration +files in path ``.\CUDAVisualStudioIntegration\extras\ +visual_studio_integration\MSBuildExtensions\``. One can create a standalone +CUDA toolkit directory by either opening a installer with 7zip or +copying the files that are extracted by the running installer. +The value may be empty if no path to a standalone CUDA Toolkit was +specified. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0ad180d71294c513270b4d97cec40ad3af504faa commit 0ad180d71294c513270b4d97cec40ad3af504faa Author: Benjamin Wozniak <benjamin.wozn...@intenta.de> AuthorDate: Wed Aug 21 15:31:24 2019 +0200 Commit: Benjamin Wozniak <benjamin.wozn...@intenta.de> CommitDate: Fri Aug 30 08:14:00 2019 +0200 cuda: Extend cuda compiler detection to work with custom cuda path diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 0fcbbb7..40658ea 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -347,8 +347,14 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(cuda_tools "CUDA ${CMAKE_VS_PLATFORM_TOOLSET_CUDA}") set(id_compile "CudaCompile") set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]]) - string(CONCAT id_Import_props [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.props" />]]) - string(CONCAT id_Import_targets [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.targets" />]]) + if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR) + set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc</CudaToolkitCustomDir>") + string(CONCAT id_Import_props "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.props\" />") + string(CONCAT id_Import_targets "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.targets\" />") + else() + string(CONCAT id_Import_props [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.props" />]]) + string(CONCAT id_Import_targets [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.targets" />]]) + endif() if(CMAKE_VS_PLATFORM_NAME STREQUAL x64) set(id_ItemDefinitionGroup_entry "<CudaCompile><TargetMachinePlatform>64</TargetMachinePlatform></CudaCompile>") endif() diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in index 32c4ffc..d742274 100644 --- a/Modules/CompilerId/VS-10.vcxproj.in +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -14,6 +14,7 @@ @id_system_version@ @id_WindowsTargetPlatformVersion@ @id_WindowsSDKDesktopARMSupport@ + @id_CudaToolkitCustomDir@ </PropertyGroup> @id_toolset_version_props@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=55b0532128304cb60021831cd37adbe4eb5d3650 commit 55b0532128304cb60021831cd37adbe4eb5d3650 Author: Benjamin Wozniak <benjamin.wozn...@intenta.de> AuthorDate: Wed Aug 21 15:30:46 2019 +0200 Commit: Benjamin Wozniak <benjamin.wozn...@intenta.de> CommitDate: Fri Aug 30 08:13:58 2019 +0200 cuda: Extend vs10 target generator to use custom cuda path diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 08378eb..fde214d 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -526,6 +526,13 @@ void cmVisualStudio10TargetGenerator::Generate() } e1.Element("TargetFrameworkTargetsVersion", targetFrameworkVer); } + if (!this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString() + .empty()) { + e1.Element( + "CudaToolkitCustomDir", + this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString() + + "nvcc"); + } } // Disable the project upgrade prompt that is displayed the first time a @@ -612,10 +619,17 @@ void cmVisualStudio10TargetGenerator::Generate() e1.SetHasElements(); if (this->GlobalGenerator->IsCudaEnabled()) { + auto customDir = + this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString(); + std::string cudaPath = customDir.empty() + ? "$(VCTargetsPath)\\BuildCustomizations\\" + : customDir + + "CUDAVisualStudioIntegration\\extras\\" + "visual_studio_integration\\MSBuildExtensions\\"; Elem(e1, "Import") .Attribute("Project", - "$(VCTargetsPath)\\BuildCustomizations\\CUDA " + - this->GlobalGenerator->GetPlatformToolsetCudaString() + + std::move(cudaPath) + "CUDA " + + this->GlobalGenerator->GetPlatformToolsetCuda() + ".props"); } if (this->GlobalGenerator->IsMasmEnabled()) { @@ -698,10 +712,17 @@ void cmVisualStudio10TargetGenerator::Generate() e1.SetHasElements(); this->WriteTargetsFileReferences(e1); if (this->GlobalGenerator->IsCudaEnabled()) { + auto customDir = + this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString(); + std::string cudaPath = customDir.empty() + ? "$(VCTargetsPath)\\BuildCustomizations\\" + : customDir + + "CUDAVisualStudioIntegration\\extras\\" + "visual_studio_integration\\MSBuildExtensions\\"; Elem(e1, "Import") .Attribute("Project", - "$(VCTargetsPath)\\BuildCustomizations\\CUDA " + - this->GlobalGenerator->GetPlatformToolsetCudaString() + + std::move(cudaPath) + "CUDA " + + this->GlobalGenerator->GetPlatformToolsetCuda() + ".targets"); } if (this->GlobalGenerator->IsMasmEnabled()) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d888e339064d39ae894b4df567441539c8c65da commit 2d888e339064d39ae894b4df567441539c8c65da Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Thu Aug 29 17:31:44 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Thu Aug 29 22:51:58 2019 +0200 cmSourceFile: Rename mutating GetFullPath() overload Rename mutating GetFullPath() overload to ResolveFullPath(). diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index f0c1845..b20f595 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -536,7 +536,7 @@ void CCONV* cmGetSource(void* arg, const char* name) // Create a proxy source file object for this source. cmCPluginAPISourceFile* sf = new cmCPluginAPISourceFile; sf->RealSourceFile = rsf; - sf->FullPath = rsf->GetFullPath(); + sf->FullPath = rsf->ResolveFullPath(); sf->SourceName = cmSystemTools::GetFilenameWithoutLastExtension(sf->FullPath); sf->SourceExtension = diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 487d0de..6b16b93 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -371,7 +371,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( isCFile = cm->IsSourceExtension(srcext); } - std::string const& fullPath = s->GetFullPath(); + std::string const& fullPath = s->ResolveFullPath(); // Check file position relative to project root dir. const std::string relative = diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 7f71a2c..0956729 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -223,7 +223,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( gt->GetSourceFiles(sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (cmSourceFile* s : sources) { - std::string const& fullPath = s->GetFullPath(); + std::string const& fullPath = s->ResolveFullPath(); std::string const& extLower = cmSystemTools::LowerCase(s->GetExtension()); // check whether it is a source or a include file diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 6c94aae..43f1e12 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -524,7 +524,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (cmSourceFile* sf : files) { // Add the file to the list of sources. - std::string const& source = sf->GetFullPath(); + std::string const& source = sf->ResolveFullPath(); cmSourceGroup* sourceGroup = makefile->FindSourceGroup(source, sourceGroups); sourceGroup->AssignSource(sf); diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 2bfbb0d..7ac73cf 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -254,7 +254,7 @@ std::string cmExtraKateGenerator::GenerateFilesString( continue; } - tmp = sf->GetFullPath(); + tmp = sf->ResolveFullPath(); files.insert(tmp); } } diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 6f4472b..52ba968 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -243,12 +243,12 @@ void cmExtraSublimeTextGenerator::AppendTarget( makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (cmSourceFile* sourceFile : sourceFiles) { MapSourceFileFlags::iterator sourceFileFlagsIter = - sourceFileFlags.find(sourceFile->GetFullPath()); + sourceFileFlags.find(sourceFile->ResolveFullPath()); if (sourceFileFlagsIter == sourceFileFlags.end()) { sourceFileFlagsIter = sourceFileFlags - .insert(MapSourceFileFlags::value_type(sourceFile->GetFullPath(), - std::vector<std::string>())) + .insert(MapSourceFileFlags::value_type( + sourceFile->ResolveFullPath(), std::vector<std::string>())) .first; } std::vector<std::string>& flags = sourceFileFlagsIter->second; diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 2150051..ea9e672 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -112,7 +112,7 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args, if (classNum) { sourceListValue += ";"; } - sourceListValue += generatedSourcesClasses[classNum]->GetFullPath(); + sourceListValue += generatedSourcesClasses[classNum]->ResolveFullPath(); } std::string const varName = target + "_FLTK_UI_SRCS"; diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 08db7c7..4e34438 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -999,7 +999,7 @@ Json::Value Target::DumpSource(cmGeneratorTarget::SourceAndKind const& sk, { Json::Value source = Json::objectValue; - std::string const path = sk.Source.Value->GetFullPath(); + std::string const path = sk.Source.Value->ResolveFullPath(); source["path"] = RelativeIfUnder(this->TopSource, path); if (sk.Source.Value->GetIsGenerated()) { source["isGenerated"] = true; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index cc37232..5fbff2b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1351,7 +1351,7 @@ bool processSources(cmGeneratorTarget const* tgt, for (std::string& src : entry.Values) { cmSourceFile* sf = mf->GetOrCreateSource(src); std::string e; - std::string fullPath = sf->GetFullPath(&e); + std::string fullPath = sf->ResolveFullPath(&e); if (fullPath.empty()) { if (!e.empty()) { cmake* cm = tgt->GetLocalGenerator()->GetCMakeInstance(); @@ -1619,7 +1619,7 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, // Both names would have been auto generated from Visual Studio // where the user supplied the file name and Visual Studio // appended the suffix. - std::string resx = sf->GetFullPath(); + std::string resx = sf->ResolveFullPath(); std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h"; files.ExpectedResxHeaders.insert(hFileName); } else if (ext == "appxmanifest") { @@ -1635,12 +1635,12 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, // Both names would have been auto generated from Visual Studio // where the user supplied the file name and Visual Studio // appended the suffix. - std::string xaml = sf->GetFullPath(); + std::string xaml = sf->ResolveFullPath(); std::string hFileName = xaml + ".h"; std::string cppFileName = xaml + ".cpp"; files.ExpectedXamlHeaders.insert(hFileName); files.ExpectedXamlSources.insert(cppFileName); - } else if (header_regex.find(sf->GetFullPath())) { + } else if (header_regex.find(sf->ResolveFullPath())) { kind = SourceKindHeader; } else { kind = SourceKindExtra; @@ -2648,7 +2648,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) this->GlobalGenerator->GetFilenameTargetDepends(sf); if (cmContains(tgts, this->GeneratorTarget)) { std::ostringstream e; - e << "Evaluation output file\n \"" << sf->GetFullPath() + e << "Evaluation output file\n \"" << sf->ResolveFullPath() << "\"\ndepends on the sources of a target it is used in. This " "is a dependency loop and is not allowed."; this->GeneratorTarget->LocalGenerator->IssueMessage( @@ -2690,7 +2690,7 @@ void cmTargetTraceDependencies::Trace() } // Queue the source needed to generate this file, if any. - this->FollowName(sf->GetFullPath()); + this->FollowName(sf->ResolveFullPath()); // Queue dependencies added programmatically by commands. this->FollowNames(sf->GetDepends()); @@ -2711,7 +2711,7 @@ void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf) this->SourceQueue.push(sf); // Make sure this file is in the target at the end. - this->NewSources.push_back(sf->GetFullPath()); + this->NewSources.push_back(sf->ResolveFullPath()); } } @@ -6095,7 +6095,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( const char* sep = ""; for (cmSourceFile* f : files) { firstConfigFiles += sep; - firstConfigFiles += f->GetFullPath(); + firstConfigFiles += f->ResolveFullPath(); sep = "\n "; } @@ -6103,7 +6103,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( sep = ""; for (cmSourceFile* f : configFiles) { thisConfigFiles += sep; - thisConfigFiles += f->GetFullPath(); + thisConfigFiles += f->ResolveFullPath(); sep = "\n "; } std::ostringstream e; diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index e7b20ed..658f65d 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -488,7 +488,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) std::set<std::string> groupNames; for (auto& sf : sources) { cmSourceGroup* sourceGroup = - this->Makefile->FindSourceGroup(sf->GetFullPath(), sourceGroups); + this->Makefile->FindSourceGroup(sf->ResolveFullPath(), sourceGroups); std::string gn = sourceGroup->GetFullName(); groupFiles[gn].push_back(sf); groupNames.insert(std::move(gn)); @@ -543,7 +543,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) for (auto& n : groupFilesList) { std::sort(groupFiles[n].begin(), groupFiles[n].end(), [](cmSourceFile* l, cmSourceFile* r) { - return l->GetFullPath() < r->GetFullPath(); + return l->ResolveFullPath() < r->ResolveFullPath(); }); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4342e9f..bfccb12 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2974,7 +2974,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target) auto const sourcesEnd = cmRemoveDuplicates(sources); for (cmSourceFile* sf : cmMakeRange(sources.cbegin(), sourcesEnd)) { Json::Value& lj_source = lj_sources.append(Json::objectValue); - std::string const& sfp = sf->GetFullPath(); + std::string const& sfp = sf->ResolveFullPath(); fout << sfp << "\n"; lj_source["file"] = sfp; if (const char* svalue = sf->GetProperty("LABELS")) { diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index b0c065f..f4c47ce 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -195,7 +195,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() if (cmSourceFile* file = mf->AddCustomCommandToOutput( stamps, no_byproducts, listFiles, no_main_dependency, commandLines, "Checking Build System", no_working_directory, true, false)) { - gt->AddSource(file->GetFullPath()); + gt->AddSource(file->ResolveFullPath()); } else { cmSystemTools::Error("Error adding rule for " + stamps[0]); } diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index 4948b01..52e28d3 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -327,7 +327,7 @@ static Json::Value DumpSourceFilesList( fileData.IsGenerated = file->GetIsGenerated(); std::vector<std::string>& groupFileList = fileGroups[fileData]; - groupFileList.push_back(file->GetFullPath()); + groupFileList.push_back(file->ResolveFullPath()); } const std::string& baseDir = target->Makefile->GetCurrentSourceDirectory(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7177694..78133db 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1179,7 +1179,7 @@ void cmLocalGenerator::GetTargetFlags( if (sf->GetExtension() == "def") { linkFlags += defFlag; linkFlags += this->ConvertToOutputFormat( - cmSystemTools::CollapseFullPath(sf->GetFullPath()), SHELL); + cmSystemTools::CollapseFullPath(sf->ResolveFullPath()), SHELL); linkFlags += " "; } } @@ -1727,7 +1727,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, // Check for a source file in this directory that matches the // dependency. if (cmSourceFile* sf = this->Makefile->GetSource(inName)) { - dep = sf->GetFullPath(); + dep = sf->ResolveFullPath(); return true; } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 795cee4..f88c3e9 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -102,7 +102,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() if (cmSourceFile* file = this->Makefile->AddCustomCommandToOutput( force.c_str(), no_depends, no_main_dependency, force_commands, " ", 0, true)) { - l->AddSource(file->GetFullPath()); + l->AddSource(file->ResolveFullPath()); } } } @@ -268,7 +268,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() if (cmSourceFile* file = this->Makefile->GetSource(makefileIn.c_str())) { // Finalize the source file path now since we're adding this after // the generator validated all project-named sources. - file->GetFullPath(); + file->ResolveFullPath(); return file; } else { cmSystemTools::Error("Error adding rule for " + makefileIn); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f101cdc..5f09ce3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1112,7 +1112,7 @@ void cmMakefile::AddCustomCommandOldStyle( if (sf && !sf->GetPropertyAsBool("__CMAKE_RULE")) { cmTargetMap::iterator ti = this->Targets.find(target); if (ti != this->Targets.end()) { - ti->second.AddSource(sf->GetFullPath()); + ti->second.AddSource(sf->ResolveFullPath()); } else { cmSystemTools::Error("Attempt to add a custom rule to a target " "that does not exist yet for target " + @@ -3322,7 +3322,7 @@ void cmMakefile::AddTargetObject(std::string const& tgtName, sf->SetProperty("EXTERNAL_OBJECT", "1"); #if !defined(CMAKE_BOOTSTRAP) this->SourceGroups[this->ObjectLibrariesSourceGroupIndex].AddGroupFile( - sf->GetFullPath()); + sf->ResolveFullPath()); #endif } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 3d8ebc3..187f0ab 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -325,7 +325,7 @@ protected: cmSourceFile* srcFile = this->Makefile->GetSource( cmSystemTools::GetFilenameWithoutExtension(path)); if (srcFile) { - if (srcFile->GetFullPath() == path) { + if (srcFile->ResolveFullPath() == path) { found = true; } else { // try to guess which include path to use @@ -334,7 +334,7 @@ protected: incpath += "/"; } incpath += path; - if (srcFile->GetFullPath() == incpath) { + if (srcFile->ResolveFullPath() == incpath) { // set the path to the guessed path info->FullPath = incpath; found = true; diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index bd96c08..155167b 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -647,7 +647,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() // 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; - std::string const& fullPath = sf->GetFullPath(&pathError); + std::string const& fullPath = sf->ResolveFullPath(&pathError); if (!pathError.empty() || fullPath.empty()) { continue; } @@ -703,7 +703,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() MUFile const& muf = *pair.second; if (muf.MocIt || muf.UicIt) { // Search for the default header file and a private header - std::string const& srcPath = muf.SF->GetFullPath(); + std::string const& srcPath = muf.SF->ResolveFullPath(); std::string basePath = cmStrCat(cmQtAutoGen::SubDirPrefix(srcPath), cmSystemTools::GetFilenameWithoutLastExtension(srcPath)); @@ -761,7 +761,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() // 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; - std::string const& fullPath = sf->GetFullPath(&pathError); + std::string const& fullPath = sf->ResolveFullPath(&pathError); if (!pathError.empty() || fullPath.empty()) { continue; } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 5d738d5..4deb94a 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -65,7 +65,7 @@ std::string const& cmSourceFile::GetOrDetermineLanguage() this->Location.DirectoryIsAmbiguous()) { // Finalize the file location to get the extension and set the // language. - this->GetFullPath(); + this->ResolveFullPath(); } else { // Use the known extension to get the language if possible. std::string ext = @@ -94,7 +94,7 @@ cmSourceFileLocation const& cmSourceFile::GetLocation() const return this->Location; } -std::string const& cmSourceFile::GetFullPath(std::string* error) +std::string const& cmSourceFile::ResolveFullPath(std::string* error) { if (this->FullPath.empty()) { if (this->FindFullPath(error)) { @@ -269,7 +269,7 @@ const char* cmSourceFile::GetPropertyForUser(const std::string& prop) // LOCATION property we must commit now. if (prop == propLOCATION) { // Commit to a location. - this->GetFullPath(); + this->ResolveFullPath(); } // Similarly, LANGUAGE can be determined by the file extension diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index ccd5b62..774cb28 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -63,14 +63,15 @@ public: bool GetIsGenerated() const { return this->IsGenerated; } /** - * The full path to the file. The non-const version of this method - * may attempt to locate the file on disk and finalize its location. - * The const version of this method may return an empty string if - * the non-const version has not yet been called (yes this is a - * horrible interface, but is necessary for backwards - * compatibility). + * Resolves the full path to the file. Attempts to locate the file on disk + * and finalizes its location. + */ + std::string const& ResolveFullPath(std::string* error = nullptr); + + /** + * The resolved full path to the file. The returned file name might be empty + * if the path has not yet been resolved. */ - std::string const& GetFullPath(std::string* error = nullptr); std::string const& GetFullPath() const; /** https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe683876952ee6172e46fe770b4f3e48c69646d1 commit fe683876952ee6172e46fe770b4f3e48c69646d1 Author: Christophe Giboudeaux <christo...@krop.fr> AuthorDate: Wed Aug 28 00:52:13 2019 +0200 Commit: Christophe Giboudeaux <christo...@krop.fr> CommitDate: Thu Aug 29 21:50:49 2019 +0200 FindPkgConfig: return the module found by pkg_search_module When running `pkg_search_module`, it may be useful to get the matching module name in order to run `pkg_get_variable`. `pkg_search_module` now defines `<prefix>_MODULE_NAME` which contains the first matching module name. Fixes: #19648 diff --git a/Help/release/dev/FindPkgConfig-module-name.rst b/Help/release/dev/FindPkgConfig-module-name.rst new file mode 100644 index 0000000..9f1cd36 --- /dev/null +++ b/Help/release/dev/FindPkgConfig-module-name.rst @@ -0,0 +1,6 @@ +FindPkgConfig-module-name +------------------------- + +* The :module:`FindPkgConfig` module :command:`pkg_search_module` macro + now defines a ``<prefix>_MODULE_NAME`` result variable containing the + first matching module name. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index e05d5c8..4c9af91 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -363,6 +363,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma _pkgconfig_unset(${_prefix}_PREFIX) _pkgconfig_unset(${_prefix}_INCLUDEDIR) _pkgconfig_unset(${_prefix}_LIBDIR) + _pkgconfig_unset(${_prefix}_MODULE_NAME) _pkgconfig_unset(${_prefix}_LIBS) _pkgconfig_unset(${_prefix}_LIBS_L) _pkgconfig_unset(${_prefix}_LIBS_PATHS) @@ -480,6 +481,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR) _pkgconfig_set("${_pkg_check_prefix}_${variable}" "${${_pkg_check_prefix}_${variable}}") endforeach () + _pkgconfig_set("${_pkg_check_prefix}_MODULE_NAME" "${_pkg_check_modules_pkg}") if (NOT ${_is_silent}) message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") @@ -664,6 +666,10 @@ endmacro() [IMPORTED_TARGET [GLOBAL]] <moduleSpec> [<moduleSpec>...]) + If a module is found, the ``<prefix>_MODULE_NAME`` variable will contain the + name of the matching module. This variable can be used if you need to run + :command:`pkg_get_variable`. + Example: .. code-block:: cmake @@ -688,6 +694,7 @@ macro(pkg_search_module _prefix _module0) if (${_prefix}_FOUND) set(_pkg_modules_found 1) + break() endif() endforeach() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake new file mode 100644 index 0000000..fc3a766 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake @@ -0,0 +1,28 @@ +# Prepare environment to reuse bletch.pc +file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-bletch/lib/pkgconfig" PC_PATH) +if(UNIX) + string(REPLACE "\\ " " " PC_PATH "${PC_PATH}") +endif() +set(ENV{PKG_CONFIG_PATH} "${PC_PATH}") + +find_package(PkgConfig REQUIRED) +pkg_search_module(FOO REQUIRED foo bletch bar) + +if(NOT FOO_MODULE_NAME STREQUAL "bletch") + message(FATAL_ERROR "Wrong value for FOO_MODULE_NAME. Expected: bletch, got: ${FOO_MODULE_NAME}") +endif() + +pkg_get_variable(FOO_JACKPOT ${FOO_MODULE_NAME} jackpot) + +if(NOT FOO_JACKPOT STREQUAL "bletch-lives") + message(FATAL_ERROR "Wrong value for FOO_JACKPOT. Expected: bletch-lives, got: ${FOO_JACKPOT}") +endif() + +unset(FOO_MODULE_NAME) + +# verify variable get's also set on subsequent run +pkg_search_module(FOO REQUIRED foo bletch bar) + +if(NOT FOO_MODULE_NAME STREQUAL "bletch") + message(FATAL_ERROR "Wrong value for FOO_MODULE_NAME on second run. Expected: bletch, got: ${FOO_MODULE_NAME}") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index 414d9b6..b77bb54 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -19,4 +19,5 @@ if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_cache_variables) run_cmake(FindPkgConfig_IMPORTED_TARGET) run_cmake(FindPkgConfig_VERSION_OPERATORS) + run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME) endif () https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=079b8e29168dc081f37f79f3577a5c0690bb7051 commit 079b8e29168dc081f37f79f3577a5c0690bb7051 Author: Zsolt Parragi <zsolt.parr...@cancellar.hu> AuthorDate: Thu Jul 11 16:55:19 2019 +0200 Commit: Zsolt Parragi <zsolt.parr...@cancellar.hu> CommitDate: Tue Aug 27 20:19:29 2019 +0200 Clang: prefer lld-link over link.exe Objects compiled with -flto can only be linked with the llvm linker. Before this change, clang-cl only supperted IPO with manual linker selection. diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 773ee53..01f9dae 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -69,7 +69,12 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND OR (CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")) - find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xClang") + find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm llvm-nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + set(_CMAKE_ADDITIONAL_LINKER_NAMES "lld-link") + endif() + + find_program(CMAKE_LINKER NAMES ${_CMAKE_ADDITIONAL_LINKER_NAMES} link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_MT NAMES mt HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) list(APPEND _CMAKE_TOOL_VARS LINKER MT) @@ -115,6 +120,17 @@ else() list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE) + + unset(_CMAKE_ADDITIONAL_AR_NAMES) + unset(_CMAKE_ADDITIONAL_RANLIB_NAMES) + unset(_CMAKE_ADDITIONAL_STRIP_NAMES) + unset(_CMAKE_ADDITIONAL_LINKER_NAMES) + unset(_CMAKE_ADDITIONAL_NM_NAMES) + unset(_CMAKE_ADDITIONAL_OBJDUMP_NAMES) + unset(_CMAKE_ADDITIONAL_OBJCOPY_NAMES) + unset(_CMAKE_ADDITIONAL_READELF_NAMES) + unset(_CMAKE_ADDITIONAL_DLLTOOL_NAMES) + unset(_CMAKE_ADDITIONAL_ADDR2LINE_NAMES) endif() if(CMAKE_PLATFORM_HAS_INSTALLNAME) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e3655db2cc8202424e54bdde83e4240eb680cc3 commit 6e3655db2cc8202424e54bdde83e4240eb680cc3 Author: Zsolt Parragi <zsolt.parr...@cancellar.hu> AuthorDate: Mon Jul 8 18:52:23 2019 +0200 Commit: Zsolt Parragi <zsolt.parr...@cancellar.hu> CommitDate: Tue Aug 27 20:19:29 2019 +0200 Clang: add LTO support for GNU-command line clang on windows diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 728e0b9..6a12381 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -44,15 +44,22 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 1) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto") + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) + set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) + set(CMAKE_${lang}_ARCHIVE_CREATE_IPO "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_APPEND_IPO "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_FINISH_IPO "<CMAKE_RANLIB> <TARGET>") + # Create archiving rules to support large object file lists for static libraries. set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "<CMAKE_${lang}_COMPILER> -nostartfiles -nostdlib <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <OBJECTS> <LINK_LIBRARIES>") + "<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <OBJECTS> <LINK_LIBRARIES>") set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_${lang}_COMPILER> -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") + "<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmt) set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -D_DLL -D_MT -Xclang --dependent-lib=msvcrt) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df0247a3714667e0f60d64da1b30ea200c43c7d5 commit df0247a3714667e0f60d64da1b30ea200c43c7d5 Author: Benjamin Wozniak <benjamin.wozn...@intenta.de> AuthorDate: Wed Aug 21 15:27:42 2019 +0200 Commit: Benjamin Wozniak <benjamin.wozn...@intenta.de> CommitDate: Tue Aug 27 12:54:35 2019 +0200 cuda: Extend toolset argument to accept path Previously cuda could only be used with cmake if it is installed globally on the system. Sometimes this is not possible (eg docker, packaging with conan, etc.). Thus the cuda toolset argument is extended to take a path to a cuda install directory. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 02d25fb..a90abe1 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -232,7 +232,15 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( if (this->GeneratorToolsetCuda.empty()) { // Find the highest available version of the CUDA tools. std::vector<std::string> cudaTools; - std::string const bcDir = this->VCTargetsPath + "/BuildCustomizations"; + std::string bcDir; + if (this->GeneratorToolsetCudaCustomDir.empty()) { + bcDir = this->VCTargetsPath + "/BuildCustomizations"; + } else { + bcDir = this->GetPlatformToolsetCudaCustomDirString() + + "CUDAVisualStudioIntegration\\extras\\" + "visual_studio_integration\\MSBuildExtensions"; + cmSystemTools::ConvertToUnixSlashes(bcDir); + } cmsys::Glob gl; gl.SetRelative(bcDir.c_str()); if (gl.FindFiles(bcDir + "/CUDA *.props")) { @@ -243,6 +251,24 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( std::sort(cudaTools.begin(), cudaTools.end(), cmSystemTools::VersionCompareGreater); this->GeneratorToolsetCuda = cudaTools.at(0); + } else if (!this->GeneratorToolsetCudaCustomDir.empty()) { + // Generate an error if Visual Studio integration files are not found + // inside of custom cuda toolset. + std::ostringstream e; + /* clang-format off */ + e << + "Generator\n" + " " << this->GetName() << "\n" + "given toolset\n" + " cuda=" << this->GeneratorToolsetCudaCustomDir << "\n" + "cannot detect Visual Studio integration files in path\n" + " " << bcDir; + + /* clang-format on */ + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + + // Clear the configured tool-set + this->GeneratorToolsetCuda.clear(); } } @@ -319,6 +345,9 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( if (const char* cuda = this->GetPlatformToolsetCuda()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA", cuda); } + if (const char* cudaDir = this->GetPlatformToolsetCudaCustomDir()) { + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR", cudaDir); + } return true; } @@ -395,7 +424,17 @@ bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField( std::string const& key, std::string const& value) { if (key == "cuda") { - this->GeneratorToolsetCuda = value; + /* test if cuda toolset is path to custom dir or cuda version */ + auto pos = value.find_first_not_of("0123456789."); + if (pos != std::string::npos) { + this->GeneratorToolsetCudaCustomDir = value; + /* ensure trailing backslash for easy path joining */ + if (this->GeneratorToolsetCudaCustomDir.back() != '\\') { + this->GeneratorToolsetCudaCustomDir.push_back('\\'); + } + } else { + this->GeneratorToolsetCuda = value; + } return true; } if (key == "version") { @@ -643,6 +682,21 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaString() const return this->GeneratorToolsetCuda; } +const char* cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaCustomDir() + const +{ + if (!this->GeneratorToolsetCudaCustomDir.empty()) { + return this->GeneratorToolsetCudaCustomDir.c_str(); + } + return nullptr; +} + +std::string const& +cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaCustomDirString() const +{ + return this->GeneratorToolsetCudaCustomDir; +} + bool cmGlobalVisualStudio10Generator::IsDefaultToolset( const std::string&) const { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 1d30cd6..9adcf08 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -61,6 +61,10 @@ public: const char* GetPlatformToolsetCuda() const; std::string const& GetPlatformToolsetCudaString() const; + /** The custom cuda install directory */ + const char* GetPlatformToolsetCudaCustomDir() const; + std::string const& GetPlatformToolsetCudaCustomDirString() const; + /** Return whether we need to use No/Debug instead of false/true for GenerateDebugInformation. */ bool GetPlatformToolsetNeedsDebugEnum() const @@ -152,6 +156,7 @@ protected: std::string GeneratorToolsetVersion; std::string GeneratorToolsetHostArchitecture; std::string GeneratorToolsetCuda; + std::string GeneratorToolsetCudaCustomDir; std::string DefaultPlatformToolset; std::string DefaultPlatformToolsetHostArchitecture; std::string WindowsTargetPlatformVersion; ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/FindPkgConfig-module-name.rst | 6 ++ Help/release/dev/gtest-1.8.1.rst | 5 ++ Help/variable/CMAKE_GENERATOR_TOOLSET.rst | 11 +-- Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA.rst | 6 +- .../CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst | 16 +++++ Modules/CMakeDetermineCompilerId.cmake | 10 ++- Modules/CMakeFindBinUtils.cmake | 18 ++++- Modules/CompilerId/VS-10.vcxproj.in | 1 + Modules/FindGTest.cmake | 8 +++ Modules/FindPkgConfig.cmake | 7 ++ Modules/Platform/Windows-Clang.cmake | 11 ++- Source/bindexplib.cxx | 82 ++++++++++++++++++++-- Source/bindexplib.h | 5 +- Source/cmCPluginAPI.cxx | 2 +- Source/cmComputeTargetDepends.cxx | 7 +- Source/cmExtraCodeBlocksGenerator.cxx | 2 +- Source/cmExtraCodeLiteGenerator.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmExtraKateGenerator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 6 +- Source/cmFLTKWrapUICommand.cxx | 2 +- Source/cmFileAPICodemodel.cxx | 15 ++-- Source/cmGeneratorTarget.cxx | 46 +++++------- Source/cmGhsMultiTargetGenerator.cxx | 4 +- Source/cmGlobalGenerator.cxx | 17 ++--- Source/cmGlobalVisualStudio10Generator.cxx | 58 ++++++++++++++- Source/cmGlobalVisualStudio10Generator.h | 5 ++ Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmJsonObjects.cxx | 2 +- Source/cmLocalGenerator.cxx | 11 ++- Source/cmLocalVisualStudio7Generator.cxx | 4 +- Source/cmMakefile.cxx | 14 +++- Source/cmMakefile.h | 3 + Source/cmMakefileTargetGenerator.cxx | 7 ++ Source/cmNinjaNormalTargetGenerator.cxx | 8 +++ Source/cmOutputRequiredFilesCommand.cxx | 4 +- Source/cmQtAutoGenInitializer.cxx | 6 +- Source/cmSourceFile.cxx | 6 +- Source/cmSourceFile.h | 15 ++-- Source/cmVisualStudio10TargetGenerator.cxx | 29 ++++++-- Source/cmcmd.cxx | 13 +++- Tests/CMakeLists.txt | 1 - Tests/IPO/CMakeLists.txt | 7 -- Tests/Module/CheckIPOSupported-C/CMakeLists.txt | 12 +++- .../Module/CheckIPOSupported-C/bar.c | 2 +- Tests/Module/CheckIPOSupported-C/main.c | 3 +- Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt | 15 +++- .../Module/CheckIPOSupported-CXX/bar.cpp | 2 +- Tests/Module/CheckIPOSupported-CXX/main.cpp | 3 +- .../FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake | 28 ++++++++ Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake | 1 + Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake | 12 ++-- .../TestToolsetCudaBoth-stdout.txt | 2 +- .../TestToolsetCudaPathOnly-result.txt} | 0 .../TestToolsetCudaPathOnly-stderr.txt | 12 ++++ ...oolsets.cmake => TestToolsetCudaPathOnly.cmake} | 0 ...t.txt => TestToolsetCudaVersionOnly-stdout.txt} | 2 +- ...Only.cmake => TestToolsetCudaVersionOnly.cmake} | 0 59 files changed, 443 insertions(+), 140 deletions(-) create mode 100644 Help/release/dev/FindPkgConfig-module-name.rst create mode 100644 Help/release/dev/gtest-1.8.1.rst create mode 100644 Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst delete mode 100644 Tests/IPO/CMakeLists.txt copy Modules/CheckIPOSupported/foo.c => Tests/Module/CheckIPOSupported-C/bar.c (65%) copy Modules/CheckIPOSupported/foo.c => Tests/Module/CheckIPOSupported-CXX/bar.cpp (65%) create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_MODULE_NAME.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorToolset/TestToolsetCudaPathOnly-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt copy Tests/RunCMake/GeneratorToolset/{TwoToolsets.cmake => TestToolsetCudaPathOnly.cmake} (100%) rename Tests/RunCMake/GeneratorToolset/{TestToolsetCudaOnly-stdout.txt => TestToolsetCudaVersionOnly-stdout.txt} (54%) rename Tests/RunCMake/GeneratorToolset/{TestToolsetCudaOnly.cmake => TestToolsetCudaVersionOnly.cmake} (100%) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits