Skip to content

Commit

Permalink
build: update cmake min version to 3.10 neovim#16065
Browse files Browse the repository at this point in the history
* build(cmake): update cmake min version to 3.10
* ci: test cmake minimum required version
* build(cmake): remove some legacy includes
  * Since version 3.5 cmake_parse_arguments is implemented natively.
  • Loading branch information
doubleloop authored Oct 20, 2021
1 parent 427bac6 commit 035d82e
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 39 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
cc: gcc
runner: ubuntu-20.04
os: linux
cmake: minimum_required
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
if: github.event.pull_request.draft == false
Expand All @@ -55,6 +56,24 @@ jobs:
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential ccache cmake cpanminus cscope gcc-multilib gdb gettext gperf language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip
- name: Install minimum required version of cmake
if: matrix.cmake == 'minimum_required'
env:
CMAKE_URL: 'https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.sh'
CMAKE_VERSION: '3.10.0'
shell: bash
run: |
curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
mkdir -p "$HOME/.local/bin" /opt/cmake-custom
chmod a+x /tmp/cmake-installer.sh
/tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"
cmake_version="$(cmake --version | head -1)"
echo "$cmake_version" | grep -qF "cmake version $CMAKE_VERSION" || {
echo "Unexpected CMake version: $cmake_version"
exit 1
}
- name: Install new clang
if: matrix.flavor == 'asan' || matrix.flavor == 'tsan'
run: |
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ jobs:
- BUILD_32BIT=ON
- CMAKE_FLAGS="$CMAKE_FLAGS -m32 -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
- DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -m32 -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
# Minimum required CMake.
- CMAKE_URL=https://cmake.org/files/v2.8/cmake-2.8.12-Linux-i386.sh
- *common-job-env
- name: big-endian
os: linux
Expand Down
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# intro: https://codingnest.com/basic-cmake/
# best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1

# Version should match the tested CMAKE_URL in .travis.yml.
cmake_minimum_required(VERSION 2.8.12)
# Version should match the tested CMAKE_URL in .github/workflows/ci.yml.
cmake_minimum_required(VERSION 3.10)
project(nvim C)

if(POLICY CMP0065)
Expand Down Expand Up @@ -590,9 +590,7 @@ if(BUSTED_PRG)
# console pool: to do so we need to use the USES_TERMINAL
# option, but this is only available in CMake 3.2
set(TEST_TARGET_ARGS)
if(NOT (${CMAKE_VERSION} VERSION_LESS 3.2.0))
list(APPEND TEST_TARGET_ARGS "USES_TERMINAL")
endif()
list(APPEND TEST_TARGET_ARGS "USES_TERMINAL")

set(UNITTEST_PREREQS nvim-test unittest-headers)
set(FUNCTIONALTEST_PREREQS nvim printenv-test printargs-test shell-test streams-test tty-test ${GENERATED_HELP_TAGS})
Expand Down
13 changes: 0 additions & 13 deletions ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,3 @@ fi

source ~/.nvm/nvm.sh
nvm install 10

if [[ -n "$CMAKE_URL" ]]; then
echo "Installing custom CMake: $CMAKE_URL"
curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
mkdir -p "$HOME/.local/bin" /opt/cmake-custom
bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"
cmake_version="$(cmake --version)"
echo "$cmake_version" | grep -qF '2.8.12' || {
echo "Unexpected CMake version: $cmake_version"
exit 1
}
fi
2 changes: 0 additions & 2 deletions src/nvim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ endfunction()
set(use_git_version 0)
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)
Expand Down
2 changes: 0 additions & 2 deletions third-party/cmake/BuildLibuv.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(CMakeParseArguments)

# BuildLibuv(TARGET targetname CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
# Reusable function to build libuv, wraps ExternalProject_Add.
# Failing to pass a command argument will result in no command being run
Expand Down
2 changes: 0 additions & 2 deletions third-party/cmake/BuildLibvterm.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(CMakeParseArguments)

# BuildLibvterm(CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
# Failing to pass a command argument will result in no command being run
function(BuildLibvterm)
Expand Down
2 changes: 0 additions & 2 deletions third-party/cmake/BuildLua.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(CMakeParseArguments)

# BuildLua(CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
# Reusable function to build lua, wraps ExternalProject_Add.
# Failing to pass a command argument will result in no command being run
Expand Down
2 changes: 0 additions & 2 deletions third-party/cmake/BuildLuajit.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(CMakeParseArguments)

# BuildLuajit(TARGET targetname CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
# Reusable function to build luajit, wraps ExternalProject_Add.
# Failing to pass a command argument will result in no command being run
Expand Down
2 changes: 0 additions & 2 deletions third-party/cmake/BuildLuv.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(CMakeParseArguments)

# BuildLuv(PATCH_COMMAND ... CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
# Reusable function to build luv, wraps ExternalProject_Add.
# Failing to pass a command argument will result in no command being run
Expand Down
2 changes: 0 additions & 2 deletions third-party/cmake/BuildMsgpack.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(CMakeParseArguments)

# BuildMsgpack(CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
# Reusable function to build msgpack, wraps ExternalProject_Add.
# Failing to pass a command argument will result in no command being run
Expand Down
2 changes: 0 additions & 2 deletions third-party/cmake/BuildTreesitter.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(CMakeParseArguments)

# BuildTreeSitter(TARGET targetname CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
function(BuildTreeSitter)
cmake_parse_arguments(_treesitter
Expand Down
3 changes: 0 additions & 3 deletions third-party/cmake/GetBinaryDeps.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Download and install binary dependencies for windows
include(CMakeParseArguments)

# This is similar to the build recipes, but instead downloads a third party
# binary and installs it under the DEPS_PREFIX.
# The INSTALL_COMMAND is executed in the folder where downloaded files are
Expand Down

0 comments on commit 035d82e

Please sign in to comment.