endif()
add_subdirectory(runtime)
-option(FLANG_BUILD_EXAMPLES "Build Flang example programs by default." OFF)
-if (FLANG_BUILD_EXAMPLES AND FLANG_STANDALONE_BUILD)
- message(FATAL_ERROR "Examples are not supported in out-of-tree builds.")
+if (LLVM_INCLUDE_EXAMPLES)
+ add_subdirectory(examples)
endif()
-add_subdirectory(examples)
if (FLANG_INCLUDE_TESTS)
add_subdirectory(test)
# Always generate install targets
llvm_install_symlink(FLANG ${name} ${dest} ALWAYS_GENERATE)
endmacro()
-
For in-tree plugins, there is the CMake flag `FLANG_PLUGIN_SUPPORT`, enabled by
default, that controls the exporting of executable symbols from `flang-new`,
which plugins need access to. Additionally, there is the CMake flag
-`FLANG_BUILD_EXAMPLES`, turned off by default, that is used to control if the
+`LLVM_BUILD_EXAMPLES`, turned off by default, that is used to control if the
example programs are built. This includes plugins that are in the
`flang/example` directory and added as a `sub_directory` to the
`flang/examples/CMakeLists.txt`, for example, the `PrintFlangFunctionNames`
-if(NOT FLANG_BUILD_EXAMPLES)
- set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL ON)
-endif()
-
add_subdirectory(ExternalHelloWorld)
add_subdirectory(PrintFlangFunctionNames)
add_subdirectory(FlangOmpReport)
+set(LLVM_LINK_COMPONENTS
+ FortranRuntime
+ )
+
# This test is not run by default as it requires input.
-add_executable(external-hello-world
+add_llvm_example(external-hello-world
external-hello.cpp
)
-
-target_link_libraries(external-hello-world
- FortranRuntime
-)
-add_llvm_library(flangOmpReport
+add_llvm_example_library(flangOmpReport
MODULE
FlangOmpReport.cpp
FlangOmpReportVisitor.cpp
# 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_example_library(flangPrintFunctionNames
MODULE
PrintFlangFunctionNames.cpp
add_subdirectory(lib)
llvm_canonicalize_cmake_booleans(
- FLANG_BUILD_EXAMPLES
FLANG_STANDALONE_BUILD
+ LLVM_BUILD_EXAMPLES
LLVM_BYE_LINK_INTO_TOOLS
LLVM_ENABLE_PLUGINS
)
endif()
endif()
-if (FLANG_BUILD_EXAMPLES)
+if (LLVM_BUILD_EXAMPLES)
list(APPEND FLANG_TEST_DEPENDS
flangPrintFunctionNames
flangOmpReport
! Check the Flang Print Function Names example plugin doesn't count/print function/subroutine calls (should only count definitions)
-! This requires that the examples are built (FLANG_BUILD_EXAMPLES=ON) to access flangPrintFunctionNames.so
+! This requires that the examples are built (LLVM_BUILD_EXAMPLES=ON) to access flangPrintFunctionNames.so
! REQUIRES: plugins, examples, shell
! Check the Flang Print Function Names example plugin prints and counts function/subroutine definitions
! This includes internal and external Function/Subroutines, but not Statement Functions
-! This requires that the examples are built (FLANG_BUILD_EXAMPLES=ON) to access flangPrintFunctionNames.so
+! This requires that the examples are built (LLVM_BUILD_EXAMPLES=ON) to access flangPrintFunctionNames.so
! REQUIRES: plugins, examples, shell
! Check the Flang Print Function Names example plugin doesn't count/print Functions/Subroutines in interfaces
! (It should only count definitions, which will appear elsewhere for interfaced functions/subroutines)
-! This requires that the examples are built (FLANG_BUILD_EXAMPLES=ON) to access flangPrintFunctionNames.so
+! This requires that the examples are built (LLVM_BUILD_EXAMPLES=ON) to access flangPrintFunctionNames.so
! REQUIRES: plugins, examples, shell
config.flang_llvm_tools_dir = "@CMAKE_BINARY_DIR@/bin"
config.flang_lib_dir = "@CMAKE_BINARY_DIR@/lib"
config.flang_test_triple = "@FLANG_TEST_TARGET_TRIPLE@"
-config.flang_examples = @FLANG_BUILD_EXAMPLES@
+config.flang_examples = @LLVM_BUILD_EXAMPLES@
config.python_executable = "@PYTHON_EXECUTABLE@"
config.flang_standalone_build = @FLANG_STANDALONE_BUILD@
config.has_plugins = @LLVM_ENABLE_PLUGINS@