Skip to content

Commit 49ce8ef

Browse files
committed
Isolate inference library deployment from CMake installation
1 parent 1c6ce94 commit 49ce8ef

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

‎cmake/DeployInference.cmake‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,33 @@ function(dssp_deploy_inference_plugins target)
3636
endif()
3737
endforeach()
3838

39-
# srtsepinfer is built by this project. Staging must follow its target and
40-
# re-run even when only the manifest changed or a deployed file was removed.
39+
# Stage copies of project libraries and interpreters because deployment rewrites
40+
# runtime paths. CMake installation requires the unmodified target binaries.
4141
set(_separation_destination "${_plugin_root}/srtsepinfer/inferenceinterpreters/demucs")
4242
add_custom_target(srtsepinfer_deploy_plugins
43-
COMMAND "${CMAKE_COMMAND}" -E make_directory "${_separation_destination}"
43+
COMMAND "${CMAKE_COMMAND}" -E make_directory "${_dependency_dir}" "${_separation_destination}"
44+
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
45+
"$<TARGET_FILE:srtsepinfer>" "${_dependency_dir}/$<TARGET_FILE_NAME:srtsepinfer>"
4446
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
4547
"$<TARGET_FILE:srtsepinferdemucs>" "${_separation_destination}/$<TARGET_FILE_NAME:srtsepinferdemucs>"
4648
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
4749
"${SRTSEPINFER_PLUGIN_MANIFEST}" "${_separation_destination}/plugin.json"
48-
DEPENDS srtsepinferdemucs "${SRTSEPINFER_PLUGIN_MANIFEST}"
49-
COMMENT "Stage project-built srtsepinfer interpreter"
50+
DEPENDS srtsepinfer srtsepinferdemucs "${SRTSEPINFER_PLUGIN_MANIFEST}"
51+
COMMENT "Stage project-built srtsepinfer library and interpreter"
5052
VERBATIM
5153
)
5254

5355
add_dependencies(${target} srtsepinfer_deploy_plugins)
5456

5557
set(_beat_destination "${_plugin_root}/srtbeatinfer/inferenceinterpreters/beat-this")
5658
add_custom_target(srtbeatinfer_deploy_plugins
57-
COMMAND "${CMAKE_COMMAND}" -E make_directory "${_beat_destination}"
59+
COMMAND "${CMAKE_COMMAND}" -E make_directory "${_dependency_dir}" "${_beat_destination}"
60+
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
61+
"$<TARGET_FILE:srtbeatinfer>" "${_dependency_dir}/$<TARGET_FILE_NAME:srtbeatinfer>"
5862
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:srtbeatinferbeatthis>" "${_beat_destination}/$<TARGET_FILE_NAME:srtbeatinferbeatthis>"
5963
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${SRTBEATINFER_PLUGIN_MANIFEST}" "${_beat_destination}/plugin.json"
60-
DEPENDS srtbeatinferbeatthis "${SRTBEATINFER_PLUGIN_MANIFEST}"
61-
COMMENT "Stage project-built srtbeatinfer interpreter"
64+
DEPENDS srtbeatinfer srtbeatinferbeatthis "${SRTBEATINFER_PLUGIN_MANIFEST}"
65+
COMMENT "Stage project-built srtbeatinfer library and interpreter"
6266
VERBATIM)
6367

6468
add_dependencies(${target} srtbeatinfer_deploy_plugins)

‎src/libs/3rdparty/srtbeatinfer/CMakeLists.txt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ target_link_libraries(srtbeatinfer PUBLIC synthrt::synthrt)
1212
target_include_directories(srtbeatinfer PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
1313

1414
generate_export_header(srtbeatinfer EXPORT_FILE_NAME "include/srtbeatinfer/export.h")
15+
# Deployment rewrites runtime paths. Retain the original binary for CMake installation.
1516
set_target_properties(srtbeatinfer PROPERTIES
1617
OUTPUT_NAME synthrt-srtbeatinfer
17-
RUNTIME_OUTPUT_DIRECTORY "${DSSP_BUILD_RUNTIME_DIR}"
18-
LIBRARY_OUTPUT_DIRECTORY "${DSSP_BUILD_LIBRARY_DIR}"
18+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/runtime/$<CONFIG>"
19+
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/runtime/$<CONFIG>"
1920
)
2021

2122
add_library(srtbeatinfer_dsp STATIC src/BeatFeatures.cpp)

‎src/libs/3rdparty/srtsepinfer/CMakeLists.txt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ target_include_directories(srtsepinfer PUBLIC
1616
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
1717

1818
generate_export_header(srtsepinfer EXPORT_FILE_NAME "include/srtsepinfer/export.h")
19+
# Deployment rewrites runtime paths. Retain the original binary for CMake installation.
1920
set_target_properties(srtsepinfer PROPERTIES
2021
OUTPUT_NAME synthrt-srtsepinfer
21-
RUNTIME_OUTPUT_DIRECTORY "${DSSP_BUILD_RUNTIME_DIR}"
22-
LIBRARY_OUTPUT_DIRECTORY "${DSSP_BUILD_LIBRARY_DIR}")
22+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/runtime/$<CONFIG>"
23+
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/runtime/$<CONFIG>")
2324

2425
add_library(srtsepinfer_dsp STATIC src/SpectralTransform.cpp)
2526
target_compile_features(srtsepinfer_dsp PUBLIC cxx_std_23)

0 commit comments

Comments
 (0)