aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fürmetz <fuermetz@mailbox.org>2018-12-14 15:32:21 +0100
committerLukas Fürmetz <fuermetz@mailbox.org>2019-01-27 18:34:18 +0100
commit3929a9d573d89365fc68053824045ef654ef1146 (patch)
tree1ef1bd44964232a1771e0f7b447446b78e552c42
parent777d215db8d94746fe555ec2f8e794e78fb504dc (diff)
Use by default a vendored libvterm
-rw-r--r--.gitmodules0
-rw-r--r--CMakeLists.txt60
-rw-r--r--README.md16
3 files changed, 41 insertions, 35 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.gitmodules
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 521ce54..06edb6a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,27 +1,8 @@
cmake_minimum_required(VERSION 3.0.2)
+include(ExternalProject)
project(emacs-libvterm C)
-# Look for the header file.
-find_path(LIBVTERM_INCLUDE_DIR NAMES
- vterm.h
- )
-
-if(NOT LIBVTERM_INCLUDE_DIR)
- message(FATAL_ERROR "vterm.h not found")
-endif()
-
-find_library(LIBVTERM_LIBRARY NAMES
- vterm
- libvterm
- )
-
-if(NOT LIBVTERM_LIBRARY)
- message(FATAL_ERROR "libvterm not found")
-endif()
-
-include_directories(${LIBVTERM_INCLUDE_DIR})
-
add_library(vterm-module MODULE vterm-module.c utf8.c elisp.c)
set_target_properties(vterm-module PROPERTIES
C_STANDARD 99
@@ -30,6 +11,45 @@ set_target_properties(vterm-module PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}
)
+# Look for the header file.
+option(USE_SYSTEM_LIBVTERM "Use system libvterm instead of the vendored version." OFF)
+
+if(USE_SYSTEM_LIBVTERM)
+ find_path(LIBVTERM_INCLUDE_DIR NAMES
+ vterm.h
+ )
+
+ if(NOT LIBVTERM_INCLUDE_DIR)
+ message(FATAL_ERROR "vterm.h not found")
+ endif()
+
+ find_library(LIBVTERM_LIBRARY NAMES
+ vterm
+ libvterm
+ )
+
+ if(NOT LIBVTERM_LIBRARY)
+ message(FATAL_ERROR "libvterm not found")
+ endif()
+else()
+ ExternalProject_add(libvterm
+ GIT_REPOSITORY https://github.com/neovim/libvterm.git
+ GIT_TAG a6293a0e033e7e86c74889b4527787993656883a
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND make "CFLAGS='-fPIC'"
+ BUILD_IN_SOURCE ON
+ INSTALL_COMMAND "")
+
+ ExternalProject_Get_property(libvterm SOURCE_DIR)
+
+ set(LIBVTERM_INCLUDE_DIR ${SOURCE_DIR}/include)
+ set(LIBVTERM_LIBRARY ${SOURCE_DIR}/.libs/libvterm.a)
+
+ add_dependencies(vterm-module libvterm)
+endif()
+
+include_directories(${LIBVTERM_INCLUDE_DIR})
+
# Link with libvterm
target_link_libraries(vterm-module ${LIBVTERM_LIBRARY})
diff --git a/README.md b/README.md
index 454d4ab..ad64211 100644
--- a/README.md
+++ b/README.md
@@ -10,21 +10,7 @@ report a bug!
# Installation
-First, you need to have `libvterm` installed in your system.
-
-**On Ubuntu / Debian:**
-
-```
-sudo apt-get install libvterm-dev
-```
-
-**On macOS:**
-
-```
-brew install libvterm
-```
-
-Then clone the repository:
+Clone the repository:
```
git clone https://github.com/akermu/emacs-libvterm.git