build: rename build-related dirs

Problem:
Dirs "config", "packaging", and "third-party" are all closely related
but this is not obvious from the layout. This adds friction for new
contributors.

Solution:
- rename config/ to cmake.config/
- rename test/config/ to test/cmakeconfig/ because it is used in Lua
  tests: require('test.cmakeconfig.paths').
- rename packaging/ to cmake.packaging/
- rename third-party/ to cmake.deps/ (parallel with .deps/)
This commit is contained in:
Justin M. Keyes 2022-06-27 03:08:59 -07:00
parent 9ddb481d88
commit f05a2891d3
55 changed files with 46 additions and 44 deletions

View File

@ -33,7 +33,7 @@ tasks:
export AUTOMAKE_VERSION=1.16
mkdir neovim/.deps
cd neovim/.deps
cmake -G Ninja ../third-party/
cmake -G Ninja ../cmake.deps/
cmake --build . --config RelWithDebInfo
- build: |
mkdir neovim/build

2
.github/labeler.yml vendored
View File

@ -18,7 +18,7 @@
- runtime/lua/vim/diagnostic.lua
"dependencies":
- third-party/**/*
- cmake.deps/**/*
"spell":
- src/nvim/spell*

View File

@ -98,9 +98,9 @@ jobs:
path: |
${{ env.CACHE_NVIM_DEPS_DIR }}
~/.ccache
key: lint-${{ hashFiles('cmake/*', '**/CMakeLists.txt', '!third-party/**CMakeLists.txt') }}-${{ github.base_ref }}
key: lint-${{ hashFiles('cmake/*', '**/CMakeLists.txt', '!cmake.deps/**CMakeLists.txt') }}-${{ github.base_ref }}
- name: Build third-party
- name: Build third-party deps
run: ./ci/before_script.sh
- name: Build nvim
@ -236,9 +236,9 @@ jobs:
path: |
${{ env.CACHE_NVIM_DEPS_DIR }}
~/.ccache
key: ${{ matrix.runner }}-${{ matrix.flavor }}-${{ matrix.cc }}-${{ hashFiles('cmake/*', 'third-party/**', '**/CMakeLists.txt') }}-${{ github.base_ref }}
key: ${{ matrix.runner }}-${{ matrix.flavor }}-${{ matrix.cc }}-${{ hashFiles('cmake/*', 'cmake.deps/**', '**/CMakeLists.txt') }}-${{ github.base_ref }}
- name: Build third-party
- name: Build third-party deps
run: ./ci/before_script.sh
- name: Build
@ -276,7 +276,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ env.DEPS_BUILD_DIR }}
key: ${{ hashFiles('third-party\**') }}
key: ${{ hashFiles('cmake.deps\**') }}
- name: Run CI
run: powershell ci\build.ps1

View File

@ -30,7 +30,7 @@ if(DEFINED ENV{DEPS_BUILD_DIR})
# pkg-config 29.2 has a bug on OpenBSD which causes it to drop any paths that
# *contain* system include paths. To avoid this, we prefix what would be
# "/usr/include" as "/_usr/include".
# This check is also performed in the third-party/CMakeLists.txt and in the
# This check is also performed in the cmake.deps/CMakeLists.txt and in the
# else clause following here.
# https://github.com/neovim/neovim/pull/14745#issuecomment-860201794
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/_usr" CACHE PATH "Path prefix for finding dependencies")
@ -62,7 +62,7 @@ else()
-DCMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO}
-DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
${PROJECT_SOURCE_DIR}/third-party
${PROJECT_SOURCE_DIR}/cmake.deps
WORKING_DIRECTORY ${DEPS_BUILD_DIR})
execute_process(
COMMAND ${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}
@ -400,7 +400,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT P
"${CMAKE_MODULE_LINKER_FLAGS} -image_base 100000000")
endif()
include_directories("${PROJECT_BINARY_DIR}/config")
include_directories("${PROJECT_BINARY_DIR}/cmake.config")
include_directories("${PROJECT_SOURCE_DIR}/src")
find_package(LibUV 1.28.0 REQUIRED)
@ -651,7 +651,7 @@ install_helper(
add_subdirectory(src/nvim)
get_directory_property(NVIM_VERSION_CFLAGS DIRECTORY src/nvim DEFINITION NVIM_VERSION_CFLAGS)
add_subdirectory(test/includes)
add_subdirectory(config)
add_subdirectory(cmake.config)
add_subdirectory(test/functional/fixtures) # compile test programs
add_subdirectory(runtime)
get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
@ -702,11 +702,11 @@ if(BUSTED_PRG)
set(TEST_LIBNVIM_PATH "")
endif()
configure_file(
${CMAKE_SOURCE_DIR}/test/config/paths.lua.in
${CMAKE_BINARY_DIR}/test/config/paths.lua.gen)
${CMAKE_SOURCE_DIR}/test/cmakeconfig/paths.lua.in
${CMAKE_BINARY_DIR}/test/cmakeconfig/paths.lua.gen)
file(GENERATE
OUTPUT ${CMAKE_BINARY_DIR}/test/config/paths.lua
INPUT ${CMAKE_BINARY_DIR}/test/config/paths.lua.gen)
OUTPUT ${CMAKE_BINARY_DIR}/test/cmakeconfig/paths.lua
INPUT ${CMAKE_BINARY_DIR}/test/cmakeconfig/paths.lua.gen)
add_custom_target(functionaltest
COMMAND ${CMAKE_COMMAND}
@ -760,5 +760,5 @@ add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/UninstallHelper.cmake)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(packaging)
add_subdirectory(cmake.packaging)
endif()

