aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindMsgpack.cmake7
-rw-r--r--cmake/PreventInTreeBuilds.cmake23
-rw-r--r--cmake/RunTests.cmake9
-rw-r--r--cmake/WindowsDllCopy.cmake30
4 files changed, 67 insertions, 2 deletions
diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake
index 015737d658..8881a34332 100644
--- a/cmake/FindMsgpack.cmake
+++ b/cmake/FindMsgpack.cmake
@@ -42,7 +42,12 @@ if(MSGPACK_USE_STATIC)
"${CMAKE_STATIC_LIBRARY_PREFIX}msgpack${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
-list(APPEND MSGPACK_NAMES msgpackc msgpack)
+if(MSVC)
+ # The import library for the msgpack DLL has a different name
+ list(APPEND MSGPACK_NAMES msgpack_import)
+else()
+ list(APPEND MSGPACK_NAMES msgpackc msgpack)
+endif()
find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES}
# Check each directory for all names to avoid using headers/libraries from
diff --git a/cmake/PreventInTreeBuilds.cmake b/cmake/PreventInTreeBuilds.cmake
new file mode 100644
index 0000000000..9c0ce1c0a2
--- /dev/null
+++ b/cmake/PreventInTreeBuilds.cmake
@@ -0,0 +1,23 @@
+function(PreventInTreeBuilds)
+ get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
+ get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
+
+ if("${srcdir}" STREQUAL "${bindir}")
+ message("")
+ message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
+ message("Neovim doesn't support in-tree builds. It's recommended that you")
+ message("use a build/ subdirectory:")
+ message(" mkdir build")
+ message(" cd build")
+ message(" cmake <OPTIONS> ..")
+ message("")
+ message("Make sure to cleanup some CMake artifacts from this failed build")
+ message("with:")
+ message(" rm -rf CMakeFiles CMakeCache.txt")
+ message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
+ message("")
+ message(FATAL_ERROR "Stopping build.")
+ endif()
+endfunction()
+
+PreventInTreeBuilds()
diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake
index 0858ea24ac..58f19b6fa5 100644
--- a/cmake/RunTests.cmake
+++ b/cmake/RunTests.cmake
@@ -2,6 +2,9 @@ get_filename_component(BUSTED_DIR ${BUSTED_PRG} PATH)
set(ENV{PATH} "${BUSTED_DIR}:$ENV{PATH}")
set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
+set(ENV{NVIM_RPLUGIN_MANIFEST} ${WORKING_DIR}/Xtest_rplugin_manifest)
+set(ENV{XDG_CONFIG_HOME} ${WORKING_DIR}/Xtest_xdg/config)
+set(ENV{XDG_DATA_HOME} ${WORKING_DIR}/Xtest_xdg/share)
if(NVIM_PRG)
set(ENV{NVIM_PROG} "${NVIM_PRG}")
@@ -25,15 +28,19 @@ if(DEFINED ENV{TEST_FILTER})
set(TEST_TAG "--filter=$ENV{TEST_FILTER}")
endif()
+set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
execute_process(
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
- --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
+ --lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
--lpath=${BUILD_DIR}/?.lua ${TEST_PATH}
WORKING_DIRECTORY ${WORKING_DIR}
ERROR_VARIABLE err
RESULT_VARIABLE res
${EXTRA_ARGS})
+file(REMOVE ${WORKING_DIR}/Xtest_rplugin_manifest)
+file(REMOVE_RECURSE ${WORKING_DIR}/Xtest_xdg)
+
if(NOT res EQUAL 0)
message(STATUS "Output to stderr:\n${err}")
message(FATAL_ERROR "Running ${TEST_TYPE} tests failed with error: ${res}.")
diff --git a/cmake/WindowsDllCopy.cmake b/cmake/WindowsDllCopy.cmake
new file mode 100644
index 0000000000..fbbabf3a0c
--- /dev/null
+++ b/cmake/WindowsDllCopy.cmake
@@ -0,0 +1,30 @@
+# In Windows we need to find dependency DLLs and install them along with our
+# binaries. This script uses the following variables:
+#
+# - BINARY: The binary file whose dependencies need to be installed
+# - DST: The destination path
+# - CMAKE_PREFIX_PATH: A list of directories to search for dependencies
+
+if(NOT DEFINED BINARY)
+ message(FATAL_ERROR "Missing required argument -DBINARY=")
+endif()
+if(NOT DEFINED DST)
+ message(FATAL_ERROR "Missing required arguments -DDST=")
+endif()
+if(NOT DEFINED CMAKE_PREFIX_PATH)
+ message(FATAL_ERROR "Missing required arguments -DCMAKE_PREFIX_PATH=")
+endif()
+
+include(GetPrerequisites)
+get_prerequisites(${BINARY} DLLS 1 1 "" "${CMAKE_PREFIX_PATH}")
+foreach(DLL_NAME ${DLLS})
+ find_program(DLL_PATH ${DLL_NAME})
+ if(NOT DLL_PATH)
+ message(FATAL_ERROR "Unable to find dependency ${DLL_NAME}")
+ endif()
+
+ message("Copying ${DLL_NAME} to ${DST}")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${DLL_PATH} ${DST})
+ unset(DLL_PATH CACHE)
+endforeach()
+