ggml : replace compile definitions with version.h.in (#28364)
This commit adds a cmake version configuration file to replace the current compile definition solution for the version. The motivation for this change is that I made a mistake and did not take into consideration that the compile definition means that this will become a compiler flag for all sources in the target. This means that when a version update happens that will recompile all sources in the target even if they have not changed. Refs: https://github.com/ggml-org/llama.cpp/pull/28278
This commit is contained in:
@@ -404,10 +404,6 @@ write_basic_package_version_file(
|
|||||||
VERSION ${GGML_INSTALL_VERSION}
|
VERSION ${GGML_INSTALL_VERSION}
|
||||||
COMPATIBILITY SameMajorVersion)
|
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 version: ${GGML_INSTALL_VERSION}")
|
||||||
message(STATUS "ggml commit: ${GGML_BUILD_COMMIT}")
|
message(STATUS "ggml commit: ${GGML_BUILD_COMMIT}")
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,9 @@ set_target_properties(ggml-base PROPERTIES
|
|||||||
SOVERSION ${GGML_VERSION_MAJOR}
|
SOVERSION ${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)
|
if (GGML_BACKEND_DL)
|
||||||
target_compile_definitions(ggml-base PUBLIC GGML_BACKEND_DL)
|
target_compile_definitions(ggml-base PUBLIC GGML_BACKEND_DL)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define GGML_VERSION "@GGML_VERSION@"
|
||||||
|
#define GGML_COMMIT "@GGML_BUILD_COMMIT@"
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#define _CRT_SECURE_NO_DEPRECATE // Disables "unsafe" warnings on Windows
|
#define _CRT_SECURE_NO_DEPRECATE // Disables "unsafe" warnings on Windows
|
||||||
#define _USE_MATH_DEFINES // For M_PI on MSVC
|
#define _USE_MATH_DEFINES // For M_PI on MSVC
|
||||||
|
|
||||||
|
#include "ggml-version.h"
|
||||||
#include "ggml-backend.h"
|
#include "ggml-backend.h"
|
||||||
#include "ggml-impl.h"
|
#include "ggml-impl.h"
|
||||||
#include "ggml-threading.h"
|
#include "ggml-threading.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user