From 7ccacaf4428d1712029594184baa6f617a51c340 Mon Sep 17 00:00:00 2001 From: Andrzej Warzynski Date: Tue, 11 Jan 2022 13:16:03 +0000 Subject: [PATCH] [flang][examples] Add missing CMake dependencies Currently, everything that includes "flang/Parser/parse-tree.h" in Flang depends on the `gen_acc` and `gen_omp` CMake targets (these targets generate include files that are used in "parse-tree.h"). The examples in Flang do use this header file and hence also depend on `gen_acc`/`gen_omp`. This patch updates relevant CMake scripts accordingly. I've also taken the liberty to rename some of the example files so that their names follow LLVM's coding guidelines. Differential Revision: https://reviews.llvm.org/D117016 --- flang/examples/CMakeLists.txt | 2 +- flang/examples/FlangOmpReport/CMakeLists.txt | 9 +++++++++ .../FlangOmpReport.cpp} | 2 +- .../FlangOmpReportVisitor.cpp} | 2 +- .../FlangOmpReportVisitor.h} | 0 .../requirements.txt | 0 .../yaml_summarizer.py | 0 flang/examples/PrintFlangFunctionNames/CMakeLists.txt | 7 +++++-- flang/examples/flang-omp-report-plugin/CMakeLists.txt | 6 ------ 9 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 flang/examples/FlangOmpReport/CMakeLists.txt rename flang/examples/{flang-omp-report-plugin/flang-omp-report.cpp => FlangOmpReport/FlangOmpReport.cpp} (98%) rename flang/examples/{flang-omp-report-plugin/flang-omp-report-visitor.cpp => FlangOmpReport/FlangOmpReportVisitor.cpp} (99%) rename flang/examples/{flang-omp-report-plugin/flang-omp-report-visitor.h => FlangOmpReport/FlangOmpReportVisitor.h} (100%) rename flang/examples/{flang-omp-report-plugin => FlangOmpReport}/requirements.txt (100%) rename flang/examples/{flang-omp-report-plugin => FlangOmpReport}/yaml_summarizer.py (100%) delete mode 100644 flang/examples/flang-omp-report-plugin/CMakeLists.txt diff --git a/flang/examples/CMakeLists.txt b/flang/examples/CMakeLists.txt index f9b656ce86fe..b0a78eeaa4ea 100644 --- a/flang/examples/CMakeLists.txt +++ b/flang/examples/CMakeLists.txt @@ -12,4 +12,4 @@ target_link_libraries(external-hello-world ) add_subdirectory(PrintFlangFunctionNames) -add_subdirectory(flang-omp-report-plugin) +add_subdirectory(FlangOmpReport) diff --git a/flang/examples/FlangOmpReport/CMakeLists.txt b/flang/examples/FlangOmpReport/CMakeLists.txt new file mode 100644 index 000000000000..aebebe92d6b3 --- /dev/null +++ b/flang/examples/FlangOmpReport/CMakeLists.txt @@ -0,0 +1,9 @@ +add_llvm_library(flangOmpReport + MODULE + FlangOmpReport.cpp + FlangOmpReportVisitor.cpp + + DEPENDS + acc_gen + omp_gen +) diff --git a/flang/examples/flang-omp-report-plugin/flang-omp-report.cpp b/flang/examples/FlangOmpReport/FlangOmpReport.cpp similarity index 98% rename from flang/examples/flang-omp-report-plugin/flang-omp-report.cpp rename to flang/examples/FlangOmpReport/FlangOmpReport.cpp index 9ee8eb1a80cb..0fa7582561d2 100644 --- a/flang/examples/flang-omp-report-plugin/flang-omp-report.cpp +++ b/flang/examples/FlangOmpReport/FlangOmpReport.cpp @@ -15,7 +15,7 @@ // //===----------------------------------------------------------------------===// -#include "flang-omp-report-visitor.h" +#include "FlangOmpReportVisitor.h" #include "flang/Frontend/CompilerInstance.h" #include "flang/Frontend/FrontendActions.h" diff --git a/flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp similarity index 99% rename from flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp rename to flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp index 32dcef25feda..a0c3b194bfd3 100644 --- a/flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp +++ b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "flang-omp-report-visitor.h" +#include "FlangOmpReportVisitor.h" #include "llvm/ADT/StringExtras.h" namespace Fortran { diff --git a/flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.h similarity index 100% rename from flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h rename to flang/examples/FlangOmpReport/FlangOmpReportVisitor.h diff --git a/flang/examples/flang-omp-report-plugin/requirements.txt b/flang/examples/FlangOmpReport/requirements.txt similarity index 100% rename from flang/examples/flang-omp-report-plugin/requirements.txt rename to flang/examples/FlangOmpReport/requirements.txt diff --git a/flang/examples/flang-omp-report-plugin/yaml_summarizer.py b/flang/examples/FlangOmpReport/yaml_summarizer.py similarity index 100% rename from flang/examples/flang-omp-report-plugin/yaml_summarizer.py rename to flang/examples/FlangOmpReport/yaml_summarizer.py diff --git a/flang/examples/PrintFlangFunctionNames/CMakeLists.txt b/flang/examples/PrintFlangFunctionNames/CMakeLists.txt index 6b107b4e1ea5..490f2ea89516 100644 --- a/flang/examples/PrintFlangFunctionNames/CMakeLists.txt +++ b/flang/examples/PrintFlangFunctionNames/CMakeLists.txt @@ -1,7 +1,10 @@ # TODO: Note that this is currently only available on Linux. # On Windows, we would also have to specify e.g. `PLUGIN_TOOL`. -add_llvm_library( - flangPrintFunctionNames +add_llvm_library(flangPrintFunctionNames MODULE PrintFlangFunctionNames.cpp + + DEPENDS + acc_gen + omp_gen ) diff --git a/flang/examples/flang-omp-report-plugin/CMakeLists.txt b/flang/examples/flang-omp-report-plugin/CMakeLists.txt deleted file mode 100644 index 993ba320d757..000000000000 --- a/flang/examples/flang-omp-report-plugin/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_llvm_library( - flangOmpReport - MODULE - flang-omp-report.cpp - flang-omp-report-visitor.cpp -)