xiaobai created this revision.
xiaobai added reviewers: sas, labath.
Herald added a subscriber: mgorny.

Currently, if you build lldb-framework the entire framework doesn't
actually build. In order to build the entire framework, you need to actually
build lldb-suite. This abstraction doesn't feel quite right because
lldb-framework truly does depend on lldb-suite (liblldb + related tools).

In this change I want to invert their dependency. This will mean that lldb and
finish_swig will depend on lldb-framework in a framework build, and lldb-suite
otherwise. Instead of adding conditional logic everywhere to handle this, I
introduce LLDB_SUITE_TARGET to handle it.

I tested this by building lldb with:

  cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLDB_CODESIGN_IDENTITY=""
  -DLLDB_BUILD_FRAMEWORK=1 -DLLDB_USE_SYSTEM_SIX=1 -DCMAKE_INSTALL_PREFIX=""

and

  ninja lldb


https://reviews.llvm.org/D49406

Files:
  CMakeLists.txt
  cmake/modules/LLDBFramework.cmake
  source/API/CMakeLists.txt
  tools/driver/CMakeLists.txt

Index: tools/driver/CMakeLists.txt
===================================================================
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -24,4 +24,4 @@
   add_definitions( -DIMPORT_LIBLLDB )
 endif()
 
-add_dependencies(lldb lldb-suite)
+add_dependencies(lldb ${LLDB_SUITE_TARGET})
Index: source/API/CMakeLists.txt
===================================================================
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -91,6 +91,8 @@
     Support
   )
 
+add_dependencies(lldb-suite liblldb)
+
 if (MSVC)
   set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
 else()
@@ -108,10 +110,20 @@
     PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
 endif ()
 
-set_target_properties(liblldb
-  PROPERTIES
-  VERSION ${LLDB_VERSION}
-  )
+if (LLDB_BUILD_FRAMEWORK)
+  set_target_properties(liblldb
+    PROPERTIES
+    OUTPUT_NAME LLDB
+    FRAMEWORK ON
+    FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
+    MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist
+    LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_DIR})
+else()
+  set_target_properties(liblldb
+    PROPERTIES
+    VERSION ${LLDB_VERSION}
+    OUTPUT_NAME lldb)
+endif()
 
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   if (NOT LLDB_EXPORT_ALL_SYMBOLS)
@@ -134,11 +146,6 @@
   if (MSVC AND NOT LLDB_DISABLE_PYTHON)
     target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
   endif()
-else()
-  set_target_properties(liblldb
-    PROPERTIES
-    OUTPUT_NAME lldb
-    )
 endif()
 
 if (LLDB_WRAP_PYTHON)
Index: cmake/modules/LLDBFramework.cmake
===================================================================
--- cmake/modules/LLDBFramework.cmake
+++ cmake/modules/LLDBFramework.cmake
@@ -33,13 +33,8 @@
 endif()
 
 set_target_properties(liblldb PROPERTIES
-  OUTPUT_NAME LLDB
-  FRAMEWORK On
-  FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
-  MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist
-  LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}
   PUBLIC_HEADER "${framework_headers}")
 
 add_dependencies(lldb-framework
-  liblldb
-  lldb-framework-headers)
+  lldb-framework-headers
+  lldb-suite)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -40,6 +40,7 @@
 # lldb-suite is a dummy target that encompasses all the necessary tools and
 # libraries for building a fully-functioning liblldb.
 add_custom_target(lldb-suite)
+set(LLDB_SUITE_TARGET lldb-suite)
 
 option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off)
 if(LLDB_BUILD_FRAMEWORK)
@@ -55,6 +56,7 @@
   set(PRODUCT_NAME "LLDB")
   set(EXECUTABLE_NAME "LLDB")
   set(CURRENT_PROJECT_VERSION "360.99.0")
+  set(LLDB_SUITE_TARGET lldb-framework)
 
   set(LLDB_FRAMEWORK_DIR
     ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
@@ -163,9 +165,7 @@
 if (LLDB_BUILD_FRAMEWORK)
   add_custom_target(lldb-framework)
   include(LLDBFramework)
-  add_dependencies(lldb-suite lldb-framework)
 endif()
-add_dependencies(lldb-suite liblldb)
 
 if (NOT LLDB_DISABLE_PYTHON)
     # Add a Post-Build Event to copy over Python files and create the symlink
@@ -187,7 +187,7 @@
         COMMENT "Python script sym-linking LLDB Python API")
 
     # We depend on liblldb and lldb-argdumper being built before we can do this step.
-    add_dependencies(finish_swig lldb-suite)
+    add_dependencies(finish_swig ${LLDB_SUITE_TARGET})
 
     # If we build the readline module, we depend on that happening
     # first.
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to