mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
4c5c6ca800
* build: various cmake refactors and simplifications - Add STATUS keyword to message to ensure messages are shown in the correct order. - Remove DEPS_CXX_COMPILER as we don't rely on C++ for any of our dependencies. - Simplify how msgpack and luv configure options are constructed. - Rely on the default installation for luv instead of manually passing configure, build and install commands. - Simplify return code conditional. * build: remove CMAKE_OSX_ARCHITECTURES_ALT_SEP workaround CMAKE_OSX_ARCHITECTURES_ALT_SEP was defined as a workaround to prevent the shell from interpreting `;`, which CMake uses as a list separator. However, the same thing can be achieved by instead passing CMAKE_OSX_ARCHITECTURES as a cache variable instead, which is a more idiomatic way of achieving the same thing. * build: define CMAKE_BUILD_TYPE before adding it to BUILD_TYPE_STRING The problem with the current setup is that CMAKE_BUILD_TYPE is defined after BUILD_TYPE_STRING. BUILD_TYPE_STRING will then be empty on the first run, meaning that dependencies are built without a build type. However, since CMAKE_BUILD_TYPE is a cache variable its value will persist in subsequent runs. On the second run BUILD_TYPE_STRING will have the correct value, but it's a different value from the ones the dependencies were built with. This will force some dependencies to be built again. Fixes https://github.com/neovim/neovim/issues/21672.
40 lines
1.4 KiB
CMake
40 lines
1.4 KiB
CMake
set(NVIM_VERSION
|
|
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}${NVIM_VERSION_PRERELEASE}")
|
|
|
|
execute_process(
|
|
COMMAND git --git-dir=${NVIM_SOURCE_DIR}/.git --work-tree=${NVIM_SOURCE_DIR} describe --first-parent --dirty --always
|
|
OUTPUT_VARIABLE GIT_TAG
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
RESULT_VARIABLE RES)
|
|
|
|
if(RES)
|
|
message(STATUS "Using NVIM_VERSION: ${NVIM_VERSION}")
|
|
file(WRITE "${OUTPUT}" "")
|
|
return()
|
|
endif()
|
|
|
|
# `git describe` annotates the most recent tagged release; for pre-release
|
|
# builds we append that to the dev version.
|
|
if(NVIM_VERSION_PRERELEASE)
|
|
# Extract pre-release info: "v0.8.0-145-g0f9113907" => "145-g0f9113907"
|
|
string(REGEX REPLACE "^v[0-9]+.[0-9]+.[0-9]+-" "" NVIM_VERSION_GIT "${GIT_TAG}")
|
|
# Replace "-" with "+": "145-g0f9113907" => "145+g0f9113907"
|
|
string(REGEX REPLACE "^([0-9]+)-([a-z0-9]+)" "\\1+\\2" NVIM_VERSION_GIT "${NVIM_VERSION_GIT}")
|
|
set(NVIM_VERSION "${NVIM_VERSION}-${NVIM_VERSION_GIT}")
|
|
endif()
|
|
|
|
set(NVIM_VERSION_STRING "#define NVIM_VERSION_MEDIUM \"${NVIM_VERSION}\"\n")
|
|
|
|
string(SHA1 CURRENT_VERSION_HASH "${NVIM_VERSION_STRING}")
|
|
if(EXISTS ${OUTPUT})
|
|
file(SHA1 "${OUTPUT}" NVIM_VERSION_HASH)
|
|
endif()
|
|
|
|
if(NOT "${NVIM_VERSION_HASH}" STREQUAL "${CURRENT_VERSION_HASH}")
|
|
message(STATUS "Using NVIM_VERSION: ${NVIM_VERSION}")
|
|
file(WRITE "${OUTPUT}" "${NVIM_VERSION_STRING}")
|
|
if(WIN32)
|
|
configure_file("${OUTPUT}" "${OUTPUT}" NEWLINE_STYLE UNIX)
|
|
endif()
|
|
endif()
|