From 44a8f1e6e6a485228f1547798d89d64ed13b97b9 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 23 Jun 2022 00:27:35 +0100 Subject: [PATCH] Create the symlink for the python module in the build tree as well The unit tests need the python module to be loadable, so there needs to also be a symlink to the kiface inside the build directory. --- pcbnew/CMakeLists.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index b6fbe0eadb..622d1059c0 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -849,10 +849,6 @@ if( APPLE ) COMMAND ${CMAKE_COMMAND} -E copy ${OSX_BUNDLE_BUILD_KIFACE_DIR}/_pcbnew.kiface _pcbnew.${PYMOD_EXT} COMMENT "Creating python's pcbnew native module _pcbnew.${PYMOD_EXT} for command line use." ) - add_custom_target( - pcbnew_python_module ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.${PYMOD_EXT} - ) elseif( WIN32 ) # For phase 1, copy _pcbnew.kiface to the python module. add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.${PYMOD_EXT} @@ -860,12 +856,22 @@ elseif( WIN32 ) COMMAND ${CMAKE_COMMAND} -E copy _pcbnew${KIFACE_SUFFIX} _pcbnew.${PYMOD_EXT} COMMENT "Creating python's pcbnew native module _pcbnew.${PYMOD_EXT} for command line use." ) - add_custom_target( - pcbnew_python_module ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.${PYMOD_EXT} +else() + # For linux, just create a symlink in the build directory to ensure the unit tests can find the library + # We don't actually do anything with this symlink though, since the install process will create the proper + # one for the install tree. + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.${PYMOD_EXT} + DEPENDS pcbnew_kiface + COMMAND ${CMAKE_COMMAND} -E create_symlink _pcbnew${KIFACE_SUFFIX} _pcbnew.${PYMOD_EXT} + COMMENT "Symlinking _pcbnew.${PYMOD_EXT} to _pcbnew${KIFACE_SUFFIX}." ) endif() +add_custom_target( + pcbnew_python_module ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.${PYMOD_EXT} + ) + if( APPLE ) # If we don't have wxPython, then we must create the site-packages directory