aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-02-02 19:02:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-02-02 19:02:58 +0000
commitb255fa570d8b041e4c81e3454d51e06100c2fa4f (patch)
treed3b246b467500ca48067ed4a45d2fa53966cd9f1 /cmake
parenteeccad2ff1ae8892fe9e06d733a7b07a166eecb0 (diff)
parent0bd07bea095a8000cffa4f379c1fa53e009c1143 (diff)
downloadrneovim-20230125_mix.tar.gz
rneovim-20230125_mix.tar.bz2
rneovim-20230125_mix.zip
Merge branch 'aucmd_textputpost' into 20230125_mix20230125_mix
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindLIBVTERM.cmake10
-rw-r--r--cmake/FindUNIBILIUM.cmake12
-rw-r--r--cmake/Findlibvterm.cmake20
-rw-r--r--cmake/Findunibilium.cmake27
-rw-r--r--cmake/RunTests.cmake10
5 files changed, 56 insertions, 23 deletions
diff --git a/cmake/FindLIBVTERM.cmake b/cmake/FindLIBVTERM.cmake
deleted file mode 100644
index 469494ddfd..0000000000
--- a/cmake/FindLIBVTERM.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-# - Try to find libvterm
-# Once done this will define
-# LIBVTERM_FOUND - System has libvterm
-# LIBVTERM_INCLUDE_DIRS - The libvterm include directories
-# LIBVTERM_LIBRARIES - The libraries needed to use libvterm
-
-include(LibFindMacros)
-
-libfind_pkg_detect(LIBVTERM vterm FIND_PATH vterm.h FIND_LIBRARY vterm)
-libfind_process(LIBVTERM REQUIRED)
diff --git a/cmake/FindUNIBILIUM.cmake b/cmake/FindUNIBILIUM.cmake
deleted file mode 100644
index 0bf27b45e2..0000000000
--- a/cmake/FindUNIBILIUM.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-# - Try to find unibilium
-# Once done this will define
-# UNIBILIUM_FOUND - System has unibilium
-# UNIBILIUM_INCLUDE_DIRS - The unibilium include directories
-# UNIBILIUM_LIBRARIES - The libraries needed to use unibilium
-
-include(LibFindMacros)
-
-libfind_pkg_detect(UNIBILIUM unibilium
- FIND_PATH unibilium.h
- FIND_LIBRARY unibilium)
-libfind_process(UNIBILIUM)
diff --git a/cmake/Findlibvterm.cmake b/cmake/Findlibvterm.cmake
new file mode 100644
index 0000000000..d8536ca894
--- /dev/null
+++ b/cmake/Findlibvterm.cmake
@@ -0,0 +1,20 @@
+find_path(LIBVTERM_INCLUDE_DIR vterm.h)
+find_library(LIBVTERM_LIBRARY vterm)
+
+if(LIBVTERM_INCLUDE_DIR AND EXISTS "${LIBVTERM_INCLUDE_DIR}/vterm.h")
+ file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MAJOR REGEX "#define VTERM_VERSION_MAJOR")
+ string(REGEX MATCH "[0-9]+" VTERM_VERSION_MAJOR ${VTERM_VERSION_MAJOR})
+
+ file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MINOR REGEX "#define VTERM_VERSION_MINOR")
+ string(REGEX MATCH "[0-9]+" VTERM_VERSION_MINOR ${VTERM_VERSION_MINOR})
+
+ set(VTERM_VERSION ${VTERM_VERSION_MAJOR}.${VTERM_VERSION_MINOR})
+endif()
+
+find_package_handle_standard_args(libvterm
+ REQUIRED_VARS LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY
+ VERSION_VAR VTERM_VERSION)
+
+add_library(libvterm INTERFACE)
+target_include_directories(libvterm SYSTEM BEFORE INTERFACE INTERFACE ${LIBVTERM_INCLUDE_DIR})
+target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY})
diff --git a/cmake/Findunibilium.cmake b/cmake/Findunibilium.cmake
new file mode 100644
index 0000000000..7bfbcba942
--- /dev/null
+++ b/cmake/Findunibilium.cmake
@@ -0,0 +1,27 @@
+find_path(UNIBILIUM_INCLUDE_DIR unibilium.h)
+find_library(UNIBILIUM_LIBRARY unibilium)
+
+find_package_handle_standard_args(unibilium
+ REQUIRED_VARS UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY)
+
+add_library(unibilium INTERFACE)
+target_include_directories(unibilium SYSTEM BEFORE INTERFACE ${UNIBILIUM_INCLUDE_DIR})
+target_link_libraries(unibilium INTERFACE ${UNIBILIUM_LIBRARY})
+
+list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIR}")
+list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARY}")
+check_c_source_compiles("
+#include <unibilium.h>
+
+int
+main(void)
+{
+ unibi_str_from_var(unibi_var_from_str(\"\"));
+ return unibi_num_from_var(unibi_var_from_num(0));
+}
+" UNIBI_HAS_VAR_FROM)
+list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIR}")
+list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARY}")
+if(UNIBI_HAS_VAR_FROM)
+ target_compile_definitions(unibilium INTERFACE NVIM_UNIBI_HAS_VAR_FROM)
+endif()
diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake
index c3ac5f208e..d724f43a5f 100644
--- a/cmake/RunTests.cmake
+++ b/cmake/RunTests.cmake
@@ -71,8 +71,16 @@ if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "")
endif()
set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua.
+
+# TODO: eventually always use NVIM_PRG as the runner
+if("${TEST_TYPE}" STREQUAL "unit")
+ set(RUNNER_PRG ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua)
+else()
+ set(RUNNER_PRG ${BUSTED_PRG})
+endif()
+
execute_process(
- COMMAND ${BUSTED_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE}
+ COMMAND ${RUNNER_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE}
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
--lpath=${BUILD_DIR}/?.lua
--lpath=${WORKING_DIR}/runtime/lua/?.lua