Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-doc][cmake] Copy assets to build directory #95185

Conversation

ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Jun 12, 2024

While we copy the asset files, like index.js, into the
correct location in the install step, tests do not have
access to those resources in the build directory.

This patch copies the contents of the clang-doc/assets
directory into the build folder, so that they can be
used in testing.

tmatheson-arm and others added 2 commits June 12, 2024 01:10
Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Jun 12, 2024

@llvm/pr-subscribers-clang-tools-extra

Author: Paul Kirth (ilovepi)

Changes

While we copy the asset files, like index.js, into the
correct location in the install step, tests do not have
access to those resources in the build directory.

This patch copies the contents of the clang-doc/assets
directory into the build folder, so that they can be
used in testing.


Full diff: https://github.com/llvm/llvm-project/pull/95185.diff

1 Files Affected:

  • (modified) clang-tools-extra/clang-doc/tool/CMakeLists.txt (+8)
diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index fb8317b272932..c2425747562b9 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,3 +25,11 @@ install(FILES ../assets/clang-doc-default-stylesheet.css
 install(FILES ../assets/index.js
   DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
+
+add_custom_target(copy-clang-doc-assets
+  COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${CMAKE_CURRENT_SOURCE_DIR}/../assets" "${CMAKE_BINARY_DIR}/share/clang"
+  DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../assets"
+  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)

@ilovepi
Copy link
Contributor Author

ilovepi commented Jun 12, 2024

@petrhosek I'm pretty sure there's a better way to spell this, but I think we need something similar to properly test clang-doc w/o an install step.

cc: @PeterChou1

@ilovepi ilovepi requested review from Endilll, nikic and a team as code owners June 12, 2024 01:13
@ilovepi
Copy link
Contributor Author

ilovepi commented Jun 12, 2024

Jeez. IDK what I've done w/ SPR to do this, but I apologize.

@ilovepi ilovepi closed this Jun 12, 2024
@ilovepi ilovepi deleted the users/ilovepi/spr/clang-doccmake-copy-assets-to-build-directory branch June 12, 2024 01:15
ilovepi added a commit to ilovepi/llvm-project that referenced this pull request Jun 12, 2024
While we copy the asset files, like index.js, into the
correct location in the install step, tests do not have
access to those resources in the build directory.

This patch copies the contents of the clang-doc/assets
directory into the build folder, so that they can be
used in testing.

Pull Request: llvm#95185
ilovepi added a commit that referenced this pull request Jun 14, 2024
While we copy the asset files, like index.js, into the correct location
in the install step, tests do not have access to those resources in the
build directory.

This patch copies the contents of the clang-doc/assets directory into
the build folder, so that they can be used in testing.

Pull Request: #95185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants