[runtimes] Share doxygen handling with LLVM (#176948)
Hoist handling of Doxygen into the top-level cmake/ directory so it can be shared between LLVM and RUNTIMES and a default/standalone runtimes build can support building Doxygen documentation as well. The openmp subproject currently supports doxygen documentation using an `LLVM_ENABLE_PROJECTS=openmp` build, but not with `LLVM_ENABLE_RUNTIMES=openmp` because of this missing boilerplate code in the runtimes build. This is a step towards removing the `LLVM_ENABLE_PROJECTS=openmp` build mode which was deprecated (#124014) and already scheduled to be removed in LLVM 21 (#136314). Eventual removal is planned with #176950. Hoisting CMake code for shared use with runtimes has been done before in e.g. #84641, 7017e6c9cfd2de3122ce9528f338a97d61e96373, 44e3365775101fec3fd355eda339282258d74415, 7017e6c9cfd2de3122ce9528f338a97d61e96373 --------- Co-authored-by: Petr Hosek <phosek@google.com>
This commit is contained in:
parent
be50b78afe
commit
50638e01e4
40
cmake/Modules/HandleDoxygen.cmake
Normal file
40
cmake/Modules/HandleDoxygen.cmake
Normal file
@ -0,0 +1,40 @@
|
||||
option(LLVM_ENABLE_DOXYGEN "Use Doxygen to generate API documentation." OFF)
|
||||
|
||||
|
||||
# available programs checks
|
||||
function(llvm_find_program name)
|
||||
string(TOUPPER ${name} NAME)
|
||||
string(REGEX REPLACE "\\." "_" NAME ${NAME})
|
||||
|
||||
find_program(LLVM_PATH_${NAME} NAMES ${ARGV})
|
||||
mark_as_advanced(LLVM_PATH_${NAME})
|
||||
if(LLVM_PATH_${NAME})
|
||||
set(HAVE_${NAME} 1 CACHE INTERNAL "Is ${name} available ?")
|
||||
mark_as_advanced(HAVE_${NAME})
|
||||
else(LLVM_PATH_${NAME})
|
||||
set(HAVE_${NAME} "" CACHE INTERNAL "Is ${name} available ?")
|
||||
endif(LLVM_PATH_${NAME})
|
||||
endfunction()
|
||||
|
||||
if (LLVM_ENABLE_DOXYGEN)
|
||||
message(STATUS "Doxygen enabled.")
|
||||
llvm_find_program(dot)
|
||||
find_package(Doxygen REQUIRED)
|
||||
|
||||
if (DOXYGEN_FOUND)
|
||||
# If we find doxygen and we want to enable doxygen by default create a
|
||||
# global aggregate doxygen target for generating llvm and any/all
|
||||
# subprojects doxygen documentation.
|
||||
if (LLVM_BUILD_DOCS)
|
||||
add_custom_target(doxygen ALL)
|
||||
endif()
|
||||
|
||||
option(LLVM_DOXYGEN_EXTERNAL_SEARCH "Enable doxygen external search." OFF)
|
||||
if (LLVM_DOXYGEN_EXTERNAL_SEARCH)
|
||||
set(LLVM_DOXYGEN_SEARCHENGINE_URL "" CACHE STRING "URL to use for external search.")
|
||||
set(LLVM_DOXYGEN_SEARCH_MAPPINGS "" CACHE STRING "Doxygen Search Mappings")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Doxygen disabled.")
|
||||
endif()
|
||||
@ -857,12 +857,13 @@ option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks c
|
||||
|
||||
option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF)
|
||||
option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON)
|
||||
option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OFF)
|
||||
option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
|
||||
option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
|
||||
option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
|
||||
option (LLVM_ENABLE_TELEMETRY "Enable the telemetry library. If set to OFF, library cannot be enabled after build (eg., at runtime)" ON)
|
||||
|
||||
include(HandleDoxygen)
|
||||
|
||||
set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
|
||||
CACHE STRING "Doxygen-generated HTML documentation install directory")
|
||||
set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/ocaml-html"
|
||||
|
||||
@ -448,25 +448,6 @@ if (NOT WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# available programs checks
|
||||
function(llvm_find_program name)
|
||||
string(TOUPPER ${name} NAME)
|
||||
string(REGEX REPLACE "\\." "_" NAME ${NAME})
|
||||
|
||||
find_program(LLVM_PATH_${NAME} NAMES ${ARGV})
|
||||
mark_as_advanced(LLVM_PATH_${NAME})
|
||||
if(LLVM_PATH_${NAME})
|
||||
set(HAVE_${NAME} 1 CACHE INTERNAL "Is ${name} available ?")
|
||||
mark_as_advanced(HAVE_${NAME})
|
||||
else(LLVM_PATH_${NAME})
|
||||
set(HAVE_${NAME} "" CACHE INTERNAL "Is ${name} available ?")
|
||||
endif(LLVM_PATH_${NAME})
|
||||
endfunction()
|
||||
|
||||
if (LLVM_ENABLE_DOXYGEN)
|
||||
llvm_find_program(dot)
|
||||
endif ()
|
||||
|
||||
if(LLVM_ENABLE_FFI)
|
||||
set(FFI_REQUIRE_INCLUDE On)
|
||||
if(LLVM_ENABLE_FFI STREQUAL FORCE_ON)
|
||||
@ -670,28 +651,6 @@ else( LLVM_ENABLE_THREADS )
|
||||
message(STATUS "Threads disabled.")
|
||||
endif()
|
||||
|
||||
if (LLVM_ENABLE_DOXYGEN)
|
||||
message(STATUS "Doxygen enabled.")
|
||||
find_package(Doxygen REQUIRED)
|
||||
|
||||
if (DOXYGEN_FOUND)
|
||||
# If we find doxygen and we want to enable doxygen by default create a
|
||||
# global aggregate doxygen target for generating llvm and any/all
|
||||
# subprojects doxygen documentation.
|
||||
if (LLVM_BUILD_DOCS)
|
||||
add_custom_target(doxygen ALL)
|
||||
endif()
|
||||
|
||||
option(LLVM_DOXYGEN_EXTERNAL_SEARCH "Enable doxygen external search." OFF)
|
||||
if (LLVM_DOXYGEN_EXTERNAL_SEARCH)
|
||||
set(LLVM_DOXYGEN_SEARCHENGINE_URL "" CACHE STRING "URL to use for external search.")
|
||||
set(LLVM_DOXYGEN_SEARCH_MAPPINGS "" CACHE STRING "Doxygen Search Mappings")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Doxygen disabled.")
|
||||
endif()
|
||||
|
||||
find_program(GOLD_EXECUTABLE NAMES ${LLVM_DEFAULT_TARGET_TRIPLE}-ld.gold ld.gold ${LLVM_DEFAULT_TARGET_TRIPLE}-ld ld DOC "The gold linker")
|
||||
set(LLVM_BINUTILS_INCDIR "" CACHE PATH
|
||||
"PATH to binutils/include containing plugin-api.h for gold plugin.")
|
||||
|
||||
@ -241,6 +241,8 @@ option(LLVM_INCLUDE_DOCS "Generate build targets for the runtimes documentation.
|
||||
option(LLVM_ENABLE_SPHINX "Use Sphinx to generate the runtimes documentation." OFF)
|
||||
option(RUNTIMES_EXECUTE_ONLY_CODE "Compile runtime libraries as execute-only." OFF)
|
||||
|
||||
include(HandleDoxygen)
|
||||
|
||||
if (RUNTIMES_EXECUTE_ONLY_CODE)
|
||||
# If a target doesn't support or recognise -mexecute-only, Clang will simply ignore the flag.
|
||||
# We can check for this case using -Werror=unused-command-line-argument.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user