Skip to content

Commit

Permalink
Try to solve issues with win32 release ci.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Aug 23, 2023
1 parent 73adaf7 commit 01ab2a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions source/loaders/py_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ else()
find_package(Python3 COMPONENTS Development REQUIRED)
endif()

# Copy Python DLL into project output directory
# TODO: https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies
# TODO: https://gist.github.com/micahsnyder/5d98ac8548b429309ec5a35bca9366da
include(Portability)

if(PROJECT_OS_WIN)
string(REGEX REPLACE "[.]lib$" ".dll" Python3_LIBRARY_NAME ${Python3_LIBRARY})
elseif(PROJECT_OS_MINGW)
string(REGEX REPLACE "[.]a$" ".dll" Python3_LIBRARY_NAME ${Python3_LIBRARY})
endif()

if(Python3_LIBRARY_NAME)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_OUTPUT_DIR})
file(COPY ${Python3_LIBRARY_NAME} DESTINATION ${PROJECT_OUTPUT_DIR})
endif()

#
# Plugin name and options
#
Expand Down Expand Up @@ -196,3 +212,14 @@ install(TARGETS ${target}
LIBRARY DESTINATION ${INSTALL_SHARED} COMPONENT runtime
ARCHIVE DESTINATION ${INSTALL_LIB} COMPONENT dev
)

# Runtime (pack Python DLL in windows)
# TODO: https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies
# TODO: https://gist.github.com/micahsnyder/5d98ac8548b429309ec5a35bca9366da
if(Python3_LIBRARY_NAME)
install(FILES
${Python3_LIBRARY_NAME}
DESTINATION ${INSTALL_LIB}
COMPONENT runtime
)
endif()
2 changes: 1 addition & 1 deletion source/ports/rb_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif()
# so there is no need to make it work anyway. In any case this project should be reviewed.
include(Portability)

if(PROJECT_OS_FAMILY STREQUAL win32 OR PROJECT_OS_FAMILY STREQUAL macos OR PROJECT_OS_NAME STREQUAL MinGW)
if(PROJECT_OS_FAMILY STREQUAL win32 OR PROJECT_OS_FAMILY STREQUAL macos)
message(WARNING "rb_port does not work on Windows neither MacOS")
return()
endif()
Expand Down

0 comments on commit 01ab2a0

Please sign in to comment.