aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--third-party/CMakeLists.txt5
-rw-r--r--third-party/cmake/BuildLibvterm.cmake13
-rw-r--r--third-party/patches/libvterm-Remove-VLAs-for-MSVC.patch50
3 files changed, 60 insertions, 8 deletions
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index 53ec81669b..ceebb4cf1d 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -114,13 +114,8 @@ set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.20.tar
set(LIBTERMKEY_SHA256 6c0d87c94ab9915e76ecd313baec08dedf3bd56de83743d9aa923a081935d2f5)
endif()
-if(MSVC)
-set(LIBVTERM_URL https://github.com/b-r-o-c-k/libvterm/archive/eb386b1d82f7d07363c9133b7aa06902ccd555fe.tar.gz)
-set(LIBVTERM_SHA256 be65c79611d306003440e651a3c52f603fc18b46e4117fe5957235ce7dd98233)
-else()
set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/a9c7c6fd20fa35e0ad3e0e98901ca12dfca9c25c.tar.gz)
set(LIBVTERM_SHA256 1a4272be91d9614dc183a503786df83b6584e4afaab7feaaa5409f841afbd796)
-endif()
set(JEMALLOC_URL https://github.com/jemalloc/jemalloc/releases/download/4.5.0/jemalloc-4.5.0.tar.bz2)
set(JEMALLOC_SHA256 9409d85664b4f135b77518b0b118c549009dc10f6cba14557d170476611f6780)
diff --git a/third-party/cmake/BuildLibvterm.cmake b/third-party/cmake/BuildLibvterm.cmake
index 5ea8314da5..1b95007cf2 100644
--- a/third-party/cmake/BuildLibvterm.cmake
+++ b/third-party/cmake/BuildLibvterm.cmake
@@ -6,7 +6,7 @@ function(BuildLibvterm)
cmake_parse_arguments(_libvterm
""
""
- "CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
+ "PATCH_COMMAND;CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
${ARGN})
if(NOT _libvterm_CONFIGURE_COMMAND AND NOT _libvterm_BUILD_COMMAND
@@ -26,6 +26,7 @@ function(BuildLibvterm)
-DTARGET=libvterm
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ PATCH_COMMAND "${_libvterm_PATCH_COMMAND}"
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND "${_libvterm_CONFIGURE_COMMAND}"
@@ -34,7 +35,12 @@ function(BuildLibvterm)
endfunction()
if(WIN32)
- # MinGW
+ if(MSVC)
+ set(LIBVTERM_PATCH_COMMAND
+ git -C ${DEPS_BUILD_DIR}/src/libvterm init
+ COMMAND git -C ${DEPS_BUILD_DIR}/src/libvterm apply
+ ${CMAKE_CURRENT_SOURCE_DIR}/patches/libvterm-Remove-VLAs-for-MSVC.patch)
+ endif()
set(LIBVTERM_CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibvtermCMakeLists.txt
${DEPS_BUILD_DIR}/src/libvterm/CMakeLists.txt
@@ -52,7 +58,8 @@ else()
install)
endif()
-BuildLibvterm(CONFIGURE_COMMAND ${LIBVTERM_CONFIGURE_COMMAND}
+BuildLibvterm(PATCH_COMMAND ${LIBVTERM_PATCH_COMMAND}
+ CONFIGURE_COMMAND ${LIBVTERM_CONFIGURE_COMMAND}
BUILD_COMMAND ${LIBVTERM_BUILD_COMMAND}
INSTALL_COMMAND ${LIBVTERM_INSTALL_COMMAND})
diff --git a/third-party/patches/libvterm-Remove-VLAs-for-MSVC.patch b/third-party/patches/libvterm-Remove-VLAs-for-MSVC.patch
new file mode 100644
index 0000000000..3fb18351be
--- /dev/null
+++ b/third-party/patches/libvterm-Remove-VLAs-for-MSVC.patch
@@ -0,0 +1,50 @@
+From eb386b1d82f7d07363c9133b7aa06902ccd555fe Mon Sep 17 00:00:00 2001
+Date: Tue, 27 Feb 2018 17:54:20 -0600
+Subject: [PATCH] Remove VLAs for MSVC
+
+VLAs are replaced with calls to _alloca() because MSVC does not support them.
+---
+ src/state.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/state.c b/src/state.c
+index 84299df..f9aabb3 100644
+--- a/src/state.c
++++ b/src/state.c
+@@ -1,5 +1,6 @@
+ #include "vterm_internal.h"
+
++#include <malloc.h>
+ #include <stdio.h>
+ #include <string.h>
+
+@@ -236,7 +237,7 @@ static int on_text(const char bytes[], size_t len, void *user)
+ VTermPos oldpos = state->pos;
+
+ // We'll have at most len codepoints
+- uint32_t codepoints[len];
++ uint32_t* codepoints = _alloca(len);
+ int npoints = 0;
+ size_t eaten = 0;
+
+@@ -313,7 +314,7 @@ static int on_text(const char bytes[], size_t len, void *user)
+
+ int width = 0;
+
+- uint32_t chars[glyph_ends - glyph_starts + 1];
++ uint32_t* chars = _alloca(glyph_ends - glyph_starts + 1);
+
+ for( ; i < glyph_ends; i++) {
+ chars[i - glyph_starts] = codepoints[i];
+@@ -512,7 +513,7 @@ static int settermprop_int(VTermState *state, VTermProp prop, int v)
+
+ static int settermprop_string(VTermState *state, VTermProp prop, const char *str, size_t len)
+ {
+- char strvalue[len+1];
++ char* strvalue = _alloca(len+1);
+ strncpy(strvalue, str, len);
+ strvalue[len] = 0;
+
+--
+2.16.1.windows.4
+