From 1e37703a74eeebfa14c401db865157c39f1215bf Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 26 Feb 2023 22:32:08 +0100 Subject: [PATCH] build: remove pkgconfig-related code (#22422) Cmake should already be able to find everything on its own. --- CMakeLists.txt | 19 ++----------------- cmake.deps/CMakeLists.txt | 16 +++------------- cmake/FindLibLUV.cmake | 19 ++----------------- cmake/FindLibTermkey.cmake | 19 ++----------------- cmake/FindLibUV.cmake | 26 +++----------------------- cmake/FindLuaJit.cmake | 17 +---------------- cmake/FindMsgpack.cmake | 21 ++------------------- 7 files changed, 15 insertions(+), 122 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce29a65dde..7944dec396 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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), diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt index 836d9e62c6..6c71173766 100644 --- a/cmake.deps/CMakeLists.txt +++ b/cmake.deps/CMakeLists.txt @@ -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}) diff --git a/cmake/FindLibLUV.cmake b/cmake/FindLibLUV.cmake index 23b62b66d3..8fc2c8509b 100644 --- a/cmake/FindLibLUV.cmake +++ b/cmake/FindLibLUV.cmake @@ -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}) diff --git a/cmake/FindLibTermkey.cmake b/cmake/FindLibTermkey.cmake index 3e0c7f1bfd..f1f644dbd0 100644 --- a/cmake/FindLibTermkey.cmake +++ b/cmake/FindLibTermkey.cmake @@ -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}) diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake index d6c4e9cbef..ce8037b858 100644 --- a/cmake/FindLibUV.cmake +++ b/cmake/FindLibUV.cmake @@ -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) diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake index 72795afefd..d89e3d7dfa 100644 --- a/cmake/FindLuaJit.cmake +++ b/cmake/FindLuaJit.cmake @@ -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}) diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index 2429c49706..7ab8239f8d 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -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)