From 9441e15ebc368a88b2654dc51b0d7ccc278a20b3 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 19 Apr 2017 16:21:46 +0100 Subject: [PATCH] Make sure linking static python exports all of its symbols * This is needed to correctly load C modules like math, ctypes, etc --- qrenderdoc/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qrenderdoc/CMakeLists.txt b/qrenderdoc/CMakeLists.txt index 6cb4d7980..728177fc7 100644 --- a/qrenderdoc/CMakeLists.txt +++ b/qrenderdoc/CMakeLists.txt @@ -80,6 +80,13 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") find_package(PySide2) +set(PYTHON_LINK "${PYTHON_LIBRARY}") + +# ensure we link the whole python library so that modules have all the exports they need +if(STATIC_QRENDERDOC) + set(PYTHON_LINK "-rdynamic -Wl,--whole-archive ${PYTHON_LINK} -Wl,--no-whole-archive") +endif() + # Output our configuration for qmake. We output this to a separate file so that # the user can then open the qrenderdoc.pro in qt creator and be able to build # with these configuration entries propagated for e.g. linking against libraries @@ -101,7 +108,7 @@ file(WRITE "\n" # include and link against python "INCLUDEPATH+=${PYTHON_INCLUDE_DIR}\n" - "LIBS+=${PYTHON_LIBRARY}\n" + "LIBS+=${PYTHON_LINK}\n" "\n" "RENDERDOC_VERSION=${RENDERDOC_VERSION}\n" "\n"