build: remove pkgconfig-related code

Cmake should already be able to find everything on its own.
This commit is contained in:
dundargoc 2023-02-26 22:04:43 +01:00
parent 774e59f3f9
commit 09118052ce
7 changed files with 15 additions and 122 deletions

View File

@ -38,23 +38,9 @@ endif()
# Prefer our bundled versions of dependencies. # Prefer our bundled versions of dependencies.
if(DEFINED ENV{DEPS_BUILD_DIR}) if(DEFINED ENV{DEPS_BUILD_DIR})
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
# 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()
else() else()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
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()
# When running from within CLion or Visual Studio, # When running from within CLion or Visual Studio,
# build bundled dependencies automatically. # build bundled dependencies automatically.
if(NOT EXISTS ${DEPS_PREFIX} if(NOT EXISTS ${DEPS_PREFIX}
@ -84,7 +70,6 @@ else()
endif() endif()
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) 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(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# If the macOS deployment target is not set manually (via $MACOSX_DEPLOYMENT_TARGET), # 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}) set(DEFAULT_MAKE_CFLAGS CFLAGS+=-Og ${DEFAULT_MAKE_CFLAGS})
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.")
# 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_BIN_DIR "${DEPS_INSTALL_DIR}/bin" CACHE PATH "Dependencies binary 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_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_BUILD_DIR "${CMAKE_BINARY_DIR}/build" CACHE PATH "Dependencies build directory.")
set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependencies download 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 "Use bundled dependencies." ON)
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED}) option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})

View File

@ -1,24 +1,9 @@
# - Try to find luv find_path(LIBLUV_INCLUDE_DIR luv/luv.h)
# 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})
# Explicitly look for luv.so. #10407 # Explicitly look for luv.so. #10407
list(APPEND LIBLUV_NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX}) list(APPEND LIBLUV_NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX})
find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES} find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES})
HINTS ${PC_LIBLUV_LIBDIR} ${PC_LIBLUV_LIBRARY_DIRS})
set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY}) set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY})
set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR}) set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR})

View File

@ -1,23 +1,8 @@
# - Try to find libtermkey find_path(LIBTERMKEY_INCLUDE_DIR termkey.h)
# 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})
list(APPEND LIBTERMKEY_NAMES termkey) list(APPEND LIBTERMKEY_NAMES termkey)
find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES} find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES})
HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS})
set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY}) set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY})
set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR}) set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR})

View File

@ -1,34 +1,14 @@
# - Try to find libuv find_path(LIBUV_INCLUDE_DIR uv.h)
# 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})
list(APPEND LIBUV_NAMES uv_a uv) list(APPEND LIBUV_NAMES uv_a uv)
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES} find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES})
HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS})
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY)
if(PC_LIBUV_LIBRARIES) set(LIBUV_LIBRARIES ${LIBUV_LIBRARY})
list(REMOVE_ITEM PC_LIBUV_LIBRARIES uv)
endif()
set(LIBUV_LIBRARIES ${LIBUV_LIBRARY} ${PC_LIBUV_LIBRARIES})
set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR}) set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR})
# Deal with the fact that libuv.pc is missing important dependency information.
include(CheckLibraryExists) include(CheckLibraryExists)
check_library_exists(dl dlopen "dlfcn.h" HAVE_LIBDL) 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 find_path(LUAJIT_INCLUDE_DIR luajit.h
PATHS ${PC_LUAJIT_INCLUDEDIR} ${PC_LUAJIT_INCLUDE_DIRS}
PATH_SUFFIXES luajit-2.0 luajit-2.1) PATH_SUFFIXES luajit-2.0 luajit-2.1)
if(MSVC) if(MSVC)
@ -23,8 +9,7 @@ else()
list(APPEND LUAJIT_NAMES luajit-5.1) list(APPEND LUAJIT_NAMES luajit-5.1)
endif() endif()
find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES} find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES})
PATHS ${PC_LUAJIT_LIBDIR} ${PC_LUAJIT_LIBRARY_DIRS})
set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY})
set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR})

View File

@ -1,20 +1,4 @@
# - Try to find msgpack find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h)
# 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})
if(MSGPACK_INCLUDE_DIR) if(MSGPACK_INCLUDE_DIR)
file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h) file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h)
@ -36,8 +20,7 @@ endif()
find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES} find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES}
# Check each directory for all names to avoid using headers/libraries from # Check each directory for all names to avoid using headers/libraries from
# different places. # different places.
NAMES_PER_DIR NAMES_PER_DIR)
HINTS ${PC_MSGPACK_LIBDIR} ${PC_MSGPACK_LIBRARY_DIRS})
mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY)