From d69e8968542ff92abb261918dc20ed8da0e38990 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 May 2020 06:30:58 +0200 Subject: samplebinding: Fix running with Python 3.8.2 on Windows Copy the shiboken DLL into the source directory. Since it does not make sense to hardlink into the build directory and install to another directory, remove the hardlink logic. Fixes: PYSIDE-1236 Change-Id: I016dac916502f4c28785981244e29e91e61700fe Reviewed-by: Cristian Maureira-Fredes --- examples/samplebinding/CMakeLists.txt | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'examples/samplebinding') diff --git a/examples/samplebinding/CMakeLists.txt b/examples/samplebinding/CMakeLists.txt index 3852ed36f..cb61358bf 100644 --- a/examples/samplebinding/CMakeLists.txt +++ b/examples/samplebinding/CMakeLists.txt @@ -180,6 +180,7 @@ endif() # ================================= Dubious deployment section ================================ +set(windows_shiboken_shared_libraries) if(WIN32) # ========================================================================================= @@ -202,22 +203,12 @@ if(WIN32) set_target_properties(${bindings_library} PROPERTIES LINK_FLAGS "${python_additional_link_flags}") - # Add custom target to hard-link shiboken shared libraries into the build folder, so that + # Compile a list of shiboken shared libraries to be installed, so that # the user doesn't have to set the PATH manually to point to the PySide2 package. foreach(library_path ${shiboken_shared_libraries}) string(REGEX REPLACE ".lib$" ".dll" library_path ${library_path}) - get_filename_component(base_name ${library_path} NAME) - file(TO_NATIVE_PATH ${library_path} source_path) - file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${base_name}" dest_path) - add_custom_command(OUTPUT "${base_name}" - COMMAND mklink /H "${dest_path}" "${source_path}" - DEPENDS ${library_path} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Creating hardlink to shiboken shared library ${base_name}") - - # Fake target that depends on the previous one, but has special ALL keyword, which means - # it will always be executed. - add_custom_target("fake_${base_name}" ALL DEPENDS ${base_name}) + file(TO_CMAKE_PATH ${library_path} library_path) + list(APPEND windows_shiboken_shared_libraries "${library_path}") endforeach() # ========================================================================================= # !!! End of dubious section. @@ -233,7 +224,8 @@ endif() install(TARGETS ${bindings_library} ${sample_library} LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} - ) + ) +install(FILES ${windows_shiboken_shared_libraries} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}) # ============================================================================================= # !!! End of dubious section. # ============================================================================================= -- cgit v1.2.3