Has anyone managed to make this work? Using the JUCE CMake example on Windows 10 / VS2019, I tried the following with no luck.
In CMakeLists.txt
- added
list(APPEND CMAKE_PREFIX_PATH "<my_path_to>/libtorch-win-shared-with-deps-debug-1.12.0+cpu/libtorch")
find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
- modified
target_link_libraries():
target_link_libraries(AudioPluginExample
PRIVATE
# AudioPluginData # If we'd created a binary data target, we'd link to it here
juce::juce_audio_utils
"${TORCH_LIBRARIES}"
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
)
- added at the end:
if (MSVC)
file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")
add_custom_command(TARGET AudioPluginExample
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${TORCH_DLLS}
$<TARGET_FILE_DIR:AudioPluginExample>)
endif (MSVC)
It compiles fine, but upon trying to open the standalone, I get the usual “torch_cpu.dll not found”. If I move all the libtorch .dll files in the same directory as the executable, it opens just fine. But the VST3 obviously won’t open.
Any help much appreciated.
