From e0b33ee8a605c5366e0b2e26e8d30192d9b742f7 Mon Sep 17 00:00:00 2001 From: hauptmech Date: Mon, 26 Feb 2018 14:36:12 +1300 Subject: [PATCH] Fix RPATH not removed in shared object file for python Build pcbnew_kiface files as object target that can then be linked in to pcbnew.kiface and _pcbnew.so Only create _pcbnew.so target if scripting modules is enabled. For linux builds only. --- pcbnew/CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 520dc11664..3ec6bbc234 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -608,12 +608,15 @@ if( PCBNEW_LINK_MAPS ) endif() # the main pcbnew program, in DSO form. -add_library( pcbnew_kiface MODULE +add_library( pcbnew_kiface_objects OBJECT pcbnew.cpp ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS} ${PCBNEW_SCRIPTING_SRCS} ) + +add_library( pcbnew_kiface MODULE $ ) + set_target_properties( pcbnew_kiface PROPERTIES # Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like # _pcbnew.so, _pcbnew.dll, or _pcbnew.kiface @@ -640,7 +643,7 @@ if( ${OPENMP_FOUND} ) ) endif() -target_link_libraries( pcbnew_kiface +set( PCBNEW_KIFACE_LIBRARIES 3d-viewer pcbcommon pnsrouter @@ -660,6 +663,9 @@ target_link_libraries( pcbnew_kiface ${OPENMP_LIBRARIES} ) + +target_link_libraries( pcbnew_kiface ${PCBNEW_KIFACE_LIBRARIES} ) + set_source_files_properties( pcbnew.cpp PROPERTIES # The KIFACE is in pcbnew.cpp, export it: COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL" @@ -777,9 +783,12 @@ if( KICAD_SCRIPTING_MODULES ) ) add_dependencies( ScriptingModulesPcbnewSoCopy ScriptingWxpythonCopy ) set( PYMOD_EXT "so" ) - else() # only linux remains among supported platforms - install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} ) + add_library( pcbnew_python MODULE $ ) + target_link_libraries( pcbnew_python ${PCBNEW_KIFACE_LIBRARIES} ) + set_target_properties( pcbnew_python PROPERTIES OUTPUT_NAME pcbnew PREFIX "_" SUFFIX ".so" ) + install( TARGETS pcbnew_python DESTINATION ${PYTHON_DEST} COMPONENT binary ) + set( PYMOD_EXT "so" ) endif()