[PATCH] D97250: [test-suite] Robust warnings for Fortran Test Suite tests that require Ninja.

Nichols A. Romero via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 11:59:49 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rT37a356505b2a: [test-suite] Robust warnings for Fortran Test Suite tests that require Ninja. (authored by naromero77).

Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97250/new/

https://reviews.llvm.org/D97250

Files:
  CMakeLists.txt
  External/SPEC/CFP2017rate/554.roms_r/CMakeLists.txt
  External/SPEC/SpecCPU2017.cmake
  cmake/modules/Fortran.cmake


Index: cmake/modules/Fortran.cmake
===================================================================
--- /dev/null
+++ cmake/modules/Fortran.cmake
@@ -0,0 +1,29 @@
+##===- Fortran.cmake ----------------------------------------------------===##
+#
+# Fortran-specific helper functions to build benchmarks and the
+# corresponding .test files
+#
+##===--------------------------------------------------------------------===##
+
+
+# The Ninja generator supports robust scanning for modules that are
+# needed by some Fortran tests. Because Ninja does a full
+# preprocessing pass on Fortran files, it is able to detect module
+# dependencies that are dependent on preprocessing.
+# For example,
+# #ifdef FOO 
+# USE MODULE_A
+# #else
+# USE MODULE_B
+# #endif
+# This is support by Ninja, but not the Unix Makefiles generator.
+# More details here:
+# https://gitlab.kitware.com/cmake/cmake/-/issues/16590"
+
+function(ninja_required)
+  if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
+    message(SEND_ERROR
+      "This test is NOT supported by CMAKE_GENERATOR = ${CMAKE_GENERATOR}.\n"
+      "Please use use Ninja 1.10 or later by adding -G \"Ninja\" to cmake invocation.\n")
+  endif()
+endfunction()
Index: External/SPEC/SpecCPU2017.cmake
===================================================================
--- External/SPEC/SpecCPU2017.cmake
+++ External/SPEC/SpecCPU2017.cmake
@@ -4,6 +4,7 @@
 include(External)
 include(CopyDir)
 include(Host)
+include(Fortran)
 
 # Search for SPEC CPU 2017 root directory.
 llvm_externals_find(TEST_SUITE_SPEC2017_ROOT "speccpu2017" "SPEC CPU2017")
Index: External/SPEC/CFP2017rate/554.roms_r/CMakeLists.txt
===================================================================
--- External/SPEC/CFP2017rate/554.roms_r/CMakeLists.txt
+++ External/SPEC/CFP2017rate/554.roms_r/CMakeLists.txt
@@ -4,6 +4,8 @@
   return ()
 endif ()
 
+ninja_required()
+
 speccpu2017_benchmark(RATE)
 
 speccpu2017_add_include_dirs(.)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -8,11 +8,6 @@
 
 if(TEST_SUITE_FORTRAN)
   enable_language(Fortran)
-  if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
-      message(WARNING
-	"Fortran test suite may NOT build with this CMAKE_GENERATOR = ${CMAKE_GENERATOR}.\n"
-	"Recommend using Ninja 1.10 or later by adding -G \"Ninja\" to cmake invocation.")
-  endif()
 endif()
 
 function(append value)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97250.326174.patch
Type: text/x-patch
Size: 2435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210224/ce1b49a1/attachment.bin>


More information about the llvm-commits mailing list