It's simpler to let cmake figure out what flags to add to each platforms
to create position independent code rather than handling it ourselves.
Also remove code that sets POSITION_INDEPENDENT_CODE property on SHARED
and MODULE libraries, as it's already on by default.
* 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.
The default cmake installation process for dependencies that use cmake
on all platforms is in general more robust and less verbose, so we rely
on that if possible.
build(deps): disable shared library for libvterm
Problem:
Cannot build both static and share libraries for libvterm under Windows.
The static and shared library would have the same name "vterm.lib", thus there would be multiple rules to build the same target.
Solution:
Disable shared library for libvterm.
This makes it possible to use Ninja on Windows to build dependencies (2x speedup!).
But not for Release builds yet.
Co-authored-by: Wei Tang <gauchyler@uestc.edu.cn>
59d5f692f removed cmake.deps/cmake/DownloadAndExtractFile.cmake and
support for USE_EXISTING_SRC_DIR. The Ubuntu nightly PPA still relies
on USE_EXISTING_SRC_DIR functionality since it can't access the network
during the build.
Supplying an empty value for ExternalProject_Add()'s URL value appears
to provide the needed mechanism to avoid re-downloading when the sources
are already present. This is undocumented behavior, though, so it may
break in the future.
Now, if USE_EXISTING_SRC_DIR is set, the ExternalProject's URL variable
is unset, preventing the download and erroring out if the source doesn't
actually exist.
DownloadAndExtractFile.cmake was initially introduced as a workaround to
avoid the massive amounts of logs generated by the download progress.
This is not a problem anymore as ExternalProject_Add has had the
DOWNLOAD_NO_PROGRESS option since cmake version 3.1.
We don't support 32bit Windows anymore, so it's not needed. Also remove
TargetArch.cmake and related code as we don't need architecture
detection for the same reason.
Change the default build type to always be Debug, and allow only four
predefined build types: Debug, Release, RelWithDebInfo and MinRelSize.
Furthermore, flags meant for single-configuration generator (make,
ninja) will not be used for multi-configuration generators (visual
studio, Xcode), and flags meant for multi-configuration generators will
not be used for single-configuration generators.
This will allow Debug builds to be built with MSVC which requires that
all dependencies are also built with the Debug build type to avoid
runtime library mismatch.
The correct way to specify build type (for example Release) for
single-configuration generators (Make and Ninja) is to run
cmake -B build -D CMAKE_BUILD_TYPE=Release
cmake --build build
while for multi-configuration generators (Visual Studio, Xcode and Ninja
Multi-Config) is to run
cmake -B build
cmake --build build --config Release
Passing CMAKE_BUILD_TYPE for multi-config generators will now not only
not be used, but also generate a warning for the user.
Co-authored-by: dundargoc <gocundar@gmail.com>
The @error capture is used for tree-sitter's ERROR node, which indicates
a parsing error -- which can be quite frequent (and jarring) while typing.
Users can still manually `hi link @error Error` in their config.
Use the same logic for both deps (including LuaJIT, for which setting
this variable is mandatory) and Nvim: either the eponymous environment
variable if set, or the current software version if not.
Removes annoying warnings when building locally on macOS.
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/)