Skip to content

Fix bridge lib copy on windows #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,13 @@ target_include_directories(${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)

# List of absolute paths to libraries that should be bundled with the plugin
set(openpgp_bundled_libraries
""
PARENT_SCOPE
)

set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
# Make the "install" step default, as it's required to run.
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()

Comment on lines 18 to 19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

BINARY_NAME is undefined – BUILD_BUNDLE_DIR will expand to an empty path at configure-time
BUILD_BUNDLE_DIR is set using ${BINARY_NAME}, but that variable is never declared in this file (and is not part of the standard Flutter-plugin template). A missing value will silently evaluate to an empty string, breaking any downstream logic that relies on BUILD_BUNDLE_DIR.

-set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
+# If the intent is the plugin DLL directory, use the target created above.
+set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${PLUGIN_NAME}>")
#
# Alternatively, drop the variable entirely if nothing consumes it any more.
🤖 Prompt for AI Agents
In windows/CMakeLists.txt around lines 18 to 19, the variable BINARY_NAME is
used but never defined, causing BUILD_BUNDLE_DIR to expand to an empty path.
Define BINARY_NAME appropriately before its usage, typically by setting it to
the target binary name or retrieving it from a relevant variable, so that
BUILD_BUNDLE_DIR resolves correctly and downstream logic depending on it
functions as expected.

set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
set(LIBOPENPGP_BRIDGE "libopenpgp_bridge.dll")
set(LIBOPENPGP_BRIDGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/shared/${LIBOPENPGP_BRIDGE}")
install(CODE "file(REMOVE_RECURSE \"${INSTALL_BUNDLE_LIB_DIR}/${LIBOPENPGP_BRIDGE}\")" COMPONENT Runtime)
install(FILES "${LIBOPENPGP_BRIDGE_PATH}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)

# List of absolute paths to libraries that should be bundled with the plugin
set(openpgp_bundled_libraries
${LIBOPENPGP_BRIDGE_PATH}
PARENT_SCOPE
)