diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindLibUV.cmake | 21 | ||||
-rw-r--r-- | cmake/FindLuaJit.cmake | 2 | ||||
-rw-r--r-- | cmake/FindMsgpack.cmake | 29 | ||||
-rw-r--r-- | cmake/GenerateHelptags.cmake.in | 2 | ||||
-rw-r--r-- | cmake/GetGitRevisionDescription.cmake | 8 | ||||
-rw-r--r-- | cmake/RunLint.cmake | 6 | ||||
-rw-r--r-- | cmake/RunTestsLint.cmake | 13 |
7 files changed, 55 insertions, 26 deletions
diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake index 8542100e67..dcdd5e48b7 100644 --- a/cmake/FindLibUV.cmake +++ b/cmake/FindLibUV.cmake @@ -59,11 +59,6 @@ if(HAVE_LIBDL) list(APPEND LIBUV_LIBRARIES dl) endif() -check_library_exists(iphlpapi GetAdaptersAddresses "iphlpapi.h" HAVE_LIBIPHLPAPI) -if(HAVE_LIBIPHLPAPI) - list(APPEND LIBUV_LIBRARIES iphlpapi) -endif() - check_library_exists(kstat kstat_lookup "kstat.h" HAVE_LIBKSTAT) if(HAVE_LIBKSTAT) list(APPEND LIBUV_LIBRARIES kstat) @@ -84,11 +79,6 @@ if(HAVE_LIBPERFSTAT) list(APPEND LIBUV_LIBRARIES perfstat) endif() -check_library_exists(psapi GetProcessMemoryInfo "psapi.h" HAVE_LIBPSAPI) -if(HAVE_LIBPSAPI) - list(APPEND LIBUV_LIBRARIES psapi) -endif() - check_library_exists(rt clock_gettime "time.h" HAVE_LIBRT) if(HAVE_LIBRT) list(APPEND LIBUV_LIBRARIES rt) @@ -99,13 +89,12 @@ if(HAVE_LIBSENDFILE) list(APPEND LIBUV_LIBRARIES sendfile) endif() -check_library_exists(userenv GetUserProfileDirectoryW "userenv.h" HAVE_LIBUSERENV) -if(HAVE_LIBUSERENV) +if(WIN32) + # check_library_exists() does not work for Win32 API calls in X86 due to name + # mangling calling conventions + list(APPEND LIBUV_LIBRARIES iphlpapi) + list(APPEND LIBUV_LIBRARIES psapi) list(APPEND LIBUV_LIBRARIES userenv) -endif() - -check_library_exists(ws2_32 WSAStartup "winsock2.h" HAVE_LIBWS232) -if(HAVE_LIBWS232) list(APPEND LIBUV_LIBRARIES ws2_32) endif() diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake index 59642d11b9..e9ff53ab62 100644 --- a/cmake/FindLuaJit.cmake +++ b/cmake/FindLuaJit.cmake @@ -34,7 +34,7 @@ endif() if(MSVC) list(APPEND LUAJIT_NAMES lua51) elseif(MINGW) - list(APPEND LUAJIT_NAMES libluajit) + list(APPEND LUAJIT_NAMES libluajit libluajit-5.1) else() list(APPEND LUAJIT_NAMES luajit-5.1) endif() diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index 7d88137915..015737d658 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -7,7 +7,9 @@ if(NOT MSGPACK_USE_BUNDLED) find_package(PkgConfig) if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_MSGPACK QUIET msgpack) + pkg_search_module(PC_MSGPACK QUIET + msgpackc>=${Msgpack_FIND_VERSION} + msgpack>=${Msgpack_FIND_VERSION}) endif() else() set(PC_MSGPACK_INCLUDEDIR) @@ -19,19 +21,33 @@ endif() set(MSGPACK_DEFINITIONS ${PC_MSGPACK_CFLAGS_OTHER}) -find_path(MSGPACK_INCLUDE_DIR msgpack.h +find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS} ${LIMIT_SEARCH}) -# If we're asked to use static linkage, add libmsgpack.a as a preferred library name. +if(MSGPACK_INCLUDE_DIR) + file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h) + string(REGEX REPLACE ".*MSGPACK_VERSION_MAJOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MAJOR "${msgpack_version_h}") + string(REGEX REPLACE ".*MSGPACK_VERSION_MINOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MINOR "${msgpack_version_h}") + string(REGEX REPLACE ".*MSGPACK_VERSION_REVISION +([0-9]+).*" "\\1" MSGPACK_VERSION_REVISION "${msgpack_version_h}") + set(MSGPACK_VERSION_STRING "${MSGPACK_VERSION_MAJOR}.${MSGPACK_VERSION_MINOR}.${MSGPACK_VERSION_REVISION}") +else() + set(MSGPACK_VERSION_STRING) +endif() + +# If we're asked to use static linkage, add libmsgpack{,c}.a as a preferred library name. if(MSGPACK_USE_STATIC) list(APPEND MSGPACK_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}msgpackc${CMAKE_STATIC_LIBRARY_SUFFIX}" "${CMAKE_STATIC_LIBRARY_PREFIX}msgpack${CMAKE_STATIC_LIBRARY_SUFFIX}") endif() -list(APPEND MSGPACK_NAMES msgpack) +list(APPEND MSGPACK_NAMES msgpackc msgpack) 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} ${LIMIT_SEARCH}) @@ -43,6 +59,7 @@ set(MSGPACK_INCLUDE_DIRS ${MSGPACK_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set MSGPACK_FOUND to TRUE # if all listed variables are TRUE -find_package_handle_standard_args(Msgpack DEFAULT_MSG - MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR) +find_package_handle_standard_args(Msgpack + REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR + VERSION_VAR MSGPACK_VERSION_STRING) diff --git a/cmake/GenerateHelptags.cmake.in b/cmake/GenerateHelptags.cmake.in index 0df10d730e..3ced2c0b17 100644 --- a/cmake/GenerateHelptags.cmake.in +++ b/cmake/GenerateHelptags.cmake.in @@ -25,7 +25,7 @@ file(WRITE ${EMPTY_FILE} "") execute_process( COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/nvim -u NONE - -esX + -es -c "helptags ++t ." -c quit WORKING_DIRECTORY ${HELPTAGS_WORKING_DIRECTORY} diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index 1e0968ec3b..5044c682e4 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -42,7 +42,13 @@ set(__get_git_revision_description YES) get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) function(get_git_dir _gitdir) - # check GIT_DIR in environment first + # check FORCED_GIT_DIR first + if(FORCED_GIT_DIR) + set(${_gitdir} ${FORCED_GIT_DIR} PARENT_SCOPE) + return() + endif() + + # check GIT_DIR in environment set(GIT_DIR $ENV{GIT_DIR}) if(NOT GIT_DIR) set(GIT_PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/cmake/RunLint.cmake b/cmake/RunLint.cmake index 42ef7a86ad..306e938232 100644 --- a/cmake/RunLint.cmake +++ b/cmake/RunLint.cmake @@ -2,7 +2,11 @@ get_filename_component(LINT_DIR ${LINT_DIR} ABSOLUTE) get_filename_component(LINT_PREFIX ${LINT_DIR} PATH) set(LINT_SUPPRESS_FILE "${LINT_PREFIX}/errors.json") -file(GLOB_RECURSE LINT_FILES ${LINT_DIR}/*.c ${LINT_DIR}/*.h) +if(DEFINED ENV{LINT_FILE}) + file(GLOB_RECURSE LINT_FILES "$ENV{LINT_FILE}") +else() + file(GLOB_RECURSE LINT_FILES ${LINT_DIR}/*.c ${LINT_DIR}/*.h) +endif() set(LINT_ARGS) diff --git a/cmake/RunTestsLint.cmake b/cmake/RunTestsLint.cmake new file mode 100644 index 0000000000..addc9ab35e --- /dev/null +++ b/cmake/RunTestsLint.cmake @@ -0,0 +1,13 @@ +set(IGNORE_FILES "${TEST_DIR}/*/preload.lua") + +execute_process( + COMMAND ${LUACHECK_PRG} -q ${TEST_DIR} --exclude-files ${IGNORE_FILES} + WORKING_DIRECTORY ${TEST_DIR} + ERROR_VARIABLE err + RESULT_VARIABLE res + ${EXTRA_ARGS}) + +if(NOT res EQUAL 0) + message(STATUS "Output to stderr:\n${err}") + message(FATAL_ERROR "Linting tests failed with error: ${res}.") +endif() |