[Lldb-commits] [PATCH] D25680: [cmake] Make dependencies of lldb libraries private, take 2

2016-10-18 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

Looks fine, thanks.


Repository:
  rL LLVM

https://reviews.llvm.org/D25680



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


[Lldb-commits] [PATCH] D25680: [cmake] Make dependencies of lldb libraries private, take 2

2016-10-18 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284466: [cmake] Make dependencies of lldb libraries private, 
take 2 (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D25680?vs=74854&id=74967#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25680

Files:
  lldb/trunk/cmake/modules/AddLLDB.cmake
  lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
  lldb/trunk/tools/argdumper/CMakeLists.txt
  lldb/trunk/tools/driver/CMakeLists.txt
  lldb/trunk/tools/lldb-mi/CMakeLists.txt

Index: lldb/trunk/cmake/modules/AddLLDB.cmake
===
--- lldb/trunk/cmake/modules/AddLLDB.cmake
+++ lldb/trunk/cmake/modules/AddLLDB.cmake
@@ -4,7 +4,7 @@
   endif()
 
   if(${targetkind} MATCHES "SHARED")
-set(LINK_KEYWORD PUBLIC)
+set(LINK_KEYWORD PRIVATE)
   endif()
 
   if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE")
@@ -56,19 +56,20 @@
   if (PARAM_OBJECT)
 add_library(${name} ${libkind} ${srcs})
   else()
-llvm_add_library(${name} ${libkind} DISABLE_LLVM_LINK_LLVM_DYLIB ${srcs})
-
-lldb_link_common_libs(${name} "${libkind}")
-
 if (PARAM_SHARED)
   if (LLDB_LINKER_SUPPORTS_GROUPS)
-target_link_libraries(${name} PUBLIC
--Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
+llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
+-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group
+-Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group
+  )
   else()
-target_link_libraries(${name} PUBLIC ${CLANG_USED_LIBS})
+llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
+${LLDB_USED_LIBS} ${CLANG_USED_LIBS}
+  )
   endif()
+else()
+  llvm_add_library(${name} ${libking} ${srcs})
 endif()
-llvm_config(${name} ${LLVM_LINK_COMPONENTS} ${LLVM_PRIVATE_LINK_COMPONENTS})
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
   if (PARAM_SHARED)
@@ -101,7 +102,7 @@
 
 macro(add_lldb_executable name)
   cmake_parse_arguments(ARG "INCLUDE_IN_FRAMEWORK" "" "" ${ARGN})
-  add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARG_UNPARSED_ARGUMENTS})
+  add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
   set_target_properties(${name} PROPERTIES
 FOLDER "lldb executables")
 
