upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/cmake/opus_decoder.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/cmake/opus_decoder.cmake')
-rw-r--r--runtime/cmake/opus_decoder.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/runtime/cmake/opus_decoder.cmake b/runtime/cmake/opus_decoder.cmake
new file mode 100644
index 000000000..1286b15fa
--- /dev/null
+++ b/runtime/cmake/opus_decoder.cmake
@@ -0,0 +1,23 @@
1# Resolves -DLEONIDA_OPUS_DECODER_LIB=<path> for runtime/CMakeLists.txt.
2#
3# When LEONIDA_OPUS_DECODER_LIB is set, the runtime links that prebuilt static library directly and
4# skips running cargo at configure time. A value that does not name an existing file is a configure
5# error rather than a silent fallback to silent XAPU output.
6function(leonida_resolve_prebuilt_opus_decoder lib_input base_dir out_var)
7 if(NOT lib_input)
8 set(${out_var} "" PARENT_SCOPE)
9 return()
10 endif()
11 if(IS_ABSOLUTE "${lib_input}")
12 set(_resolved "${lib_input}")
13 else()
14 cmake_path(ABSOLUTE_PATH lib_input BASE_DIRECTORY "${base_dir}" NORMALIZE OUTPUT_VARIABLE _resolved)
15 endif()
16 if(EXISTS "${_resolved}" AND NOT IS_DIRECTORY "${_resolved}")
17 set(${out_var} "${_resolved}" PARENT_SCOPE)
18 else()
19 message(FATAL_ERROR
20 "LEONIDA_OPUS_DECODER_LIB does not point to an existing file: ${_resolved} "
21 "(pass the path to leonida_opus_decoder.lib or leave it empty to build with cargo)")
22 endif()
23endfunction()