@@ -66,26 +66,21 @@ include(CheckLanguage)
6666if (LLAMA_BACKEND STREQUAL "CPU" )
6767 message (STATUS "llama.cpp backend: CPU-only" )
6868 set (GGML_NATIVE ON CACHE BOOL "" FORCE ) # enable CPU SIMD optimizations
69-
7069elseif (LLAMA_BACKEND STREQUAL "GPU" )
7170 message (STATUS "llama.cpp backend: GPU (non-CUDA)" )
7271 set (GGML_OPENMP ON CACHE BOOL "" FORCE ) # parallel CPU fallback
7372 # GPU non-CUDA options can be added here in the future
74-
7573elseif (LLAMA_BACKEND STREQUAL "CUDA" )
7674 message (STATUS "llama.cpp backend: CUDA" )
77-
7875 check_language (CUDA )
7976 if (CMAKE_CUDA_COMPILER)
8077 enable_language (CUDA )
8178 set (GGML_CUDA ON CACHE BOOL "" FORCE )
8279 else ()
8380 message (FATAL_ERROR "CUDA backend requested but nvcc not found" )
8481 endif ()
85-
8682elseif (LLAMA_BACKEND STREQUAL "AUTO" )
8783 message (STATUS "llama.cpp backend: AUTO" )
88-
8984 check_language (CUDA )
9085 if (CMAKE_CUDA_COMPILER)
9186 enable_language (CUDA )
@@ -96,7 +91,6 @@ elseif(LLAMA_BACKEND STREQUAL "AUTO")
9691 set (GGML_NATIVE ON CACHE BOOL "" FORCE )
9792 message (STATUS "CUDA not found – using CPU/OpenMP" )
9893 endif ()
99-
10094else ()
10195 message (FATAL_ERROR "Invalid LLAMA_BACKEND value: ${LLAMA_BACKEND} " )
10296endif ()
@@ -148,120 +142,6 @@ set_target_properties(llm PROPERTIES
148142 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR } /lib
149143)
150144
151- # -----------------------------
152- # nitro agent application
153- # (only built when notcurses is available)
154- # -----------------------------
155- find_package (PkgConfig QUIET )
156-
157- # ── notcurses ─────────────────────────────────────────────────────────────
158- set (NC_FOUND FALSE )
159- set (NC_TARGET "" )
160- if (DEFINED NOTCURSES_DIR)
161- # Explicit path — create an imported target manually
162- find_library (NC_LIB NAMES notcurses HINTS "${NOTCURSES_DIR} /lib" REQUIRED )
163- find_library (NC_CORE_LIB NAMES notcurses-core HINTS "${NOTCURSES_DIR} /lib" )
164- add_library (notcurses_imported INTERFACE IMPORTED )
165- target_include_directories (notcurses_imported INTERFACE "${NOTCURSES_DIR} /include" )
166- target_link_libraries (notcurses_imported INTERFACE ${NC_LIB} )
167- if (NC_CORE_LIB)
168- target_link_libraries (notcurses_imported INTERFACE ${NC_CORE_LIB} )
169- endif ()
170- set (NC_TARGET notcurses_imported)
171- set (NC_FOUND TRUE )
172- elseif (PkgConfig_FOUND)
173- pkg_check_modules (NC QUIET IMPORTED_TARGET notcurses )
174- if (NC_FOUND)
175- set (NC_TARGET PkgConfig::NC)
176- endif ()
177- else ()
178- find_library (NC_LIB NAMES notcurses )
179- find_library (NC_CORE_LIB NAMES notcurses-core )
180- if (NC_LIB AND NC_CORE_LIB)
181- add_library (notcurses_imported INTERFACE IMPORTED )
182- target_link_libraries (notcurses_imported INTERFACE ${NC_LIB} ${NC_CORE_LIB} )
183- set (NC_TARGET notcurses_imported)
184- set (NC_FOUND TRUE )
185- endif ()
186- endif ()
187-
188- # ── libcurl ───────────────────────────────────────────────────────────────
189- # Try the modern CMake find-module first (ships with CMake ≥ 3.12).
190- # Fall back to pkg-config, then a raw library search.
191- set (CURL_FOUND_INTERNAL FALSE )
192- set (CURL_TARGET "" )
193-
194- if (DEFINED CURL_DIR)
195- # Explicit path supplied by the user (-DCURL_DIR=...)
196- find_library (CURL_LIB NAMES curl HINTS "${CURL_DIR} /lib" REQUIRED )
197- find_path (CURL_INCLUDE NAMES curl/curl.h HINTS "${CURL_DIR} /include" REQUIRED )
198- add_library (curl_imported INTERFACE IMPORTED )
199- target_include_directories (curl_imported INTERFACE "${CURL_INCLUDE} " )
200- target_link_libraries (curl_imported INTERFACE ${CURL_LIB} )
201- set (CURL_TARGET curl_imported)
202- set (CURL_FOUND_INTERNAL TRUE )
203- else ()
204- # CMake built-in (sets CURL::libcurl target when found)
205- find_package (CURL QUIET )
206- if (CURL_FOUND)
207- set (CURL_TARGET CURL::libcurl)
208- set (CURL_FOUND_INTERNAL TRUE )
209- elseif (PkgConfig_FOUND)
210- pkg_check_modules (CURL_PC QUIET IMPORTED_TARGET libcurl )
211- if (CURL_PC_FOUND)
212- set (CURL_TARGET PkgConfig::CURL_PC)
213- set (CURL_FOUND_INTERNAL TRUE )
214- endif ()
215- endif ()
216- if (NOT CURL_FOUND_INTERNAL)
217- find_library (CURL_LIB NAMES curl )
218- find_path (CURL_INCLUDE NAMES curl/curl.h )
219- if (CURL_LIB AND CURL_INCLUDE)
220- add_library (curl_imported INTERFACE IMPORTED )
221- target_include_directories (curl_imported INTERFACE "${CURL_INCLUDE} " )
222- target_link_libraries (curl_imported INTERFACE ${CURL_LIB} )
223- set (CURL_TARGET curl_imported)
224- set (CURL_FOUND_INTERNAL TRUE )
225- endif ()
226- endif ()
227- endif ()
228-
229- # ── nitro target ──────────────────────────────────────────────────────────
230- if (NC_FOUND)
231- if (NOT CURL_FOUND_INTERNAL)
232- message (WARNING "libcurl not found — TOOL:CURL will be unavailable. "
233- "Install libcurl-dev or set -DCURL_DIR=<prefix> to enable." )
234- endif ()
235-
236- message (STATUS "notcurses found — building nitro" )
237- add_executable (nitro
238- nitro.cpp
239- llama-sb-rag.cpp
240- )
241- target_include_directories (nitro PRIVATE
242- ${LLAMA_DIR} /include
243- ${LLAMA_DIR} /ggml/include
244- ${CMAKE_CURRENT_SOURCE_DIR } /../include
245- )
246- target_link_libraries (nitro PRIVATE
247- llm
248- llama
249- ggml
250- ${NC_TARGET} # imported target carries include + lib paths
251- )
252- if (CURL_FOUND_INTERNAL)
253- target_link_libraries (nitro PRIVATE ${CURL_TARGET} )
254- target_compile_definitions (nitro PRIVATE NITRO_HAVE_CURL=1 )
255- else ()
256- target_compile_definitions (nitro PRIVATE NITRO_HAVE_CURL=0 )
257- endif ()
258- set_target_properties (nitro PROPERTIES
259- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR } /bin
260- )
261- else ()
262- message (STATUS "notcurses not found — skipping nitro (set -DNOTCURSES_DIR=... to enable)" )
263- endif ()
264-
265145# ------------------------------------------------------------------
266146# Android native library
267147# ------------------------------------------------------------------
0 commit comments