Skip to content

Commit 94ccec3

Browse files
committed
fix(cmake): add short-name aliases for installed dsfw targets
The exported targets use dsfw:: namespace prefix on target names like dsfw-core, producing dsfw::dsfw-core. But docs and test-find-package use short names like dsfw::core (matching build-tree ALIAS targets). Add IMPORTED_GLOBAL + ALIAS definitions in dsfwConfig.cmake.in so find_package(dsfw) consumers can use dsfw::core, dsfw::ui-core, etc. Also fix macOS app bundle executable path in CI verify step.
1 parent b3991fd commit 94ccec3

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ jobs:
226226
for app in DatasetPipeline MinLabel PhonemeLabeler PitchLabeler GameInfer DiffSingerLabeler; do
227227
if [ "$RUNNER_OS" = "Windows" ]; then
228228
EXE="${{github.workspace}}/build/bin/${app}.exe"
229+
elif [ "$RUNNER_OS" = "macOS" ]; then
230+
EXE="${{github.workspace}}/build/bin/${app}.app/Contents/MacOS/${app}"
229231
else
230232
EXE="${{github.workspace}}/build/bin/${app}"
231233
fi

cmake/dsfwConfig.cmake.in

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,35 @@ find_dependency(dstools-infer-common CONFIG)
1010

1111
include("${CMAKE_CURRENT_LIST_DIR}/dsfwTargets.cmake")
1212

13+
# Provide short-name aliases matching the build-tree ALIAS targets
14+
# so that consumers can use dsfw::core instead of dsfw::dsfw-core, etc.
15+
# Requires CMake >= 3.18 for ALIAS of IMPORTED targets.
16+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
17+
foreach(_dsfw_tgt dsfw-base dsfw-core dsfw-ui-core dstools-audio dsfw-widgets)
18+
if(TARGET dsfw::${_dsfw_tgt})
19+
set_target_properties(dsfw::${_dsfw_tgt} PROPERTIES IMPORTED_GLOBAL TRUE)
20+
endif()
21+
endforeach()
22+
23+
set(_dsfw_alias_pairs
24+
"dsfw::base;dsfw::dsfw-base"
25+
"dsfw::core;dsfw::dsfw-core"
26+
"dsfw::ui-core;dsfw::dsfw-ui-core"
27+
"dsfw::audio;dsfw::dstools-audio"
28+
"dsfw::widgets;dsfw::dsfw-widgets"
29+
)
30+
foreach(_dsfw_pair IN LISTS _dsfw_alias_pairs)
31+
list(GET _dsfw_pair 0 _dsfw_alias)
32+
list(GET _dsfw_pair 1 _dsfw_real)
33+
if(NOT TARGET ${_dsfw_alias} AND TARGET ${_dsfw_real})
34+
add_library(${_dsfw_alias} ALIAS ${_dsfw_real})
35+
endif()
36+
endforeach()
37+
unset(_dsfw_alias_pairs)
38+
unset(_dsfw_pair)
39+
unset(_dsfw_alias)
40+
unset(_dsfw_real)
41+
unset(_dsfw_tgt)
42+
endif()
43+
1344
check_required_components(dsfw)

0 commit comments

Comments
 (0)