aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-10-02 03:45:59 +0200
committerGitHub <noreply@github.com>2019-10-02 03:45:59 +0200
commit30ae60e7cac7e77005aa429bc13f8ffa3ce64eb1 (patch)
tree8723d4c2441f61df7f2c590d1f50b8b3f2e44cef /config
parentac32426b94deabb6843fab797957f0064a54c5a5 (diff)
downloadrneovim-30ae60e7cac7e77005aa429bc13f8ffa3ce64eb1.tar.gz
rneovim-30ae60e7cac7e77005aa429bc13f8ffa3ce64eb1.tar.bz2
rneovim-30ae60e7cac7e77005aa429bc13f8ffa3ce64eb1.zip
Fix/revisit git-describe enhancement (#11124)
* Fix/keep massaging git-describe result Ref: https://github.com/neovim/neovim/pull/11117#issuecomment-536416223 * build: revisit generation of version from Git Fixes "make clean && make", where "auto/versiondef.h" would be missing since b18b84d - because BYPRODUCTS are apparently removed when cleaning. This includes the following improvements/changes: - do not run git-describe during CMake's configure phase just for reporting - do not print with changed Git version (too noisy, simplifies code) * Move to src/nvim (included before config) for easier flow * fallback to describe always, write empty include file * update_version_stamp.lua: use prefix always
Diffstat (limited to 'config')
-rw-r--r--config/CMakeLists.txt29
-rw-r--r--config/versiondef.h.in4
2 files changed, 4 insertions, 29 deletions
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index 7bd48a1f1e..0ca41d5dfd 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -121,35 +121,6 @@ configure_file (
)
# generate version definitions
-if(NVIM_VERSION_MEDIUM)
- message(STATUS "NVIM_VERSION_MEDIUM: ${NVIM_VERSION_MEDIUM}")
-elseif(${CMAKE_VERSION} VERSION_LESS "3.2.0")
- message(STATUS "Skipping version-string generation (requires CMake 3.2.0+)")
-elseif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
- find_program(GIT_EXECUTABLE git)
- if(GIT_EXECUTABLE)
- # Get current version.
- execute_process(
- COMMAND ${GIT_EXECUTABLE} describe --dirty
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- OUTPUT_VARIABLE NVIM_VERSION_MEDIUM
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- message(STATUS "NVIM_VERSION_MEDIUM (from git): ${NVIM_VERSION_MEDIUM}")
-
- # Create a update_version_stamp target to update the version during build.
- file(RELATIVE_PATH relbuild "${PROJECT_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
- add_custom_target(update_version_stamp ALL
- COMMAND ${LUA_PRG} scripts/update_version_stamp.lua
- ${relbuild}/.version_stamp
- ${relbuild}/config/auto/versiondef.h
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- BYPRODUCTS ${CMAKE_BINARY_DIR}/config/auto/versiondef.h)
- add_dependencies(nvim update_version_stamp)
- else()
- message(STATUS "Skipping version-string generation (cannot find git)")
- endif()
-endif()
-
configure_file (
"${PROJECT_SOURCE_DIR}/config/versiondef.h.in"
"${PROJECT_BINARY_DIR}/config/auto/versiondef.h"
diff --git a/config/versiondef.h.in b/config/versiondef.h.in
index b9565735b3..22cad87249 100644
--- a/config/versiondef.h.in
+++ b/config/versiondef.h.in
@@ -5,7 +5,11 @@
#define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@
#define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@
#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@"
+
#cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@"
+#ifndef NVIM_VERSION_MEDIUM
+# include "auto/versiondef_git.h"
+#endif
#define NVIM_API_LEVEL @NVIM_API_LEVEL@
#define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@