-cmake_minimum_required(VERSION 3.13) # for add_link_options
+cmake_minimum_required(VERSION 3.14) # for add_link_options and implicit target directories.
project("llama.cpp" C CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(LLAMA_F16C "llama: enable F16C" ${INS_ENB})
endif()
+if (WIN32)
+ option(LLAMA_WIN_VER "llama: Windows Version" 0x602)
+endif()
+
# 3rd party libs
option(LLAMA_ACCELERATE "llama: enable Accelerate framework" ON)
option(LLAMA_BLAS "llama: use BLAS" OFF)
if (MINGW)
# Target Windows 8 for PrefetchVirtualMemory
- add_compile_definitions(_WIN32_WINNT=0x602)
+ add_compile_definitions(_WIN32_WINNT=${LLAMA_WIN_VER})
endif()
#
}
if (prefetch > 0) {
+#if _WIN32_WINNT >= 0x602
// PrefetchVirtualMemory is only present on Windows 8 and above, so we dynamically load it
BOOL (WINAPI *pPrefetchVirtualMemory) (HANDLE, ULONG_PTR, PWIN32_MEMORY_RANGE_ENTRY, ULONG);
HMODULE hKernel32 = GetModuleHandleW(L"kernel32.dll");
llama_format_win_err(GetLastError()).c_str());
}
}
+#else
+ throw std::runtime_error("PrefetchVirtualMemory unavailable");
+#endif
}
}