mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-28 08:31:25 +00:00 
			
		
		
		
	 5cf5e7d490
			
		
	
	5cf5e7d490
	
	
	
		
			
			* `build`: generate hex dumps of server assets on the fly * build: workaround lack of -n on gnu xxd * build: don't use xxd in cmake * build: don't call xxd from build.zig * build: more idiomatic hexing * build: don't use xxd in Makefile (od hackery instead) * build: avoid exceeding max cmd line limit in makefile hex dump * build: hex dump assets at cmake build time (not config time)
		
			
				
	
	
		
			17 lines
		
	
	
		
			647 B
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			647 B
		
	
	
	
		
			CMake
		
	
	
	
	
	
| # CMake equivalent of `xxd -i ${INPUT} ${OUTPUT}`
 | |
| # Usage: cmake -DINPUT=examples/server/public/index.html -DOUTPUT=examples/server/index.html.hpp -P scripts/xxd.cmake
 | |
| 
 | |
| SET(INPUT "" CACHE STRING "Input File")
 | |
| SET(OUTPUT "" CACHE STRING "Output File")
 | |
| 
 | |
| get_filename_component(filename "${INPUT}" NAME)
 | |
| string(REGEX REPLACE "\\.|-" "_" name "${filename}")
 | |
| 
 | |
| file(READ "${INPUT}" hex_data HEX)
 | |
| string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," hex_sequence "${hex_data}")
 | |
| 
 | |
| string(LENGTH ${hex_data} hex_len)
 | |
| math(EXPR len "${hex_len} / 2")
 | |
| 
 | |
| file(WRITE "${OUTPUT}" "unsigned char ${name}[] = {${hex_sequence}};\nunsigned int ${name}_len = ${len};\n")
 |