xW: improve beeping

This adds yet another build dependency,
but it's better than the alternatives of handling it in code.
This commit is contained in:
2023-07-27 16:05:32 +02:00
parent 3d345987c3
commit fcd1b8e011
4 changed files with 22 additions and 6 deletions

View File

@@ -59,6 +59,13 @@ function (icon_for_win32 ico pngs pngs_raw)
COMMENT "Generating Windows program icon" VERBATIM)
endfunction ()
# Produce a beep sample
find_program (sox_EXECUTABLE sox ${find_program_REQUIRE})
add_custom_command (OUTPUT beep.wav
COMMAND ${sox_EXECUTABLE} -b 16 -Dr 44100 -n beep.wav
synth 0.1 0 25 triangle 800 vol 0.5 fade t 0 -0 0.005 pad 0 0.05
COMMENT "Generating a beep sample" VERBATIM)
# Rasterize SVG icons
set (icon_ico_list)
foreach (icon xW xW-highlighted)
@@ -76,7 +83,8 @@ foreach (icon xW xW-highlighted)
list (APPEND icon_ico_list ${icon_ico})
endforeach ()
set_property (SOURCE xW.rc APPEND PROPERTY OBJECT_DEPENDS ${icon_ico_list})
set_property (SOURCE xW.rc
APPEND PROPERTY OBJECT_DEPENDS ${icon_ico_list} beep.wav)
# Build the main executable and link it
set (root "${PROJECT_SOURCE_DIR}/..")
@@ -97,7 +105,7 @@ add_custom_target (xC-proto DEPENDS ${PROJECT_BINARY_DIR}/xC-proto.cpp)
add_executable (xW WIN32 xW.cpp xW.rc xW.manifest ${project_config}
${root}/liberty/tools/lxdrgen-cpp-win32.cpp)
target_link_libraries (xW comctl32 ws2_32)
target_link_libraries (xW comctl32 ws2_32 winmm)
add_dependencies (xW xC-proto)
# At least with MinGW, this is a fully independent portable executable