[clang-tools-extra] [llvm] [clang-doc] fix bug introduced by asset test (PR #97540)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 21:39:19 PDT 2024


https://github.com/PeterChou1 updated https://github.com/llvm/llvm-project/pull/97540

>From b8dd4f6f2005d2e08ae13023905d0f36edd6348b Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 3 Jul 2024 04:42:33 -0400
Subject: [PATCH 1/9] [clang-doc] fix path bug introduced by asset test

---
 clang-tools-extra/clang-doc/tool/CMakeLists.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index e93a5728d6b6b..3fd41f187a617 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,7 +25,11 @@ set(assets
 )
 
 set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")
-set(resource_dir "${CMAKE_BINARY_DIR}/share/clang-doc")
+if(MSVC)
+  set(resource_dir "${CMAKE_BINARY_DIR}/$<CONFIG>/share/clang-doc")
+else()
+  set(resource_dir "${CMAKE_BINARY_DIR}/share/clang-doc")
+endif()
 set(out_files)
 
 function(copy_files_to_dst src_dir dst_dir file)
@@ -52,4 +56,4 @@ add_custom_target(copy-clang-doc-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)
+add_dependencies(clang-doc copy-clang-doc-assets)
\ No newline at end of file

>From cf993cfeeab18be6aa434e159fb625456183d4da Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 3 Jul 2024 13:49:26 -0400
Subject: [PATCH 2/9] [clang-doc] modify cmake file to fix asset install path

---
 clang-tools-extra/clang-doc/tool/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index 3fd41f187a617..ddaf8cd4cdbd6 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,7 +25,7 @@ set(assets
 )
 
 set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")
-if(MSVC)
+if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
   set(resource_dir "${CMAKE_BINARY_DIR}/$<CONFIG>/share/clang-doc")
 else()
   set(resource_dir "${CMAKE_BINARY_DIR}/share/clang-doc")

>From e389b78848127be9753797d355d196c03e3974fd Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 3 Jul 2024 14:14:56 -0400
Subject: [PATCH 3/9] [clang-doc] fix nit

---
 clang-tools-extra/clang-doc/tool/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index ddaf8cd4cdbd6..aaf3c3b8734c8 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -56,4 +56,4 @@ add_custom_target(copy-clang-doc-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)
\ No newline at end of file
+add_dependencies(clang-doc copy-clang-doc-assets)

>From 4733341a26ef3b6faa1a00d2e53b0033de440eb7 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 3 Jul 2024 16:04:37 -0400
Subject: [PATCH 4/9] [llvm] modify cmake list to add shared directory

---
 clang-tools-extra/clang-doc/tool/CMakeLists.txt | 7 +------
 llvm/CMakeLists.txt                             | 6 ++++++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index aaf3c3b8734c8..c908cac9ce2a5 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,11 +25,6 @@ set(assets
 )
 
 set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")
-if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
-  set(resource_dir "${CMAKE_BINARY_DIR}/$<CONFIG>/share/clang-doc")
-else()
-  set(resource_dir "${CMAKE_BINARY_DIR}/share/clang-doc")
-endif()
 set(out_files)
 
 function(copy_files_to_dst src_dir dst_dir file)
@@ -48,7 +43,7 @@ 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})
+  copy_files_to_dst(${asset_dir} ${LLVM_SHARE_DIR} ${f})
 endforeach(f)
 
 add_custom_target(copy-clang-doc-assets
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 91a2b6181ce0a..0c02498aa6fce 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -452,6 +452,12 @@ if(WIN32 OR CYGWIN)
 else()
   set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 endif()
+# set shared directory
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+  set(LLVM_SHARE_DIR "${CMAKE_BINARY_DIR}/$<CONFIG>/share")
+else()
+  set(LLVM_SHARE_DIR "${CMAKE_BINARY_DIR}/share")
+endif()
 
 # Each of them corresponds to llvm-config's.
 set(LLVM_TOOLS_BINARY_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) # --bindir

>From 3433bfecffe25077fc1749be6c30512e2e47eadb Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 3 Jul 2024 16:08:29 -0400
Subject: [PATCH 5/9] [clang-doc] readd resource directory

---
 clang-tools-extra/clang-doc/tool/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index c908cac9ce2a5..b88b51ce0d74a 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,6 +25,7 @@ set(assets
 )
 
 set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")
+set(resource_dir "${LLVM_SHARE_DIR}/clang-doc")
 set(out_files)
 
 function(copy_files_to_dst src_dir dst_dir file)
@@ -43,7 +44,7 @@ foreach(f ${assets})
   install(FILES ${asset_dir}/${f}
     DESTINATION "${CMAKE_INSTALL_DATADIR}/clang-doc"
     COMPONENT clang-doc)
-  copy_files_to_dst(${asset_dir} ${LLVM_SHARE_DIR} ${f})
+  copy_files_to_dst(${asset_dir} ${resource_dir} ${f})
 endforeach(f)
 
 add_custom_target(copy-clang-doc-assets

>From 8819740121bfe25ad2b1e5ed48c2984477eeff19 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 3 Jul 2024 18:47:44 -0400
Subject: [PATCH 6/9] [clang-doc] use LLVM_RUNTIME_OUTPUT_INTDIR

---
 clang-tools-extra/clang-doc/tool/CMakeLists.txt |  2 +-
 llvm/CMakeLists.txt                             | 10 ++--------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index b88b51ce0d74a..601a0460d76b3 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,7 +25,7 @@ set(assets
 )
 
 set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")
-set(resource_dir "${LLVM_SHARE_DIR}/clang-doc")
+set(resource_dir "${LLVM_RUNTIME_OUTPUT_INTDIR}/../share/clang-doc")
 set(out_files)
 
 function(copy_files_to_dst src_dir dst_dir file)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 0c02498aa6fce..33d5190a05389 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -452,12 +452,6 @@ if(WIN32 OR CYGWIN)
 else()
   set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 endif()
-# set shared directory
-if(CMAKE_GENERATOR MATCHES "Visual Studio")
-  set(LLVM_SHARE_DIR "${CMAKE_BINARY_DIR}/$<CONFIG>/share")
-else()
-  set(LLVM_SHARE_DIR "${CMAKE_BINARY_DIR}/share")
-endif()
 
 # Each of them corresponds to llvm-config's.
 set(LLVM_TOOLS_BINARY_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) # --bindir
@@ -578,11 +572,11 @@ option(LLVM_ENABLE_Z3_SOLVER
 )
 
 if (LLVM_ENABLE_Z3_SOLVER)
-  find_package(Z3 4.8.9)
+  find_package(Z3 4.7.1)
 
   if (LLVM_Z3_INSTALL_DIR)
     if (NOT Z3_FOUND)
-      message(FATAL_ERROR "Z3 >= 4.8.9 has not been found in LLVM_Z3_INSTALL_DIR: ${LLVM_Z3_INSTALL_DIR}.")
+      message(FATAL_ERROR "Z3 >= 4.7.1 has not been found in LLVM_Z3_INSTALL_DIR: ${LLVM_Z3_INSTALL_DIR}.")
     endif()
   endif()
 

>From 50bc61fdf7a5a42ed6adea9a49b0d83f83891640 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 3 Jul 2024 18:49:23 -0400
Subject: [PATCH 7/9] [llvm] fix version

---
 llvm/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 33d5190a05389..91a2b6181ce0a 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -572,11 +572,11 @@ option(LLVM_ENABLE_Z3_SOLVER
 )
 
 if (LLVM_ENABLE_Z3_SOLVER)
-  find_package(Z3 4.7.1)
+  find_package(Z3 4.8.9)
 
   if (LLVM_Z3_INSTALL_DIR)
     if (NOT Z3_FOUND)
-      message(FATAL_ERROR "Z3 >= 4.7.1 has not been found in LLVM_Z3_INSTALL_DIR: ${LLVM_Z3_INSTALL_DIR}.")
+      message(FATAL_ERROR "Z3 >= 4.8.9 has not been found in LLVM_Z3_INSTALL_DIR: ${LLVM_Z3_INSTALL_DIR}.")
     endif()
   endif()
 

>From 0f63fd21e3b525aa4d0b5165a51c8698f7d757e7 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Thu, 4 Jul 2024 00:35:38 -0400
Subject: [PATCH 8/9] [llvm] introduce new cmake global variable
 LLVM_SHARE_OUTPUT_INTDIR

---
 clang-tools-extra/clang-doc/tool/CMakeLists.txt | 2 +-
 llvm/CMakeLists.txt                             | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index 601a0460d76b3..5f67899d62abb 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,7 +25,7 @@ set(assets
 )
 
 set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")
-set(resource_dir "${LLVM_RUNTIME_OUTPUT_INTDIR}/../share/clang-doc")
+set(resource_dir "${LLVM_SHARE_OUTPUT_INTDIR}/clang-doc)
 set(out_files)
 
 function(copy_files_to_dst src_dir dst_dir file)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 91a2b6181ce0a..ad593ce2c6633 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -446,6 +446,7 @@ mark_as_advanced(LLVM_EXAMPLES_INSTALL_DIR)
 # They are used as destination of target generators.
 set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
 set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(LLVM_SHARE_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/share)
 if(WIN32 OR CYGWIN)
   # DLL platform -- put DLLs into bin.
   set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})

>From f364f412fe8960dbfaa72c0db53fb0275d2017d2 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Thu, 4 Jul 2024 00:39:03 -0400
Subject: [PATCH 9/9] [clang-doc] fix syntax error

---
 clang-tools-extra/clang-doc/tool/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index 5f67899d62abb..19c17a8f3a51f 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,7 +25,7 @@ set(assets
 )
 
 set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")
-set(resource_dir "${LLVM_SHARE_OUTPUT_INTDIR}/clang-doc)
+set(resource_dir "${LLVM_SHARE_OUTPUT_INTDIR}/clang-doc")
 set(out_files)
 
 function(copy_files_to_dst src_dir dst_dir file)



More information about the cfe-commits mailing list