On a MacBook Pro with Apple Silicon I have done the following:
% brew install llama.cpp
% llama-server -hf unsloth/Devstral-Small-2505-GGUF:UD-Q4_K_XL --jinja
I have used here the default context value -c 4096. Devstral can do 128K but I ran out of memory on this MacBook Pro M3 with 36GB, that is when using -c 0.
Then opened a webbrowser at localhost:8080 and asked the following question:
given this CMake code delimited by triple backticks:
qt_internal_extend_target(Core CONDITION MSVC AND CLANG LIBRARIES clang_rt.builtins-x86_64 )and this CMake code delimited by triple backticks:
if(MSVC AND CLANG) if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64") qt_internal_extend_target(Core LIBRARIES clang_rt.builtins-aarch64 ) else() qt_internal_extend_target(Core LIBRARIES clang_rt.builtins-x86_64 ) endif() endif()can you refactor the latter CMake code to use a CMake generator expression for the
LIBRARIESpart and not use aif()statement?
The answer I recevied is below:
Yes, you can use CMake generator expressions to conditionally set the LIBRARIES parameter in the qt_internal_extend_target function. Here's how you can refactor the code:
qt_internal_extend_target(Core CONDITION MSVC AND CLANG LIBRARIES "$<IF:$<AND:$<MATCHES:$<CMAKE_SYSTEM_PROCESSOR>,"ARM64">>,clang_rt.builtins-aarch64,clang_rt.builtins-x86_64>>" )This code uses CMake generator expressions to conditionally select the library based on the system processor architecture. The
$<IF:condition,then,else>expression is used to check if theCMAKE_SYSTEM_PROCESSORmatches "ARM64". If it does, it selectsclang_rt.builtins-aarch64; otherwise, it selectsclang_rt.builtins-x86_64.
I followed up with:
according to CMake documentation there is no
$<MATCHES, but$<STREQUALdoes exist. Can you fix the expression?
which resulted in:
You're right, there is no
$<MATCHES>generator expression in CMake. Instead, we can use a combination of$<STREQUAL>and$<OR>to achieve the same functionality. Here's the updated code:qt_internal_extend_target(Core CONDITION MSVC AND CLANG LIBRARIES "$<IF:$<STREQUAL:$<CMAKE_SYSTEM_PROCESSOR>,"ARM64">,clang_rt.builtins-aarch64,clang_rt.builtins-x86_64>>" )In this expression,
$<STREQUAL:$<CMAKE_SYSTEM_PROCESSOR>,"ARM64">checks if the system processor is exactly "ARM64". If true, it selectsclang_rt.builtins-aarch64; otherwise, it selectsclang_rt.builtins-x86_64.
The CMake documentation is at cmake-generator-expressions(7)