From 9bcaa6ab98ad2cf1a935faf24890d31f6437620f Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Sat, 31 Oct 2026 08:40:18 +0000 Subject: [PATCH] Fix MCP bridge build failure on windows. --- plugins/feature/mcpserver/bridge/CMakeLists.txt | 7 +++++++ .../feature/mcpserver/bridge/run-tools-dump.cmake | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/plugins/feature/mcpserver/bridge/CMakeLists.txt b/plugins/feature/mcpserver/bridge/CMakeLists.txt index 10b89c41a..f2dddfa62 100644 --- a/plugins/feature/mcpserver/bridge/CMakeLists.txt +++ b/plugins/feature/mcpserver/bridge/CMakeLists.txt @@ -91,6 +91,12 @@ if(BUILD_MCP_BUNDLE) # This helper runs during the build, before macOS packaging rewrites library paths for # the app bundle, so it needs the external-library build directories on its own rpath. set_target_properties(sdrangel-mcp-tools-dump PROPERTIES BUILD_RPATH "${MACOS_EXTERNAL_LIBS_FIXUP}") + elseif(WIN32) + # The same on Windows: sdrbase needs the fftw and libsigmf DLLs, which are copied into + # bin/ by targets that nothing orders before this helper runs, so it loads them from + # where they come from. Joined with | because a ; would split the command argument + set(MCPTOOLSDUMP_DLL_DIRS "${FFTW3F_DLL_DIR}" "${LIBSIGMF_DLL_DIR}") + list(JOIN MCPTOOLSDUMP_DLL_DIRS "|" MCPTOOLSDUMP_DLL_PATH) endif() set(MCPTOOLSDUMP_TIMEOUT 60 CACHE STRING "Timeout in seconds for generating the MCP tool list") @@ -118,6 +124,7 @@ if(BUILD_MCP_BUNDLE) "-DTOOLSDUMP=$" "-DTOOLS_JSON=${MCPBRIDGE_BUNDLE_DIR}/server/tools.json" "-DTOOLSDUMP_TIMEOUT=${MCPTOOLSDUMP_TIMEOUT}" + "-DTOOLSDUMP_DLL_PATH=${MCPTOOLSDUMP_DLL_PATH}" -P "${CMAKE_CURRENT_SOURCE_DIR}/run-tools-dump.cmake" COMMAND ${CMAKE_COMMAND} -E rm -f "${MCPBRIDGE_BUNDLE_FILE}" # Relative paths and a working directory, so that manifest.json lands at the root of diff --git a/plugins/feature/mcpserver/bridge/run-tools-dump.cmake b/plugins/feature/mcpserver/bridge/run-tools-dump.cmake index d828fb678..8785c237e 100644 --- a/plugins/feature/mcpserver/bridge/run-tools-dump.cmake +++ b/plugins/feature/mcpserver/bridge/run-tools-dump.cmake @@ -10,6 +10,19 @@ if(NOT TOOLSDUMP_TIMEOUT MATCHES "^[1-9][0-9]*$") message(FATAL_ERROR "TOOLSDUMP_TIMEOUT must be a positive integer") endif() +# Windows only: directories of DLLs that may not have been copied beside the helper yet, +# separated by | +if(TOOLSDUMP_DLL_PATH) + string(REPLACE "|" ";" toolsdump_dll_dirs "${TOOLSDUMP_DLL_PATH}") + foreach(dll_dir IN LISTS toolsdump_dll_dirs) + if(dll_dir) + file(TO_NATIVE_PATH "${dll_dir}" dll_dir) + set(ENV{PATH} "${dll_dir};$ENV{PATH}") + endif() + endforeach() + message(STATUS "mcpbundle: DLL search path adds ${TOOLSDUMP_DLL_PATH}") +endif() + message(STATUS "mcpbundle: starting ${TOOLSDUMP}") message(STATUS "mcpbundle: output ${TOOLS_JSON}; timeout ${TOOLSDUMP_TIMEOUT}s") get_filename_component(toolsdump_working_directory "${TOOLS_JSON}" DIRECTORY)