Skip to content

Commit e0f3342

Browse files
committed
chore: disable rag on windows
1 parent 5356dbf commit e0f3342

File tree

9 files changed

+432
-195
lines changed

9 files changed

+432
-195
lines changed

sdk/runanywhere-commons/CMakeLists.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ project(RunAnywhereCommons
1515
DESCRIPTION "RunAnywhere Commons - Standalone infrastructure library for ML inference SDKs"
1616
)
1717

18+
# Enable folder organization for IDEs
19+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
20+
1821
# =============================================================================
1922
# ABOUT THIS LIBRARY
2023
# =============================================================================
@@ -37,7 +40,14 @@ option(RAC_BUILD_PLATFORM "Build platform backend (Apple Foundation Models, Syst
3740
option(RAC_BUILD_BACKENDS "Build ML backends (LlamaCPP, ONNX, WhisperCPP, RAG)" OFF)
3841
option(RAC_BACKEND_LLAMACPP "Build LlamaCPP backend" ON)
3942
option(RAC_BACKEND_ONNX "Build ONNX backend" ON)
40-
option(RAC_BACKEND_RAG "Build RAG pipeline (USearch vector search)" ON)
43+
# RAG backend is currently not supported on Windows due to a compatibility issue in the USearch library
44+
# when building with Unicode,
45+
# see https://github.com/unum-cloud/USearch/commit/20cb74202121999e28ca95cd63ad4b55147597fe#diff-1ca00f90ac7927aa1a54acac43c239bbaf6c25ab5c884d56d5ade2a99b65c47dR1782-R1783 for more details.
46+
if(WIN32)
47+
set(RAC_BACKEND_RAG OFF CACHE BOOL "" FORCE)
48+
else()
49+
option(RAC_BACKEND_RAG "Build RAG pipeline (USearch vector search)" ON)
50+
endif()
4151
# WhisperCPP OFF by default - Sherpa-ONNX (NeMo CTC / Parakeet) is now the primary STT backend
4252
option(RAC_BACKEND_WHISPERCPP "Build WhisperCPP backend" OFF)
4353
if(APPLE)
@@ -336,13 +346,23 @@ else()
336346
set(RAC_WHISPERKIT_COREML_SOURCES "")
337347
endif()
338348

349+
# Utilities sources
350+
set(RAC_UTILITIES_SOURCES
351+
src/utils/rac_image_utils.cpp
352+
)
353+
354+
if(RAC_PLATFORM_WINDOWS)
355+
list(APPEND RAC_UTILITIES_SOURCES src/utils/rac_str_trans.cpp)
356+
endif()
357+
339358
# Combine all sources
340359
set(RAC_COMMONS_SOURCES
341360
${RAC_CORE_SOURCES}
342361
${RAC_INFRASTRUCTURE_SOURCES}
343362
${RAC_FEATURES_SOURCES}
344363
${RAC_PLATFORM_SOURCES}
345364
${RAC_WHISPERKIT_COREML_SOURCES}
365+
${RAC_UTILITIES_SOURCES}
346366
)
347367

348368
# =============================================================================
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/**
2+
* @file rac_str_trans.h
3+
* @brief RunAnywhere Commons - String Transformation
4+
*
5+
* String transformation utilities for Windows.
6+
* Converts strings between ANSI (system code page), UTF-8, and Unicode (UTF-16).
7+
*
8+
* All conversion functions follow the Windows API size-query convention:
9+
* - Pass NULL (or 0) for the output buffer to query the required buffer size.
10+
* - The required size always includes the null terminator.
11+
* - out_required receives the required size even when a buffer is provided.
12+
*
13+
* Buffer sizes for narrow (char) outputs are in bytes.
14+
* Buffer sizes for wide (wchar_t) outputs are in wchar_t units.
15+
*
16+
* Note: These functions are Windows-only and depend on Windows code page APIs.
17+
*/
18+
19+
#ifndef RAC_STR_TRANS_H
20+
#define RAC_STR_TRANS_H
21+
22+
#include "rac/core/rac_error.h"
23+
#include "rac/core/rac_types.h"
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
// =============================================================================
30+
// STRING CONVERSION - ANSI <-> UNICODE
31+
// =============================================================================
32+
33+
/**
34+
* @brief Convert ANSI (system code page) string to Unicode (UTF-16) string
35+
*
36+
* @param src Source ANSI string (null-terminated)
37+
* @param out_buf Output buffer, or NULL to query required size
38+
* @param buf_wchars Output buffer size in wchar_t units (including null terminator)
39+
* @param out_required If non-NULL, receives the required size in wchar_t units
40+
* @return RAC_SUCCESS or error code
41+
*/
42+
RAC_API rac_result_t rac_str_ascii_to_unicode(const char* src, wchar_t* out_buf, int buf_wchars,
43+
int* out_required);
44+
45+
/**
46+
* @brief Convert Unicode (UTF-16) string to ANSI (system code page) string
47+
*
48+
* @param src Source Unicode string (null-terminated)
49+
* @param out_buf Output buffer, or NULL to query required size
50+
* @param buf_size Output buffer size in bytes (including null terminator)
51+
* @param out_required If non-NULL, receives the required size in bytes
52+
* @return RAC_SUCCESS or error code
53+
*/
54+
RAC_API rac_result_t rac_str_unicode_to_ascii(const wchar_t* src, char* out_buf, int buf_size,
55+
int* out_required);
56+
57+
// =============================================================================
58+
// STRING CONVERSION - ANSI <-> UTF-8
59+
// =============================================================================
60+
61+
/**
62+
* @brief Convert ANSI (system code page) string to UTF-8 string
63+
*
64+
* @param src Source ANSI string (null-terminated)
65+
* @param out_buf Output buffer, or NULL to query required size
66+
* @param buf_size Output buffer size in bytes (including null terminator)
67+
* @param out_required If non-NULL, receives the required size in bytes
68+
* @return RAC_SUCCESS or error code
69+
*/
70+
RAC_API rac_result_t rac_str_ascii_to_utf8(const char* src, char* out_buf, int buf_size,
71+
int* out_required);
72+
73+
/**
74+
* @brief Convert UTF-8 string to ANSI (system code page) string
75+
*
76+
* @param src Source UTF-8 string (null-terminated)
77+
* @param out_buf Output buffer, or NULL to query required size
78+
* @param buf_size Output buffer size in bytes (including null terminator)
79+
* @param out_required If non-NULL, receives the required size in bytes
80+
* @return RAC_SUCCESS or error code
81+
*/
82+
RAC_API rac_result_t rac_str_utf8_to_ascii(const char* src, char* out_buf, int buf_size,
83+
int* out_required);
84+
85+
// =============================================================================
86+
// STRING CONVERSION - UNICODE <-> UTF-8
87+
// =============================================================================
88+
89+
/**
90+
* @brief Convert Unicode (UTF-16) string to UTF-8 string
91+
*
92+
* @param src Source Unicode string (null-terminated)
93+
* @param out_buf Output buffer, or NULL to query required size
94+
* @param buf_size Output buffer size in bytes (including null terminator)
95+
* @param out_required If non-NULL, receives the required size in bytes
96+
* @return RAC_SUCCESS or error code
97+
*/
98+
RAC_API rac_result_t rac_str_unicode_to_utf8(const wchar_t* src, char* out_buf, int buf_size,
99+
int* out_required);
100+
101+
/**
102+
* @brief Convert UTF-8 string to Unicode (UTF-16) string
103+
*
104+
* @param src Source UTF-8 string (null-terminated)
105+
* @param out_buf Output buffer, or NULL to query required size
106+
* @param buf_wchars Output buffer size in wchar_t units (including null terminator)
107+
* @param out_required If non-NULL, receives the required size in wchar_t units
108+
* @return RAC_SUCCESS or error code
109+
*/
110+
RAC_API rac_result_t rac_str_utf8_to_unicode(const char* src, wchar_t* out_buf, int buf_wchars,
111+
int* out_required);
112+
113+
#ifdef __cplusplus
114+
}
115+
#endif
116+
117+
#endif /* RAC_STR_TRANS_H */

sdk/runanywhere-commons/scripts/build-windows.bat

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ setlocal enabledelayedexpansion
1111
::
1212
:: OPTIONS:
1313
:: --skip-backends Build RACommons only; do not build backend frameworks
14-
:: --backend NAME Build specific backend: llamacpp, onnx, all (default: all)
14+
:: --backend NAME Build specific backend: llamacpp, onnx, rag, all (default: all)
1515
:: - llamacpp: LLM text generation (GGUF models)
1616
:: - onnx: STT/TTS/VAD (ONNX Runtime + Sherpa-ONNX)
17-
:: - all: Both backends (default)
17+
:: - rag: RAG backend (embeddings + text generation)
18+
:: - all: All backends (default)
1819
:: --clean Remove build and dist directories before building
1920
:: --release Release build (default)
2021
:: --debug Debug build
@@ -27,7 +28,7 @@ setlocal enabledelayedexpansion
2728
:: --help, -h Show this help
2829
::
2930
:: OUTPUTS:
30-
:: dist\windows\bin\ RACommons and backend DLLs (if shared)
31+
:: dist\windows\bin\ RACommons and backend DLLs (if shared): rac_commons, rac_backend_llamacpp, rac_backend_onnx, rac_backend_rag
3132
:: dist\windows\lib\ Import libraries (.lib) and static libs
3233
:: dist\windows\include\ Public headers
3334
::
@@ -38,6 +39,9 @@ setlocal enabledelayedexpansion
3839
:: REM Build only LlamaCPP backend (no ONNX dependencies)
3940
:: scripts\build-windows.bat --backend llamacpp
4041
::
42+
:: REM Build only RAG backend (embeddings + text generation, needs ONNX)
43+
:: scripts\build-windows.bat --backend rag
44+
::
4145
:: REM Build only RACommons (no backends)
4246
:: scripts\build-windows.bat --skip-backends
4347
::
@@ -114,7 +118,7 @@ echo USAGE: scripts\build-windows.bat [options]
114118
echo.
115119
echo OPTIONS:
116120
echo --skip-backends Build RACommons only
117-
echo --backend NAME all ^| llamacpp ^| onnx (default: all)
121+
echo --backend NAME all ^| llamacpp ^| onnx ^| rag (default: all)
118122
echo --clean Clean build and dist first
119123
echo --release Release build (default)
120124
echo --debug Debug build
@@ -129,6 +133,7 @@ echo.
129133
echo EXAMPLES:
130134
echo scripts\build-windows.bat # Full build (needs third_party deps)
131135
echo scripts\build-windows.bat --backend llamacpp # LlamaCPP only
136+
echo scripts\build-windows.bat --backend rag # RAG only (uses ONNX + LlamaCPP)
132137
echo scripts\build-windows.bat --clean --package # Clean build + ZIP
133138
echo.
134139
exit /b 0
@@ -140,10 +145,11 @@ set "BACKEND_VALID=0"
140145
if /i "!BUILD_BACKEND!"=="all" set "BACKEND_VALID=1"
141146
if /i "!BUILD_BACKEND!"=="llamacpp" set "BACKEND_VALID=1"
142147
if /i "!BUILD_BACKEND!"=="onnx" set "BACKEND_VALID=1"
148+
if /i "!BUILD_BACKEND!"=="rag" set "BACKEND_VALID=1"
143149

144150
if "!BACKEND_VALID!"=="0" (
145151
echo [ERROR] Invalid --backend: !BUILD_BACKEND!
146-
echo [ERROR] Valid backend options are: all, llamacpp, onnx
152+
echo [ERROR] Valid backend options are: all, llamacpp, onnx, rag
147153
exit /b 1
148154
)
149155

@@ -223,20 +229,29 @@ if errorlevel 1 (
223229
set "RAC_BUILD_BACKENDS=ON"
224230
set "RAC_BACKEND_LLAMACPP=ON"
225231
set "RAC_BACKEND_ONNX=ON"
232+
set "RAC_BACKEND_RAG=ON"
226233
set "RAC_BACKEND_WHISPERCPP=OFF"
227234

228235
if "%SKIP_BACKENDS%"=="1" (
229236
set "RAC_BUILD_BACKENDS=OFF"
230237
set "RAC_BACKEND_LLAMACPP=OFF"
231238
set "RAC_BACKEND_ONNX=OFF"
239+
set "RAC_BACKEND_RAG=OFF"
232240
) else (
233241
if /i "%BUILD_BACKEND%"=="llamacpp" (
234242
set "RAC_BACKEND_LLAMACPP=ON"
235243
set "RAC_BACKEND_ONNX=OFF"
244+
set "RAC_BACKEND_RAG=OFF"
236245
)
237246
if /i "%BUILD_BACKEND%"=="onnx" (
238247
set "RAC_BACKEND_LLAMACPP=OFF"
239248
set "RAC_BACKEND_ONNX=ON"
249+
set "RAC_BACKEND_RAG=OFF"
250+
)
251+
if /i "%BUILD_BACKEND%"=="rag" (
252+
set "RAC_BACKEND_LLAMACPP=ON"
253+
set "RAC_BACKEND_ONNX=ON"
254+
set "RAC_BACKEND_RAG=ON"
240255
)
241256
)
242257

@@ -258,6 +273,7 @@ set "CMAKE_ARGS=%CMAKE_ARGS% -DRAC_BUILD_TESTS=OFF"
258273
set "CMAKE_ARGS=%CMAKE_ARGS% -DRAC_BUILD_BACKENDS=%RAC_BUILD_BACKENDS%"
259274
set "CMAKE_ARGS=%CMAKE_ARGS% -DRAC_BACKEND_LLAMACPP=%RAC_BACKEND_LLAMACPP%"
260275
set "CMAKE_ARGS=%CMAKE_ARGS% -DRAC_BACKEND_ONNX=%RAC_BACKEND_ONNX%"
276+
set "CMAKE_ARGS=%CMAKE_ARGS% -DRAC_BACKEND_RAG=%RAC_BACKEND_RAG%"
261277
set "CMAKE_ARGS=%CMAKE_ARGS% -DRAC_BACKEND_WHISPERCPP=%RAC_BACKEND_WHISPERCPP%"
262278
set "CMAKE_ARGS=%CMAKE_ARGS% -DRAC_BUILD_SHARED=%RAC_SHARED_FLAG%"
263279

@@ -313,22 +329,28 @@ if "%BUILD_OUT%"=="" set "BUILD_OUT=%BUILD_DIR%"
313329
if exist "%BUILD_OUT%\rac_commons.dll" copy /y "%BUILD_OUT%\rac_commons.dll" "%DIST_BIN%\" >nul
314330
if exist "%BUILD_OUT%\rac_backend_llamacpp.dll" copy /y "%BUILD_OUT%\rac_backend_llamacpp.dll" "%DIST_BIN%\" >nul
315331
if exist "%BUILD_OUT%\rac_backend_onnx.dll" copy /y "%BUILD_OUT%\rac_backend_onnx.dll" "%DIST_BIN%\" >nul
332+
if exist "%BUILD_OUT%\rac_backend_rag.dll" copy /y "%BUILD_OUT%\rac_backend_rag.dll" "%DIST_BIN%\" >nul
316333
if exist "%BUILD_OUT%\src\backends\llamacpp\rac_backend_llamacpp.dll" copy /y "%BUILD_OUT%\src\backends\llamacpp\rac_backend_llamacpp.dll" "%DIST_BIN%\" >nul
317334
if exist "%BUILD_OUT%\src\backends\onnx\rac_backend_onnx.dll" copy /y "%BUILD_OUT%\src\backends\onnx\rac_backend_onnx.dll" "%DIST_BIN%\" >nul
335+
if exist "%BUILD_OUT%\src\backends\rag\rac_backend_rag.dll" copy /y "%BUILD_OUT%\src\backends\rag\rac_backend_rag.dll" "%DIST_BIN%\" >nul
318336

319337
:: Copy import libs / static libs to lib
320338
if exist "%BUILD_OUT%\rac_commons.lib" copy /y "%BUILD_OUT%\rac_commons.lib" "%DIST_LIB%\" >nul
321339
if exist "%BUILD_OUT%\rac_backend_llamacpp.lib" copy /y "%BUILD_OUT%\rac_backend_llamacpp.lib" "%DIST_LIB%\" >nul
322340
if exist "%BUILD_OUT%\rac_backend_onnx.lib" copy /y "%BUILD_OUT%\rac_backend_onnx.lib" "%DIST_LIB%\" >nul
341+
if exist "%BUILD_OUT%\rac_backend_rag.lib" copy /y "%BUILD_OUT%\rac_backend_rag.lib" "%DIST_LIB%\" >nul
323342
if exist "%BUILD_OUT%\src\backends\llamacpp\rac_backend_llamacpp.lib" copy /y "%BUILD_OUT%\src\backends\llamacpp\rac_backend_llamacpp.lib" "%DIST_LIB%\" >nul
324343
if exist "%BUILD_OUT%\src\backends\onnx\rac_backend_onnx.lib" copy /y "%BUILD_OUT%\src\backends\onnx\rac_backend_onnx.lib" "%DIST_LIB%\" >nul
344+
if exist "%BUILD_OUT%\src\backends\rag\rac_backend_rag.lib" copy /y "%BUILD_OUT%\src\backends\rag\rac_backend_rag.lib" "%DIST_LIB%\" >nul
325345

326346
:: PDB files (optional, for debugging)
327347
if exist "%BUILD_OUT%\rac_commons.pdb" copy /y "%BUILD_OUT%\rac_commons.pdb" "%DIST_BIN%\" >nul
328348
if exist "%BUILD_OUT%\rac_backend_llamacpp.pdb" copy /y "%BUILD_OUT%\rac_backend_llamacpp.pdb" "%DIST_BIN%\" >nul
329349
if exist "%BUILD_OUT%\rac_backend_onnx.pdb" copy /y "%BUILD_OUT%\rac_backend_onnx.pdb" "%DIST_BIN%\" >nul
350+
if exist "%BUILD_OUT%\rac_backend_rag.pdb" copy /y "%BUILD_OUT%\rac_backend_rag.pdb" "%DIST_BIN%\" >nul
330351
if exist "%BUILD_OUT%\src\backends\llamacpp\rac_backend_llamacpp.pdb" copy /y "%BUILD_OUT%\src\backends\llamacpp\rac_backend_llamacpp.pdb" "%DIST_BIN%\" >nul
331352
if exist "%BUILD_OUT%\src\backends\onnx\rac_backend_onnx.pdb" copy /y "%BUILD_OUT%\src\backends\onnx\rac_backend_onnx.pdb" "%DIST_BIN%\" >nul
353+
if exist "%BUILD_OUT%\src\backends\rag\rac_backend_rag.pdb" copy /y "%BUILD_OUT%\src\backends\rag\rac_backend_rag.pdb" "%DIST_BIN%\" >nul
332354

333355
:: Headers: rac and backends
334356
if exist "%PROJECT_ROOT%\include\rac" (

sdk/runanywhere-commons/src/backends/onnx/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,6 @@ if(RAC_BACKEND_RAG AND EXISTS "${RAG_DIR}/onnx_embedding_provider.cpp")
205205
message(STATUS " ONNX embedding provider: Compiled into rac_backend_onnx (from RAG dir)")
206206
endif()
207207

208-
if(RAC_PLATFORM_WINDOWS)
209-
list(APPEND ONNX_BACKEND_SOURCES rac_str_trans.cpp)
210-
endif()
211-
212208
set(ONNX_BACKEND_HEADERS
213209
onnx_backend.h
214210
)

0 commit comments

Comments
 (0)