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 e025495b8500f9aaf6745571ffdb48a6218e7929 (commit) via a9fb9a8774a7b1dd411542d1d14fb537968e32f1 (commit) via f945c3e755469457bd1c89fe7c9153521005f43f (commit) via 1ded3599d698c1bfa0243d58ece8b619d2900a17 (commit) via 827da1119ef2d0978dd6dbc58aeee803e43b2455 (commit) via adc3459707c4c942b547eb57d02a82b8d5085962 (commit) via 0d41b45cc931530d5dbc51674699f4da2290a6d3 (commit) via a9180ccf9a9e845658ba455e2dbc2447b18d2654 (commit) via d745551fb6311f5db6e8133df63a7fc410e8a68b (commit) via 9a182c9e5b36ba68fc91b53e3d755c263ee3d0ef (commit) via e9b0063e8e0f2fcb5cc4239a06deec17c49688c4 (commit) via b6412e3e38ba22bf816445f19394e7c8027c186f (commit) via 7d7f31161d65d8b1f460eaf23e1b092bdaf7c238 (commit) via d688c4c19d0ec6d639ba7047e786bdacb7a4b45b (commit) via 0723582208dda7da9815a319973eed596c61a44c (commit) via 086c51dc045c75662500b39da3341af83281d6df (commit) from 28ee31149030c75c32ebbf134502a9d020dbd54b (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=e025495b8500f9aaf6745571ffdb48a6218e7929 commit e025495b8500f9aaf6745571ffdb48a6218e7929 Merge: a9fb9a8 f945c3e Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon May 20 14:55:53 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon May 20 10:56:22 2019 -0400 Merge topic 'makefiles_additional_clean_files' f945c3e755 Tests: Extend MakeClean test to cover subdirectories without targets 1ded3599d6 Makefiles: Process ADDTIONAL_CLEAN_FILES dir prop at directory level 827da1119e Makefiles: Make build root targets "all", "clean" and "preinstall" recursive adc3459707 Makefiles: Avoid pointer repurposing 0d41b45cc9 Makefiles: Inline range loop range arguments Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3338 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9fb9a8774a7b1dd411542d1d14fb537968e32f1 commit a9fb9a8774a7b1dd411542d1d14fb537968e32f1 Merge: 28ee311 a9180cc Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon May 20 14:55:11 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon May 20 10:55:27 2019 -0400 Merge topic 'ninja-swift' a9180ccf9a Tests: add a check for the Swift compiler d745551fb6 Help: add some initial documentation for Swift support 9a182c9e5b Auxiliary: update vim syntax highlighting e9b0063e8e Modules: add build rules for Swift Ninja support b6412e3e38 Ninja: add placeholders to support Swift build 7d7f31161d Ninja: add support for Swift's output-file-map.json d688c4c19d Swift: remove unnecessary unreleased Ninja infrastructure 0723582208 Swift: Detect compiler version ... Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3297 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f945c3e755469457bd1c89fe7c9153521005f43f commit f945c3e755469457bd1c89fe7c9153521005f43f Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 17 10:30:34 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Sat May 18 12:27:29 2019 +0200 Tests: Extend MakeClean test to cover subdirectories without targets This adds a subdirectory to the MakeClean test, in which files are added to the `ADDITIONAL_CLEAN_FILES` directory property, but which holds no targets. diff --git a/Tests/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt index 5d84e6c..6f16d12 100644 --- a/Tests/MakeClean/ToClean/CMakeLists.txt +++ b/Tests/MakeClean/ToClean/CMakeLists.txt @@ -2,45 +2,56 @@ cmake_minimum_required(VERSION 3.14) project(ToClean) # Utility variables -set(TSD ${ToClean_SOURCE_DIR}) -set(TBD ${ToClean_BINARY_DIR}) +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) set(CLEAN_FILE_CONTENT "File registered for cleaning.\n") # Lists build-time-generated files that should be cleaned away -set(TOCLEAN_FILES) +set_property(GLOBAL PROPERTY TOCLEAN_FILES "") +function(addCleanFile FILENAME) + set_property(GLOBAL APPEND PROPERTY TOCLEAN_FILES "${FILENAME}") +endfunction() +function(writeCleanFile FILENAME) + file(WRITE "${FILENAME}" ${CLEAN_FILE_CONTENT}) +endfunction() # Build a simple project whose compiled objects should be cleaned. add_executable(toclean toclean.cxx) -list(APPEND TOCLEAN_FILES - "${TBD}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}") +addCleanFile("${CBD}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}") + +# Create a post build custom command that copies the toclean output executable +# to a custom location +function(addToCleanPostBuildCopy FILENAME) + add_custom_command(TARGET toclean POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy $<TARGET_FILE:toclean> ${FILENAME}) +endfunction() # Create a custom command whose output should be cleaned. -set(CustomCommandFile "${TBD}/CustomCommandFile.txt") +set(CustomCommandFile "${CBD}/CustomCommandFile.txt") add_custom_command(OUTPUT ${CustomCommandFile} - DEPENDS ${TSD}/toclean.cxx + DEPENDS ${CSD}/toclean.cxx COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${TSD}/toclean.cxx ${CustomCommandFile}) + ARGS -E copy ${CSD}/toclean.cxx ${CustomCommandFile}) add_custom_target(generate ALL DEPENDS ${CustomCommandFile}) -list(APPEND TOCLEAN_FILES ${CustomCommandFile}) +addCleanFile(${CustomCommandFile}) ### Tests ADDITIONAL_MAKE_CLEAN_FILES directory property if("${CMAKE_GENERATOR}" MATCHES "Makefile") # Create a file that must be registered for cleaning. - set(MakeDirPropFile "${TBD}/MakeDirPropFile.txt") - file(WRITE "${MakeDirPropFile}" ${CLEAN_FILE_CONTENT}) + set(MakeDirPropFile "${CBD}/MakeDirPropFile.txt") + writeCleanFile("${MakeDirPropFile}") set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${MakeDirPropFile}") - list(APPEND TOCLEAN_FILES "${MakeDirPropFile}") + addCleanFile(${MakeDirPropFile}) # Create a custom command whose output should be cleaned, but whose name # is not known until generate-time set(MakeDirPropExpFileRel "MakeDirProp_copy${CMAKE_EXECUTABLE_SUFFIX}") set(MakeDirPropExpFile "$<TARGET_FILE_DIR:toclean>/${MakeDirPropExpFileRel}") - add_custom_command(TARGET toclean POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy $<TARGET_FILE:toclean> ${MakeDirPropExpFile}) + addToCleanPostBuildCopy("${MakeDirPropExpFile}") set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${MakeDirPropExpFile}) - list(APPEND TOCLEAN_FILES "${TBD}/${MakeDirPropExpFileRel}") + addCleanFile("${CBD}/${MakeDirPropExpFileRel}") endif() @@ -48,51 +59,52 @@ endif() # Register a file path relative to the build directory set(DirPropFileRel "DirPropFileRel.txt") -file(WRITE "${TBD}/${DirPropFileRel}" ${CLEAN_FILE_CONTENT}) +writeCleanFile("${CBD}/${DirPropFileRel}") set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES ${DirPropFileRel}) -list(APPEND TOCLEAN_FILES "${TBD}/${DirPropFileRel}") +addCleanFile("${CBD}/${DirPropFileRel}") # Register an absolute file path -set(DirPropFileAbs "${TBD}/DirPropFileAbs.txt") -file(WRITE "${DirPropFileAbs}" ${CLEAN_FILE_CONTENT}) +set(DirPropFileAbs "${CBD}/DirPropFileAbs.txt") +writeCleanFile("${DirPropFileAbs}") set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${DirPropFileAbs}) -list(APPEND TOCLEAN_FILES "${DirPropFileAbs}") +addCleanFile("${DirPropFileAbs}") # Create a custom command whose output should be cleaned, but whose name # is not known until generate-time set(DirPropExpFileRel "DirProp_copy${CMAKE_EXECUTABLE_SUFFIX}") set(DirPropExpFile "$<TARGET_FILE_DIR:toclean>/${DirPropExpFileRel}") -add_custom_command(TARGET toclean POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy $<TARGET_FILE:toclean> ${DirPropExpFile}) +addToCleanPostBuildCopy("${DirPropExpFile}") set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${DirPropExpFile}) -list(APPEND TOCLEAN_FILES "${TBD}/${DirPropExpFileRel}") +addCleanFile("${CBD}/${DirPropExpFileRel}") ### Tests ADDITIONAL_CLEAN_FILES target property # Register a file path relative to the build directory set(TgtPropFileRel "TargetPropFileRel.txt") -file(WRITE "${TBD}/${TgtPropFileRel}" ${CLEAN_FILE_CONTENT}) +writeCleanFile("${CBD}/${TgtPropFileRel}") set_target_properties(toclean PROPERTIES ADDITIONAL_CLEAN_FILES ${TgtPropFileRel}) -list(APPEND TOCLEAN_FILES "${TBD}/${TgtPropFileRel}") +addCleanFile("${CBD}/${TgtPropFileRel}") # Register an absolute file path -set(TgtPropFileAbs "${TBD}/TargetPropFileAbs.txt") -file(WRITE "${TgtPropFileAbs}" ${CLEAN_FILE_CONTENT}) +set(TgtPropFileAbs "${CBD}/TargetPropFileAbs.txt") +writeCleanFile("${TgtPropFileAbs}") set_property(TARGET toclean APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${TgtPropFileAbs}) -list(APPEND TOCLEAN_FILES "${TgtPropFileAbs}") +addCleanFile("${TgtPropFileAbs}") # Create a custom command whose output should be cleaned, but whose name # is not known until generate-time set(TgtPropExpFileRel "TgtProp_copy${CMAKE_EXECUTABLE_SUFFIX}") set(TgtPropExpFile "$<TARGET_FILE_DIR:toclean>/${TgtPropExpFileRel}") -add_custom_command(TARGET toclean POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy $<TARGET_FILE:toclean> ${TgtPropExpFile}) +addToCleanPostBuildCopy("${TgtPropExpFile}") set_property(TARGET toclean APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${TgtPropExpFile}) -list(APPEND TOCLEAN_FILES "${TBD}/${TgtPropExpFileRel}") +addCleanFile("${CBD}/${TgtPropExpFileRel}") + + +# Process subdirectory without targets +add_subdirectory(EmptySubDir) # Configure a file listing these build-time-generated files. -configure_file(${TSD}/ToCleanFiles.cmake.in ${TBD}/ToCleanFiles.cmake @ONLY) +get_property(TOCLEAN_FILES GLOBAL PROPERTY TOCLEAN_FILES) +configure_file(${CSD}/ToCleanFiles.cmake.in ${CBD}/ToCleanFiles.cmake @ONLY) diff --git a/Tests/MakeClean/ToClean/EmptySubDir/CMakeLists.txt b/Tests/MakeClean/ToClean/EmptySubDir/CMakeLists.txt new file mode 100644 index 0000000..55893ae --- /dev/null +++ b/Tests/MakeClean/ToClean/EmptySubDir/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.14) + +# Subdirectory CMakeLists.txt without targets +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +# Register a file path relative to the build directory +set(DirPropFileRel "DirPropFileRel.txt") +writeCleanFile("${CBD}/${DirPropFileRel}") +set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES ${DirPropFileRel}) +addCleanFile("${CBD}/${DirPropFileRel}") + +# Register an absolute file path +set(DirPropFileAbs "${CBD}/DirPropFileAbs.txt") +writeCleanFile("${DirPropFileAbs}") +set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${DirPropFileAbs}) +addCleanFile("${DirPropFileAbs}") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ded3599d698c1bfa0243d58ece8b619d2900a17 commit 1ded3599d698c1bfa0243d58ece8b619d2900a17 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 17 17:15:50 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Sat May 18 12:27:24 2019 +0200 Makefiles: Process ADDTIONAL_CLEAN_FILES dir prop at directory level In the "Unix Makefiles" generator, the `ADDTIONAL_CLEAN_FILES` directory property was evaluated on a per target basis. This had two drawbacks: - per directory clean files were repeated in every target clean script - per directory clean files weren't removed in directories without targets (issue #8164) This patch moves the `ADDTIONAL_CLEAN_FILES` directory property processing from the target to the directory level clean target. Fixes: #8164 "ADDITIONAL_CLEAN_FILES directory property not respected if no target present in directory" diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index f640d52..8053f61 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -398,7 +398,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules( void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3* lg, - const char* pass, bool check_all, bool check_relink) + const char* pass, bool check_all, bool check_relink, + std::vector<std::string> const& commands) { // Get the relative path to the subdirectory from the top. std::string makeTarget = lg->GetCurrentBinaryDirectory(); @@ -454,9 +455,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( doc += pass; doc += "\" directory target."; } - std::vector<std::string> no_commands; - lg->WriteMakeRule(ruleFileStream, doc.c_str(), makeTarget, depends, - no_commands, true); + lg->WriteMakeRule(ruleFileStream, doc.c_str(), makeTarget, depends, commands, + true); } void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( @@ -480,7 +480,11 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false); // Write directory-level rules for "clean". - this->WriteDirectoryRule2(ruleFileStream, lg, "clean", false, false); + { + std::vector<std::string> cmds; + lg->AppendDirectoryCleanCommand(cmds); + this->WriteDirectoryRule2(ruleFileStream, lg, "clean", false, false, cmds); + } // Write directory-level rules for "preinstall". this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true); diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index e919d38..287472c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -165,7 +165,8 @@ protected: void WriteDirectoryRule2(std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3* lg, const char* pass, - bool check_all, bool check_relink); + bool check_all, bool check_relink, + std::vector<std::string> const& commands = {}); void WriteDirectoryRules2(std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3* lg); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 857440c..6a08840 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -15,6 +15,7 @@ #include "cmCustomCommandGenerator.h" #include "cmFileTimeCache.h" #include "cmGeneratedFileStream.h" +#include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmGlobalUnixMakefileGenerator3.h" @@ -1089,6 +1090,56 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( } } +void cmLocalUnixMakefileGenerator3::AppendDirectoryCleanCommand( + std::vector<std::string>& commands) +{ + std::vector<std::string> cleanFiles; + // Look for additional files registered for cleaning in this directory. + if (const char* prop_value = + this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) { + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value); + cmSystemTools::ExpandListArgument( + cge->Evaluate(this, + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")), + cleanFiles); + } + if (cleanFiles.empty()) { + return; + } + + cmLocalGenerator* rootLG = + this->GetGlobalGenerator()->GetLocalGenerators().at(0); + std::string const& binaryDir = rootLG->GetCurrentBinaryDirectory(); + std::string const& currentBinaryDir = this->GetCurrentBinaryDirectory(); + std::string cleanfile = currentBinaryDir; + cleanfile += "/CMakeFiles/cmake_directory_clean.cmake"; + // Write clean script + { + std::string cleanfilePath = cmSystemTools::CollapseFullPath(cleanfile); + cmsys::ofstream fout(cleanfilePath.c_str()); + if (!fout) { + cmSystemTools::Error("Could not create " + cleanfilePath); + return; + } + fout << "file(REMOVE_RECURSE\n"; + for (std::string const& cfl : cleanFiles) { + std::string fc = rootLG->MaybeConvertToRelativePath( + binaryDir, cmSystemTools::CollapseFullPath(cfl, currentBinaryDir)); + fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n"; + } + fout << ")\n"; + } + // Create command + { + std::string remove = "$(CMAKE_COMMAND) -P "; + remove += this->ConvertToOutputFormat( + rootLG->MaybeConvertToRelativePath(binaryDir, cleanfile), + cmOutputConverter::SHELL); + commands.push_back(std::move(remove)); + } +} + void cmLocalUnixMakefileGenerator3::AppendEcho( std::vector<std::string>& commands, std::string const& text, EchoColor color, EchoProgress const* progress) diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index fed25e1..c8e4b0e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -227,6 +227,7 @@ protected: const std::set<std::string>& files, cmGeneratorTarget* target, const char* filename = nullptr); + void AppendDirectoryCleanCommand(std::vector<std::string>& commands); // Helper methods for dependency updates. bool ScanDependencies(std::string const& targetDir, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e62b107..3a89d75 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -172,18 +172,6 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->CleanFiles.insert(files.begin(), files.end()); } - // Look for additional files registered for cleaning in this directory. - if (const char* prop_value = - this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) { - std::vector<std::string> const files = evaluatedFiles(prop_value); - // For relative path support - std::string const& binaryDir = - this->LocalGenerator->GetCurrentBinaryDirectory(); - for (std::string const& cfl : files) { - this->CleanFiles.insert(cmSystemTools::CollapseFullPath(cfl, binaryDir)); - } - } - // Look for additional files registered for cleaning in this target. if (const char* prop_value = this->GeneratorTarget->GetProperty("ADDITIONAL_CLEAN_FILES")) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=827da1119ef2d0978dd6dbc58aeee803e43b2455 commit 827da1119ef2d0978dd6dbc58aeee803e43b2455 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 17 17:02:53 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Sat May 18 12:06:49 2019 +0200 Makefiles: Make build root targets "all", "clean" and "preinstall" recursive In the "Unix Makefiles" generator, the subdirectory targets "all", "clean" and "preinstall" in Makefile2 are recursive. In the build root directory, these targets aren't. Instead they're are added separately and additional dependencies are added on a per target basis. This is inconsistent and it complicates per directory commands, like a per directory clean command. This patch makes the "all", "clean" and "preinstall" targets in Makefile2 in the build root directory recursive, using the same algorithm that is already used for subdirectories. Some side effects are: - Makefile2 gets smaller and simpler - The main "all", "clean" and "preinstall" targets have recursive dependencies, instead of flat (depth of 1) ones. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 2f3bc76..f640d52 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -232,18 +232,6 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() depends.push_back(this->EmptyRuleHackDepends); } - // Write and empty all: - lg->WriteMakeRule(makefileStream, "The main recursive all target", "all", - depends, no_commands, true); - - // Write an empty preinstall: - lg->WriteMakeRule(makefileStream, "The main recursive preinstall target", - "preinstall", depends, no_commands, true); - - // Write an empty clean: - lg->WriteMakeRule(makefileStream, "The main recursive clean target", "clean", - depends, no_commands, true); - // Write out the "special" stuff lg->WriteSpecialTargetsTop(makefileStream); @@ -414,7 +402,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( { // Get the relative path to the subdirectory from the top. std::string makeTarget = lg->GetCurrentBinaryDirectory(); - makeTarget += "/"; + makeTarget += '/'; makeTarget += pass; // The directory-level rule should depend on the target-level rules @@ -444,7 +432,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( // rules of the subdirectories. for (cmStateSnapshot const& c : lg->GetStateSnapshot().GetChildren()) { std::string subdir = c.GetDirectory().GetCurrentBinary(); - subdir += "/"; + subdir += '/'; subdir += pass; depends.push_back(std::move(subdir)); } @@ -456,9 +444,16 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( } // Write the rule. - std::string doc = "Convenience name for \""; - doc += pass; - doc += "\" pass in the directory."; + std::string doc; + if (lg->IsRootMakefile()) { + doc = "The main recursive \""; + doc += pass; + doc += "\" target."; + } else { + doc = "Recursive \""; + doc += pass; + doc += "\" directory target."; + } std::vector<std::string> no_commands; lg->WriteMakeRule(ruleFileStream, doc.c_str(), makeTarget, depends, no_commands, true); @@ -467,17 +462,19 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3* lg) { - // Only subdirectories need these rules. - if (lg->IsRootMakefile()) { - return; - } - // Begin the directory-level rules section. - std::string dir = - cmSystemTools::ConvertToOutputPath(lg->MaybeConvertToRelativePath( - lg->GetBinaryDirectory(), lg->GetCurrentBinaryDirectory())); - lg->WriteDivider(ruleFileStream); - ruleFileStream << "# Directory level rules for directory " << dir << "\n\n"; + { + std::string dir = + cmSystemTools::ConvertToOutputPath(lg->MaybeConvertToRelativePath( + lg->GetBinaryDirectory(), lg->GetCurrentBinaryDirectory())); + lg->WriteDivider(ruleFileStream); + if (lg->IsRootMakefile()) { + ruleFileStream << "# Directory level rules for the build root directory"; + } else { + ruleFileStream << "# Directory level rules for directory " << dir; + } + ruleFileStream << "\n\n"; + } // Write directory-level rules for "all". this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false); @@ -709,15 +706,6 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", localName, depends, commands, true); - // add the all/all dependency - if (!this->IsExcluded(gtarget)) { - depends.clear(); - depends.push_back(localName); - commands.clear(); - lg->WriteMakeRule(ruleFileStream, "Include target in all.", "all", - depends, commands, true); - } - // Write the rule. commands.clear(); @@ -794,9 +782,6 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( lg->WriteMakeRule(ruleFileStream, "clean rule for target.", makeTargetName, depends, commands, true); commands.clear(); - depends.push_back(makeTargetName); - lg->WriteMakeRule(ruleFileStream, "clean rule for target.", "clean", - depends, commands, true); } } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=adc3459707c4c942b547eb57d02a82b8d5085962 commit adc3459707c4c942b547eb57d02a82b8d5085962 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 17 12:30:08 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Fri May 17 17:58:55 2019 +0200 Makefiles: Avoid pointer repurposing diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 5486ac0..2f3bc76 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -247,13 +247,13 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() // Write out the "special" stuff lg->WriteSpecialTargetsTop(makefileStream); - // write the target convenience rules + // Write the target convenience rules for (cmLocalGenerator* localGen : this->LocalGenerators) { - lg = static_cast<cmLocalUnixMakefileGenerator3*>(localGen); - this->WriteConvenienceRules2(makefileStream, lg); + this->WriteConvenienceRules2( + makefileStream, static_cast<cmLocalUnixMakefileGenerator3*>(localGen)); } - lg = static_cast<cmLocalUnixMakefileGenerator3*>(this->LocalGenerators[0]); + // Write special bottom targets lg->WriteSpecialTargetsBottom(makefileStream); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d41b45cc931530d5dbc51674699f4da2290a6d3 commit 0d41b45cc931530d5dbc51674699f4da2290a6d3 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 17 10:56:50 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Fri May 17 17:58:55 2019 +0200 Makefiles: Inline range loop range arguments diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 1ea3673..5486ac0 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -354,9 +354,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() { cmakefileStream << "# Byproducts of CMake generate step:\n" << "set(CMAKE_MAKEFILE_PRODUCTS\n"; - const std::vector<std::string>& outfiles = - lg->GetMakefile()->GetOutputFiles(); - for (std::string const& outfile : outfiles) { + for (std::string const& outfile : lg->GetMakefile()->GetOutputFiles()) { cmakefileStream << " \"" << lg->MaybeConvertToRelativePath(binDir, outfile) << "\"\n"; @@ -392,8 +390,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules( for (cmLocalGenerator* lGenerator : lGenerators) { lg = static_cast<cmLocalUnixMakefileGenerator3*>(lGenerator); // for all of out targets - const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* tgt : tgts) { + for (cmGeneratorTarget* tgt : lg->GetGeneratorTargets()) { if ((tgt->GetType() == cmStateEnums::EXECUTABLE) || (tgt->GetType() == cmStateEnums::STATIC_LIBRARY) || (tgt->GetType() == cmStateEnums::SHARED_LIBRARY) || @@ -423,8 +420,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( // The directory-level rule should depend on the target-level rules // for all targets in the directory. std::vector<std::string> depends; - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* gtarget : targets) { + for (cmGeneratorTarget* gtarget : lg->GetGeneratorTargets()) { int type = gtarget->GetType(); if ((type == cmStateEnums::EXECUTABLE) || (type == cmStateEnums::STATIC_LIBRARY) || @@ -446,8 +442,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( // The directory-level rule should depend on the directory-level // rules of the subdirectories. - std::vector<cmStateSnapshot> children = lg->GetStateSnapshot().GetChildren(); - for (cmStateSnapshot const& c : children) { + for (cmStateSnapshot const& c : lg->GetStateSnapshot().GetChildren()) { std::string subdir = c.GetDirectory().GetCurrentBinary(); subdir += "/"; subdir += pass; @@ -567,8 +562,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( cmLocalUnixMakefileGenerator3* lg = static_cast<cmLocalUnixMakefileGenerator3*>(localGen); // for each target Generate the rule files for each target. - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* gtarget : targets) { + for (cmGeneratorTarget* gtarget : lg->GetGeneratorTargets()) { // Don't emit the same rule twice (e.g. two targets with the same // simple name) int type = gtarget->GetType(); @@ -652,8 +646,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( } // for each target Generate the rule files for each target. - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* gtarget : targets) { + for (cmGeneratorTarget* gtarget : lg->GetGeneratorTargets()) { int type = gtarget->GetType(); std::string name = gtarget->GetName(); if (!name.empty() && @@ -693,9 +686,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( { std::ostringstream progressArg; const char* sep = ""; - std::vector<unsigned long> const& progFiles = - this->ProgressMap[gtarget].Marks; - for (unsigned long progFile : progFiles) { + for (unsigned long progFile : this->ProgressMap[gtarget].Marks) { progressArg << sep << progFile; sep = ","; } @@ -817,8 +808,7 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() this->DirectoryTargetsMap.clear(); // Loop over all targets in all local generators. for (cmLocalGenerator* lg : this->LocalGenerators) { - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* gt : targets) { + for (cmGeneratorTarget* gt : lg->GetGeneratorTargets()) { cmLocalGenerator* tlg = gt->GetLocalGenerator(); if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY || @@ -841,8 +831,7 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() // Add dependencies of the included target. An excluded // target may still be included if it is a dependency of a // non-excluded target. - TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt); - for (cmTargetDepend const& tgtdep : tgtdeps) { + for (cmTargetDepend const& tgtdep : this->GetTargetDirectDepends(gt)) { targetSet.insert(tgtdep); } } @@ -856,8 +845,7 @@ size_t cmGlobalUnixMakefileGenerator3::CountProgressMarksInTarget( size_t count = 0; if (emitted.insert(target).second) { count = this->ProgressMap[target].Marks.size(); - TargetDependSet const& depends = this->GetTargetDirectDepends(target); - for (cmTargetDepend const& depend : depends) { + for (cmTargetDepend const& depend : this->GetTargetDirectDepends(target)) { if (depend->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -872,9 +860,8 @@ size_t cmGlobalUnixMakefileGenerator3::CountProgressMarksInAll( { size_t count = 0; std::set<cmGeneratorTarget const*> emitted; - std::set<cmGeneratorTarget const*> const& targets = - this->DirectoryTargetsMap[lg->GetStateSnapshot()]; - for (cmGeneratorTarget const* target : targets) { + for (cmGeneratorTarget const* target : + this->DirectoryTargetsMap[lg->GetStateSnapshot()]) { count += this->CountProgressMarksInTarget(target, emitted); } return count; @@ -913,8 +900,7 @@ void cmGlobalUnixMakefileGenerator3::TargetProgress::WriteProgressVariables( void cmGlobalUnixMakefileGenerator3::AppendGlobalTargetDepends( std::vector<std::string>& depends, cmGeneratorTarget* target) { - TargetDependSet const& depends_set = this->GetTargetDirectDepends(target); - for (cmTargetDepend const& i : depends_set) { + for (cmTargetDepend const& i : this->GetTargetDirectDepends(target)) { // Create the target-level dependency. cmGeneratorTarget const* dep = i; if (dep->GetType() == cmStateEnums::INTERFACE_LIBRARY) { @@ -956,9 +942,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule( // the targets if (lg2 == lg || lg->IsRootMakefile()) { // for each target Generate the rule files for each target. - const std::vector<cmGeneratorTarget*>& targets = - lg2->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + for (cmGeneratorTarget* target : lg2->GetGeneratorTargets()) { cmStateEnums::TargetType type = target->GetType(); if ((type == cmStateEnums::EXECUTABLE) || (type == cmStateEnums::STATIC_LIBRARY) || diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 88966c8..857440c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -115,10 +115,9 @@ void cmLocalUnixMakefileGenerator3::Generate() this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES"); // Generate the rule files for each target. - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); cmGlobalUnixMakefileGenerator3* gg = static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); - for (cmGeneratorTarget* target : targets) { + for (cmGeneratorTarget* target : this->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -154,8 +153,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath() void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles( std::map<std::string, LocalObjectInfo>& localObjectFiles) { - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (cmGeneratorTarget* gt : targets) { + for (cmGeneratorTarget* gt : this->GetGeneratorTargets()) { if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -353,9 +351,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( // for each target we just provide a rule to cd up to the top and do a make // on the target - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); std::string localName; - for (cmGeneratorTarget* target : targets) { + for (cmGeneratorTarget* target : this->GetGeneratorTargets()) { if ((target->GetType() == cmStateEnums::EXECUTABLE) || (target->GetType() == cmStateEnums::STATIC_LIBRARY) || (target->GetType() == cmStateEnums::SHARED_LIBRARY) || https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9180ccf9a9e845658ba455e2dbc2447b18d2654 commit a9180ccf9a9e845658ba455e2dbc2447b18d2654 Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Tue Apr 23 10:05:25 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri May 17 10:09:35 2019 -0400 Tests: add a check for the Swift compiler This ensures that the tests only run when the Swift compiler is present. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index d992986..a0f90b2 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -22,6 +22,7 @@ macro(ADD_TEST_MACRO NAME) endmacro() include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/CheckSwift.cmake) # Fake a user home directory to avoid polluting the real one. if(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME) @@ -365,11 +366,16 @@ if(BUILD_TESTING) ((NOT CMAKE_OSX_SDKPRODUCT STREQUAL "Mac OS X") OR (NOT CMAKE_OSX_SDKVERSION VERSION_LESS 10.10))) if(CMAKE_GENERATOR STREQUAL "Xcode") - ADD_TEST_MACRO(SwiftMix SwiftMix) - ADD_TEST_MACRO(SwiftOnly SwiftOnly) + set(CMake_TEST_XCODE_SWIFT 1) endif() endif() endif() + if(CMAKE_Swift_COMPILER OR CMake_TEST_XCODE_SWIFT) + ADD_TEST_MACRO(SwiftOnly SwiftOnly) + if(CMake_TEST_XCODE_SWIFT) + ADD_TEST_MACRO(SwiftMix SwiftMix) + endif() + endif() if(CMAKE_Fortran_COMPILER) ADD_TEST_MACRO(FortranOnly FortranOnly) endif() diff --git a/Tests/CheckSwift.cmake b/Tests/CheckSwift.cmake new file mode 100644 index 0000000..fcbae7e --- /dev/null +++ b/Tests/CheckSwift.cmake @@ -0,0 +1,61 @@ +if(NOT CMAKE_GENERATOR MATCHES "Xcode|Ninja") + set(CMAKE_Swift_COMPILER "") + return() +endif() + +if(NOT DEFINED CMAKE_Swift_COMPILER) + set(_desc "Looking for a Swift compiler") + message(STATUS ${_desc}) + + file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckSwift) + + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckSwift/CMakeLists.txt" + "cmake_minimum_required(VERSION 3.14) +project(CheckSwift Swift) +file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" + \"set(CMAKE_Swift_COMPILER \\\"\${CMAKE_Swift_COMPILER}\\\")\\n\" + \"set(CMAKE_Swift_FLAGS \\\"\${CMAKE_Swift_FLAGS}\\\")\\n\") +") + + if(CMAKE_GENERATOR_INSTANCE) + set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}") + else() + set(_D_CMAKE_GENERATOR_INSTANCE "") + endif() + + execute_process(WORKING_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckSwift + COMMAND + ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR} + -A "${CMAKE_GENERATOR_PLATFORM}" + -T "${CMAKE_GENERATOR_TOOLSET}" + ${_D_CMAKE_GENERATOR_INSTANCE} + TIMEOUT + 60 + OUTPUT_VARIABLE + output + ERROR_VARIABLE + output + RESULT_VARIABLE + result) + + include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckSwift/result.cmake + OPTIONAL) + if(CMAKE_Swift_COMPILER AND "${result}" STREQUAL "0") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${_desc} passed with the following output:\n" + "${output}\n") + else() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "${_desc} failed with the following output:\n" + "${output}\n") + endif() + + message(STATUS "${_desc} - ${CMAKE_Swift_COMPILER}") + + set(CMAKE_Swift_COMPILER "${CMAKE_Swift_COMPILER}" CACHE FILEPATH "Swift compiler") + set(CMAKE_Swift_FLAGS "${CMAKE_Swift_FLAGS}" CACHE STRING "Swift flags") + + mark_as_advanced(CMAKE_Swift_COMPILER) + mark_as_advanced(CMAKE_Swift_FLAGS) +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d57138b..0ccfca8 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -205,7 +205,7 @@ if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STRE add_RunCMake_test(RuntimePath) endif() add_RunCMake_test(ScriptMode) -add_RunCMake_test(Swift) +add_RunCMake_test(Swift -DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER}) add_RunCMake_test(TargetObjects) add_RunCMake_test(TargetSources) add_RunCMake_test(ToolchainFile) diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake index 4864295..de99042 100644 --- a/Tests/RunCMake/Swift/RunCMakeTest.cmake +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -4,6 +4,10 @@ if(RunCMake_GENERATOR STREQUAL Xcode) if(XCODE_BELOW_6_1) run_cmake(XcodeTooOld) endif() +elseif(RunCMake_GENERATOR STREQUAL Ninja) + if(CMAKE_Swift_COMPILER) + # Add Ninja-specific Swift tests here. + endif() else() run_cmake(NotSupported) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d745551fb6311f5db6e8133df63a7fc410e8a68b commit d745551fb6311f5db6e8133df63a7fc410e8a68b Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Wed May 8 22:49:33 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu May 16 14:41:05 2019 -0400 Help: add some initial documentation for Swift support diff --git a/Help/envvar/SWIFTC.rst b/Help/envvar/SWIFTC.rst new file mode 100644 index 0000000..b12e51d --- /dev/null +++ b/Help/envvar/SWIFTC.rst @@ -0,0 +1,11 @@ +SWIFTC +------ + +.. include:: ENV_VAR.txt + +Preferred executable for compiling ``Swift`` language files. Will only be used by +CMake on the first configuration to determine ``Swift`` compiler, after which the +value for ``SWIFTC`` is stored in the cache as +:variable:`CMAKE_Swift_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration run +(including the first), the environment variable will be ignored if the +:variable:`CMAKE_Swift_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined. diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index c433412..f106f28 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -52,6 +52,7 @@ Environment Variables for Languages /envvar/FFLAGS /envvar/RC /envvar/RCFLAGS + /envvar/SWIFTC Environment Variables for CTest =============================== diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 70974c0..9d2ad90 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -315,6 +315,9 @@ Properties on Targets /prop_tgt/STATIC_LIBRARY_FLAGS /prop_tgt/STATIC_LIBRARY_OPTIONS /prop_tgt/SUFFIX + /prop_tgt/Swift_DEPENDENCIES_FILE + /prop_tgt/Swift_MODULE_DIRECTORY + /prop_tgt/Swift_MODULE_NAME /prop_tgt/TYPE /prop_tgt/VERSION /prop_tgt/VISIBILITY_INLINES_HIDDEN @@ -439,6 +442,8 @@ Properties on Source Files /prop_sf/SKIP_AUTOMOC /prop_sf/SKIP_AUTORCC /prop_sf/SKIP_AUTOUIC + /prop_sf/Swift_DEPENDENCIES_FILE + /prop_sf/Swift_DIAGNOSTICS_FILE /prop_sf/SYMBOLIC /prop_sf/VS_COPY_TO_OUT_DIR /prop_sf/VS_CSHARP_tagname diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e5669d8..fd5e28f 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -97,6 +97,7 @@ Variables that Provide Information /variable/CMAKE_SOURCE_DIR /variable/CMAKE_STATIC_LIBRARY_PREFIX /variable/CMAKE_STATIC_LIBRARY_SUFFIX + /variable/CMAKE_Swift_MODULE_DIRECTORY /variable/CMAKE_TOOLCHAIN_FILE /variable/CMAKE_TWEAK_VERSION /variable/CMAKE_VERBOSE_MAKEFILE diff --git a/Help/prop_sf/Swift_DEPENDENCIES_FILE.rst b/Help/prop_sf/Swift_DEPENDENCIES_FILE.rst new file mode 100644 index 0000000..a8cf063 --- /dev/null +++ b/Help/prop_sf/Swift_DEPENDENCIES_FILE.rst @@ -0,0 +1,5 @@ +Swift_DEPENDENCIES_FILE +----------------------- + +This property sets the path for the Swift dependency file (swiftdeps) for the +source. diff --git a/Help/prop_sf/Swift_DIAGNOSTICS_FILE.rst b/Help/prop_sf/Swift_DIAGNOSTICS_FILE.rst new file mode 100644 index 0000000..5bf5d59 --- /dev/null +++ b/Help/prop_sf/Swift_DIAGNOSTICS_FILE.rst @@ -0,0 +1,4 @@ +Swift_DIAGNOSTICS_FILE +---------------------- + +This property controls where the Swift diagnostics are serialized. diff --git a/Help/prop_tgt/Swift_DEPENDENCIES_FILE.rst b/Help/prop_tgt/Swift_DEPENDENCIES_FILE.rst new file mode 100644 index 0000000..93cdd2c --- /dev/null +++ b/Help/prop_tgt/Swift_DEPENDENCIES_FILE.rst @@ -0,0 +1,5 @@ +Swift_DEPENDENCIES_FILE +----------------------- + +This property sets the path for the Swift dependency file (swiftdep) for the +target. diff --git a/Help/prop_tgt/Swift_MODULE_DIRECTORY.rst b/Help/prop_tgt/Swift_MODULE_DIRECTORY.rst new file mode 100644 index 0000000..d404251 --- /dev/null +++ b/Help/prop_tgt/Swift_MODULE_DIRECTORY.rst @@ -0,0 +1,10 @@ +Swift_MODULE_DIRECTORY +---------------------- + +Specify output directory for Swift modules provided by the target. + +If the target contains Swift source files, this specifies the directory in which +the modules will be placed. When this property is not set, the modules will be +placed in the build directory corresponding to the target's source directory. +If the variable :variable:`CMAKE_Swift_MODULE_DIRECTORY` is set when a target is +created its value is used to initialise this property. diff --git a/Help/prop_tgt/Swift_MODULE_NAME.rst b/Help/prop_tgt/Swift_MODULE_NAME.rst new file mode 100644 index 0000000..2866020 --- /dev/null +++ b/Help/prop_tgt/Swift_MODULE_NAME.rst @@ -0,0 +1,5 @@ +Swift_MODULE_NAME +----------------- + +This property specifies the name of the Swift module. It is defaulted to the +name of the target. diff --git a/Help/release/dev/swift-support.rst b/Help/release/dev/swift-support.rst new file mode 100644 index 0000000..49784e2 --- /dev/null +++ b/Help/release/dev/swift-support.rst @@ -0,0 +1,23 @@ +Swift Language Support +---------------------- + +* Preliminary support for the Swift language with the :generator:`Ninja` + generator was added. Use the :envvar:`SWIFTC` environment variable to + specify a compiler. + +* Support to emit an output file map was added to enable Swift compilation. + +* A target property :prop_tgt:`Swift_DEPENDENCIES_FILE` was added to targets to + indicate where to save the target swift dependencies file. If one is not + specified, it will default to `<TARGET>.swiftdeps`. + +* A target property :prop_tgt:`Swift_MODULE_NAME` was added to targets to + indicate the Swift module name. If it is not specified, it will default to + the name of the target. + +* A source property :prop_sf:`Swift_DEPENDENCIES_FILE` was added to sources to + indicate where to save the target swift dependencies file. If one is not + specified, it will default to `<OBJECT>.swiftdeps`. + +* A source property :prop_sf:`Swift_DIAGNOSTICS_FILE` was added to sources to + indicate where to write the serialised Swift diagnostics. diff --git a/Help/variable/CMAKE_Swift_MODULE_DIRECTORY.rst b/Help/variable/CMAKE_Swift_MODULE_DIRECTORY.rst new file mode 100644 index 0000000..b11253b --- /dev/null +++ b/Help/variable/CMAKE_Swift_MODULE_DIRECTORY.rst @@ -0,0 +1,8 @@ +CMAKE_Swift_MODULE_DIRECTORY +---------------------------- + +Swift module output directory. + +This variable is used to initialise the :prop_tgt:`Swift_MODULE_DIRECTORY` +property on all the targets. See the target property for additional +information. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a182c9e5b36ba68fc91b53e3d755c263ee3d0ef commit 9a182c9e5b36ba68fc91b53e3d755c263ee3d0ef Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Wed May 8 22:13:12 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu May 16 14:41:05 2019 -0400 Auxiliary: update vim syntax highlighting Add new Swift keywords to the highlighting rules. diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 7fcdc72..01380b5 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -96,6 +96,7 @@ syn keyword cmakeProperty contained \ CMAKE_CONFIGURE_DEPENDS \ CMAKE_CXX_KNOWN_FEATURES \ CMAKE_C_KNOWN_FEATURES + \ CMAKE_Swift_MODULE_DIRECTORY \ COMMON_LANGUAGE_RUNTIME \ COMPATIBLE_INTERFACE_BOOL \ COMPATIBLE_INTERFACE_NUMBER_MAX @@ -287,6 +288,11 @@ syn keyword cmakeProperty contained \ STRINGS \ SUBDIRECTORIES \ SUFFIX + \ Swift_DEPENDENCIES_FILE + \ Swift_DIAGNOSTICS_FILE + \ Swift_MODULE + \ Swift_MODULE_DIRECTORY + \ Swift_MODULE_NAME \ SYMBOLIC \ TARGET_ARCHIVES_MAY_BE_SHARED_LIBS \ TARGET_MESSAGES https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e9b0063e8e0f2fcb5cc4239a06deec17c49688c4 commit e9b0063e8e0f2fcb5cc4239a06deec17c49688c4 Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Wed May 8 21:01:47 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu May 16 14:41:05 2019 -0400 Modules: add build rules for Swift Ninja support Add rules to support building Swift sources using Ninja. diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake index dd02d54..2fcf7b0 100644 --- a/Modules/CMakeDetermineSwiftCompiler.cmake +++ b/Modules/CMakeDetermineSwiftCompiler.cmake @@ -1,15 +1,46 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) +# Local system-specific compiler preferences for this language. +include(Platform/${CMAKE_SYSTEM_NAME}-Determine-Swift OPTIONAL) +include(Platform/${CMAKE_SYSTEM_NAME}-Swift OPTIONAL) +if(NOT CMAKE_Swift_COMPILER_NAMES) + set(CMAKE_Swift_COMPILER_NAMES swiftc) +endif() + if("${CMAKE_GENERATOR}" STREQUAL "Xcode") if(XCODE_VERSION VERSION_LESS 6.1) message(FATAL_ERROR "Swift language not supported by Xcode ${XCODE_VERSION}") endif() set(CMAKE_Swift_COMPILER_XCODE_TYPE sourcecode.swift) _cmake_find_compiler_path(Swift) +elseif("${CMAKE_GENERATOR}" STREQUAL "Ninja") + if(CMAKE_Swift_COMPILER) + _cmake_find_compiler_path(Swift) + else() + set(CMAKE_Swift_COMPILER_INIT NOTFOUND) + + if(NOT $ENV{SWIFTC} STREQUAL "") + get_filename_component(CMAKE_Swift_COMPILER_INIT $ENV{SWIFTC} PROGRAM + PROGRAM_ARGS CMAKE_Swift_FLAGS_ENV_INIT) + if(CMAKE_Swift_FLAGS_ENV_INIT) + set(CMAKE_Swift_COMPILER_ARG1 "${CMAKE_Swift_FLAGS_ENV_INIT}" CACHE + STRING "First argument to the Swift compiler") + endif() + if(NOT EXISTS ${CMAKE_Swift_COMPILER_INIT}) + message(FATAL_ERROR "Could not find compiler set in environment variable SWIFTC\n$ENV{SWIFTC}.\n${CMAKE_Swift_COMPILER_INIT}") + endif() + endif() + + if(NOT CMAKE_Swift_COMPILER_INIT) + set(CMAKE_Swift_COMPILER_LIST swiftc ${_CMAKE_TOOLCHAIN_PREFIX}swiftc) + endif() + + _cmake_find_compiler(Swift) + endif() + mark_as_advanced(CMAKE_Swift_COMPILER) else() message(FATAL_ERROR "Swift language not supported by \"${CMAKE_GENERATOR}\" generator") endif() @@ -18,11 +49,13 @@ endif() if(NOT CMAKE_Swift_COMPILER_ID_RUN) set(CMAKE_Swift_COMPILER_ID_RUN 1) - list(APPEND CMAKE_Swift_COMPILER_ID_MATCH_VENDORS Apple) - set(CMAKE_Swift_COMPILER_ID_MATCH_VENDOR_REGEX_Apple "com.apple.xcode.tools.swift.compiler") + if("${CMAKE_GENERATOR}" STREQUAL "Xcode") + list(APPEND CMAKE_Swift_COMPILER_ID_MATCH_VENDORS Apple) + set(CMAKE_Swift_COMPILER_ID_MATCH_VENDOR_REGEX_Apple "com.apple.xcode.tools.swift.compiler") - set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_REGEX "\nCompileSwiftSources[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]* -c[^\r\n]*CompilerIdSwift/CompilerId/main.swift") - set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_INDEX 2) + set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_REGEX "\nCompileSwiftSources[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]* -c[^\r\n]*CompilerIdSwift/CompilerId/main.swift") + set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_INDEX 2) + endif() # Try to identify the compiler. set(CMAKE_Swift_COMPILER_ID) @@ -40,6 +73,6 @@ unset(_CMAKE_PROCESSING_LANGUAGE) # configure variables set in this file for fast reload later on configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake - @ONLY - ) + ${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake @ONLY) + +set(CMAKE_Swift_COMPILER_ENV_VAR "SWIFTC") diff --git a/Modules/CMakeSwiftCompiler.cmake.in b/Modules/CMakeSwiftCompiler.cmake.in index 45f0a31..7c8d1c1 100644 --- a/Modules/CMakeSwiftCompiler.cmake.in +++ b/Modules/CMakeSwiftCompiler.cmake.in @@ -1,5 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + set(CMAKE_Swift_COMPILER "@CMAKE_Swift_COMPILER@") set(CMAKE_Swift_COMPILER_ID "@CMAKE_Swift_COMPILER_ID@") +set(CMAKE_Swift_COMPILER_VERSION "@CMAKE_Swift_COMPILER_VERSION@") + +set(CMAKE_Swift_COMPILER_LOADED 1) +set(CMAKE_Swift_COMPILER_WORKS "@CMAKE_Swift_COMPILER_WORKS@") + +set(CMAKE_Swift_COMPILER_ENV_VAR "SWIFTC") set(CMAKE_Swift_COMPILER_ID_RUN 1) set(CMAKE_Swift_SOURCE_FILE_EXTENSIONS swift) diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 07ba6d0..64e7f99 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -1,32 +1,61 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. - -set(CMAKE_Swift_OUTPUT_EXTENSION .o) -set(CMAKE_INCLUDE_FLAG_Swift "-I") +if(UNIX) + set(CMAKE_Swift_OUTPUT_EXTENSION .o) +else() + set(CMAKE_Swift_OUTPUT_EXTENSION .obj) +endif() # Load compiler-specific information. if(CMAKE_Swift_COMPILER_ID) include(Compiler/${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) -endif() -# load the system- and compiler specific files -if(CMAKE_Swift_COMPILER_ID) - # load a hardware specific file, mostly useful for embedded compilers if(CMAKE_SYSTEM_PROCESSOR) include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) endif() include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) endif() -# for most systems a module is the same as a shared library -# so unless the variable CMAKE_MODULE_EXISTS is set just -# copy the values from the LIBRARY variables -if(NOT CMAKE_MODULE_EXISTS) - set(CMAKE_SHARED_MODULE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_Swift_FLAGS}) - set(CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Swift_FLAGS}) +set(CMAKE_INCLUDE_FLAG_Swift "-I") +set(CMAKE_INCLUDE_FLAG_SEP_Swift " ") +set(CMAKE_Swift_DEFINE_FLAG -D) +set(CMAKE_Swift_COMPILE_OPTIONS_TARGET "-target ") +set(CMAKE_Swift_COMPILER_ARG1 -frontend) + +set(CMAKE_Swift_FLAGS_DEBUG_INIT "-g") +set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O") +set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g") +set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize") + +# NOTE(compnerd) we do not have an object compile rule since we build the objects as part of the link step +if(NOT CMAKE_Swift_COMPILE_OBJECT) + set(CMAKE_Swift_COMPILE_OBJECT ":") endif() -include(CMakeCommonLanguageInclude) +if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY) + if(CMAKE_Swift_COMPILER_TARGET) + set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <FLAGS> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>") + else() + set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <FLAGS> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>") + endif() +endif() + +if(NOT CMAKE_Swift_CREATE_SHARED_MODULE) + set(CMAKE_Swift_CREATE_SHARED_MODULE ${CMAKE_Swift_CREATE_SHARED_LIBRARY}) +endif() + +if(NOT CMAKE_Swift_LINK_EXECUTABLE) + if(CMAKE_Swift_COMPILER_TARGET) + set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <FLAGS> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>") + else() + set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <FLAGS> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>") + endif() +endif() + +if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY) + set(CMAKE_Swift_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <OBJECTS>") + set(CMAKE_Swift_ARCHIVE_FINISH "") +endif() set(CMAKE_Swift_INFORMATION_LOADED 1) diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake index 858c1be..841aee6 100644 --- a/Modules/CMakeTestSwiftCompiler.cmake +++ b/Modules/CMakeTestSwiftCompiler.cmake @@ -1,7 +1,6 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. - if(CMAKE_Swift_COMPILER_FORCED) # The compiler configuration was forced by the user. # Assume the user has configured all compiler information. @@ -23,7 +22,6 @@ unset(CMAKE_Swift_COMPILER_WORKS CACHE) if(NOT CMAKE_Swift_COMPILER_WORKS) PrintTestCompilerStatus("Swift" "") file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift - "import Foundation\n" "print(\"CMake\")\n") try_compile(CMAKE_Swift_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift @@ -51,6 +49,11 @@ else() "Determining if the Swift compiler works passed with " "the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n") endif() + + # Re-configure to save learned information. + configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake @ONLY) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake) endif() unset(__CMAKE_Swift_COMPILER_OUTPUT) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6412e3e38ba22bf816445f19394e7c8027c186f commit b6412e3e38ba22bf816445f19394e7c8027c186f Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Tue May 7 23:11:52 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu May 16 14:41:05 2019 -0400 Ninja: add placeholders to support Swift build Add the placeholders needed to support compiling Swift code. diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 770d80c..146ef79 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -282,6 +282,14 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) vars.Language = this->TargetLinkLanguage.c_str(); + if (this->TargetLinkLanguage == "Swift") { + vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME"; + vars.SwiftModule = "$SWIFT_MODULE"; + vars.SwiftModuleName = "$SWIFT_MODULE_NAME"; + vars.SwiftOutputFileMap = "$SWIFT_OUTPUT_FILE_MAP"; + vars.SwiftSources = "$SWIFT_SOURCES"; + } + std::string responseFlag; if (!useResponseFile) { vars.Objects = "$in"; @@ -799,8 +807,83 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmNinjaDeps outputs; outputs.push_back(targetOutputReal); + if (this->TargetLinkLanguage == "Swift") { + vars["SWIFT_LIBRARY_NAME"] = [this]() -> std::string { + cmGeneratorTarget::Names targetNames = + this->GetGeneratorTarget()->GetLibraryNames(this->GetConfigName()); + return targetNames.Base; + }(); + + vars["SWIFT_MODULE"] = [this]() -> std::string { + cmGeneratorTarget::Names targetNames = + this->GetGeneratorTarget()->GetLibraryNames(this->GetConfigName()); + + std::string directory = + this->GetLocalGenerator()->GetCurrentBinaryDirectory(); + if (const char* prop = this->GetGeneratorTarget()->GetProperty( + "Swift_MODULE_DIRECTORY")) { + directory = prop; + } + + std::string name = targetNames.Base + ".swiftmodule"; + if (const char* prop = + this->GetGeneratorTarget()->GetProperty("Swift_MODULE")) { + name = prop; + } + + return this->GetLocalGenerator()->ConvertToOutputFormat( + this->ConvertToNinjaPath(directory + "/" + name), + cmOutputConverter::SHELL); + }(); + + vars["SWIFT_MODULE_NAME"] = [this]() -> std::string { + if (const char* name = + this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) { + return name; + } + return this->GetGeneratorTarget()->GetName(); + }(); + + vars["SWIFT_OUTPUT_FILE_MAP"] = + this->GetLocalGenerator()->ConvertToOutputFormat( + this->ConvertToNinjaPath(gt.GetSupportDirectory() + + "/output-file-map.json"), + cmOutputConverter::SHELL); + + vars["SWIFT_SOURCES"] = [this]() -> std::string { + std::vector<cmSourceFile const*> sources; + std::stringstream oss; + + this->GetGeneratorTarget()->GetObjectSources(sources, + this->GetConfigName()); + cmLocalGenerator const* LocalGen = this->GetLocalGenerator(); + for (const auto& source : sources) { + oss << " " + << LocalGen->ConvertToOutputFormat( + this->ConvertToNinjaPath(this->GetSourceFilePath(source)), + cmOutputConverter::SHELL); + } + return oss.str(); + }(); + } + // Compute specific libraries to link with. - cmNinjaDeps explicitDeps = this->GetObjects(); + cmNinjaDeps explicitDeps; + if (this->TargetLinkLanguage == "Swift") { + std::vector<cmSourceFile const*> sources; + this->GetGeneratorTarget()->GetObjectSources(sources, + this->GetConfigName()); + for (const auto& source : sources) { + outputs.push_back( + this->ConvertToNinjaPath(this->GetObjectFilePath(source))); + explicitDeps.push_back( + this->ConvertToNinjaPath(this->GetSourceFilePath(source))); + } + + outputs.push_back(vars["SWIFT_MODULE"]); + } else { + explicitDeps = this->GetObjects(); + } cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); if (!this->DeviceLinkObject.empty()) { diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index 8751a11..33389ca 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -91,6 +91,31 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( if (replaceValues.Includes && variable == "INCLUDES") { return replaceValues.Includes; } + if (replaceValues.SwiftLibraryName) { + if (variable == "SWIFT_LIBRARY_NAME") { + return replaceValues.SwiftLibraryName; + } + } + if (replaceValues.SwiftModule) { + if (variable == "SWIFT_MODULE") { + return replaceValues.SwiftModule; + } + } + if (replaceValues.SwiftModuleName) { + if (variable == "SWIFT_MODULE_NAME") { + return replaceValues.SwiftModuleName; + } + } + if (replaceValues.SwiftOutputFileMap) { + if (variable == "SWIFT_OUTPUT_FILE_MAP") { + return replaceValues.SwiftOutputFileMap; + } + } + if (replaceValues.SwiftSources) { + if (variable == "SWIFT_SOURCES") { + return replaceValues.SwiftSources; + } + } if (replaceValues.TargetPDB) { if (variable == "TARGET_PDB") { return replaceValues.TargetPDB; diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index 4a03dc8..8f36196 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -58,6 +58,11 @@ public: const char* Includes; const char* DependencyFile; const char* FilterPrefix; + const char* SwiftLibraryName; + const char* SwiftModule; + const char* SwiftModuleName; + const char* SwiftOutputFileMap; + const char* SwiftSources; }; // Expand rule variables in CMake of the type found in language rules diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d6d463b..2de8950 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -335,6 +335,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, InitProperty("LINK_SEARCH_START_STATIC", nullptr); InitProperty("LINK_SEARCH_END_STATIC", nullptr); InitProperty("FOLDER", nullptr); + InitProperty("Swift_MODULE_DIRECTORY", nullptr); InitProperty("VS_JUST_MY_CODE_DEBUGGING", nullptr); #ifdef __APPLE__ if (this->GetGlobalGenerator()->IsXcode()) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d7f31161d65d8b1f460eaf23e1b092bdaf7c238 commit 7d7f31161d65d8b1f460eaf23e1b092bdaf7c238 Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Tue May 7 22:01:59 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu May 16 14:41:05 2019 -0400 Ninja: add support for Swift's output-file-map.json Add an emitter for the Swift's output-map-file.json to emit the requisite support files for Swift compilation. This additionally prevents the build rules for the object file emission as well to properly support the Swift build semantics. diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b818107..19ca2a8 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -915,6 +915,28 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() } this->GetBuildFileStream() << "\n"; + + if (!this->SwiftOutputMap.empty()) { + std::string const mapFilePath = this->ConvertToNinjaPath( + this->GeneratorTarget->GetSupportDirectory() + "/output-file-map.json"); + std::string const targetSwiftDepsPath = [this]() -> std::string { + cmGeneratorTarget const* target = this->GeneratorTarget; + if (const char* name = target->GetProperty("Swift_DEPENDENCIES_FILE")) { + return name; + } + return this->ConvertToNinjaPath(target->GetSupportDirectory() + "/" + + target->GetName() + ".swiftdeps"); + }(); + + // build the global target dependencies + // https://github.com/apple/swift/blob/master/docs/Driver.md#output-file-maps + Json::Value deps(Json::objectValue); + deps["swift-dependencies"] = targetSwiftDepsPath; + this->SwiftOutputMap[""] = deps; + + cmGeneratedFileStream output(mapFilePath); + output << this->SwiftOutputMap; + } } void cmNinjaTargetGenerator::WriteObjectBuildStatement( @@ -1131,10 +1153,14 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( std::string const rspfile = objectFileName + ".rsp"; - this->GetGlobalGenerator()->WriteBuild( - this->GetBuildFileStream(), comment, rule, outputs, - /*implicitOuts=*/cmNinjaDeps(), explicitDeps, implicitDeps, orderOnlyDeps, - vars, rspfile, commandLineLengthLimit); + if (language == "Swift") { + this->EmitSwiftDependencyInfo(source); + } else { + this->GetGlobalGenerator()->WriteBuild( + this->GetBuildFileStream(), comment, rule, outputs, + /*implicitOuts=*/cmNinjaDeps(), explicitDeps, implicitDeps, + orderOnlyDeps, vars, rspfile, commandLineLengthLimit); + } if (const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) { std::vector<std::string> outputList; @@ -1193,6 +1219,52 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang) tdif << tdi; } +void cmNinjaTargetGenerator::EmitSwiftDependencyInfo( + cmSourceFile const* source) +{ + std::string const sourceFilePath = + this->ConvertToNinjaPath(this->GetSourceFilePath(source)); + std::string const objectFilePath = + this->ConvertToNinjaPath(this->GetObjectFilePath(source)); + std::string const swiftDepsPath = [source, objectFilePath]() -> std::string { + if (const char* name = source->GetProperty("Swift_DEPENDENCIES_FILE")) { + return name; + } + return objectFilePath + ".swiftdeps"; + }(); + std::string const swiftDiaPath = [source, objectFilePath]() -> std::string { + if (const char* name = source->GetProperty("Swift_DIAGNOSTICS_FILE")) { + return name; + } + return objectFilePath + ".dia"; + }(); + std::string const makeDepsPath = [this, source]() -> std::string { + cmLocalNinjaGenerator const* local = this->GetLocalGenerator(); + std::string const objectFileName = + this->ConvertToNinjaPath(this->GetObjectFilePath(source)); + std::string const objectFileDir = + cmSystemTools::GetFilenamePath(objectFileName); + + if (this->Makefile->IsOn("CMAKE_Swift_DEPFLE_EXTNSION_REPLACE")) { + std::string dependFileName = + cmSystemTools::GetFilenameWithoutLastExtension(objectFileName) + ".d"; + return local->ConvertToOutputFormat(objectFileDir + "/" + dependFileName, + cmOutputConverter::SHELL); + } + return local->ConvertToOutputFormat(objectFileName + ".d", + cmOutputConverter::SHELL); + }(); + + // build the source file mapping + // https://github.com/apple/swift/blob/master/docs/Driver.md#output-file-maps + Json::Value entry = Json::Value(Json::objectValue); + entry["object"] = objectFilePath; + entry["dependencies"] = makeDepsPath; + entry["swift-dependencies"] = swiftDepsPath; + entry["diagnostics"] = swiftDiaPath; + SwiftOutputMap[sourceFilePath] = entry; +} + void cmNinjaTargetGenerator::ExportObjectCompileCommand( std::string const& language, std::string const& sourceFileName, std::string const& objectDir, std::string const& objectFileName, diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 235c60c..3055e18 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -5,6 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include "cm_jsoncpp_value.h" + #include "cmCommonTargetGenerator.h" #include "cmGlobalNinjaGenerator.h" #include "cmNinjaTypes.h" @@ -128,6 +130,8 @@ protected: void WriteObjectBuildStatement(cmSourceFile const* source); void WriteTargetDependInfo(std::string const& lang); + void EmitSwiftDependencyInfo(cmSourceFile const* source); + void ExportObjectCompileCommand( std::string const& language, std::string const& sourceFileName, std::string const& objectDir, std::string const& objectFileName, @@ -171,7 +175,10 @@ private: cmLocalNinjaGenerator* LocalGenerator; /// List of object files for this target. cmNinjaDeps Objects; + // Fortran Support std::map<std::string, cmNinjaDeps> DDIFiles; + // Swift Support + Json::Value SwiftOutputMap; std::vector<cmCustomCommand const*> CustomCommands; cmNinjaDeps ExtraFiles; }; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d688c4c19d0ec6d639ba7047e786bdacb7a4b45b commit d688c4c19d0ec6d639ba7047e786bdacb7a4b45b Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Tue May 7 21:10:58 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu May 16 14:41:05 2019 -0400 Swift: remove unnecessary unreleased Ninja infrastructure This cleans up the new options that were added to support Swift. This was not released, and the proper support approach that we settled upon does not require as much specialised support. diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 680f881..770d80c 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -281,11 +281,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()); vars.Language = this->TargetLinkLanguage.c_str(); - if (this->TargetLinkLanguage == "Swift") { - vars.SwiftPartialModules = "$SWIFT_PARTIAL_MODULES"; - vars.TargetSwiftModule = "$TARGET_SWIFT_MODULE"; - vars.TargetSwiftDoc = "$TARGET_SWIFT_DOC"; - } std::string responseFlag; if (!useResponseFile) { @@ -804,34 +799,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmNinjaDeps outputs; outputs.push_back(targetOutputReal); - if (this->TargetLinkLanguage == "Swift") { - if (const char* name = gt.GetProperty("SWIFT_MODULE_NAME")) { - vars["TARGET_SWIFT_DOC"] = std::string(name) + ".swiftdoc"; - vars["TARGET_SWIFT_MODULE"] = std::string(name) + ".swiftmodule"; - } else { - vars["TARGET_SWIFT_DOC"] = gt.GetName() + ".swiftdoc"; - vars["TARGET_SWIFT_MODULE"] = gt.GetName() + ".swiftmodule"; - } - outputs.push_back(vars["TARGET_SWIFT_DOC"]); - outputs.push_back(vars["TARGET_SWIFT_MODULE"]); - - cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator(); - - std::string partials; - std::vector<cmSourceFile const*> sources; - gt.GetObjectSources(sources, this->GetConfigName()); - for (cmSourceFile const* source : sources) { - partials += " "; - if (const char* partial = source->GetProperty("SWIFT_PARTIAL_MODULE")) { - partials += partial; - } else { - partials += localGen.GetTargetDirectory(>) + "/" + - gt.GetObjectName(source) + ".swiftmodule"; - } - } - vars["SWIFT_PARTIAL_MODULES"] = partials; - } - // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 8afac70..b818107 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -19,7 +19,6 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalNinjaGenerator.h" -#include "cmListFileCache.h" // for BT #include "cmLocalGenerator.h" #include "cmLocalNinjaGenerator.h" #include "cmMakefile.h" @@ -455,13 +454,6 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; vars.ObjectFileDir = "$OBJECT_FILE_DIR"; - if (lang == "Swift") { - vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES"; - vars.SwiftModuleName = "$SWIFT_MODULE_NAME"; - vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME"; - vars.SwiftPartialModule = "$SWIFT_PARTIAL_MODULE"; - vars.SwiftPartialDoc = "$SWIFT_PARTIAL_DOC"; - } // For some cases we do an explicit preprocessor invocation. bool const explicitPP = this->NeedExplicitPreprocessing(lang); @@ -947,43 +939,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["DEFINES"] = this->ComputeDefines(source, language); vars["INCLUDES"] = this->ComputeIncludes(source, language); - if (language == "Swift") { - // The swift compiler needs all the sources besides the one being compiled - // in order to do the type checking. List all these "auxiliary" sources. - std::string aux_sources; - cmGeneratorTarget::KindedSources const& sources = - this->GeneratorTarget->GetKindedSources(this->GetConfigName()); - for (cmGeneratorTarget::SourceAndKind const& src : sources.Sources) { - if (src.Source.Value == source) { - continue; - } - aux_sources += " " + this->GetSourceFilePath(src.Source.Value); - } - vars["SWIFT_AUXILIARY_SOURCES"] = aux_sources; - - if (const char* name = - this->GeneratorTarget->GetProperty("SWIFT_MODULE_NAME")) { - vars["SWIFT_MODULE_NAME"] = name; - } else { - vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName(); - } - - cmGeneratorTarget::Names targetNames = - this->GeneratorTarget->GetLibraryNames(this->GetConfigName()); - vars["SWIFT_LIBRARY_NAME"] = targetNames.Base; - - if (const char* partial = source->GetProperty("SWIFT_PARTIAL_MODULE")) { - vars["SWIFT_PARTIAL_MODULE"] = partial; - } else { - vars["SWIFT_PARTIAL_MODULE"] = objectFileName + ".swiftmodule"; - } - - if (const char* partial = source->GetProperty("SWIFT_PARTIAL_DOC")) { - vars["SWIFT_PARTIAL_DOC"] = partial; - } else { - vars["SWIFT_PARTIAL_DOC"] = objectFileName + ".swiftdoc"; - } - } if (!this->NeedDepTypeMSVC(language)) { bool replaceExt(false); diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index 309ee30..8751a11 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -162,46 +162,6 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( } } } - if (replaceValues.SwiftAuxiliarySources) { - if (variable == "SWIFT_AUXILIARY_SOURCES") { - return replaceValues.SwiftAuxiliarySources; - } - } - if (replaceValues.SwiftModuleName) { - if (variable == "SWIFT_MODULE_NAME") { - return replaceValues.SwiftModuleName; - } - } - if (replaceValues.SwiftLibraryName) { - if (variable == "SWIFT_LIBRARY_NAME") { - return replaceValues.SwiftLibraryName; - } - } - if (replaceValues.SwiftPartialDoc) { - if (variable == "SWIFT_PARTIAL_DOC") { - return replaceValues.SwiftPartialDoc; - } - } - if (replaceValues.SwiftPartialModule) { - if (variable == "SWIFT_PARTIAL_MODULE") { - return replaceValues.SwiftPartialModule; - } - } - if (replaceValues.SwiftPartialModules) { - if (variable == "SWIFT_PARTIAL_MODULES") { - return replaceValues.SwiftPartialModules; - } - } - if (replaceValues.TargetSwiftDoc) { - if (variable == "TARGET_SWIFT_DOC") { - return replaceValues.TargetSwiftDoc; - } - } - if (replaceValues.TargetSwiftModule) { - if (variable == "TARGET_SWIFT_MODULE") { - return replaceValues.TargetSwiftModule; - } - } if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" || variable == "TARGET_INSTALLNAME_DIR") { // All these variables depend on TargetSOName diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index ebd4d41..4a03dc8 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -58,14 +58,6 @@ public: const char* Includes; const char* DependencyFile; const char* FilterPrefix; - const char* SwiftAuxiliarySources; - const char* SwiftModuleName; - const char* SwiftLibraryName; - const char* SwiftPartialModule; - const char* SwiftPartialDoc; - const char* TargetSwiftModule; - const char* TargetSwiftDoc; - const char* SwiftPartialModules; }; // Expand rule variables in CMake of the type found in language rules https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0723582208dda7da9815a319973eed596c61a44c commit 0723582208dda7da9815a319973eed596c61a44c Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu May 16 14:32:35 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu May 16 14:41:04 2019 -0400 Swift: Detect compiler version diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 7bf13fa..7036b93 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -84,6 +84,30 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) endif() endif() + # For Swift we need to explicitly query the version. + if(lang STREQUAL "Swift" + AND CMAKE_${lang}_COMPILER + AND NOT CMAKE_${lang}_COMPILER_VERSION) + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" + -version + OUTPUT_VARIABLE output ERROR_VARIABLE output + RESULT_VARIABLE result + TIMEOUT 10 + ) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Running the ${lang} compiler: \"${CMAKE_${lang}_COMPILER}\" -version\n" + "${output}\n" + ) + + if(output MATCHES [[Swift version ([0-9]+\.[0-9]+(\.[0-9]+)?)]]) + set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}") + if(NOT CMAKE_${lang}_COMPILER_ID) + set(CMAKE_Swift_COMPILER_ID "Apple") + endif() + endif() + endif() + if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") execute_process( COMMAND "${CMAKE_${lang}_COMPILER}" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=086c51dc045c75662500b39da3341af83281d6df commit 086c51dc045c75662500b39da3341af83281d6df Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu May 16 14:30:56 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu May 16 14:31:30 2019 -0400 CMakeDetermineCompilerId: Make CMAKE_${lang}_COMPILER available earlier If compiler id detection gave us the compiler tool, copy its value to the `CMAKE_${lang}_COMPILER` variable as early as possible. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 1cd919a..7bf13fa 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -46,6 +46,14 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) endif() endforeach() + # Check if compiler id detection gave us the compiler tool. + if(CMAKE_${lang}_COMPILER_ID_TOOL) + set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}") + set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE) + elseif(NOT CMAKE_${lang}_COMPILER) + set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE) + endif() + # If the compiler is still unknown, try to query its vendor. if(CMAKE_${lang}_COMPILER AND NOT CMAKE_${lang}_COMPILER_ID) foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "") @@ -124,13 +132,6 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) message(STATUS "The ${lang} compiler identification is unknown") endif() - # Check if compiler id detection gave us the compiler tool. - if(CMAKE_${lang}_COMPILER_ID_TOOL) - set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE) - elseif(NOT CMAKE_${lang}_COMPILER) - set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE) - endif() - set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}" PARENT_SCOPE) ----------------------------------------------------------------------- Summary of changes: Auxiliary/vim/syntax/cmake.vim | 6 + Help/envvar/SWIFTC.rst | 11 ++ Help/manual/cmake-env-variables.7.rst | 1 + Help/manual/cmake-properties.7.rst | 5 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_sf/Swift_DEPENDENCIES_FILE.rst | 5 + Help/prop_sf/Swift_DIAGNOSTICS_FILE.rst | 4 + Help/prop_tgt/Swift_DEPENDENCIES_FILE.rst | 5 + Help/prop_tgt/Swift_MODULE_DIRECTORY.rst | 10 ++ Help/prop_tgt/Swift_MODULE_NAME.rst | 5 + Help/release/dev/swift-support.rst | 23 ++++ Help/variable/CMAKE_Swift_MODULE_DIRECTORY.rst | 8 ++ Modules/CMakeDetermineCompilerId.cmake | 39 +++++-- Modules/CMakeDetermineSwiftCompiler.cmake | 49 ++++++-- Modules/CMakeSwiftCompiler.cmake.in | 9 ++ Modules/CMakeSwiftInformation.cmake | 57 ++++++--- Modules/CMakeTestSwiftCompiler.cmake | 7 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 129 ++++++++------------- Source/cmGlobalUnixMakefileGenerator3.h | 3 +- Source/cmLocalUnixMakefileGenerator3.cxx | 60 +++++++++- Source/cmLocalUnixMakefileGenerator3.h | 1 + Source/cmMakefileTargetGenerator.cxx | 12 -- Source/cmNinjaNormalTargetGenerator.cxx | 102 +++++++++++----- Source/cmNinjaTargetGenerator.cxx | 125 ++++++++++++-------- Source/cmNinjaTargetGenerator.h | 7 ++ Source/cmRulePlaceholderExpander.cxx | 65 ++++------- Source/cmRulePlaceholderExpander.h | 11 +- Source/cmTarget.cxx | 1 + Tests/CMakeLists.txt | 10 +- Tests/CheckSwift.cmake | 61 ++++++++++ Tests/MakeClean/ToClean/CMakeLists.txt | 82 +++++++------ Tests/MakeClean/ToClean/EmptySubDir/CMakeLists.txt | 17 +++ Tests/RunCMake/CMakeLists.txt | 2 +- Tests/RunCMake/Swift/RunCMakeTest.cmake | 4 + 34 files changed, 649 insertions(+), 288 deletions(-) create mode 100644 Help/envvar/SWIFTC.rst create mode 100644 Help/prop_sf/Swift_DEPENDENCIES_FILE.rst create mode 100644 Help/prop_sf/Swift_DIAGNOSTICS_FILE.rst create mode 100644 Help/prop_tgt/Swift_DEPENDENCIES_FILE.rst create mode 100644 Help/prop_tgt/Swift_MODULE_DIRECTORY.rst create mode 100644 Help/prop_tgt/Swift_MODULE_NAME.rst create mode 100644 Help/release/dev/swift-support.rst create mode 100644 Help/variable/CMAKE_Swift_MODULE_DIRECTORY.rst create mode 100644 Tests/CheckSwift.cmake create mode 100644 Tests/MakeClean/ToClean/EmptySubDir/CMakeLists.txt hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits