build: remove pkgconfig-related code (#22422)

Cmake should already be able to find everything on its own.
This commit is contained in:
dundargoc 2023-02-26 22:32:08 +01:00 committed by GitHub
parent 774e59f3f9
commit 1e37703a74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 122 deletions

View File

@ -38,23 +38,9 @@ endif()
# Prefer our bundled versions of dependencies.
if(DEFINED ENV{DEPS_BUILD_DIR})
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
# 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 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")
else()
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
endif()
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
else()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/_usr" CACHE PATH "Path prefix for finding dependencies")
else()
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
endif()
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
# When running from within CLion or Visual Studio,
# build bundled dependencies automatically.
if(NOT EXISTS ${DEPS_PREFIX}
@ -84,7 +70,6 @@ else()
endif()
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX})
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# If the macOS deployment target is not set manually (via $MACOSX_DEPLOYMENT_TARGET),

View File

@ -34,24 +34,14 @@ if(HAS_OG_FLAG)
set(DEFAULT_MAKE_CFLAGS CFLAGS+=-Og ${DEFAULT_MAKE_CFLAGS})
endif()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
# 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 root CMakeLists.txt
# https://github.com/neovim/neovim/pull/14745#issuecomment-860201794
set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/_usr" CACHE PATH "Dependencies install directory.")
else()
set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.")
endif()
list(APPEND DEPS_CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR})
set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.")
set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin" CACHE PATH "Dependencies binary install directory.")
set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib" CACHE PATH "Dependencies library install directory.")
set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build" CACHE PATH "Dependencies build directory.")
set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependencies download directory.")
list(APPEND DEPS_CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR})
option(USE_BUNDLED "Use bundled dependencies." ON)
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})

View File

@ -1,24 +1,9 @@
# - Try to find luv
# Once done this will define
# LIBLUV_FOUND - System has libluv
# LIBLUV_INCLUDE_DIRS - The libluv include directories
# LIBLUV_LIBRARIES - The libraries needed to use libluv
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBLUV QUIET luv)
endif()
set(LIBLUV_DEFINITIONS ${PC_LIBLUV_CFLAGS_OTHER})
find_path(LIBLUV_INCLUDE_DIR luv/luv.h
PATHS ${PC_LIBLUV_INCLUDEDIR} ${PC_LIBLUV_INCLUDE_DIRS})
find_path(LIBLUV_INCLUDE_DIR luv/luv.h)
# Explicitly look for luv.so. #10407
list(APPEND LIBLUV_NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX})
find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}
HINTS ${PC_LIBLUV_LIBDIR} ${PC_LIBLUV_LIBRARY_DIRS})
find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES})
set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY})
set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR})

View File

@ -1,23 +1,8 @@
# - Try to find libtermkey
# Once done this will define
# LIBTERMKEY_FOUND - System has libtermkey
# LIBTERMKEY_INCLUDE_DIRS - The libtermkey include directories
# LIBTERMKEY_LIBRARIES - The libraries needed to use libtermkey
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBTERMKEY QUIET termkey)
endif()
set(LIBTERMKEY_DEFINITIONS ${PC_LIBTERMKEY_CFLAGS_OTHER})
find_path(LIBTERMKEY_INCLUDE_DIR termkey.h
PATHS ${PC_LIBTERMKEY_INCLUDEDIR} ${PC_LIBTERMKEY_INCLUDE_DIRS})
find_path(LIBTERMKEY_INCLUDE_DIR termkey.h)
list(APPEND LIBTERMKEY_NAMES termkey)
find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES}
HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS})
find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES})
set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY})
set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR})

View File

@ -1,34 +1,14 @@
# - Try to find libuv
# Once done, this will define
#
# LIBUV_FOUND - system has libuv
# LIBUV_INCLUDE_DIRS - the libuv include directories
# LIBUV_LIBRARIES - link these to use libuv
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBUV QUIET libuv)
endif()
find_path(LIBUV_INCLUDE_DIR uv.h
HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS})
find_path(LIBUV_INCLUDE_DIR uv.h)
list(APPEND LIBUV_NAMES uv_a uv)
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}
HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS})
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES})
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY)
if(PC_LIBUV_LIBRARIES)
list(REMOVE_ITEM PC_LIBUV_LIBRARIES uv)
endif()
set(LIBUV_LIBRARIES ${LIBUV_LIBRARY} ${PC_LIBUV_LIBRARIES})
set(LIBUV_LIBRARIES ${LIBUV_LIBRARY})
set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR})
# Deal with the fact that libuv.pc is missing important dependency information.
include(CheckLibraryExists)
check_library_exists(dl dlopen "dlfcn.h" HAVE_LIBDL)

View File

@ -1,18 +1,4 @@
# - Try to find luajit
# Once done this will define
# LUAJIT_FOUND - System has luajit
# LUAJIT_INCLUDE_DIRS - The luajit include directories
# LUAJIT_LIBRARIES - The libraries needed to use luajit
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LUAJIT QUIET luajit)
endif()
set(LUAJIT_DEFINITIONS ${PC_LUAJIT_CFLAGS_OTHER})
find_path(LUAJIT_INCLUDE_DIR luajit.h
PATHS ${PC_LUAJIT_INCLUDEDIR} ${PC_LUAJIT_INCLUDE_DIRS}
PATH_SUFFIXES luajit-2.0 luajit-2.1)
if(MSVC)
@ -23,8 +9,7 @@ else()
list(APPEND LUAJIT_NAMES luajit-5.1)
endif()
find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}
PATHS ${PC_LUAJIT_LIBDIR} ${PC_LUAJIT_LIBRARY_DIRS})
find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES})
set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY})
set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR})

View File

@ -1,20 +1,4 @@
# - Try to find msgpack
# Once done this will define
# MSGPACK_FOUND - System has msgpack
# MSGPACK_INCLUDE_DIRS - The msgpack include directories
# MSGPACK_LIBRARIES - The libraries needed to use msgpack
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_search_module(PC_MSGPACK QUIET
msgpackc>=${Msgpack_FIND_VERSION}
msgpack>=${Msgpack_FIND_VERSION})
endif()
set(MSGPACK_DEFINITIONS ${PC_MSGPACK_CFLAGS_OTHER})
find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h
HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS})
find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h)
if(MSGPACK_INCLUDE_DIR)
file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h)
@ -36,8 +20,7 @@ endif()
find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES}
# Check each directory for all names to avoid using headers/libraries from
# different places.
NAMES_PER_DIR
HINTS ${PC_MSGPACK_LIBDIR} ${PC_MSGPACK_LIBRARY_DIRS})
NAMES_PER_DIR)
mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY)