[Lldb-commits] [lldb] [lldb] Use add_custom_command for SBLanguages.h (PR #91254)

2024-05-07 Thread Pavel Labath via lldb-commits

labath wrote:

thanks

https://github.com/llvm/llvm-project/pull/91254
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use add_custom_command for SBLanguages.h (PR #91254)

2024-05-06 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere closed 
https://github.com/llvm/llvm-project/pull/91254
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use add_custom_command for SBLanguages.h (PR #91254)

2024-05-06 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Good point. I can't imagine anything needing the SB header that doesn't need 
the rest of the framework, but if that's the case we go through a custom 
target. 

https://github.com/llvm/llvm-project/pull/91254
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use add_custom_command for SBLanguages.h (PR #91254)

2024-05-06 Thread Alex Langford via lldb-commits

https://github.com/bulbazord approved this pull request.


https://github.com/llvm/llvm-project/pull/91254
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use add_custom_command for SBLanguages.h (PR #91254)

2024-05-06 Thread Alex Langford via lldb-commits

bulbazord wrote:

This should work if there is exactly one thing that depends on the output of 
this custom command. If multiple things start depending on the generated files, 
you may end up with weird results. See:

https://cmake.org/cmake/help/latest/command/add_custom_command.html
> Do not list the output in more than one independent target that may build in 
> parallel or the instances of the rule may conflict. Instead, use the 
> [add_custom_target()](https://cmake.org/cmake/help/latest/command/add_custom_target.html#command:add_custom_target)
>  command to drive the command and make the other targets depend on that one. 
> See the [Example: Generating Files for Multiple 
> Targets](https://cmake.org/cmake/help/latest/command/add_custom_command.html#example-generating-files-for-multiple-targets)
>  below.

https://github.com/llvm/llvm-project/pull/91254
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use add_custom_command for SBLanguages.h (PR #91254)

2024-05-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Use add_custom_command instead of add_custom_target to generate SBLanguages.h.

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


1 Files Affected:

- (modified) lldb/source/API/CMakeLists.txt (+5-7) 


``diff
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index a64c0d4a333425..798a92874f13d1 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -23,13 +23,13 @@ endif()
 # Target to generate SBLanguages.h from Dwarf.def.
 set(sb_languages_file
   ${CMAKE_CURRENT_BINARY_DIR}/../../include/lldb/API/SBLanguages.h)
-add_custom_target(
-  lldb-sbapi-dwarf-enums
-  "${Python3_EXECUTABLE}"
+add_custom_command(
+  COMMENT "Generating SBLanguages.h from Dwarf.def"
+  COMMAND "${Python3_EXECUTABLE}"
   ${LLDB_SOURCE_DIR}/scripts/generate-sbapi-dwarf-enum.py
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/BinaryFormat/Dwarf.def
   -o ${sb_languages_file}
-  BYPRODUCTS ${sb_languages_file}
+  OUTPUT ${sb_languages_file}
   DEPENDS ${LLVM_MAIN_INCLUDE_DIR}/llvm/BinaryFormat/Dwarf.def
   WORKING_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR}
 )
@@ -113,9 +113,7 @@ add_lldb_library(liblldb SHARED ${option_framework}
   SystemInitializerFull.cpp
   ${lldb_python_wrapper}
   ${lldb_lua_wrapper}
-
-  DEPENDS
-lldb-sbapi-dwarf-enums
+  ${sb_languages_file}
 
   LINK_LIBS
 lldbBreakpoint

``




https://github.com/llvm/llvm-project/pull/91254
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use add_custom_command for SBLanguages.h (PR #91254)

2024-05-06 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/91254

Use add_custom_command instead of add_custom_target to generate SBLanguages.h.

>From 7fa130d2bb2e45f350ca8c3851d32bbec3332f8c Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Mon, 6 May 2024 11:48:24 -0700
Subject: [PATCH] [lldb] Use add_custom_command for SBLanguages.h

Use add_custom_command instead of add_custom_target to generate
SBLanguages.h.
---
 lldb/source/API/CMakeLists.txt | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index a64c0d4a333425..798a92874f13d1 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -23,13 +23,13 @@ endif()
 # Target to generate SBLanguages.h from Dwarf.def.
 set(sb_languages_file
   ${CMAKE_CURRENT_BINARY_DIR}/../../include/lldb/API/SBLanguages.h)
-add_custom_target(
-  lldb-sbapi-dwarf-enums
-  "${Python3_EXECUTABLE}"
+add_custom_command(
+  COMMENT "Generating SBLanguages.h from Dwarf.def"
+  COMMAND "${Python3_EXECUTABLE}"
   ${LLDB_SOURCE_DIR}/scripts/generate-sbapi-dwarf-enum.py
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/BinaryFormat/Dwarf.def
   -o ${sb_languages_file}
-  BYPRODUCTS ${sb_languages_file}
+  OUTPUT ${sb_languages_file}
   DEPENDS ${LLVM_MAIN_INCLUDE_DIR}/llvm/BinaryFormat/Dwarf.def
   WORKING_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR}
 )
@@ -113,9 +113,7 @@ add_lldb_library(liblldb SHARED ${option_framework}
   SystemInitializerFull.cpp
   ${lldb_python_wrapper}
   ${lldb_lua_wrapper}
-
-  DEPENDS
-lldb-sbapi-dwarf-enums
+  ${sb_languages_file}
 
   LINK_LIBS
 lldbBreakpoint

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits