LLM inference in C/C++
C++ ggml
ggml : replace compile definitions with version.h.in (#28364)
Daniel Bevenius86b351fd64d5
diff --git a/ggml/CMakeLists.txt b/ggml/CMakeLists.txtindex 634e18c542..b75506a26b 100644--- a/ggml/CMakeLists.txt+++ b/ggml/CMakeLists.txt@@ -404,10 +404,6 @@ write_basic_package_version_file(VERSION ${GGML_INSTALL_VERSION}COMPATIBILITY SameMajorVersion)-target_compile_definitions(ggml-base PRIVATE- GGML_VERSION="${GGML_INSTALL_VERSION}"- GGML_COMMIT="${GGML_BUILD_COMMIT}"-)message(STATUS "ggml version: ${GGML_INSTALL_VERSION}")message(STATUS "ggml commit: ${GGML_BUILD_COMMIT}")diff --git a/ggml/src/CMakeLists.txt b/ggml/src/CMakeLists.txtindex 96535b49fa..9477320002 100644--- a/ggml/src/CMakeLists.txt+++ b/ggml/src/CMakeLists.txt@@ -213,7 +213,9 @@ set_target_properties(ggml-base PROPERTIESSOVERSION ${GGML_VERSION_MAJOR})-target_include_directories(ggml-base PRIVATE .)+configure_file(ggml-version.h.in ${CMAKE_CURRENT_BINARY_DIR}/ggml-version.h @ONLY)++target_include_directories(ggml-base PRIVATE . ${CMAKE_CURRENT_BINARY_DIR})if (GGML_BACKEND_DL)target_compile_definitions(ggml-base PUBLIC GGML_BACKEND_DL)endif()diff --git a/ggml/src/ggml-version.h.in b/ggml/src/ggml-version.h.innew file mode 100644index 0000000000..37de362977--- /dev/null+++ b/ggml/src/ggml-version.h.in@@ -0,0 +1,4 @@+#pragma once++#define GGML_VERSION "@GGML_VERSION@"+#define GGML_COMMIT "@GGML_BUILD_COMMIT@"diff --git a/ggml/src/ggml.c b/ggml/src/ggml.cindex 2d5fdb7c10..6257cdbe58 100644--- a/ggml/src/ggml.c+++ b/ggml/src/ggml.c@@ -1,6 +1,7 @@#define _CRT_SECURE_NO_DEPRECATE // Disables "unsafe" warnings on Windows#define _USE_MATH_DEFINES // For M_PI on MSVC+#include "ggml-version.h"#include "ggml-backend.h"#include "ggml-impl.h"#include "ggml-threading.h"