View File

@ -63,7 +63,7 @@ or the backport will fail.
Third-party dependencies
--------------
These "bundled" dependencies can be updated by bumping their versions in `third-party/CMakeLists.txt`:
These "bundled" dependencies can be updated by bumping their versions in `cmake.deps/CMakeLists.txt`:
- [Lua](https://www.lua.org/download.html)
- [LuaJIT](https://github.com/LuaJIT/LuaJIT)
- [Luv](https://github.com/luvit/luv)

View File

@ -96,7 +96,7 @@ build/.ran-cmake: | deps
cd build && $(CMAKE_PRG) -G '$(CMAKE_GENERATOR)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(MAKEFILE_DIR)
touch $@
deps: | build/.ran-third-party-cmake
deps: | build/.ran-deps-cmake
ifeq ($(call filter-true,$(USE_BUNDLED)),)
+$(BUILD_TOOL) -C $(DEPS_BUILD_DIR)
endif
@ -104,12 +104,12 @@ endif
ifeq ($(call filter-true,$(USE_BUNDLED)),)
$(DEPS_BUILD_DIR):
mkdir -p "$@"
build/.ran-third-party-cmake:: $(DEPS_BUILD_DIR)
build/.ran-deps-cmake:: $(DEPS_BUILD_DIR)
cd $(DEPS_BUILD_DIR) && \
$(CMAKE_PRG) -G '$(CMAKE_GENERATOR)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) $(MAKEFILE_DIR)/third-party
$(DEPS_CMAKE_FLAGS) $(MAKEFILE_DIR)/cmake.deps
endif
build/.ran-third-party-cmake::
build/.ran-deps-cmake::
mkdir -p build
touch $@

View File

@ -81,8 +81,10 @@ Project layout
--------------
├─ ci/ build automation
├─ cmake/ build scripts
├─ runtime/ user plugins/docs
├─ cmake/ CMake utils
├─ cmake.config/ CMake defines
├─ cmake.deps/ subproject to fetch and build dependencies (optional)
├─ runtime/ plugins and docs
├─ src/nvim/ application source code (see src/nvim/README.md)
│ ├─ api/ API subsystem
│ ├─ eval/ VimL subsystem
@ -93,7 +95,6 @@ Project layout
│ ├─ msgpack_rpc/ RPC subsystem
│ ├─ os/ low-level platform code
│ └─ tui/ built-in UI
├─ third-party/ CMake subproject to build dependencies
└─ test/ tests (see test/README.md)
License

View File

@ -71,9 +71,9 @@ function convertToCmakeArgs($vars) {
cd $env:DEPS_BUILD_DIR
if ($bits -eq 32) {
cmake -G $cmakeGenerator -A Win32 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
cmake -G $cmakeGenerator -A Win32 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/cmake.deps/" ; exitIfFailed
} else {
cmake -G $cmakeGenerator -A x64 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
cmake -G $cmakeGenerator -A x64 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/cmake.deps/" ; exitIfFailed
}
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
cd $buildDir

View File

@ -35,7 +35,7 @@ build_deps() {
# update CMake configuration and update to newer deps versions.
cd "${DEPS_BUILD_DIR}"
echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/third-party/"
CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/cmake.deps/"
if ! top_make; then
exit 1

View File

@ -128,14 +128,14 @@ endif()
# generate configuration header and update include directories
configure_file (
"${PROJECT_SOURCE_DIR}/config/config.h.in"
"${PROJECT_BINARY_DIR}/config/auto/config.h"
"${PROJECT_SOURCE_DIR}/cmake.config/config.h.in"
"${PROJECT_BINARY_DIR}/cmake.config/auto/config.h"
)
# generate version definitions
configure_file (
"${PROJECT_SOURCE_DIR}/config/versiondef.h.in"
"${PROJECT_BINARY_DIR}/config/auto/versiondef.h"
"${PROJECT_SOURCE_DIR}/cmake.config/versiondef.h.in"
"${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef.h"
)
# generate pathdef.c
@ -158,6 +158,6 @@ elseif (EXISTS ${HOSTNAME_PROG})
endif()
configure_file (
"${PROJECT_SOURCE_DIR}/config/pathdef.c.in"
"${PROJECT_BINARY_DIR}/config/auto/pathdef.c"
"${PROJECT_SOURCE_DIR}/cmake.config/pathdef.c.in"
"${PROJECT_BINARY_DIR}/cmake.config/auto/pathdef.c"
ESCAPE_QUOTES)

View File

@ -286,6 +286,7 @@ else()
set(ALL_DEPS clean-shared-libraries)
endif()
# TODO(justinmk): does anyone use this target?
add_custom_target(third-party ALL
COMMAND ${CMAKE_COMMAND} -E touch .third-party
DEPENDS ${ALL_DEPS}

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -132,7 +132,7 @@ end
local function write_cmakelists_line(symbol, kind, value)
require_executable("sed")
local cmakelists_path = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt"
local cmakelists_path = nvim_src_dir .. "/" .. "cmake.deps/CMakeLists.txt"
run_die({
"sed",
"-i",
@ -169,7 +169,7 @@ local function update_cmakelists(dependency, archive, comment)
verify_branch(dependency.name)
local changed_file = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt"
local changed_file = nvim_src_dir .. "/" .. "cmake.deps/CMakeLists.txt"
p("Updating " .. dependency.name .. " to " .. archive.url .. "\n")
write_cmakelists_line(dependency.symbol, "URL", archive.url:gsub("/", "\\/"))
@ -183,7 +183,7 @@ end
local function verify_cmakelists_committed()
require_executable("git")
local cmakelists_path = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt"
local cmakelists_path = nvim_src_dir .. "/" .. "cmake.deps/CMakeLists.txt"
run_die({ "git", "diff", "--quiet", "HEAD", "--", cmakelists_path }, cmakelists_path .. " has uncommitted changes")
end

View File

@ -244,12 +244,12 @@ if(use_git_version)
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}/config/auto/versiondef_git.h
${relbuild}/cmake.config/auto/versiondef_git.h
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}${NVIM_VERSION_PRERELEASE}"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
BYPRODUCTS ${CMAKE_BINARY_DIR}/config/auto/versiondef_git.h)
BYPRODUCTS ${CMAKE_BINARY_DIR}/cmake.config/auto/versiondef_git.h)
else()
file(WRITE ${CMAKE_BINARY_DIR}/config/auto/versiondef_git.h "")
file(WRITE ${CMAKE_BINARY_DIR}/cmake.config/auto/versiondef_git.h "")
endif()
# NVIM_GENERATED_FOR_HEADERS: generated headers to be included in headers
@ -394,7 +394,7 @@ list(APPEND NVIM_GENERATED_FOR_SOURCES
)
list(APPEND NVIM_GENERATED_SOURCES
"${PROJECT_BINARY_DIR}/config/auto/pathdef.c"
"${PROJECT_BINARY_DIR}/cmake.config/auto/pathdef.c"
)
add_custom_command(OUTPUT ${GENERATED_EX_CMDS_ENUM} ${GENERATED_EX_CMDS_DEFS}

View File

@ -7,7 +7,7 @@ local write_file, spawn, set_session, nvim_prog, exc_exec =
helpers.exc_exec
local lfs = require('lfs')
local paths = require('test.config.paths')
local paths = require('test.cmakeconfig.paths')
local mpack = require('mpack')

View File

@ -4,7 +4,7 @@ local assert = require('luassert')
local luv = require('luv')
local lfs = require('lfs')
local relpath = require('pl.path').relpath
local Paths = require('test.config.paths')
local Paths = require('test.cmakeconfig.paths')
assert:set_parameter('TableFormatLevel', 100)

View File

@ -54,7 +54,7 @@ main() {
includes="$includes -I$PROJECT_SOURCE_DIR/src"
includes="$includes -I$PROJECT_BINARY_DIR/src/nvim/auto"
includes="$includes -I$PROJECT_BINARY_DIR/include"
includes="$includes -I$PROJECT_BINARY_DIR/config"
includes="$includes -I$PROJECT_BINARY_DIR/cmake.config"
includes="$includes -I/host-includes"
local defines=

View File

@ -2,7 +2,7 @@ local ffi = require('ffi')
local formatc = require('test.unit.formatc')
local Set = require('test.unit.set')
local Preprocess = require('test.unit.preprocess')
local Paths = require('test.config.paths')
local Paths = require('test.cmakeconfig.paths')
local global_helpers = require('test.helpers')
local assert = require('luassert')
local say = require('say')