Index: lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(LLVM_PRIVATE_LINK_COMPONENTS
+set(LLVM_LINK_COMPONENTS
 DebugInfoPDB)
 
 add_lldb_library(lldbPluginSymbolFilePDB
Index: lldb/trunk/tools/driver/CMakeLists.txt
===
--- lldb/trunk/tools/driver/CMakeLists.txt
+++ lldb/trunk/tools/driver/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_executable(lldb
   Driver.cpp
   Platform.cpp
@@ -18,9 +20,14 @@
 endif()
 
 target_link_libraries(lldb liblldb)
-# TODO: why isn't this done by add_lldb_executable?
-#target_link_libraries(lldb ${LLDB_USED_LIBS})
-#llvm_config(lldb ${LLVM_LINK_COMPONENTS})
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+  # Windows does not have getopt support, so it relies on the one provided by
+  # liblldb. However, getopt is not a part of the liblldb interfact, so we have
+  # to link against the constituent libraries manually. Note that this is
+  # extremely scary as it introduces ODR violations, and it should go away as
+  # soon as possible.
+  target_link_libraries(lldb ${LLDB_USED_LIBS})
+endif()
 
 set_target_properties(lldb PROPERTIES VERSION ${LLDB_VERSION})
 
Index: lldb/trunk/tools/argdumper/CMakeLists.txt
===
--- lldb/trunk/tools/argdumper/CMakeLists.txt
+++ lldb/trunk/tools/argdumper/CMakeLists.txt
@@ -1,8 +1,16 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_executable(lldb-argdumper INCLUDE_IN_FRAMEWORK
   argdumper.cpp
   )
 
-target_link_libraries(lldb-argdumper liblldb)
+if (LLDB_LINKER_SUPPORTS_GROUPS)
+  target_link_libraries(lldb-argdumper -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+else()
+  target_link_libraries(lldb-argdumper ${LLDB_USED_LIBS})
+endif()
+llvm_config(lldb-argdumper ${LLVM_LINK_COMPONENTS})
+
 
 install(TARGETS lldb-argdumper
   RUNTIME DESTINATION bin)
Index: lldb/trunk/tools/lldb-mi/CMakeLists.txt
===
--- lldb/trunk/tools/lldb-mi/CMakeLists.txt
+++ lldb/trunk/tools/lldb-mi/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 set(LLDB_MI_SOURCES
   MICmdArgContext.cpp
   MICmdArgSet.cpp
__

[Lldb-commits] [PATCH] D25680: [cmake] Make dependencies of lldb libraries private, take 2

2016-10-18 Thread Pavel Labath via lldb-commits
labath added subscribers: krytarowski, emaste, sylvestre.ledru.
labath added a comment.

@sylvestre.ledru : I believe this will fix the LINK_LLVM_DYLIB issue you were 
encountering. Let me know if you're still having problems after this.
@emaste @krytarowski : This has potential to break linking on *BSD. I'll keep 
an eye on the bots and respond accordingly.


https://reviews.llvm.org/D25680



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


[Lldb-commits] [PATCH] D25680: [cmake] Make dependencies of lldb libraries private, take 2

2016-10-17 Thread Chris Bieneman via lldb-commits
beanz accepted this revision.
beanz added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D25680



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


[Lldb-commits] [PATCH] D25680: [cmake] Make dependencies of lldb libraries private, take 2

2016-10-17 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: zturner, beanz.
labath added a subscriber: lldb-commits.
Herald added subscribers: mgorny, ki.stfu.

The dependencies of our libraries (only liblldb, really) we marked as public, 
which caused all
their dependencies to be repeated when linking any executables to them. This is 
a problem because
then all the .a files could end up being linked twice, once to liblldb and once
again to to the executable linking against liblldb (lldb, lldb-mi). As it turns 
out,
our build actually depends on this behavior:

- on windows, lldb does not have getopt, so it pulls it from inside liblldb, 
even though getopt is not a part of the exported interface of liblldb (maybe 
some of the bsd variants have this problem as well)
- lldb-mi uses llvm, which again is not exported by liblldb

This change does not actually fix these problems (that is going to be a hard
one), but it does make them explicit by moving this magic from add_lldb_library
to the places the executable targets are defined. That way, I can link the
additional .a files only on targets that really need it, and the other targets
can build cleanly and make sure we don't regress further. It also fixes the
LLVM_LINK_LLVM_DYLIB build on linux.


https://reviews.llvm.org/D25680

Files:
  cmake/modules/AddLLDB.cmake
  source/Plugins/SymbolFile/PDB/CMakeLists.txt
  tools/argdumper/CMakeLists.txt
  tools/driver/CMakeLists.txt
  tools/lldb-mi/CMakeLists.txt

Index: tools/lldb-mi/CMakeLists.txt
===
--- tools/lldb-mi/CMakeLists.txt
+++ tools/lldb-mi/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 set(LLDB_MI_SOURCES
   MICmdArgContext.cpp
   MICmdArgSet.cpp
Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_executable(lldb
   Driver.cpp
   Platform.cpp
@@ -18,9 +20,14 @@
 endif()
 
 target_link_libraries(lldb liblldb)
-# TODO: why isn't this done by add_lldb_executable?
-#target_link_libraries(lldb ${LLDB_USED_LIBS})
-#llvm_config(lldb ${LLVM_LINK_COMPONENTS})
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+  # Windows does not have getopt support, so it relies on the one provided by
+  # liblldb. However, getopt is not a part of the liblldb interfact, so we have
+  # to link against the constituent libraries manually. Note that this is
+  # extremely scary as it introduces ODR violations, and it should go away as
+  # soon as possible.
+  target_link_libraries(lldb ${LLDB_USED_LIBS})
+endif()
 
 set_target_properties(lldb PROPERTIES VERSION ${LLDB_VERSION})
 
Index: tools/argdumper/CMakeLists.txt
===
--- tools/argdumper/CMakeLists.txt
+++ tools/argdumper/CMakeLists.txt
@@ -1,8 +1,16 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_executable(lldb-argdumper INCLUDE_IN_FRAMEWORK
   argdumper.cpp
   )
 
-target_link_libraries(lldb-argdumper liblldb)
+if (LLDB_LINKER_SUPPORTS_GROUPS)
+  target_link_libraries(lldb-argdumper -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+else()
+  target_link_libraries(lldb-argdumper ${LLDB_USED_LIBS})
+endif()
+llvm_config(lldb-argdumper ${LLVM_LINK_COMPONENTS})
+
 
 install(TARGETS lldb-argdumper
   RUNTIME DESTINATION bin)
Index: source/Plugins/SymbolFile/PDB/CMakeLists.txt
===
--- source/Plugins/SymbolFile/PDB/CMakeLists.txt
+++ source/Plugins/SymbolFile/PDB/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(LLVM_PRIVATE_LINK_COMPONENTS
+set(LLVM_LINK_COMPONENTS
 DebugInfoPDB)
 
 add_lldb_library(lldbPluginSymbolFilePDB
Index: cmake/modules/AddLLDB.cmake
===
--- cmake/modules/AddLLDB.cmake
+++ cmake/modules/AddLLDB.cmake
@@ -4,7 +4,7 @@
   endif()
 
   if(${targetkind} MATCHES "SHARED")
-set(LINK_KEYWORD PUBLIC)
+set(LINK_KEYWORD PRIVATE)
   endif()
 
   if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE")
@@ -56,19 +56,20 @@
   if (PARAM_OBJECT)
 add_library(${name} ${libkind} ${srcs})
   else()
-llvm_add_library(${name} ${libkind} DISABLE_LLVM_LINK_LLVM_DYLIB ${srcs})
-
-lldb_link_common_libs(${name} "${libkind}")
-
 if (PARAM_SHARED)
   if (LLDB_LINKER_SUPPORTS_GROUPS)
-target_link_libraries(${name} PUBLIC
--Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
+llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
+-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group
+-Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group
+  )
   else()
-target_link_libraries(${name} PUBLIC ${CLANG_USED_LIBS})
+llvm_add_libra