forked from ggerganov/llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake : fix issue with version info not getting baked into LlamaConfi…
…g.cmake (ggerganov#3970) * Split CPP generation from build-info query * Remove blank lines * Add BUILD_SHARED_LIBS option
- Loading branch information
Showing
4 changed files
with
29 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/scripts/build-info.cmake) | ||
|
||
set(TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/common/build-info.cpp.in") | ||
set(OUTPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/common/build-info.cpp") | ||
|
||
# Only write the build info if it changed | ||
if(EXISTS ${OUTPUT_FILE}) | ||
file(READ ${OUTPUT_FILE} CONTENTS) | ||
string(REGEX MATCH "LLAMA_COMMIT = \"([^\"]*)\";" _ ${CONTENTS}) | ||
set(OLD_COMMIT ${CMAKE_MATCH_1}) | ||
string(REGEX MATCH "LLAMA_COMPILER = \"([^\"]*)\";" _ ${CONTENTS}) | ||
set(OLD_COMPILER ${CMAKE_MATCH_1}) | ||
string(REGEX MATCH "LLAMA_BUILD_TARGET = \"([^\"]*)\";" _ ${CONTENTS}) | ||
set(OLD_TARGET ${CMAKE_MATCH_1}) | ||
if ( | ||
NOT OLD_COMMIT STREQUAL BUILD_COMMIT OR | ||
NOT OLD_COMPILER STREQUAL BUILD_COMPILER OR | ||
NOT OLD_TARGET STREQUAL BUILD_TARGET | ||
) | ||
configure_file(${TEMPLATE_FILE} ${OUTPUT_FILE}) | ||
endif() | ||
else() | ||
configure_file(${TEMPLATE_FILE} ${OUTPUT_FILE}) | ||
endif() |