1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
add_clang_tool(clang-doc
ClangDocMain.cpp
)
clang_target_link_libraries(clang-doc
PRIVATE
clangAST
clangASTMatchers
clangBasic
clangDocSupport
clangFrontend
clangTooling
clangToolingCore
)
target_link_libraries(clang-doc
PRIVATE
clangDoc
)
set(assets
index.js
mustache-index.js
clang-doc-default-stylesheet.css
clang-doc-mustache.css
class-template.mustache
comment-template.mustache
enum-template.mustache
function-template.mustache
namespace-template.mustache
template.mustache
)
set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")
set(resource_dir "${LLVM_RUNTIME_OUTPUT_INTDIR}/../share/clang-doc")
set(out_files)
function(copy_files_to_dst src_dir dst_dir file)
set(src "${src_dir}/${file}")
set(dst "${dst_dir}/${file}")
add_custom_command(OUTPUT ${dst}
DEPENDS ${src}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
COMMENT "Copying ${file} to ${dst_dir}"
)
list(APPEND out_files ${dst})
set(out_files ${out_files} PARENT_SCOPE)
endfunction(copy_files_to_dst)
foreach(f ${assets})
install(FILES ${asset_dir}/${f}
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang-doc"
COMPONENT clang-doc)
copy_files_to_dst(${asset_dir} ${resource_dir} ${f})
endforeach(f)
add_custom_target(copy-clang-doc-assets
DEPENDS ${out_files}
COMMENT "Copying Clang-Doc Assets"
)
set_target_properties(copy-clang-doc-assets PROPERTIES FOLDER "Clang-Doc/Assets")
add_dependencies(clang-doc copy-clang-doc-assets)
|