summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/CMakeLists.txt19
-rw-r--r--lldb/source/CMakeLists.txt17
2 files changed, 24 insertions, 12 deletions
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index 65ce88e4b97..a6f4349b7b7 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -1,10 +1,25 @@
set(LLVM_NO_RTTI 1)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-add_definitions( -DEXPORT_LIBLLDB )
+ add_definitions( -DEXPORT_LIBLLDB )
endif()
-add_lldb_library(lldbAPI
+# An OBJECT library is a special type of CMake library that produces
+# no archive, has no link interface, and no link inputs. It is like
+# a regular archive, just without the physical output. To link against
+# an OBJECT library, you reference it in the *source* file list of a
+# library using the special syntax $<TARGET_OBJECTS:lldbAPI>. This will
+# cause every object file to be passed to the linker independently, as
+# opposed to a single archive being passed to the linker.
+#
+# This is *extremely* important on Windows. lldbAPI exports all of the
+# SB classes using __declspec(dllexport). Unfortunately for technical
+# reasons it is not possible (well, extremely difficult) to get the linker
+# to propagate a __declspec(dllexport) attribute from a symbol in an
+# object file in an archive to a DLL that links against that archive.
+# The solution to this is for the DLL to link the object file directly.
+# So lldbAPI must be an OBJECT library.
+add_lldb_library(lldbAPI OBJECT
SBAddress.cpp
SBAttachInfo.cpp
SBBlock.cpp
diff --git a/lldb/source/CMakeLists.txt b/lldb/source/CMakeLists.txt
index cd5730f1b5b..93ed716e5f1 100644
--- a/lldb/source/CMakeLists.txt
+++ b/lldb/source/CMakeLists.txt
@@ -43,29 +43,26 @@ include(../cmake/LLDBDependencies.cmake)
add_lldb_library(liblldb SHARED
lldb.cpp
lldb-log.cpp
+ $<TARGET_OBJECTS:lldbAPI>
${LLDB_WRAP_PYTHON}
${LLDB_VERS_GENERATED_FILE}
)
+set_target_properties(liblldb
+ PROPERTIES
+ VERSION ${LLDB_VERSION}
+ )
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
- target_link_libraries(liblldb PRIVATE lldbAPI)
- # Only MSVC has the ABI compatibility and avoids using FindPythonLibs,
+ # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
# so only it needs to explicitly link against ${PYTHON_LIBRARY}
- if (MSVC)
+ if (MSVC AND NOT LLDB_DISABLE_PYTHON)
target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
endif()
-
- set_target_properties(liblldb
- PROPERTIES
- OUTPUT_NAME liblldb
- VERSION ${LLDB_VERSION}
- )
else()
set_target_properties(liblldb
PROPERTIES
OUTPUT_NAME lldb
- VERSION ${LLDB_VERSION}
)
endif()
OpenPOWER on IntegriCloud