Browse Source

Merge topic 'fastbuild-instrumentation'

903d35353f instrumentation: Update tests and documentation for FASTBuild support
bd24854d56 FASTBuild: Expand TargetLabels and Config for Link Commands

Acked-by: Kitware Robot <[email protected]>
Acked-by: Eduard Voronkin <[email protected]>
Merge-request: !11135
Brad King 1 month ago
parent
commit
69edf00b57

+ 6 - 5
Help/manual/cmake-instrumentation.7.rst

@@ -21,8 +21,8 @@ The CMake Instrumentation API allows for the collection of timing data, target
 information and system diagnostic information during the configure, generate,
 build, test and install steps for a CMake project.
 
-This feature is only available for projects using the :ref:`Makefile Generators`
-or the :ref:`Ninja Generators`.
+This feature is only available for projects using the
+:ref:`Makefile Generators`, :ref:`Ninja Generators` or :generator:`FASTBuild`.
 
 All interactions with the CMake instrumentation API must specify both an API
 version and a Data version. At this time, there is only one version for each of
@@ -200,9 +200,10 @@ key is required, but all other fields are optional.
   * ``postInstall``
   * ``postTest``
 
-  ``preBuild`` and ``postBuild`` are not supported with the
-  :generator:`MSYS Makefiles` generator. Additionally, they will not be
-  triggered when the build tool is invoked by ``cmake --build``.
+  ``preBuild`` and ``postBuild`` are not supported when using the
+  :generator:`MSYS Makefiles` or :generator:`FASTBuild` generators.
+  Additionally, they will not be triggered when the build tool is invoked by
+  ``cmake --build``.
 
 ``options``
   A list of strings used to enable certain optional behavior, including the

+ 3 - 0
Source/cmFastbuildNormalTargetGenerator.cxx

@@ -250,6 +250,9 @@ bool cmFastbuildNormalTargetGenerator::DetectBaseLinkerCommand(
   cmRulePlaceholderExpander::RuleVariables vars;
   vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
   vars.CMTargetType = cmState::GetTargetTypeName(targetType).c_str();
+  vars.CMTargetLabels =
+    this->GetGeneratorTarget()->GetTargetLabelsString().c_str();
+  vars.Config = Config.c_str();
   vars.Language = linkLanguage.c_str();
   std::string const manifests =
     cmJoin(this->GetManifestsAsFastbuildPath(), " ");

+ 1 - 1
Tests/RunCMake/CMakeLists.txt

@@ -422,7 +422,7 @@ endif()
 add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE}
                           -DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}
                           -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
-if(CMAKE_GENERATOR MATCHES "Make|Ninja")
+if(CMAKE_GENERATOR MATCHES "Make|Ninja|FASTBuild")
   add_RunCMake_test(Instrumentation)
 endif()
 add_RunCMake_test(ConfigDir)

+ 4 - 1
Tests/RunCMake/Instrumentation/RunCMakeTest.cmake

@@ -160,7 +160,10 @@ instrument(cmake-command-custom-content-bad-type NO_WARN)
 instrument(cmake-command-custom-content-bad-content NO_WARN)
 
 # Test make/ninja hooks
-if(RunCMake_GENERATOR STREQUAL "MSYS Makefiles")
+if(RunCMake_GENERATOR STREQUAL "FASTBuild")
+  # FIXME(#27184): This does not work for FASTBuild.
+  set(Skip_BUILD_MAKE_PROGRAM_Case 1)
+elseif(RunCMake_GENERATOR STREQUAL "MSYS Makefiles")
   # FIXME(#27079): This does not work for MSYS Makefiles.
   set(Skip_BUILD_MAKE_PROGRAM_Case 1)
 elseif(RunCMake_GENERATOR STREQUAL "NMake Makefiles")