diff options
author | John Szakmeister <john@szakmeister.net> | 2014-03-03 10:09:06 -0500 |
---|---|---|
committer | John Szakmeister <john@szakmeister.net> | 2014-03-21 15:22:00 -0400 |
commit | 0b2f6a0cf4c50d86744b1d3d774103db39773b4c (patch) | |
tree | 7bbc6275200f2c42ba20bf0a910c2b92fbdc4a50 /cmake/FindLibUV.cmake | |
parent | 5dd0ce4263721b636f5b006a47ceb7e769e10dca (diff) | |
download | rneovim-0b2f6a0cf4c50d86744b1d3d774103db39773b4c.tar.gz rneovim-0b2f6a0cf4c50d86744b1d3d774103db39773b4c.tar.bz2 rneovim-0b2f6a0cf4c50d86744b1d3d774103db39773b4c.zip |
Revamp the build system.
This achieves several goals:
* Less reliance on scripts so we have better portability to Windows
(though we still have a ways to go for proper Windows support).
Luajit, luarocks, moonscript, and busted are all installed via CMake
now.
* Trying to make use of pkg-config to get the correct libraries. The
latest libuv is still broken in this regard, but we'll at least be in
a position to use it.
* Allow the use of Ninja or make. The former runs faster in many
environments, and automatically makes use of parallel builds.
This also allows for system installed dependencies--though not through
the Makefile just yet--and adds support for FreeBSD.
This also make us build libuv and luajit as static libraries only, since
we're only concerned about having static libraries for our bundled
dependencies.
Diffstat (limited to 'cmake/FindLibUV.cmake')
-rw-r--r-- | cmake/FindLibUV.cmake | 72 |
1 files changed, 47 insertions, 25 deletions
diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake index fff3823c62..b11d2b1949 100644 --- a/cmake/FindLibUV.cmake +++ b/cmake/FindLibUV.cmake @@ -1,34 +1,56 @@ # - 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 +# LIBUV_FOUND - system has libuv +# LIBUV_INCLUDE_DIRS - the libuv include directories +# LIBUV_LIBRARIES - link these to use libuv # -# Set the LibUV_USE_STATIC variable to specify if static libraries should +# Set the LIBUV_USE_STATIC variable to specify if static libraries should # be preferred to shared ones. -include(LibFindMacros) +if(NOT LIBUV_USE_BUNDLED) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUV QUIET libuv) + endif() +else() + set(PC_LIBUV_INCLUDEDIR) + set(PC_LIBUV_INCLUDE_DIRS) + set(PC_LIBUV_LIBDIR) + set(PC_LIBUV_LIBRARY_DIRS) + set(LIMIT_SEARCH NO_DEFAULT_PATH) +endif() -# Include dir -find_path(LibUV_INCLUDE_DIR - NAMES uv.h -) - -set(_uv_names uv) +set(CMAKE_PREFIX_PATH "${DEPS_INSTALL_DIR}") +find_path(LIBUV_INCLUDE_DIR uv.h + HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS} + PATHS "${DEPS_INSTALL_DIR}" + ${LIMIT_SEARCH}) # If we're asked to use static linkage, add libuv.a as a preferred library name. -if(LibUV_USE_STATIC) - list(INSERT _uv_names 0 libuv.a) -endif(LibUV_USE_STATIC) - -# The library itself. Note that we prefer the static version. -find_library(LibUV_LIBRARY - NAMES ${_uv_names} -) - -# Set the include dir variables and the libraries and let libfind_process do the rest. -# NOTE: Singular variables for this library, plural for libraries this this lib depends on. -set(LibUV_PROCESS_INCLUDES LibUV_INCLUDE_DIR) -set(LibUV_PROCESS_LIBS LibUV_LIBRARY) -libfind_process(LibUV) +if(LIBUV_USE_STATIC) + list(APPEND LIBUV_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}uv${CMAKE_STATIC_LIBRARY_SUFFIX}") +endif(LIBUV_USE_STATIC) + +list(APPEND LIBUV_NAMES uv) + +set(CMAKE_PREFIX_PATH "${DEPS_INSTALL_DIR}") +find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES} + HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS} + PATHS "${DEPS_INSTALL_DIR}" + ${LIMIT_SEARCH}) + +mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) + +set(LIBUV_LIBRARIES ${LIBUV_LIBRARY}) +set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) + +# handle the QUIETLY and REQUIRED arguments and set LIBUV_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(LibUV DEFAULT_MSG + LIBUV_LIBRARY LIBUV_INCLUDE_DIR) + +mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) |