From 843c9025ae8b44b14d0908674c8874a51dc13a38 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 26 Jan 2023 21:35:06 +0100 Subject: build: check if libvterm version meets requirement (#22010) The vterm.h file only specifies major and minor version, but not patch, meaning that requiring a specific patch number isn't currently possible. --- cmake/FindLIBVTERM.cmake | 10 ---------- cmake/Findlibvterm.cmake | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) delete mode 100644 cmake/FindLIBVTERM.cmake create mode 100644 cmake/Findlibvterm.cmake (limited to 'cmake') 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/Findlibvterm.cmake b/cmake/Findlibvterm.cmake new file mode 100644 index 0000000000..e73775d973 --- /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(main_lib INTERFACE ${LIBVTERM_LIBRARY}) -- cgit From d85ed00a8cc2274eff4409e2b18ba34178ae567a Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 27 Jan 2023 11:53:32 +0100 Subject: build: find unibilium without relying on libfindmacros (#22015) This will remove the warning about the find module not providing a version. --- cmake/FindUNIBILIUM.cmake | 12 ------------ cmake/Findunibilium.cmake | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 12 deletions(-) delete mode 100644 cmake/FindUNIBILIUM.cmake create mode 100644 cmake/Findunibilium.cmake (limited to 'cmake') 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/Findunibilium.cmake b/cmake/Findunibilium.cmake new file mode 100644 index 0000000000..fd8eb0cd7f --- /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 + +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(main_lib INTERFACE NVIM_UNIBI_HAS_VAR_FROM) +endif() -- cgit From 38365fa2ef86057775cc17b21c02a38761adbe3c Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 27 Jan 2023 14:16:31 +0100 Subject: build: fix dependencies in find modules (#22017) Find modules should only link to libraries defined in the find module, and not the main project. This helps the find modules be more self-contained and easier to understand. --- cmake/Findlibvterm.cmake | 2 +- cmake/Findunibilium.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/Findlibvterm.cmake b/cmake/Findlibvterm.cmake index e73775d973..d8536ca894 100644 --- a/cmake/Findlibvterm.cmake +++ b/cmake/Findlibvterm.cmake @@ -17,4 +17,4 @@ find_package_handle_standard_args(libvterm add_library(libvterm INTERFACE) target_include_directories(libvterm SYSTEM BEFORE INTERFACE INTERFACE ${LIBVTERM_INCLUDE_DIR}) -target_link_libraries(main_lib INTERFACE ${LIBVTERM_LIBRARY}) +target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY}) diff --git a/cmake/Findunibilium.cmake b/cmake/Findunibilium.cmake index fd8eb0cd7f..7bfbcba942 100644 --- a/cmake/Findunibilium.cmake +++ b/cmake/Findunibilium.cmake @@ -23,5 +23,5 @@ main(void) 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(main_lib INTERFACE NVIM_UNIBI_HAS_VAR_FROM) + target_compile_definitions(unibilium INTERFACE NVIM_UNIBI_HAS_VAR_FROM) endif() -- cgit From 13aa23b62af4df3e7f10687b76fe8c04efa2a598 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 30 Jan 2023 20:36:49 +0100 Subject: refactor(tests): run unittests using main nvim binary in interpreter mode This allows us to get rid of the separate "nvim-test" target --- cmake/RunTests.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmake') 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 -- cgit From f9826e1dff5f1ac8212ca55a847c872c426142db Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 3 Feb 2023 00:00:15 +0100 Subject: build: stop relying on CMAKE_BUILD_TYPE to determine the build type (#22051) Any logic involving CMAKE_BUILD_TYPE is automatically broken as it won't work with multi-config generators. The only exception is if we explicitly check whether the current generator is single-config as well. Instead, use generator expressions or cmake variables that allows to set options for certain build types only such as INTERPROCEDURAL_OPTIMIZATION_. Opt to generate all headers with optimization level O2 with no debug information for all build types as that is the simplest way to make it behave the same for all generators. --- cmake/GetCompileFlags.cmake | 57 --------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 cmake/GetCompileFlags.cmake (limited to 'cmake') diff --git a/cmake/GetCompileFlags.cmake b/cmake/GetCompileFlags.cmake deleted file mode 100644 index 9b3c053871..0000000000 --- a/cmake/GetCompileFlags.cmake +++ /dev/null @@ -1,57 +0,0 @@ -function(get_compile_flags _compile_flags) - string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type) - set(compile_flags ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${build_type}}) - - # Get flags set by target_compile_options(). - get_target_property(opt main_lib INTERFACE_COMPILE_OPTIONS) - if(opt) - list(APPEND compile_flags ${opt}) - endif() - - get_target_property(opt nvim COMPILE_OPTIONS) - if(opt) - list(APPEND compile_flags ${opt}) - endif() - - # Get flags set by target_compile_definitions(). - get_target_property(defs main_lib INTERFACE_COMPILE_DEFINITIONS) - if(defs) - foreach(def ${defs}) - list(APPEND compile_flags "-D${def}") - endforeach() - endif() - - get_target_property(defs nvim COMPILE_DEFINITIONS) - if(defs) - foreach(def ${defs}) - list(APPEND compile_flags "-D${def}") - endforeach() - endif() - - # Get include directories. - get_target_property(dirs main_lib INTERFACE_INCLUDE_DIRECTORIES) - if(dirs) - foreach(dir ${dirs}) - list(APPEND compile_flags "-I${dir}") - endforeach() - endif() - - get_target_property(dirs main_lib INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) - if(dirs) - foreach(dir ${dirs}) - list(APPEND compile_flags "-I${dir}") - endforeach() - endif() - - get_target_property(dirs nvim INCLUDE_DIRECTORIES) - if(dirs) - foreach(dir ${dirs}) - list(APPEND compile_flags "-I${dir}") - endforeach() - endif() - - list(REMOVE_DUPLICATES compile_flags) - string(REPLACE ";" " " compile_flags "${compile_flags}") - - set(${_compile_flags} "${compile_flags}" PARENT_SCOPE) -endfunction() -- cgit From d38dfdca5809f9ffcc27b3cb7846f5bb8f586811 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 7 Feb 2023 21:37:16 +0100 Subject: build: remove duplicate INTERFACE keyword (#22106) --- cmake/FindMsgpack.cmake | 1 - cmake/Findlibvterm.cmake | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index 26eb19d498..2429c49706 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -50,4 +50,3 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Msgpack REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR VERSION_VAR MSGPACK_VERSION_STRING) - diff --git a/cmake/Findlibvterm.cmake b/cmake/Findlibvterm.cmake index d8536ca894..19ecce40f0 100644 --- a/cmake/Findlibvterm.cmake +++ b/cmake/Findlibvterm.cmake @@ -16,5 +16,5 @@ find_package_handle_standard_args(libvterm VERSION_VAR VTERM_VERSION) add_library(libvterm INTERFACE) -target_include_directories(libvterm SYSTEM BEFORE INTERFACE INTERFACE ${LIBVTERM_INCLUDE_DIR}) +target_include_directories(libvterm SYSTEM BEFORE INTERFACE ${LIBVTERM_INCLUDE_DIR}) target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY}) -- cgit From 4d2c1004e96faad1179591b4409a75965af43985 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 8 Feb 2023 11:00:16 +0100 Subject: build: prefer -D = over -D= (#22164) This makes it easier to see that -D is referring to the entire "=", rather than only . It also help syntax highlighters highlight built-in variables. --- cmake/WindowsDllCopy.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/WindowsDllCopy.cmake b/cmake/WindowsDllCopy.cmake index fbbabf3a0c..c07dc51b8a 100644 --- a/cmake/WindowsDllCopy.cmake +++ b/cmake/WindowsDllCopy.cmake @@ -6,13 +6,13 @@ # - CMAKE_PREFIX_PATH: A list of directories to search for dependencies if(NOT DEFINED BINARY) - message(FATAL_ERROR "Missing required argument -DBINARY=") + message(FATAL_ERROR "Missing required argument -D BINARY=") endif() if(NOT DEFINED DST) - message(FATAL_ERROR "Missing required arguments -DDST=") + message(FATAL_ERROR "Missing required arguments -D DST=") endif() if(NOT DEFINED CMAKE_PREFIX_PATH) - message(FATAL_ERROR "Missing required arguments -DCMAKE_PREFIX_PATH=") + message(FATAL_ERROR "Missing required arguments -D CMAKE_PREFIX_PATH=") endif() include(GetPrerequisites) -- cgit From 07a6bc2be3f83e9007e93f5787f547b7b245e7a1 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 8 Feb 2023 14:37:04 +0100 Subject: build(deps): bump libuv to HEAD - 62c2374a8 (#22166) --- cmake/FindLibUV.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake index d6c4e9cbef..e4946bee3f 100644 --- a/cmake/FindLibUV.cmake +++ b/cmake/FindLibUV.cmake @@ -13,7 +13,7 @@ endif() find_path(LIBUV_INCLUDE_DIR uv.h HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS}) -list(APPEND LIBUV_NAMES uv_a uv) +list(APPEND LIBUV_NAMES uv_a uv libuv) find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES} HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS}) -- cgit From d6279f9392073cb1422d76c57baf3fd283ed954e Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 31 Jan 2023 23:35:04 +0100 Subject: refactor(tests): move lua-client into core and use it for functionaltests Eliminates lua-client and non-static libluv as test time dependencies Note: the API for a public lua-client is not yet finished. The interface needs to be adjusted to work in the embedded loop of a nvim instance (to use it to talk between instances) --- cmake/RunTests.cmake | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index d724f43a5f..3ac15f91ea 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -71,16 +71,10 @@ 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() +set(ENV{DEPS_PREFIX} ${DEPS_PREFIX}) # used by test/busted_runner.lua on windows execute_process( - COMMAND ${RUNNER_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} + COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -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 -- cgit From 4c64cbe99f2616a1d1126257da8d40773f4adba1 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 10 Feb 2023 20:20:18 +0100 Subject: build: mark uninteresting variables as advanced (#22208) Only the most important variables should be shown by default. --- cmake/FindIconv.cmake | 2 ++ cmake/Findlibvterm.cmake | 2 ++ cmake/Findunibilium.cmake | 2 ++ 3 files changed, 6 insertions(+) (limited to 'cmake') diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake index 63290fe889..a164abfea8 100644 --- a/cmake/FindIconv.cmake +++ b/cmake/FindIconv.cmake @@ -19,3 +19,5 @@ if(ICONV_LIBRARY) endif() libfind_process(Iconv) + +mark_as_advanced(ICONV_LIBRARY) diff --git a/cmake/Findlibvterm.cmake b/cmake/Findlibvterm.cmake index 19ecce40f0..4a2ae48ffa 100644 --- a/cmake/Findlibvterm.cmake +++ b/cmake/Findlibvterm.cmake @@ -18,3 +18,5 @@ find_package_handle_standard_args(libvterm add_library(libvterm INTERFACE) target_include_directories(libvterm SYSTEM BEFORE INTERFACE ${LIBVTERM_INCLUDE_DIR}) target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY}) + +mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY) diff --git a/cmake/Findunibilium.cmake b/cmake/Findunibilium.cmake index 7bfbcba942..3dbac31b5b 100644 --- a/cmake/Findunibilium.cmake +++ b/cmake/Findunibilium.cmake @@ -25,3 +25,5 @@ list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARY}") if(UNIBI_HAS_VAR_FROM) target_compile_definitions(unibilium INTERFACE NVIM_UNIBI_HAS_VAR_FROM) endif() + +mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY) -- cgit From f573fcbc0d2c8d8143f38c3c53f6cc33a5912c6d Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 12 Feb 2023 14:42:00 +0100 Subject: build: don't check environment variable to detect CI (#22234) Instead use the cmake option, which should act as the definitive source to determine whether we use CI or not. --- cmake/RunTests.cmake | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 3ac15f91ea..fe346661b5 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -1,13 +1,5 @@ # Set LC_ALL to meet expectations of some locale-sensitive tests. set(ENV{LC_ALL} "en_US.UTF-8") - -if(POLICY CMP0012) - # Avoid policy warning due to CI=true. This is needed even if the main - # project has already set this policy as project settings aren't inherited - # when using cmake script mode (-P). - cmake_policy(SET CMP0012 NEW) -endif() - set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime) set(ENV{NVIM_RPLUGIN_MANIFEST} ${BUILD_DIR}/Xtest_rplugin_manifest) set(ENV{XDG_CONFIG_HOME} ${BUILD_DIR}/Xtest_xdg/config) @@ -99,7 +91,7 @@ if(NOT res EQUAL 0) endif() # Dump the logfile on CI (if not displayed and moved already). - if($ENV{CI}) + if(CI_BUILD) if(EXISTS $ENV{NVIM_LOG_FILE} AND NOT EXISTS $ENV{NVIM_LOG_FILE}.displayed) file(READ $ENV{NVIM_LOG_FILE} out) message(STATUS "$NVIM_LOG_FILE: $ENV{NVIM_LOG_FILE}\n${out}") -- cgit From b4a92309f8f5ee4e579cee72ef352451a60733b8 Mon Sep 17 00:00:00 2001 From: Enan Ajmain <3nan.ajmain@gmail.com> Date: Tue, 14 Feb 2023 23:58:38 +0600 Subject: ci: print DLL copy messages only in CI environment (#22260) In Windows, library DLL's are copied in the building process, and a message for each copy is printed. This is useful to have in the log of CI, but annoying to see when you're building and rebuilding nvim constantly. Work around this issue by only enabling the messages on CI. --- cmake/WindowsDllCopy.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/WindowsDllCopy.cmake b/cmake/WindowsDllCopy.cmake index c07dc51b8a..b51e66e5cc 100644 --- a/cmake/WindowsDllCopy.cmake +++ b/cmake/WindowsDllCopy.cmake @@ -23,8 +23,9 @@ foreach(DLL_NAME ${DLLS}) message(FATAL_ERROR "Unable to find dependency ${DLL_NAME}") endif() - message("Copying ${DLL_NAME} to ${DST}") + if($ENV{CI} MATCHES "true") + message("Copying ${DLL_NAME} to ${DST}") + endif() execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${DLL_PATH} ${DST}) unset(DLL_PATH CACHE) endforeach() - -- cgit From 6dfabd0145c712e1419dcd6d5ce9192d766adbe3 Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:09:05 +0100 Subject: build: use libuv config file (#22209) Libuv's recent changes in their pc file breaks cmake; they are using -l:libuv.a for the linker, and it seems cmake can't resolve that. Prefer using their cmake config file instead instead, and use the find module as a fall-back in case it fails. Closes https://github.com/neovim/neovim/issues/22271. --- cmake/FindLibUV.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake index e4946bee3f..d6c4e9cbef 100644 --- a/cmake/FindLibUV.cmake +++ b/cmake/FindLibUV.cmake @@ -13,7 +13,7 @@ endif() find_path(LIBUV_INCLUDE_DIR uv.h HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS}) -list(APPEND LIBUV_NAMES uv_a uv libuv) +list(APPEND LIBUV_NAMES uv_a uv) find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES} HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS}) -- cgit From b62c0c8d9c22ae7fc9ee200733f8312efa6dbced Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Mon, 20 Feb 2023 08:12:59 +0100 Subject: docs: fix typos (#21961) Co-authored-by: Ben Morgan --- cmake/FindLibIntl.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/FindLibIntl.cmake b/cmake/FindLibIntl.cmake index 8cc5cb7dd2..d78b39ab40 100644 --- a/cmake/FindLibIntl.cmake +++ b/cmake/FindLibIntl.cmake @@ -10,7 +10,7 @@ include(CheckVariableExists) include(LibFindMacros) # Append custom gettext path to CMAKE_PREFIX_PATH -# if installed via Mac Hombrew +# if installed via Mac Homebrew if (CMAKE_HOST_APPLE) find_program(HOMEBREW_PROG brew) if (EXISTS ${HOMEBREW_PROG}) -- cgit From 1e37703a74eeebfa14c401db865157c39f1215bf Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 26 Feb 2023 22:32:08 +0100 Subject: build: remove pkgconfig-related code (#22422) Cmake should already be able to find everything on its own. --- cmake/FindLibLUV.cmake | 19 ++----------------- cmake/FindLibTermkey.cmake | 19 ++----------------- cmake/FindLibUV.cmake | 26 +++----------------------- cmake/FindLuaJit.cmake | 17 +---------------- cmake/FindMsgpack.cmake | 21 ++------------------- 5 files changed, 10 insertions(+), 92 deletions(-) (limited to 'cmake') diff --git a/cmake/FindLibLUV.cmake b/cmake/FindLibLUV.cmake index 23b62b66d3..8fc2c8509b 100644 --- a/cmake/FindLibLUV.cmake +++ b/cmake/FindLibLUV.cmake @@ -1,24 +1,9 @@ -# - Try to find luv -# Once done this will define -# LIBLUV_FOUND - System has libluv -# LIBLUV_INCLUDE_DIRS - The libluv include directories -# LIBLUV_LIBRARIES - The libraries needed to use libluv - -find_package(PkgConfig) -if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_LIBLUV QUIET luv) -endif() - -set(LIBLUV_DEFINITIONS ${PC_LIBLUV_CFLAGS_OTHER}) - -find_path(LIBLUV_INCLUDE_DIR luv/luv.h - PATHS ${PC_LIBLUV_INCLUDEDIR} ${PC_LIBLUV_INCLUDE_DIRS}) +find_path(LIBLUV_INCLUDE_DIR luv/luv.h) # Explicitly look for luv.so. #10407 list(APPEND LIBLUV_NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX}) -find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES} - HINTS ${PC_LIBLUV_LIBDIR} ${PC_LIBLUV_LIBRARY_DIRS}) +find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}) set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY}) set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR}) diff --git a/cmake/FindLibTermkey.cmake b/cmake/FindLibTermkey.cmake index 3e0c7f1bfd..f1f644dbd0 100644 --- a/cmake/FindLibTermkey.cmake +++ b/cmake/FindLibTermkey.cmake @@ -1,23 +1,8 @@ -# - Try to find libtermkey -# Once done this will define -# LIBTERMKEY_FOUND - System has libtermkey -# LIBTERMKEY_INCLUDE_DIRS - The libtermkey include directories -# LIBTERMKEY_LIBRARIES - The libraries needed to use libtermkey - -find_package(PkgConfig) -if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_LIBTERMKEY QUIET termkey) -endif() - -set(LIBTERMKEY_DEFINITIONS ${PC_LIBTERMKEY_CFLAGS_OTHER}) - -find_path(LIBTERMKEY_INCLUDE_DIR termkey.h - PATHS ${PC_LIBTERMKEY_INCLUDEDIR} ${PC_LIBTERMKEY_INCLUDE_DIRS}) +find_path(LIBTERMKEY_INCLUDE_DIR termkey.h) list(APPEND LIBTERMKEY_NAMES termkey) -find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES} - HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS}) +find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES}) set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY}) set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR}) diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake index d6c4e9cbef..ce8037b858 100644 --- a/cmake/FindLibUV.cmake +++ b/cmake/FindLibUV.cmake @@ -1,34 +1,14 @@ -# - Try to find libuv -# Once done, this will define -# -# LIBUV_FOUND - system has libuv -# LIBUV_INCLUDE_DIRS - the libuv include directories -# LIBUV_LIBRARIES - link these to use libuv - -find_package(PkgConfig) -if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_LIBUV QUIET libuv) -endif() - -find_path(LIBUV_INCLUDE_DIR uv.h - HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS}) +find_path(LIBUV_INCLUDE_DIR uv.h) list(APPEND LIBUV_NAMES uv_a uv) -find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES} - HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS}) +find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}) mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) -if(PC_LIBUV_LIBRARIES) - list(REMOVE_ITEM PC_LIBUV_LIBRARIES uv) -endif() - -set(LIBUV_LIBRARIES ${LIBUV_LIBRARY} ${PC_LIBUV_LIBRARIES}) +set(LIBUV_LIBRARIES ${LIBUV_LIBRARY}) set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR}) -# Deal with the fact that libuv.pc is missing important dependency information. - include(CheckLibraryExists) check_library_exists(dl dlopen "dlfcn.h" HAVE_LIBDL) diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake index 72795afefd..d89e3d7dfa 100644 --- a/cmake/FindLuaJit.cmake +++ b/cmake/FindLuaJit.cmake @@ -1,18 +1,4 @@ -# - Try to find luajit -# Once done this will define -# LUAJIT_FOUND - System has luajit -# LUAJIT_INCLUDE_DIRS - The luajit include directories -# LUAJIT_LIBRARIES - The libraries needed to use luajit - -find_package(PkgConfig) -if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_LUAJIT QUIET luajit) -endif() - -set(LUAJIT_DEFINITIONS ${PC_LUAJIT_CFLAGS_OTHER}) - find_path(LUAJIT_INCLUDE_DIR luajit.h - PATHS ${PC_LUAJIT_INCLUDEDIR} ${PC_LUAJIT_INCLUDE_DIRS} PATH_SUFFIXES luajit-2.0 luajit-2.1) if(MSVC) @@ -23,8 +9,7 @@ else() list(APPEND LUAJIT_NAMES luajit-5.1) endif() -find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES} - PATHS ${PC_LUAJIT_LIBDIR} ${PC_LUAJIT_LIBRARY_DIRS}) +find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index 2429c49706..7ab8239f8d 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -1,20 +1,4 @@ -# - Try to find msgpack -# Once done this will define -# MSGPACK_FOUND - System has msgpack -# MSGPACK_INCLUDE_DIRS - The msgpack include directories -# MSGPACK_LIBRARIES - The libraries needed to use msgpack - -find_package(PkgConfig) -if (PKG_CONFIG_FOUND) - pkg_search_module(PC_MSGPACK QUIET - msgpackc>=${Msgpack_FIND_VERSION} - msgpack>=${Msgpack_FIND_VERSION}) -endif() - -set(MSGPACK_DEFINITIONS ${PC_MSGPACK_CFLAGS_OTHER}) - -find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h - HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS}) +find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h) if(MSGPACK_INCLUDE_DIR) file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h) @@ -36,8 +20,7 @@ endif() 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}) + NAMES_PER_DIR) mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) -- cgit From a0292b4e5f106482edc5623eef85aa48e2e55bb7 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 2 Mar 2023 10:22:41 +0100 Subject: build: remove libfindmacros library (#22423) Large parts the library weren't being used, and the parts that were was overly abstracted for our use case. Additionally, part of its use case was to abstract pkgconfig boilerplate, which is no longer needed as pkgconfig has been removed in favor of relying on cmake alone in 09118052cee5aef978d6075db5287c1b6c27381a. --- cmake/FindIconv.cmake | 21 +--- cmake/FindLibIntl.cmake | 21 +--- cmake/FindLibLUV.cmake | 3 - cmake/FindLibTermkey.cmake | 13 +-- cmake/FindLibUV.cmake | 4 - cmake/FindLuaJit.cmake | 3 - cmake/FindMsgpack.cmake | 5 - cmake/FindTreeSitter.cmake | 16 +-- cmake/LibFindMacros.cmake | 269 --------------------------------------------- 9 files changed, 14 insertions(+), 341 deletions(-) delete mode 100644 cmake/LibFindMacros.cmake (limited to 'cmake') diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake index a164abfea8..b0ffa1bd75 100644 --- a/cmake/FindIconv.cmake +++ b/cmake/FindIconv.cmake @@ -1,23 +1,8 @@ # TODO(dundargoc): FindIconv is shipped by default on cmake version 3.11+. This # file can be removed once we decide to upgrade minimum cmake version. -# - Try to find iconv -# Once done, this will define -# -# Iconv_FOUND - system has iconv -# Iconv_INCLUDE_DIRS - the iconv include directories -# Iconv_LIBRARIES - link these to use iconv - -include(LibFindMacros) - find_path(ICONV_INCLUDE_DIR NAMES iconv.h) find_library(ICONV_LIBRARY NAMES iconv libiconv) - -set(Iconv_PROCESS_INCLUDES ICONV_INCLUDE_DIR) -if(ICONV_LIBRARY) - set(Iconv_PROCESS_LIBS ICONV_LIBRARY) -endif() - -libfind_process(Iconv) - -mark_as_advanced(ICONV_LIBRARY) +find_package_handle_standard_args(Iconv DEFAULT_MSG + ICONV_INCLUDE_DIR) +mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY) diff --git a/cmake/FindLibIntl.cmake b/cmake/FindLibIntl.cmake index d78b39ab40..8b512e5a7e 100644 --- a/cmake/FindLibIntl.cmake +++ b/cmake/FindLibIntl.cmake @@ -1,13 +1,5 @@ -# - Try to find libintl -# Once done, this will define -# -# LibIntl_FOUND - system has libintl -# LibIntl_INCLUDE_DIRS - the libintl include directories -# LibIntl_LIBRARIES - link these to use libintl - include(CheckCSourceCompiles) include(CheckVariableExists) -include(LibFindMacros) # Append custom gettext path to CMAKE_PREFIX_PATH # if installed via Mac Homebrew @@ -74,18 +66,15 @@ if (LibIntl_LIBRARY) list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}") endif() +set(REQUIRED_VARIABLES LibIntl_LIBRARY LIBTERMKEY_INCLUDE_DIR) if (HAVE_WORKING_LIBINTL) # On some systems (linux+glibc) libintl is passively available. # If HAVE_WORKING_LIBINTL then we consider the requirement satisfied. - # Unset REQUIRED so that libfind_process(LibIntl) can proceed. - if(LibIntl_FIND_REQUIRED) - unset(LibIntl_FIND_REQUIRED) - endif() - set(LibIntl_FIND_QUIETLY ON) + unset(REQUIRED_VARIABLES) check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR) endif() -set(LibIntl_PROCESS_INCLUDES LibIntl_INCLUDE_DIR) -set(LibIntl_PROCESS_LIBS LibIntl_LIBRARY) -libfind_process(LibIntl) +find_package_handle_standard_args(LibIntl DEFAULT_MSG + ${REQUIRED_VARIABLES}) +mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) diff --git a/cmake/FindLibLUV.cmake b/cmake/FindLibLUV.cmake index 8fc2c8509b..94d706e1fc 100644 --- a/cmake/FindLibLUV.cmake +++ b/cmake/FindLibLUV.cmake @@ -8,9 +8,6 @@ find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}) set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY}) set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR}) -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LIBLUV_FOUND to TRUE -# if all listed variables are TRUE find_package_handle_standard_args(LibLUV DEFAULT_MSG LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR) diff --git a/cmake/FindLibTermkey.cmake b/cmake/FindLibTermkey.cmake index f1f644dbd0..368cd21354 100644 --- a/cmake/FindLibTermkey.cmake +++ b/cmake/FindLibTermkey.cmake @@ -1,16 +1,5 @@ find_path(LIBTERMKEY_INCLUDE_DIR termkey.h) - -list(APPEND LIBTERMKEY_NAMES termkey) - -find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES}) - -set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY}) -set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LIBTERMKEY_FOUND to TRUE -# if all listed variables are TRUE +find_library(LIBTERMKEY_LIBRARY NAMES termkey) find_package_handle_standard_args(LibTermkey DEFAULT_MSG LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR) - mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake index ce8037b858..a134ca0917 100644 --- a/cmake/FindLibUV.cmake +++ b/cmake/FindLibUV.cmake @@ -63,10 +63,6 @@ if(Threads_FOUND) list(APPEND LIBUV_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) endif() -include(FindPackageHandleStandardArgs) - -# handle the QUIETLY and REQUIRED arguments and set LIBUV_FOUND to TRUE -# if all listed variables are TRUE find_package_handle_standard_args(LibUV DEFAULT_MSG LIBUV_LIBRARY LIBUV_INCLUDE_DIR) diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake index d89e3d7dfa..e3f47eee83 100644 --- a/cmake/FindLuaJit.cmake +++ b/cmake/FindLuaJit.cmake @@ -14,9 +14,6 @@ find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE -# if all listed variables are TRUE find_package_handle_standard_args(LuaJit DEFAULT_MSG LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index 7ab8239f8d..8187bce08d 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -18,8 +18,6 @@ else() endif() find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES} - # Check each directory for all names to avoid using headers/libraries from - # different places. NAMES_PER_DIR) mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) @@ -27,9 +25,6 @@ mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) set(MSGPACK_LIBRARIES ${MSGPACK_LIBRARY}) 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 REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR VERSION_VAR MSGPACK_VERSION_STRING) diff --git a/cmake/FindTreeSitter.cmake b/cmake/FindTreeSitter.cmake index ae0928e9f7..2850a61b57 100644 --- a/cmake/FindTreeSitter.cmake +++ b/cmake/FindTreeSitter.cmake @@ -1,11 +1,5 @@ -# - Try to find tree-sitter -# Once done, this will define -# -# TreeSitter_FOUND - system has tree-sitter -# TreeSitter_INCLUDE_DIRS - the tree-sitter include directories -# TreeSitter_LIBRARIES - link these to use tree-sitter - -include(LibFindMacros) - -libfind_pkg_detect(TreeSitter tree-sitter FIND_PATH tree_sitter/api.h FIND_LIBRARY tree-sitter) -libfind_process(TreeSitter) +find_path(TreeSitter_INCLUDE_DIR tree_sitter/api.h) +find_library(TreeSitter_LIBRARY NAMES tree-sitter) +find_package_handle_standard_args(TreeSitter DEFAULT_MSG + TreeSitter_LIBRARY TreeSitter_INCLUDE_DIR) +mark_as_advanced(TreeSitter_LIBRARY TreeSitter_INCLUDE_DIR) diff --git a/cmake/LibFindMacros.cmake b/cmake/LibFindMacros.cmake deleted file mode 100644 index 726a8631f0..0000000000 --- a/cmake/LibFindMacros.cmake +++ /dev/null @@ -1,269 +0,0 @@ -# Version 2.2 -# Public Domain, originally written by Lasse Kärkkäinen -# Maintained at https://github.com/Tronic/cmake-modules -# Please send your improvements as pull requests on Github. - -# Find another package and make it a dependency of the current package. -# This also automatically forwards the "REQUIRED" argument. -# Usage: libfind_package( [extra args to find_package]) -macro (libfind_package PREFIX PKG) - set(${PREFIX}_args ${PKG} ${ARGN}) - if (${PREFIX}_FIND_REQUIRED) - set(${PREFIX}_args ${${PREFIX}_args} REQUIRED) - endif() - find_package(${${PREFIX}_args}) - set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG}) - unset(${PREFIX}_args) -endmacro() - -# A simple wrapper to make pkg-config searches a bit easier. -# Works the same as CMake's internal pkg_check_modules but is always quiet. -macro (libfind_pkg_check_modules) - find_package(PkgConfig QUIET) - if (PKG_CONFIG_FOUND) - pkg_check_modules(${ARGN} QUIET) - endif() -endmacro() - -# Avoid useless copy&pasta by doing what most simple libraries do anyway: -# pkg-config, find headers, find library. -# Usage: libfind_pkg_detect( FIND_PATH [other args] FIND_LIBRARY [other args]) -# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2) -function (libfind_pkg_detect PREFIX) - # Parse arguments - set(argname pkgargs) - foreach (i ${ARGN}) - if ("${i}" STREQUAL "FIND_PATH") - set(argname pathargs) - elseif ("${i}" STREQUAL "FIND_LIBRARY") - set(argname libraryargs) - else() - set(${argname} ${${argname}} ${i}) - endif() - endforeach() - if (NOT pkgargs) - message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.") - endif() - # Find library - libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs}) - if (pathargs) - find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS}) - endif() - if (libraryargs) - find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}) - endif() - # Read pkg-config version - if (${PREFIX}_PKGCONF_VERSION) - set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE) - endif() -endfunction() - -# Extracts a version #define from a version.h file, output stored to _VERSION. -# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR) -# Fourth argument "QUIET" may be used for silently testing different define names. -# This function does nothing if the version variable is already defined. -function (libfind_version_header PREFIX VERSION_H DEFINE_NAME) - # Skip processing if we already have a version or if the include dir was not found - if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR) - return() - endif() - set(quiet ${${PREFIX}_FIND_QUIETLY}) - # Process optional arguments - foreach(arg ${ARGN}) - if (arg STREQUAL "QUIET") - set(quiet TRUE) - else() - message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.") - endif() - endforeach() - # Read the header and parse for version number - set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") - if (NOT EXISTS ${filename}) - if (NOT quiet) - message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") - endif() - return() - endif() - file(READ "${filename}" header) - string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}") - # No regex match? - if (match STREQUAL header) - if (NOT quiet) - message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") - endif() - return() - endif() - # Export the version string - set(${PREFIX}_VERSION "${match}" PARENT_SCOPE) -endfunction() - -# Do the final processing once the paths have been detected. -# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain -# all the variables, each of which contain one include directory. -# Ditto for ${PREFIX}_PROCESS_LIBS and library files. -# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. -# Also handles errors in case library detection was required, etc. -function (libfind_process PREFIX) - # Skip processing if already processed during this configuration run - if (${PREFIX}_FOUND) - return() - endif() - - set(found TRUE) # Start with the assumption that the package was found - - # Did we find any files? Did we miss includes? These are for formatting better error messages. - set(some_files FALSE) - set(missing_headers FALSE) - - # Shorthands for some variables that we need often - set(quiet ${${PREFIX}_FIND_QUIETLY}) - set(required ${${PREFIX}_FIND_REQUIRED}) - set(exactver ${${PREFIX}_FIND_VERSION_EXACT}) - set(findver "${${PREFIX}_FIND_VERSION}") - set(version "${${PREFIX}_VERSION}") - - # Lists of config option names (all, includes, libs) - unset(configopts) - set(includeopts ${${PREFIX}_PROCESS_INCLUDES}) - set(libraryopts ${${PREFIX}_PROCESS_LIBS}) - - # Process deps to add to - foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES}) - if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS) - # The package seems to export option lists that we can use, woohoo! - list(APPEND includeopts ${${i}_INCLUDE_OPTS}) - list(APPEND libraryopts ${${i}_LIBRARY_OPTS}) - else() - # If plural forms don't exist or they equal singular forms - if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR - (${i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES)) - # Singular forms can be used - if (DEFINED ${i}_INCLUDE_DIR) - list(APPEND includeopts ${i}_INCLUDE_DIR) - endif() - if (DEFINED ${i}_LIBRARY) - list(APPEND libraryopts ${i}_LIBRARY) - endif() - else() - # Oh no, we don't know the option names - message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!") - endif() - endif() - endforeach() - - if (includeopts) - list(REMOVE_DUPLICATES includeopts) - endif() - - if (libraryopts) - list(REMOVE_DUPLICATES libraryopts) - endif() - - string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}") - if (NOT tmp STREQUAL "${includeopts} ${libraryopts}") - message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).") - endif() - - # Include/library names separated by spaces (notice: not CMake lists) - unset(includes) - unset(libs) - - # Process all includes and set found false if any are missing - foreach (i ${includeopts}) - list(APPEND configopts ${i}) - if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") - list(APPEND includes "${${i}}") - else() - set(found FALSE) - set(missing_headers TRUE) - endif() - endforeach() - - # Process all libraries and set found false if any are missing - foreach (i ${libraryopts}) - list(APPEND configopts ${i}) - if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") - list(APPEND libs "${${i}}") - else() - set (found FALSE) - endif() - endforeach() - - # Version checks - if (found AND findver) - if (NOT version) - message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.") - elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver)) - set(found FALSE) - set(version_unsuitable TRUE) - endif() - endif() - - # If all-OK, hide all config options, export variables, print status and exit - if (found) - foreach (i ${configopts}) - mark_as_advanced(${i}) - endforeach() - if (NOT quiet) - message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") - if (LIBFIND_DEBUG) - message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}") - message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}") - message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}") - message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}") - message(STATUS " ${PREFIX}_LIBRARIES=${libs}") - endif() - endif() - set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE) - set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE) - set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE) - set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE) - set (${PREFIX}_FOUND TRUE PARENT_SCOPE) - return() - endif() - - # Format messages for debug info and the type of error - set(vars "Relevant CMake configuration variables:\n") - foreach (i ${configopts}) - mark_as_advanced(CLEAR ${i}) - set(val ${${i}}) - if ("${val}" STREQUAL "${i}-NOTFOUND") - set (val "") - elseif (val AND NOT EXISTS ${val}) - set (val "${val} (does not exist)") - else() - set(some_files TRUE) - endif() - set(vars "${vars} ${i}=${val}\n") - endforeach() - set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n") - if (version_unsuitable) - set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but") - if (exactver) - set(msg "${msg} only version ${findver} is acceptable.") - else() - set(msg "${msg} version ${findver} is the minimum requirement.") - endif() - else() - if (missing_headers) - set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?") - elseif (some_files) - set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?") - if(findver) - set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).") - endif() - else() - set(msg "We were unable to find package ${PREFIX}.") - endif() - endif() - - # Fatal error out if REQUIRED - if (required) - set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.") - message(FATAL_ERROR "${msg}\n${vars}") - endif() - # Otherwise just print a nasty warning - if (NOT quiet) - message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}") - endif() -endfunction() -- cgit From 4cf4ae93df6af09ef3a0df678bb3d154b65bf731 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 2 Mar 2023 22:50:43 +0100 Subject: build: cmake cleanup (#22251) - Remove unused code - Use consistent casing. Variable names such as LibLuV_LIBRARIES is needlessly jarring, even if the name might be technically correct. - Use title casing for packages. find_package(unibilium) requires the find_module to be named "Findunibilium.cmake", which makes it harder to spot when scanning the files. Instead, use "Unibilium". --- cmake/FindIconv.cmake | 6 ++++ cmake/FindLibIntl.cmake | 80 ---------------------------------------------- cmake/FindLibLUV.cmake | 14 -------- cmake/FindLibTermkey.cmake | 5 --- cmake/FindLibUV.cmake | 69 --------------------------------------- cmake/FindLibintl.cmake | 80 ++++++++++++++++++++++++++++++++++++++++++++++ cmake/FindLibluv.cmake | 14 ++++++++ cmake/FindLibtermkey.cmake | 9 ++++++ cmake/FindLibuv.cmake | 69 +++++++++++++++++++++++++++++++++++++++ cmake/FindLibvterm.cmake | 22 +++++++++++++ cmake/FindLuaJit.cmake | 20 ------------ cmake/FindLuajit.cmake | 20 ++++++++++++ cmake/FindMsgpack.cmake | 22 +++++++++++-- cmake/FindTreeSitter.cmake | 5 --- cmake/FindTreesitter.cmake | 40 +++++++++++++++++++++++ cmake/FindUnibilium.cmake | 29 +++++++++++++++++ cmake/Findlibvterm.cmake | 22 ------------- cmake/Findunibilium.cmake | 29 ----------------- 18 files changed, 308 insertions(+), 247 deletions(-) delete mode 100644 cmake/FindLibIntl.cmake delete mode 100644 cmake/FindLibLUV.cmake delete mode 100644 cmake/FindLibTermkey.cmake delete mode 100644 cmake/FindLibUV.cmake create mode 100644 cmake/FindLibintl.cmake create mode 100644 cmake/FindLibluv.cmake create mode 100644 cmake/FindLibtermkey.cmake create mode 100644 cmake/FindLibuv.cmake create mode 100644 cmake/FindLibvterm.cmake delete mode 100644 cmake/FindLuaJit.cmake create mode 100644 cmake/FindLuajit.cmake delete mode 100644 cmake/FindTreeSitter.cmake create mode 100644 cmake/FindTreesitter.cmake create mode 100644 cmake/FindUnibilium.cmake delete mode 100644 cmake/Findlibvterm.cmake delete mode 100644 cmake/Findunibilium.cmake (limited to 'cmake') diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake index b0ffa1bd75..48c1514ff2 100644 --- a/cmake/FindIconv.cmake +++ b/cmake/FindIconv.cmake @@ -6,3 +6,9 @@ find_library(ICONV_LIBRARY NAMES iconv libiconv) find_package_handle_standard_args(Iconv DEFAULT_MSG ICONV_INCLUDE_DIR) mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY) + +add_library(iconv INTERFACE) +target_include_directories(iconv SYSTEM BEFORE INTERFACE ${ICONV_INCLUDE_DIR}) +if(ICONV_LIBRARY) + target_link_libraries(iconv INTERFACE ${ICONV_LIBRARY}) +endif() diff --git a/cmake/FindLibIntl.cmake b/cmake/FindLibIntl.cmake deleted file mode 100644 index 8b512e5a7e..0000000000 --- a/cmake/FindLibIntl.cmake +++ /dev/null @@ -1,80 +0,0 @@ -include(CheckCSourceCompiles) -include(CheckVariableExists) - -# Append custom gettext path to CMAKE_PREFIX_PATH -# if installed via Mac Homebrew -if (CMAKE_HOST_APPLE) - find_program(HOMEBREW_PROG brew) - if (EXISTS ${HOMEBREW_PROG}) - execute_process(COMMAND ${HOMEBREW_PROG} --prefix gettext - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE HOMEBREW_GETTEXT_PREFIX) - list(APPEND CMAKE_PREFIX_PATH "${HOMEBREW_GETTEXT_PREFIX}") - endif() -endif() - -find_path(LibIntl_INCLUDE_DIR - NAMES libintl.h - PATH_SUFFIXES gettext -) - -find_library(LibIntl_LIBRARY - NAMES intl libintl -) - -if (LibIntl_INCLUDE_DIR) - list(APPEND CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}") -endif() -# On some systems (linux+glibc) libintl is passively available. -# So only specify the library if one was found. -if (LibIntl_LIBRARY) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}") -endif() -if (MSVC) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY}) -endif() - -# On macOS, if libintl is a static library then we also need -# to link libiconv and CoreFoundation. -get_filename_component(LibIntl_EXT "${LibIntl_LIBRARY}" EXT) -if (APPLE AND (LibIntl_EXT STREQUAL ".a")) - set(LibIntl_STATIC TRUE) - find_library(CoreFoundation_FRAMEWORK CoreFoundation) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}" "${CoreFoundation_FRAMEWORK}") -endif() - -check_c_source_compiles(" -#include - -int main(int argc, char** argv) { - gettext(\"foo\"); - ngettext(\"foo\", \"bar\", 1); - bindtextdomain(\"foo\", \"bar\"); - bind_textdomain_codeset(\"foo\", \"bar\"); - textdomain(\"foo\"); -}" HAVE_WORKING_LIBINTL) -if (MSVC) - list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY}) -endif() -if (LibIntl_STATIC) - list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}" "${CoreFoundation_FRAMEWORK}") -endif() -if (LibIntl_INCLUDE_DIR) - list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}") -endif() -if (LibIntl_LIBRARY) - list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}") -endif() - -set(REQUIRED_VARIABLES LibIntl_LIBRARY LIBTERMKEY_INCLUDE_DIR) -if (HAVE_WORKING_LIBINTL) - # On some systems (linux+glibc) libintl is passively available. - # If HAVE_WORKING_LIBINTL then we consider the requirement satisfied. - unset(REQUIRED_VARIABLES) - - check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR) -endif() - -find_package_handle_standard_args(LibIntl DEFAULT_MSG - ${REQUIRED_VARIABLES}) -mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) diff --git a/cmake/FindLibLUV.cmake b/cmake/FindLibLUV.cmake deleted file mode 100644 index 94d706e1fc..0000000000 --- a/cmake/FindLibLUV.cmake +++ /dev/null @@ -1,14 +0,0 @@ -find_path(LIBLUV_INCLUDE_DIR luv/luv.h) - -# Explicitly look for luv.so. #10407 -list(APPEND LIBLUV_NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX}) - -find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}) - -set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY}) -set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR}) - -find_package_handle_standard_args(LibLUV DEFAULT_MSG - LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR) - -mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY) diff --git a/cmake/FindLibTermkey.cmake b/cmake/FindLibTermkey.cmake deleted file mode 100644 index 368cd21354..0000000000 --- a/cmake/FindLibTermkey.cmake +++ /dev/null @@ -1,5 +0,0 @@ -find_path(LIBTERMKEY_INCLUDE_DIR termkey.h) -find_library(LIBTERMKEY_LIBRARY NAMES termkey) -find_package_handle_standard_args(LibTermkey DEFAULT_MSG - LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR) -mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake deleted file mode 100644 index a134ca0917..0000000000 --- a/cmake/FindLibUV.cmake +++ /dev/null @@ -1,69 +0,0 @@ -find_path(LIBUV_INCLUDE_DIR uv.h) - -list(APPEND LIBUV_NAMES uv_a uv) - -find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}) - -mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) - -set(LIBUV_LIBRARIES ${LIBUV_LIBRARY}) -set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR}) - -include(CheckLibraryExists) - -check_library_exists(dl dlopen "dlfcn.h" HAVE_LIBDL) -if(HAVE_LIBDL) - list(APPEND LIBUV_LIBRARIES dl) -endif() - -check_library_exists(kstat kstat_lookup "kstat.h" HAVE_LIBKSTAT) -if(HAVE_LIBKSTAT) - list(APPEND LIBUV_LIBRARIES kstat) -endif() - -check_library_exists(kvm kvm_open "kvm.h" HAVE_LIBKVM) -if(HAVE_LIBKVM AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") - list(APPEND LIBUV_LIBRARIES kvm) -endif() - -check_library_exists(nsl gethostbyname "nsl.h" HAVE_LIBNSL) -if(HAVE_LIBNSL) - list(APPEND LIBUV_LIBRARIES nsl) -endif() - -check_library_exists(perfstat perfstat_cpu "libperfstat.h" HAVE_LIBPERFSTAT) -if(HAVE_LIBPERFSTAT) - list(APPEND LIBUV_LIBRARIES perfstat) -endif() - -check_library_exists(rt clock_gettime "time.h" HAVE_LIBRT) -if(HAVE_LIBRT) - list(APPEND LIBUV_LIBRARIES rt) -endif() - -check_library_exists(sendfile sendfile "" HAVE_LIBSENDFILE) -if(HAVE_LIBSENDFILE) - list(APPEND LIBUV_LIBRARIES sendfile) -endif() - -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) - list(APPEND LIBUV_LIBRARIES ws2_32) -endif() - -find_package(Threads) -if(Threads_FOUND) - # TODO: Fix the cmake file to properly handle static deps for bundled builds. - # Meanwhile just include the threads library if CMake tells us there's one to - # use. - list(APPEND LIBUV_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) -endif() - -find_package_handle_standard_args(LibUV DEFAULT_MSG - LIBUV_LIBRARY LIBUV_INCLUDE_DIR) - -mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) diff --git a/cmake/FindLibintl.cmake b/cmake/FindLibintl.cmake new file mode 100644 index 0000000000..630a3545fc --- /dev/null +++ b/cmake/FindLibintl.cmake @@ -0,0 +1,80 @@ +include(CheckCSourceCompiles) +include(CheckVariableExists) + +# Append custom gettext path to CMAKE_PREFIX_PATH +# if installed via Mac Homebrew +if (APPLE) + find_program(HOMEBREW_PRG brew) + if (EXISTS ${HOMEBREW_PRG}) + execute_process(COMMAND ${HOMEBREW_PRG} --prefix gettext + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE HOMEBREW_GETTEXT_PREFIX) + list(APPEND CMAKE_PREFIX_PATH "${HOMEBREW_GETTEXT_PREFIX}") + endif() +endif() + +find_path(LIBINTL_INCLUDE_DIR + NAMES libintl.h + PATH_SUFFIXES gettext +) + +find_library(LIBINTL_LIBRARY + NAMES intl libintl +) + +if (LIBINTL_INCLUDE_DIR) + list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBINTL_INCLUDE_DIR}") +endif() +# On some systems (linux+glibc) libintl is passively available. +# So only specify the library if one was found. +if (LIBINTL_LIBRARY) + list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBINTL_LIBRARY}") +endif() +if (MSVC) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY}) +endif() + +# On macOS, if libintl is a static library then we also need +# to link libiconv and CoreFoundation. +get_filename_component(LibIntl_EXT "${LIBINTL_LIBRARY}" EXT) +if (APPLE AND (LibIntl_EXT STREQUAL ".a")) + set(LibIntl_STATIC TRUE) + find_library(CoreFoundation_FRAMEWORK CoreFoundation) + list(APPEND CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}" "${CoreFoundation_FRAMEWORK}") +endif() + +check_c_source_compiles(" +#include + +int main(int argc, char** argv) { + gettext(\"foo\"); + ngettext(\"foo\", \"bar\", 1); + bindtextdomain(\"foo\", \"bar\"); + bind_textdomain_codeset(\"foo\", \"bar\"); + textdomain(\"foo\"); +}" HAVE_WORKING_LIBINTL) +if (MSVC) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY}) +endif() +if (LibIntl_STATIC) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}" "${CoreFoundation_FRAMEWORK}") +endif() +if (LIBINTL_INCLUDE_DIR) + list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LIBINTL_INCLUDE_DIR}") +endif() +if (LIBINTL_LIBRARY) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${LIBINTL_LIBRARY}") +endif() + +set(REQUIRED_VARIABLES LIBINTL_LIBRARY LIBINTL_INCLUDE_DIR) +if (HAVE_WORKING_LIBINTL) + # On some systems (linux+glibc) libintl is passively available. + # If HAVE_WORKING_LIBINTL then we consider the requirement satisfied. + unset(REQUIRED_VARIABLES) + + check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR) +endif() + +find_package_handle_standard_args(Libintl DEFAULT_MSG + ${REQUIRED_VARIABLES}) +mark_as_advanced(LIBINTL_LIBRARY LIBINTL_INCLUDE_DIR) diff --git a/cmake/FindLibluv.cmake b/cmake/FindLibluv.cmake new file mode 100644 index 0000000000..9a74d5d0e1 --- /dev/null +++ b/cmake/FindLibluv.cmake @@ -0,0 +1,14 @@ +find_path(LIBLUV_INCLUDE_DIR luv/luv.h) + +# Explicitly look for luv.so. #10407 +list(APPEND LIBLUV_NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX}) + +find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}) + +set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY}) +set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR}) + +find_package_handle_standard_args(Libluv DEFAULT_MSG + LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR) + +mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY) diff --git a/cmake/FindLibtermkey.cmake b/cmake/FindLibtermkey.cmake new file mode 100644 index 0000000000..1fc8ac78f2 --- /dev/null +++ b/cmake/FindLibtermkey.cmake @@ -0,0 +1,9 @@ +find_path(LIBTERMKEY_INCLUDE_DIR termkey.h) +find_library(LIBTERMKEY_LIBRARY NAMES termkey) +find_package_handle_standard_args(Libtermkey DEFAULT_MSG + LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR) +mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) + +add_library(libtermkey INTERFACE) +target_include_directories(libtermkey SYSTEM BEFORE INTERFACE ${LIBTERMKEY_INCLUDE_DIR}) +target_link_libraries(libtermkey INTERFACE ${LIBTERMKEY_LIBRARY}) diff --git a/cmake/FindLibuv.cmake b/cmake/FindLibuv.cmake new file mode 100644 index 0000000000..0f6e80d915 --- /dev/null +++ b/cmake/FindLibuv.cmake @@ -0,0 +1,69 @@ +find_path(LIBUV_INCLUDE_DIR uv.h) + +list(APPEND LIBUV_NAMES uv_a uv) + +find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}) + +mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) + +set(LIBUV_LIBRARIES ${LIBUV_LIBRARY}) +set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR}) + +include(CheckLibraryExists) + +check_library_exists(dl dlopen "dlfcn.h" HAVE_LIBDL) +if(HAVE_LIBDL) + list(APPEND LIBUV_LIBRARIES dl) +endif() + +check_library_exists(kstat kstat_lookup "kstat.h" HAVE_LIBKSTAT) +if(HAVE_LIBKSTAT) + list(APPEND LIBUV_LIBRARIES kstat) +endif() + +check_library_exists(kvm kvm_open "kvm.h" HAVE_LIBKVM) +if(HAVE_LIBKVM AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + list(APPEND LIBUV_LIBRARIES kvm) +endif() + +check_library_exists(nsl gethostbyname "nsl.h" HAVE_LIBNSL) +if(HAVE_LIBNSL) + list(APPEND LIBUV_LIBRARIES nsl) +endif() + +check_library_exists(perfstat perfstat_cpu "libperfstat.h" HAVE_LIBPERFSTAT) +if(HAVE_LIBPERFSTAT) + list(APPEND LIBUV_LIBRARIES perfstat) +endif() + +check_library_exists(rt clock_gettime "time.h" HAVE_LIBRT) +if(HAVE_LIBRT) + list(APPEND LIBUV_LIBRARIES rt) +endif() + +check_library_exists(sendfile sendfile "" HAVE_LIBSENDFILE) +if(HAVE_LIBSENDFILE) + list(APPEND LIBUV_LIBRARIES sendfile) +endif() + +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) + list(APPEND LIBUV_LIBRARIES ws2_32) +endif() + +find_package(Threads) +if(Threads_FOUND) + # TODO: Fix the cmake file to properly handle static deps for bundled builds. + # Meanwhile just include the threads library if CMake tells us there's one to + # use. + list(APPEND LIBUV_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) +endif() + +find_package_handle_standard_args(Libuv DEFAULT_MSG + LIBUV_LIBRARY LIBUV_INCLUDE_DIR) + +mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) diff --git a/cmake/FindLibvterm.cmake b/cmake/FindLibvterm.cmake new file mode 100644 index 0000000000..ad2e682b30 --- /dev/null +++ b/cmake/FindLibvterm.cmake @@ -0,0 +1,22 @@ +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 ${LIBVTERM_INCLUDE_DIR}) +target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY}) + +mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY) diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake deleted file mode 100644 index e3f47eee83..0000000000 --- a/cmake/FindLuaJit.cmake +++ /dev/null @@ -1,20 +0,0 @@ -find_path(LUAJIT_INCLUDE_DIR luajit.h - PATH_SUFFIXES luajit-2.0 luajit-2.1) - -if(MSVC) - list(APPEND LUAJIT_NAMES lua51) -elseif(MINGW) - list(APPEND LUAJIT_NAMES libluajit libluajit-5.1) -else() - list(APPEND LUAJIT_NAMES luajit-5.1) -endif() - -find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) - -set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) -set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) - -find_package_handle_standard_args(LuaJit DEFAULT_MSG - LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) - -mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARY) diff --git a/cmake/FindLuajit.cmake b/cmake/FindLuajit.cmake new file mode 100644 index 0000000000..924e4c80d4 --- /dev/null +++ b/cmake/FindLuajit.cmake @@ -0,0 +1,20 @@ +find_path(LUAJIT_INCLUDE_DIR luajit.h + PATH_SUFFIXES luajit-2.0 luajit-2.1) + +if(MSVC) + list(APPEND LUAJIT_NAMES lua51) +elseif(MINGW) + list(APPEND LUAJIT_NAMES libluajit libluajit-5.1) +else() + list(APPEND LUAJIT_NAMES luajit-5.1) +endif() + +find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) + +set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) +set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) + +find_package_handle_standard_args(Luajit DEFAULT_MSG + LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) + +mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARY) diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index 8187bce08d..43c4c3c16b 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -22,9 +22,25 @@ find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES} mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) -set(MSGPACK_LIBRARIES ${MSGPACK_LIBRARY}) -set(MSGPACK_INCLUDE_DIRS ${MSGPACK_INCLUDE_DIR}) - find_package_handle_standard_args(Msgpack REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR VERSION_VAR MSGPACK_VERSION_STRING) + +add_library(msgpack INTERFACE) +target_include_directories(msgpack SYSTEM BEFORE INTERFACE ${MSGPACK_INCLUDE_DIR}) +target_link_libraries(msgpack INTERFACE ${MSGPACK_LIBRARY}) + +list(APPEND CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIR}") +check_c_source_compiles(" +#include + +int +main(void) +{ + return MSGPACK_OBJECT_FLOAT32; +} +" MSGPACK_HAS_FLOAT32) +list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIR}") +if(MSGPACK_HAS_FLOAT32) + target_compile_definitions(msgpack INTERFACE NVIM_MSGPACK_HAS_FLOAT32) +endif() diff --git a/cmake/FindTreeSitter.cmake b/cmake/FindTreeSitter.cmake deleted file mode 100644 index 2850a61b57..0000000000 --- a/cmake/FindTreeSitter.cmake +++ /dev/null @@ -1,5 +0,0 @@ -find_path(TreeSitter_INCLUDE_DIR tree_sitter/api.h) -find_library(TreeSitter_LIBRARY NAMES tree-sitter) -find_package_handle_standard_args(TreeSitter DEFAULT_MSG - TreeSitter_LIBRARY TreeSitter_INCLUDE_DIR) -mark_as_advanced(TreeSitter_LIBRARY TreeSitter_INCLUDE_DIR) diff --git a/cmake/FindTreesitter.cmake b/cmake/FindTreesitter.cmake new file mode 100644 index 0000000000..ef308ad5e1 --- /dev/null +++ b/cmake/FindTreesitter.cmake @@ -0,0 +1,40 @@ +find_path(TREESITTER_INCLUDE_DIR tree_sitter/api.h) +find_library(TREESITTER_LIBRARY NAMES tree-sitter) +find_package_handle_standard_args(Treesitter DEFAULT_MSG + TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR) +mark_as_advanced(TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR) + +add_library(treesitter INTERFACE) +target_include_directories(treesitter SYSTEM BEFORE INTERFACE ${TREESITTER_INCLUDE_DIR}) +target_link_libraries(treesitter INTERFACE ${TREESITTER_LIBRARY}) + +list(APPEND CMAKE_REQUIRED_INCLUDES "${TREESITTER_INCLUDE_DIR}") +list(APPEND CMAKE_REQUIRED_LIBRARIES "${TREESITTER_LIBRARY}") +check_c_source_compiles(" +#include +int +main(void) +{ + TSQueryCursor *cursor = ts_query_cursor_new(); + ts_query_cursor_set_match_limit(cursor, 32); + return 0; +} +" TS_HAS_SET_MATCH_LIMIT) +if(TS_HAS_SET_MATCH_LIMIT) + target_compile_definitions(treesitter INTERFACE NVIM_TS_HAS_SET_MATCH_LIMIT) +endif() +check_c_source_compiles(" +#include +#include +int +main(void) +{ + ts_set_allocator(malloc, calloc, realloc, free); + return 0; +} +" TS_HAS_SET_ALLOCATOR) +if(TS_HAS_SET_ALLOCATOR) + target_compile_definitions(treesitter INTERFACE NVIM_TS_HAS_SET_ALLOCATOR) +endif() +list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${TREESITTER_INCLUDE_DIR}") +list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${TREESITTER_LIBRARY}") diff --git a/cmake/FindUnibilium.cmake b/cmake/FindUnibilium.cmake new file mode 100644 index 0000000000..35a9016b19 --- /dev/null +++ b/cmake/FindUnibilium.cmake @@ -0,0 +1,29 @@ +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 + +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() + +mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY) diff --git a/cmake/Findlibvterm.cmake b/cmake/Findlibvterm.cmake deleted file mode 100644 index 4a2ae48ffa..0000000000 --- a/cmake/Findlibvterm.cmake +++ /dev/null @@ -1,22 +0,0 @@ -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 ${LIBVTERM_INCLUDE_DIR}) -target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY}) - -mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY) diff --git a/cmake/Findunibilium.cmake b/cmake/Findunibilium.cmake deleted file mode 100644 index 3dbac31b5b..0000000000 --- a/cmake/Findunibilium.cmake +++ /dev/null @@ -1,29 +0,0 @@ -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 - -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() - -mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY) -- cgit From c002fd421e3d8deb4adf144cadcd3a6fe4635e12 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 27 Feb 2023 19:41:40 +0100 Subject: refactor(build): graduate libtreesitter features which are 1+ years old --- cmake/FindTreesitter.cmake | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'cmake') diff --git a/cmake/FindTreesitter.cmake b/cmake/FindTreesitter.cmake index ef308ad5e1..ddea35fe66 100644 --- a/cmake/FindTreesitter.cmake +++ b/cmake/FindTreesitter.cmake @@ -7,34 +7,3 @@ mark_as_advanced(TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR) add_library(treesitter INTERFACE) target_include_directories(treesitter SYSTEM BEFORE INTERFACE ${TREESITTER_INCLUDE_DIR}) target_link_libraries(treesitter INTERFACE ${TREESITTER_LIBRARY}) - -list(APPEND CMAKE_REQUIRED_INCLUDES "${TREESITTER_INCLUDE_DIR}") -list(APPEND CMAKE_REQUIRED_LIBRARIES "${TREESITTER_LIBRARY}") -check_c_source_compiles(" -#include -int -main(void) -{ - TSQueryCursor *cursor = ts_query_cursor_new(); - ts_query_cursor_set_match_limit(cursor, 32); - return 0; -} -" TS_HAS_SET_MATCH_LIMIT) -if(TS_HAS_SET_MATCH_LIMIT) - target_compile_definitions(treesitter INTERFACE NVIM_TS_HAS_SET_MATCH_LIMIT) -endif() -check_c_source_compiles(" -#include -#include -int -main(void) -{ - ts_set_allocator(malloc, calloc, realloc, free); - return 0; -} -" TS_HAS_SET_ALLOCATOR) -if(TS_HAS_SET_ALLOCATOR) - target_compile_definitions(treesitter INTERFACE NVIM_TS_HAS_SET_ALLOCATOR) -endif() -list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${TREESITTER_INCLUDE_DIR}") -list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${TREESITTER_LIBRARY}") -- cgit From c9b6db45417ecbd178f0c6106f4033c760cc75df Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 27 Feb 2023 19:46:39 +0100 Subject: refactor(build): graduate msgpack-c FLOAT32 "feature" since forever --- cmake/FindMsgpack.cmake | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'cmake') diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index 43c4c3c16b..b1888560c3 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -29,18 +29,3 @@ find_package_handle_standard_args(Msgpack add_library(msgpack INTERFACE) target_include_directories(msgpack SYSTEM BEFORE INTERFACE ${MSGPACK_INCLUDE_DIR}) target_link_libraries(msgpack INTERFACE ${MSGPACK_LIBRARY}) - -list(APPEND CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIR}") -check_c_source_compiles(" -#include - -int -main(void) -{ - return MSGPACK_OBJECT_FLOAT32; -} -" MSGPACK_HAS_FLOAT32) -list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIR}") -if(MSGPACK_HAS_FLOAT32) - target_compile_definitions(msgpack INTERFACE NVIM_MSGPACK_HAS_FLOAT32) -endif() -- cgit From 848dac0aaa68a6ecbb7fe346a90bb5e5f5d7f09f Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 27 Feb 2023 19:51:25 +0100 Subject: refactor(build): graduate unibilium VAR_FROM feature from 2017 --- cmake/FindUnibilium.cmake | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'cmake') diff --git a/cmake/FindUnibilium.cmake b/cmake/FindUnibilium.cmake index 35a9016b19..91906e6660 100644 --- a/cmake/FindUnibilium.cmake +++ b/cmake/FindUnibilium.cmake @@ -8,22 +8,4 @@ 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 - -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() - mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY) -- cgit From 46c4cbced567f5f05f2c95b91cd90084ea8b5528 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 4 Mar 2023 17:26:24 +0100 Subject: build(deps): bump msgpack-c to v6.0.0 (#22522) * Remove C++ requirement if test is disabled * Change CMake package name of C library to msgpack-c * Unified all C package, library, cmake, tarball name become msgpack-c. --- cmake/FindMsgpack.cmake | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'cmake') diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index b1888560c3..a2b0174f8d 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -10,14 +10,7 @@ else() set(MSGPACK_VERSION_STRING) endif() -if(MSVC) - # The import library for the msgpack DLL has a different name - list(APPEND MSGPACK_NAMES msgpackc_import) -else() - list(APPEND MSGPACK_NAMES msgpackc msgpack) -endif() - -find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES} +find_library(MSGPACK_LIBRARY NAMES msgpackc msgpack msgpackc_import msgpack-c NAMES_PER_DIR) mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) -- cgit From ca3bc56a3b1b3454498a4a23c0d700486d554077 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Sun, 5 Mar 2023 23:20:25 +0530 Subject: build: silence git describe error output This change will silence the warning from git describe command when the project is built using source tarball. The warning is fatal: not a git repository: 'neovim/.git' --- cmake/GenerateVersion.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'cmake') diff --git a/cmake/GenerateVersion.cmake b/cmake/GenerateVersion.cmake index c092645140..ab046e93ba 100644 --- a/cmake/GenerateVersion.cmake +++ b/cmake/GenerateVersion.cmake @@ -5,6 +5,7 @@ execute_process( COMMAND git --git-dir=${NVIM_SOURCE_DIR}/.git --work-tree=${NVIM_SOURCE_DIR} describe --first-parent --dirty --always OUTPUT_VARIABLE GIT_TAG OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET RESULT_VARIABLE RES) if(RES) -- cgit From da0c66bcddbe4e6ebc72357c9f6c5de75e176744 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 5 Mar 2023 17:06:13 +0100 Subject: build: remove workaround for incorrectly packaged libluv This removes a workaround for incorrectly packaged libluv in 90e44ecf1144cb32195da00e24d23afb111ea680 as it should not be needed anymore. --- cmake/FindLibluv.cmake | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'cmake') diff --git a/cmake/FindLibluv.cmake b/cmake/FindLibluv.cmake index 9a74d5d0e1..3dfc536024 100644 --- a/cmake/FindLibluv.cmake +++ b/cmake/FindLibluv.cmake @@ -1,14 +1,5 @@ find_path(LIBLUV_INCLUDE_DIR luv/luv.h) - -# Explicitly look for luv.so. #10407 -list(APPEND LIBLUV_NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX}) - -find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}) - -set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY}) -set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR}) - +find_library(LIBLUV_LIBRARY NAMES luv_a luv libluv_a luv.so) find_package_handle_standard_args(Libluv DEFAULT_MSG LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR) - mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY) -- cgit From 30632dd21ab243bb2c4eb115819a32fdfd9155dc Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 7 Mar 2023 15:00:51 +0100 Subject: refactor(build): make installation of runtime/ more effective Currently files to install in runtime/ is detected by recursive glob pattern which has two problems: - cmake needs to do a of work at config time and build/runtime/cmake_install.cmake becomes HUGE (2.5MB, biggest config file) - we need to explicitly specify each file suffix used in the entire runtime, which is duplication of information. These globs specify every single file in a subdirectory. Thus, we can just install every runtime/ subdirectory as a single install command. Furthermore, at the top-level, only .vim and .lua files need to be installed. Further possible refactor: we could move files which does not belong in $PREFIX/runtime out of $REPO/runtime. Then runtime could be installed with a single install_helper(DIRECTORY ...) command. --- cmake/InstallHelpers.cmake | 9 --------- 1 file changed, 9 deletions(-) (limited to 'cmake') diff --git a/cmake/InstallHelpers.cmake b/cmake/InstallHelpers.cmake index 3786c4177f..49d8692aae 100644 --- a/cmake/InstallHelpers.cmake +++ b/cmake/InstallHelpers.cmake @@ -167,12 +167,3 @@ function(glob_wrapper outvar) endif() set(${outvar} ${${outvar}} PARENT_SCOPE) endfunction() - -function(globrecurse_wrapper outvar root) - if(${CMAKE_VERSION} VERSION_LESS 3.12) - file(GLOB_RECURSE ${outvar} RELATIVE ${root} ${ARGN}) - else() - file(GLOB_RECURSE ${outvar} CONFIGURE_DEPENDS RELATIVE ${root} ${ARGN}) - endif() - set(${outvar} ${${outvar}} PARENT_SCOPE) -endfunction() -- cgit From 81f2bce775bc7e7392b51538b94a0d62d6ab15b4 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 4 Apr 2023 19:27:21 +0200 Subject: build: cmake cleanup - Change libtermkeyCMakeLists.txt to LibtermkeyCMakeLists.txt - Remove duplicate mark_as_advanced calls in FindLibuv.cmake - Fix "Enabling Clang sanitizer" messages as it's no longer clang-only - Simplify parser installation syntax - Rename tree-sitter to treesitter --- cmake/FindLibuv.cmake | 2 -- 1 file changed, 2 deletions(-) (limited to 'cmake') diff --git a/cmake/FindLibuv.cmake b/cmake/FindLibuv.cmake index 0f6e80d915..0cf8da3061 100644 --- a/cmake/FindLibuv.cmake +++ b/cmake/FindLibuv.cmake @@ -4,8 +4,6 @@ list(APPEND LIBUV_NAMES uv_a uv) find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}) -mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) - set(LIBUV_LIBRARIES ${LIBUV_LIBRARY}) set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR}) -- cgit From 0a3645a72307afa563683a6e06c544810e0b65eb Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 19 Apr 2023 00:47:15 +0200 Subject: build: find system luv on ubuntu Also use the system luv in CI for the with-external-deps job. --- cmake/FindLibluv.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/FindLibluv.cmake b/cmake/FindLibluv.cmake index 3dfc536024..d402b26447 100644 --- a/cmake/FindLibluv.cmake +++ b/cmake/FindLibluv.cmake @@ -1,5 +1,14 @@ find_path(LIBLUV_INCLUDE_DIR luv/luv.h) -find_library(LIBLUV_LIBRARY NAMES luv_a luv libluv_a luv.so) +find_library(LIBLUV_LIBRARY NAMES luv_a luv libluv_a) + +# Ubuntu-specific workaround to find system paths +function(ubuntu) + set(CMAKE_FIND_LIBRARY_PREFIXES "") + find_path(LIBLUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) + find_library(LIBLUV_LIBRARY NAMES luv PATH_SUFFIXES lua/5.1) +endfunction() +ubuntu() + find_package_handle_standard_args(Libluv DEFAULT_MSG LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR) mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY) -- cgit From 45bcf8386918bbb475fbe20c48b508aa89ed0624 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 20 Apr 2023 13:19:38 +0200 Subject: refactor(build): include lpeg as a library --- cmake/FindLpeg.cmake | 14 ++++++++++++++ cmake/LuaHelpers.cmake | 23 ----------------------- 2 files changed, 14 insertions(+), 23 deletions(-) create mode 100644 cmake/FindLpeg.cmake (limited to 'cmake') diff --git a/cmake/FindLpeg.cmake b/cmake/FindLpeg.cmake new file mode 100644 index 0000000000..d4fc6dbd97 --- /dev/null +++ b/cmake/FindLpeg.cmake @@ -0,0 +1,14 @@ +find_library(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a) + +# Ubuntu-specific workaround to find system paths +function(ubuntu) + set(CMAKE_FIND_LIBRARY_PREFIXES "") + find_library(LPEG_LIBRARY NAMES lpeg PATH_SUFFIXES lua/5.1) +endfunction() +ubuntu() + +find_package_handle_standard_args(Lpeg DEFAULT_MSG LPEG_LIBRARY) +mark_as_advanced(LPEG_LIBRARY) + +add_library(lpeg INTERFACE) +target_link_libraries(lpeg INTERFACE ${LPEG_LIBRARY}) diff --git a/cmake/LuaHelpers.cmake b/cmake/LuaHelpers.cmake index 0239460f2b..00ecd1357f 100644 --- a/cmake/LuaHelpers.cmake +++ b/cmake/LuaHelpers.cmake @@ -12,26 +12,3 @@ function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR) set(${RESULT_VAR} True PARENT_SCOPE) endif() endfunction() - -# Check Lua interpreter for dependencies -function(check_lua_deps LUA_PRG_PATH MODULES RESULT_VAR) - # Check if the lua interpreter at the given path - # satisfies all Neovim dependencies - message(STATUS "Checking Lua interpreter: ${LUA_PRG_PATH}") - if(NOT EXISTS ${LUA_PRG_PATH}) - message(STATUS - "[${LUA_PRG_PATH}] file not found") - endif() - - foreach(module ${MODULES}) - check_lua_module(${LUA_PRG_PATH} ${module} has_module) - if(NOT has_module) - message(STATUS - "[${LUA_PRG_PATH}] The '${module}' lua package is required for building Neovim") - set(${RESULT_VAR} False PARENT_SCOPE) - return() - endif() - endforeach() - - set(${RESULT_VAR} True PARENT_SCOPE) -endfunction() -- cgit From 9f9cef1b569e226a87c5c74e455bc4fc76cc2fac Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 30 Apr 2023 23:57:15 +0200 Subject: build: make lpeg an imported library Cmake truncates the full link path to a shared library if it is missing an SONAME in some undocumented scenarios. This causes builds in some systems to fail if "lpeg" isn't a library on the system path. The path of imported libraries aren't modified by cmake, so we can use that as a workaround until a proper solution for this has been identified. Closes https://github.com/neovim/neovim/issues/23395. --- cmake/FindLpeg.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/FindLpeg.cmake b/cmake/FindLpeg.cmake index d4fc6dbd97..4354f815b5 100644 --- a/cmake/FindLpeg.cmake +++ b/cmake/FindLpeg.cmake @@ -10,5 +10,7 @@ ubuntu() find_package_handle_standard_args(Lpeg DEFAULT_MSG LPEG_LIBRARY) mark_as_advanced(LPEG_LIBRARY) -add_library(lpeg INTERFACE) -target_link_libraries(lpeg INTERFACE ${LPEG_LIBRARY}) +# Workaround: use an imported library to prevent cmake from modifying library +# link path. See #23395. +add_library(lpeg UNKNOWN IMPORTED) +set_target_properties(lpeg PROPERTIES IMPORTED_LOCATION ${LPEG_LIBRARY}) -- cgit From af040c3a079f6e25db0ad6b908aa1327f67deb82 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 11 May 2023 11:13:32 +0100 Subject: feat(treesitter): add support for setting query depths --- cmake/FindTreesitter.cmake | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'cmake') diff --git a/cmake/FindTreesitter.cmake b/cmake/FindTreesitter.cmake index ddea35fe66..23214283c0 100644 --- a/cmake/FindTreesitter.cmake +++ b/cmake/FindTreesitter.cmake @@ -7,3 +7,23 @@ mark_as_advanced(TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR) add_library(treesitter INTERFACE) target_include_directories(treesitter SYSTEM BEFORE INTERFACE ${TREESITTER_INCLUDE_DIR}) target_link_libraries(treesitter INTERFACE ${TREESITTER_LIBRARY}) + +# TODO(lewis6991): remove when min TS version is 0.20.9 +list(APPEND CMAKE_REQUIRED_INCLUDES "${TREESITTER_INCLUDE_DIR}") +list(APPEND CMAKE_REQUIRED_LIBRARIES "${TREESITTER_LIBRARY}") +check_c_source_compiles(" +#include +int +main(void) +{ + TSQueryCursor *cursor = ts_query_cursor_new(); + ts_query_cursor_set_max_start_depth(cursor, 32); + return 0; +} +" TS_HAS_SET_MAX_START_DEPTH) +list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${TREESITTER_INCLUDE_DIR}") +list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${TREESITTER_LIBRARY}") + +if(TS_HAS_SET_MAX_START_DEPTH) + target_compile_definitions(treesitter INTERFACE NVIM_TS_HAS_SET_MAX_START_DEPTH) +endif() -- cgit From 10860164778327c0009f6efc8e020308cadb13a2 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 13 May 2023 12:12:29 +0200 Subject: build: cmake cleanup - Simplify error checking when using execute_process. - Set BUILD_SHARED_LIBS to OFF when building dependencies. This is normally not needed, but msgpack interprets an unset BUILD_SHARED_LIBS to build a shared library, which is the opposite of the cmake behavior. - Move function check_lua_module to Util.cmake. - Remove unnecessary code. - Make variable naming more consistent --- cmake/ConvertPo.cmake | 2 +- cmake/FindLibluv.cmake | 14 -------------- cmake/FindLibuv.cmake | 8 +------- cmake/FindLuajit.cmake | 3 --- cmake/FindLuv.cmake | 14 ++++++++++++++ cmake/InstallHelpers.cmake | 3 --- cmake/LuaHelpers.cmake | 14 -------------- cmake/RunTests.cmake | 2 +- cmake/Util.cmake | 11 +++++++++++ 9 files changed, 28 insertions(+), 43 deletions(-) delete mode 100644 cmake/FindLibluv.cmake create mode 100644 cmake/FindLuv.cmake delete mode 100644 cmake/LuaHelpers.cmake (limited to 'cmake') diff --git a/cmake/ConvertPo.cmake b/cmake/ConvertPo.cmake index 2282b96f56..202cd3fbb3 100644 --- a/cmake/ConvertPo.cmake +++ b/cmake/ConvertPo.cmake @@ -6,7 +6,7 @@ execute_process( OUTPUT_VARIABLE trans ERROR_VARIABLE err RESULT_VARIABLE res) -if(NOT res EQUAL 0) +if(res) message(FATAL_ERROR "iconv failed to run correctly: ${err}") endif() diff --git a/cmake/FindLibluv.cmake b/cmake/FindLibluv.cmake deleted file mode 100644 index d402b26447..0000000000 --- a/cmake/FindLibluv.cmake +++ /dev/null @@ -1,14 +0,0 @@ -find_path(LIBLUV_INCLUDE_DIR luv/luv.h) -find_library(LIBLUV_LIBRARY NAMES luv_a luv libluv_a) - -# Ubuntu-specific workaround to find system paths -function(ubuntu) - set(CMAKE_FIND_LIBRARY_PREFIXES "") - find_path(LIBLUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) - find_library(LIBLUV_LIBRARY NAMES luv PATH_SUFFIXES lua/5.1) -endfunction() -ubuntu() - -find_package_handle_standard_args(Libluv DEFAULT_MSG - LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR) -mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY) diff --git a/cmake/FindLibuv.cmake b/cmake/FindLibuv.cmake index 0cf8da3061..fa1d51370f 100644 --- a/cmake/FindLibuv.cmake +++ b/cmake/FindLibuv.cmake @@ -1,13 +1,7 @@ find_path(LIBUV_INCLUDE_DIR uv.h) - -list(APPEND LIBUV_NAMES uv_a uv) - -find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}) +find_library(LIBUV_LIBRARY NAMES uv_a uv) set(LIBUV_LIBRARIES ${LIBUV_LIBRARY}) -set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR}) - -include(CheckLibraryExists) check_library_exists(dl dlopen "dlfcn.h" HAVE_LIBDL) if(HAVE_LIBDL) diff --git a/cmake/FindLuajit.cmake b/cmake/FindLuajit.cmake index 924e4c80d4..711c2c0c09 100644 --- a/cmake/FindLuajit.cmake +++ b/cmake/FindLuajit.cmake @@ -11,9 +11,6 @@ endif() find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) -set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) -set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) - find_package_handle_standard_args(Luajit DEFAULT_MSG LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) diff --git a/cmake/FindLuv.cmake b/cmake/FindLuv.cmake new file mode 100644 index 0000000000..ebd74887ed --- /dev/null +++ b/cmake/FindLuv.cmake @@ -0,0 +1,14 @@ +find_path(LUV_INCLUDE_DIR luv/luv.h) +find_library(LUV_LIBRARY NAMES luv_a luv libluv_a) + +# Ubuntu-specific workaround to find system paths +function(ubuntu) + set(CMAKE_FIND_LIBRARY_PREFIXES "") + find_path(LUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) + find_library(LUV_LIBRARY NAMES luv PATH_SUFFIXES lua/5.1) +endfunction() +ubuntu() + +find_package_handle_standard_args(Luv DEFAULT_MSG + LUV_LIBRARY LUV_INCLUDE_DIR) +mark_as_advanced(LUV_INCLUDE_DIR LUV_LIBRARY) diff --git a/cmake/InstallHelpers.cmake b/cmake/InstallHelpers.cmake index 49d8692aae..63bf2bb73b 100644 --- a/cmake/InstallHelpers.cmake +++ b/cmake/InstallHelpers.cmake @@ -7,9 +7,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "BSD" AND NOT DEFINED CMAKE_INSTALL_MANDIR) endif() endif() -# For $CMAKE_INSTALL_{DATAROOT,MAN, ...}DIR -include(GNUInstallDirs) - # This will create any directories that need to be created in the destination # path with the typical owner, group, and user permissions--independent of the # umask setting. diff --git a/cmake/LuaHelpers.cmake b/cmake/LuaHelpers.cmake deleted file mode 100644 index 00ecd1357f..0000000000 --- a/cmake/LuaHelpers.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# -# Functions to help checking for a Lua interpreter -# - -# Check if a module is available in Lua -function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR) - execute_process(COMMAND ${LUA_PRG_PATH} -l "${MODULE}" -e "" - RESULT_VARIABLE module_missing) - if(module_missing) - set(${RESULT_VAR} False PARENT_SCOPE) - else() - set(${RESULT_VAR} True PARENT_SCOPE) - endif() -endfunction() diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index fe346661b5..1dcb6fb373 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -82,7 +82,7 @@ execute_process( file(GLOB RM_FILES ${BUILD_DIR}/Xtest_*) file(REMOVE_RECURSE ${RM_FILES}) -if(NOT res EQUAL 0) +if(res) message(STATUS "Tests exited non-zero: ${res}") if("${err}" STREQUAL "") message(STATUS "No output to stderr.") diff --git a/cmake/Util.cmake b/cmake/Util.cmake index e15b44d29a..b70f33a302 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -193,3 +193,14 @@ function(set_default_buildtype) endif() endif() endfunction() + +# Check if a module is available in Lua +function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR) + execute_process(COMMAND ${LUA_PRG_PATH} -l "${MODULE}" -e "" + RESULT_VARIABLE module_missing) + if(module_missing) + set(${RESULT_VAR} FALSE PARENT_SCOPE) + else() + set(${RESULT_VAR} TRUE PARENT_SCOPE) + endif() +endfunction() -- cgit From 826b95203ac9c8decf02e332fbb55cf4ebf73aef Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 18 May 2023 16:27:47 +0200 Subject: build: bundle uncrustify Uncrustify is sensitive to version changes, which causes friction for contributors that doesn't have that exact version. It's also simpler to download and install the correct version than to have bespoke version checking. --- cmake/CheckUncrustifyVersion.cmake | 13 ------------- cmake/Deps.cmake | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 cmake/CheckUncrustifyVersion.cmake create mode 100644 cmake/Deps.cmake (limited to 'cmake') diff --git a/cmake/CheckUncrustifyVersion.cmake b/cmake/CheckUncrustifyVersion.cmake deleted file mode 100644 index 4812c24ace..0000000000 --- a/cmake/CheckUncrustifyVersion.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if(UNCRUSTIFY_PRG) - execute_process(COMMAND uncrustify --version - OUTPUT_VARIABLE user_version - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "[A-Za-z_#-]" "" user_version ${user_version}) - - file(STRINGS ${CONFIG_FILE} required_version LIMIT_COUNT 1) - string(REGEX REPLACE "[A-Za-z_# -]" "" required_version ${required_version}) - - if(NOT user_version STREQUAL required_version) - message(FATAL_ERROR "Wrong uncrustify version! Required version is ${required_version} but found ${user_version}") - endif() -endif() diff --git a/cmake/Deps.cmake b/cmake/Deps.cmake new file mode 100644 index 0000000000..a375270f61 --- /dev/null +++ b/cmake/Deps.cmake @@ -0,0 +1,20 @@ +set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr") +set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin") +set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib") + +set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build") +set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads") + +set(DEPS_CMAKE_ARGS + -D CMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -D CMAKE_C_STANDARD=99 + -D CMAKE_GENERATOR=${CMAKE_GENERATOR} + -D CMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + -D BUILD_SHARED_LIBS=OFF + -D CMAKE_POSITION_INDEPENDENT_CODE=ON + -D CMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}) +if(APPLE) + list(APPEND DEPS_CMAKE_ARGS -D CMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK}) +endif() + +set(DEPS_CMAKE_CACHE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}) -- cgit From 24b60b0f71e0ffbd09c827230ecb5a37e833cade Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 18 May 2023 16:28:46 +0200 Subject: build: don't format deleted files Trying to format deleted files will otherwise throw an error. --- cmake/Format.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/Format.cmake b/cmake/Format.cmake index 4115e66705..7e8ca3547d 100644 --- a/cmake/Format.cmake +++ b/cmake/Format.cmake @@ -15,21 +15,21 @@ function(get_changed_files outvar) # Changed files that have been committed execute_process( - COMMAND git diff --name-only ${ancestor_commit}...${current_branch} + COMMAND git diff --diff-filter=d --name-only ${ancestor_commit}...${current_branch} OUTPUT_VARIABLE committed_files OUTPUT_STRIP_TRAILING_WHITESPACE) separate_arguments(committed_files NATIVE_COMMAND ${committed_files}) # Unstaged files execute_process( - COMMAND git diff --name-only + COMMAND git diff --diff-filter=d --name-only OUTPUT_VARIABLE unstaged_files OUTPUT_STRIP_TRAILING_WHITESPACE) separate_arguments(unstaged_files NATIVE_COMMAND ${unstaged_files}) # Staged files execute_process( - COMMAND git diff --cached --name-only + COMMAND git diff --diff-filter=d --cached --name-only OUTPUT_VARIABLE staged_files OUTPUT_STRIP_TRAILING_WHITESPACE) separate_arguments(staged_files NATIVE_COMMAND ${staged_files}) -- cgit From 8b8e60728486e1fbb308bee2961175be355e550a Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 21 May 2023 20:57:39 +0200 Subject: build: move luarocks and rocks installation to main build This will ensure luacheck and busted are only installed when they're actually needed. This cuts total build time by over 50%. Closes https://github.com/neovim/neovim/issues/22797. --- cmake/BuildLuarocks.cmake | 109 ++++++++++++++++++++++++++++++++++++++++++++++ cmake/Deps.cmake | 34 +++++++++++++++ cmake/RunTests.cmake | 2 +- 3 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 cmake/BuildLuarocks.cmake (limited to 'cmake') diff --git a/cmake/BuildLuarocks.cmake b/cmake/BuildLuarocks.cmake new file mode 100644 index 0000000000..c5e08d2d74 --- /dev/null +++ b/cmake/BuildLuarocks.cmake @@ -0,0 +1,109 @@ +# Luarocks recipe. Luarocks is only required when testing Neovim. +# NOTE: LuaRocks rocks need to "DEPENDS" on the previous module, because +# running luarocks in parallel will break, e.g. when some rocks have +# the same dependency. + +# The luarocks binary location +set(LUAROCKS_BINARY ${DEPS_BIN_DIR}/luarocks) + +# Arguments for calls to 'luarocks build' +if(NOT MSVC) + # In MSVC don't pass the compiler/linker to luarocks, the bundled + # version already knows, and passing them here breaks the build + set(LUAROCKS_BUILDARGS CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}) +endif() + +if(UNIX) + if(PREFER_LUA) + find_package(Lua 5.1 EXACT REQUIRED) + get_filename_component(LUA_ROOT ${LUA_INCLUDE_DIR} DIRECTORY) + list(APPEND LUAROCKS_OPTS + --with-lua=${LUA_ROOT}) + else() + find_package(Luajit REQUIRED) + get_filename_component(LUA_ROOT ${LUAJIT_INCLUDE_DIR} DIRECTORY) + get_filename_component(LUA_ROOT ${LUA_ROOT} DIRECTORY) + list(APPEND LUAROCKS_OPTS + --with-lua=${LUA_ROOT} + --with-lua-include=${LUAJIT_INCLUDE_DIR} + --with-lua-interpreter=luajit) + endif() + + set(LUAROCKS_CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure + --prefix=${DEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS}) + set(LUAROCKS_INSTALL_COMMAND ${MAKE_PRG} -j1 bootstrap) +elseif(MSVC OR MINGW) + if(MINGW) + set(COMPILER_FLAG /MW) + elseif(MSVC) + set(COMPILER_FLAG /MSVC) + endif() + + find_package(Luajit REQUIRED) + # Always assume bundled luajit for native Win32 + set(LUAROCKS_INSTALL_COMMAND install.bat /FORCECONFIG /NOREG /NOADMIN /Q /F + /LUA ${DEPS_PREFIX} + /INC ${LUAJIT_INCLUDE_DIR} + /P ${DEPS_INSTALL_DIR}/luarocks + /TREE ${DEPS_INSTALL_DIR} + /SCRIPTS ${DEPS_BIN_DIR} + ${COMPILER_FLAG}) + + set(LUAROCKS_BINARY ${DEPS_INSTALL_DIR}/luarocks/luarocks.bat) +else() + message(FATAL_ERROR "Trying to build luarocks in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}") +endif() + +ExternalProject_Add(luarocks + URL https://github.com/luarocks/luarocks/archive/v3.9.2.tar.gz + URL_HASH SHA256=a0b36cd68586cd79966d0106bb2e5a4f5523327867995fd66bee4237062b3e3b + DOWNLOAD_NO_PROGRESS TRUE + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luarocks + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND "${LUAROCKS_CONFIGURE_COMMAND}" + BUILD_COMMAND "" + INSTALL_COMMAND "${LUAROCKS_INSTALL_COMMAND}" + EXCLUDE_FROM_ALL TRUE) + +set(ROCKS_DIR ${DEPS_LIB_DIR}/luarocks/rocks) + +if(MSVC) + # Workaround for luarocks failing to find the md5sum.exe it is shipped with. + list(APPEND LUAROCKS_BUILDARGS MD5SUM=md5sum) + set(PATH PATH=${DEPS_INSTALL_DIR}/luarocks/tools;$ENV{PATH}) +endif() + +set(CURRENT_DEP luarocks) + +function(Download ROCK VER) + if(ARGV2) + set(OUTPUT ${ARGV2}) + else() + set(OUTPUT ${ROCKS_DIR}/${ROCK}) + endif() + add_custom_command(OUTPUT ${OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env "${PATH}" ${LUAROCKS_BINARY} build ${ROCK} ${VER} ${LUAROCKS_BUILDARGS} + DEPENDS ${CURRENT_DEP}) + add_custom_target(${ROCK} DEPENDS ${OUTPUT}) + set(CURRENT_DEP ${ROCK} PARENT_SCOPE) +endfunction() + +if(WIN32) + set(BUSTED_EXE "${DEPS_BIN_DIR}/busted.bat") + set(LUACHECK_EXE "${DEPS_BIN_DIR}/luacheck.bat") +else() + set(BUSTED_EXE "${DEPS_BIN_DIR}/busted") + set(LUACHECK_EXE "${DEPS_BIN_DIR}/luacheck") +endif() + +add_custom_target(test_deps) + +Download(luacheck 1.1.0-1 ${LUACHECK_EXE}) + +Download(busted 2.1.1 ${BUSTED_EXE}) +add_dependencies(test_deps busted) + +if(PREFER_LUA) + Download(coxpcall 1.17.0-1) + add_dependencies(test_deps coxpcall) +endif() diff --git a/cmake/Deps.cmake b/cmake/Deps.cmake index a375270f61..69a950eb0d 100644 --- a/cmake/Deps.cmake +++ b/cmake/Deps.cmake @@ -18,3 +18,37 @@ if(APPLE) endif() set(DEPS_CMAKE_CACHE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}) + +# MAKE_PRG +if(UNIX) + find_program(MAKE_PRG NAMES gmake make) + if(NOT MAKE_PRG) + message(FATAL_ERROR "GNU Make is required to build the dependencies.") + else() + message(STATUS "Found GNU Make at ${MAKE_PRG}") + endif() +endif() +# When using make, use the $(MAKE) variable to avoid warning about the job +# server. +if(CMAKE_GENERATOR MATCHES "Makefiles") + set(MAKE_PRG "$(MAKE)") +endif() +if(MINGW AND CMAKE_GENERATOR MATCHES "Ninja") + find_program(MAKE_PRG NAMES mingw32-make) + if(NOT MAKE_PRG) + message(FATAL_ERROR "GNU Make for mingw32 is required to build the dependencies.") + else() + message(STATUS "Found GNU Make for mingw32: ${MAKE_PRG}") + endif() +endif() + +# DEPS_C_COMPILER +set(DEPS_C_COMPILER "${CMAKE_C_COMPILER}") +if(CMAKE_OSX_SYSROOT) + set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}") +endif() +if(CMAKE_OSX_ARCHITECTURES) + foreach(ARCH IN LISTS CMAKE_OSX_ARCHITECTURES) + set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -arch ${ARCH}") + endforeach() +endif() diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 1dcb6fb373..e1a0c8d6c3 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -63,7 +63,7 @@ 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. -set(ENV{DEPS_PREFIX} ${DEPS_PREFIX}) # used by test/busted_runner.lua on windows +set(ENV{DEPS_INSTALL_DIR} ${DEPS_INSTALL_DIR}) # used by test/busted_runner.lua execute_process( COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} -- cgit From 199a990c9e4e36f72ddcd041af28185f2ee4b4d6 Mon Sep 17 00:00:00 2001 From: treatybreaker Date: Sun, 11 Jun 2023 16:57:23 -0500 Subject: feat: report "build" in vim.version() #23925 Problem: Nvim version string typically has a "build" component but vim.version() doesn't report it. Solution: Add the "build" field to vim.version(). Closes #23863 --- cmake/GenerateVersion.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/GenerateVersion.cmake b/cmake/GenerateVersion.cmake index ab046e93ba..0758dad8ad 100644 --- a/cmake/GenerateVersion.cmake +++ b/cmake/GenerateVersion.cmake @@ -14,6 +14,9 @@ if(RES) return() endif() +# Extract build info: "v0.9.0-145-g0f9113907" => "g0f9113907" +string(REGEX REPLACE ".*\\-" "" NVIM_VERSION_BUILD "${GIT_TAG}") + # `git describe` annotates the most recent tagged release; for pre-release # builds we append that to the dev version. if(NVIM_VERSION_PRERELEASE) @@ -24,7 +27,7 @@ if(NVIM_VERSION_PRERELEASE) set(NVIM_VERSION "${NVIM_VERSION}-${NVIM_VERSION_GIT}") endif() -set(NVIM_VERSION_STRING "#define NVIM_VERSION_MEDIUM \"${NVIM_VERSION}\"\n") +set(NVIM_VERSION_STRING "#define NVIM_VERSION_MEDIUM \"${NVIM_VERSION}\"\n#define NVIM_VERSION_BUILD \"${NVIM_VERSION_BUILD}\"\n") string(SHA1 CURRENT_VERSION_HASH "${NVIM_VERSION_STRING}") if(EXISTS ${OUTPUT}) -- cgit From 46e95909bf898bd295f8009b15a88719733de906 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 24 Jun 2023 00:29:53 +0200 Subject: ci: introduce CI_LINT option This will abort if lint programs are not found, and is meant primarily for the lint job in CI. Supersedes the REQUIRED argument in add_glob_target as it's a superior replacement by being a built-in solution. --- cmake/Util.cmake | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'cmake') diff --git a/cmake/Util.cmake b/cmake/Util.cmake index b70f33a302..0d6fa2a4ce 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -4,7 +4,6 @@ # depends on the value of TOUCH_STRATEGY. # # Options: -# REQUIRED - Abort if COMMAND doesn't exist. # # Single value arguments: # TARGET - Name of the target @@ -53,7 +52,7 @@ # files. function(add_glob_target) cmake_parse_arguments(ARG - "REQUIRED" + "" "TARGET;COMMAND;GLOB_PAT;TOUCH_STRATEGY" "FLAGS;FILES;GLOB_DIRS;EXCLUDE" ${ARGN} @@ -61,14 +60,8 @@ function(add_glob_target) if(NOT ARG_COMMAND) add_custom_target(${ARG_TARGET}) - if(ARG_REQUIRED) - add_custom_command(TARGET ${ARG_TARGET} - COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET}: ${ARG_COMMAND} not found" - COMMAND false) - else() - add_custom_command(TARGET ${ARG_TARGET} - COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found") - endif() + add_custom_command(TARGET ${ARG_TARGET} + COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found") return() endif() -- cgit From 43ded8d3584477ab14731486cfb0e86534f2b2dc Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 1 Jul 2023 03:45:45 -0700 Subject: feat(version): unverbose ":version", ":verbose version" #24195 Problem: `nvim -v` and `:version` prints system vimrc, fallback files, and compilation info by default, which most people don't care about and just clutters up the output. Solution: Omit extra info unless 'verbose' is set. --- cmake/RunTests.cmake | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index e1a0c8d6c3..5e83b72235 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -66,6 +66,8 @@ set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. set(ENV{DEPS_INSTALL_DIR} ${DEPS_INSTALL_DIR}) # used by test/busted_runner.lua execute_process( + # Note: because of "-ll" (low-level interpreter mode), some modules like + # _editor.lua are not loaded. COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lpath=${BUILD_DIR}/?.lua -- cgit From f30844008bdd313b03a19486159f571a067e68b9 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 3 Sep 2023 00:38:10 +0200 Subject: build: download busted from own neovim/deps repository Downloading the necessary files all at once instead of doing dependency handling with luarocks speeds up installation immensely. We speed up the process even more by using luv as a replacement for the C modules in the busted dependencies, which allows us to skip costly compilation times. Co-authored-by: bfredl --- cmake/BuildLuarocks.cmake | 5 ----- cmake/Deps.cmake | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'cmake') diff --git a/cmake/BuildLuarocks.cmake b/cmake/BuildLuarocks.cmake index c5e08d2d74..2dc493a59b 100644 --- a/cmake/BuildLuarocks.cmake +++ b/cmake/BuildLuarocks.cmake @@ -89,10 +89,8 @@ function(Download ROCK VER) endfunction() if(WIN32) - set(BUSTED_EXE "${DEPS_BIN_DIR}/busted.bat") set(LUACHECK_EXE "${DEPS_BIN_DIR}/luacheck.bat") else() - set(BUSTED_EXE "${DEPS_BIN_DIR}/busted") set(LUACHECK_EXE "${DEPS_BIN_DIR}/luacheck") endif() @@ -100,9 +98,6 @@ add_custom_target(test_deps) Download(luacheck 1.1.0-1 ${LUACHECK_EXE}) -Download(busted 2.1.1 ${BUSTED_EXE}) -add_dependencies(test_deps busted) - if(PREFER_LUA) Download(coxpcall 1.17.0-1) add_dependencies(test_deps coxpcall) diff --git a/cmake/Deps.cmake b/cmake/Deps.cmake index 69a950eb0d..e8dcbaa79d 100644 --- a/cmake/Deps.cmake +++ b/cmake/Deps.cmake @@ -1,6 +1,7 @@ set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr") set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin") set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib") +set(DEPS_SHARE_DIR "${DEPS_INSTALL_DIR}/share/lua/5.1") set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build") set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads") -- cgit From c50951a4d0cf480aa138a2ed2bd2deedebeb0dec Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Mon, 4 Sep 2023 00:00:26 +0200 Subject: build: various fixes - simplify lua interpreter search - fix incorrect variable name in BuildLua.cmake - build PUC Lua with -O2 - silence non-mandatory find_package search for libuv - simplify Find modules - Prefer using the explicitly set CI_BUILD over relying on the environment variable "CI". --- cmake/FindLpeg.cmake | 9 +-------- cmake/FindLuajit.cmake | 2 +- cmake/FindLuv.cmake | 12 ++---------- cmake/GenerateVersion.cmake | 1 - cmake/WindowsDllCopy.cmake | 2 +- 5 files changed, 5 insertions(+), 21 deletions(-) (limited to 'cmake') diff --git a/cmake/FindLpeg.cmake b/cmake/FindLpeg.cmake index 4354f815b5..43c839da9a 100644 --- a/cmake/FindLpeg.cmake +++ b/cmake/FindLpeg.cmake @@ -1,11 +1,4 @@ -find_library(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a) - -# Ubuntu-specific workaround to find system paths -function(ubuntu) - set(CMAKE_FIND_LIBRARY_PREFIXES "") - find_library(LPEG_LIBRARY NAMES lpeg PATH_SUFFIXES lua/5.1) -endfunction() -ubuntu() +find_library(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a lpeg${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) find_package_handle_standard_args(Lpeg DEFAULT_MSG LPEG_LIBRARY) mark_as_advanced(LPEG_LIBRARY) diff --git a/cmake/FindLuajit.cmake b/cmake/FindLuajit.cmake index 711c2c0c09..f06b7ca6ad 100644 --- a/cmake/FindLuajit.cmake +++ b/cmake/FindLuajit.cmake @@ -1,5 +1,5 @@ find_path(LUAJIT_INCLUDE_DIR luajit.h - PATH_SUFFIXES luajit-2.0 luajit-2.1) + PATH_SUFFIXES luajit-2.1) if(MSVC) list(APPEND LUAJIT_NAMES lua51) diff --git a/cmake/FindLuv.cmake b/cmake/FindLuv.cmake index ebd74887ed..7544859ceb 100644 --- a/cmake/FindLuv.cmake +++ b/cmake/FindLuv.cmake @@ -1,13 +1,5 @@ -find_path(LUV_INCLUDE_DIR luv/luv.h) -find_library(LUV_LIBRARY NAMES luv_a luv libluv_a) - -# Ubuntu-specific workaround to find system paths -function(ubuntu) - set(CMAKE_FIND_LIBRARY_PREFIXES "") - find_path(LUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) - find_library(LUV_LIBRARY NAMES luv PATH_SUFFIXES lua/5.1) -endfunction() -ubuntu() +find_path(LUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) +find_library(LUV_LIBRARY NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) find_package_handle_standard_args(Luv DEFAULT_MSG LUV_LIBRARY LUV_INCLUDE_DIR) diff --git a/cmake/GenerateVersion.cmake b/cmake/GenerateVersion.cmake index 0758dad8ad..a52dca970f 100644 --- a/cmake/GenerateVersion.cmake +++ b/cmake/GenerateVersion.cmake @@ -7,7 +7,6 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET RESULT_VARIABLE RES) - if(RES) message(STATUS "Using NVIM_VERSION: ${NVIM_VERSION}") file(WRITE "${OUTPUT}" "") diff --git a/cmake/WindowsDllCopy.cmake b/cmake/WindowsDllCopy.cmake index b51e66e5cc..c972d88f57 100644 --- a/cmake/WindowsDllCopy.cmake +++ b/cmake/WindowsDllCopy.cmake @@ -23,7 +23,7 @@ foreach(DLL_NAME ${DLLS}) message(FATAL_ERROR "Unable to find dependency ${DLL_NAME}") endif() - if($ENV{CI} MATCHES "true") + if(CI_BUILD) message("Copying ${DLL_NAME} to ${DST}") endif() execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${DLL_PATH} ${DST}) -- cgit From 6985e12caef4c0d55c895980e423cb188c3fc5c8 Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 5 Sep 2023 11:49:08 +0200 Subject: refactor(build): derocksify luacheck --- cmake/RunTests.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 5e83b72235..d470793a27 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -63,12 +63,11 @@ 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. -set(ENV{DEPS_INSTALL_DIR} ${DEPS_INSTALL_DIR}) # used by test/busted_runner.lua execute_process( # Note: because of "-ll" (low-level interpreter mode), some modules like # _editor.lua are not loaded. - COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} + COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/lua_runner.lua ${DEPS_INSTALL_DIR} busted -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 -- cgit From 87db6d894ad252edf69cd3382704c60d3115b51e Mon Sep 17 00:00:00 2001 From: Sergey Slipchenko Date: Thu, 31 Aug 2023 09:13:58 +0400 Subject: fix(deps): make sure --force-config takes effect Fixes #24881 --force-config passed to luarocks' configure script is only taken into account in case "make install" is used afterwards. But if "make bootstrap" is used then this flag has no effect. And it can actually copy an existing config on the system to the new installation. That existing config can have a different version of Lua set by default. In which case luarocks will install packages for that version instead of the one used in tests. And trying to run tests then will fail because of missing packages. --- cmake/BuildLuarocks.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/BuildLuarocks.cmake b/cmake/BuildLuarocks.cmake index 2dc493a59b..57d2666d36 100644 --- a/cmake/BuildLuarocks.cmake +++ b/cmake/BuildLuarocks.cmake @@ -31,7 +31,7 @@ if(UNIX) set(LUAROCKS_CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure --prefix=${DEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS}) - set(LUAROCKS_INSTALL_COMMAND ${MAKE_PRG} -j1 bootstrap) + set(LUAROCKS_INSTALL_COMMAND ${MAKE_PRG} -j1 install) elseif(MSVC OR MINGW) if(MINGW) set(COMPILER_FLAG /MW) -- cgit From 25e51d393a420765d5efd44c1b4be823a5cf280a Mon Sep 17 00:00:00 2001 From: bfredl Date: Sat, 9 Sep 2023 23:45:06 +0200 Subject: build(lua): vendor coxpcall Do not require luarocks on PUC lua CI just because of this single lua file --- cmake/BuildLuarocks.cmake | 5 ----- 1 file changed, 5 deletions(-) (limited to 'cmake') diff --git a/cmake/BuildLuarocks.cmake b/cmake/BuildLuarocks.cmake index 57d2666d36..0ab4143b75 100644 --- a/cmake/BuildLuarocks.cmake +++ b/cmake/BuildLuarocks.cmake @@ -97,8 +97,3 @@ endif() add_custom_target(test_deps) Download(luacheck 1.1.0-1 ${LUACHECK_EXE}) - -if(PREFER_LUA) - Download(coxpcall 1.17.0-1) - add_dependencies(test_deps coxpcall) -endif() -- cgit From 9f8f287c6139b8b8ff2809f4d1aebb57021cd043 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 9 Sep 2023 18:14:52 +0200 Subject: build: remove luarocks Luarocks is no longer needed after 25e51d393a420765d5efd44c1b4be823a5cf280a. --- cmake/BuildLuarocks.cmake | 99 ----------------------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 cmake/BuildLuarocks.cmake (limited to 'cmake') diff --git a/cmake/BuildLuarocks.cmake b/cmake/BuildLuarocks.cmake deleted file mode 100644 index 0ab4143b75..0000000000 --- a/cmake/BuildLuarocks.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# Luarocks recipe. Luarocks is only required when testing Neovim. -# NOTE: LuaRocks rocks need to "DEPENDS" on the previous module, because -# running luarocks in parallel will break, e.g. when some rocks have -# the same dependency. - -# The luarocks binary location -set(LUAROCKS_BINARY ${DEPS_BIN_DIR}/luarocks) - -# Arguments for calls to 'luarocks build' -if(NOT MSVC) - # In MSVC don't pass the compiler/linker to luarocks, the bundled - # version already knows, and passing them here breaks the build - set(LUAROCKS_BUILDARGS CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}) -endif() - -if(UNIX) - if(PREFER_LUA) - find_package(Lua 5.1 EXACT REQUIRED) - get_filename_component(LUA_ROOT ${LUA_INCLUDE_DIR} DIRECTORY) - list(APPEND LUAROCKS_OPTS - --with-lua=${LUA_ROOT}) - else() - find_package(Luajit REQUIRED) - get_filename_component(LUA_ROOT ${LUAJIT_INCLUDE_DIR} DIRECTORY) - get_filename_component(LUA_ROOT ${LUA_ROOT} DIRECTORY) - list(APPEND LUAROCKS_OPTS - --with-lua=${LUA_ROOT} - --with-lua-include=${LUAJIT_INCLUDE_DIR} - --with-lua-interpreter=luajit) - endif() - - set(LUAROCKS_CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure - --prefix=${DEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS}) - set(LUAROCKS_INSTALL_COMMAND ${MAKE_PRG} -j1 install) -elseif(MSVC OR MINGW) - if(MINGW) - set(COMPILER_FLAG /MW) - elseif(MSVC) - set(COMPILER_FLAG /MSVC) - endif() - - find_package(Luajit REQUIRED) - # Always assume bundled luajit for native Win32 - set(LUAROCKS_INSTALL_COMMAND install.bat /FORCECONFIG /NOREG /NOADMIN /Q /F - /LUA ${DEPS_PREFIX} - /INC ${LUAJIT_INCLUDE_DIR} - /P ${DEPS_INSTALL_DIR}/luarocks - /TREE ${DEPS_INSTALL_DIR} - /SCRIPTS ${DEPS_BIN_DIR} - ${COMPILER_FLAG}) - - set(LUAROCKS_BINARY ${DEPS_INSTALL_DIR}/luarocks/luarocks.bat) -else() - message(FATAL_ERROR "Trying to build luarocks in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}") -endif() - -ExternalProject_Add(luarocks - URL https://github.com/luarocks/luarocks/archive/v3.9.2.tar.gz - URL_HASH SHA256=a0b36cd68586cd79966d0106bb2e5a4f5523327867995fd66bee4237062b3e3b - DOWNLOAD_NO_PROGRESS TRUE - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luarocks - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND "${LUAROCKS_CONFIGURE_COMMAND}" - BUILD_COMMAND "" - INSTALL_COMMAND "${LUAROCKS_INSTALL_COMMAND}" - EXCLUDE_FROM_ALL TRUE) - -set(ROCKS_DIR ${DEPS_LIB_DIR}/luarocks/rocks) - -if(MSVC) - # Workaround for luarocks failing to find the md5sum.exe it is shipped with. - list(APPEND LUAROCKS_BUILDARGS MD5SUM=md5sum) - set(PATH PATH=${DEPS_INSTALL_DIR}/luarocks/tools;$ENV{PATH}) -endif() - -set(CURRENT_DEP luarocks) - -function(Download ROCK VER) - if(ARGV2) - set(OUTPUT ${ARGV2}) - else() - set(OUTPUT ${ROCKS_DIR}/${ROCK}) - endif() - add_custom_command(OUTPUT ${OUTPUT} - COMMAND ${CMAKE_COMMAND} -E env "${PATH}" ${LUAROCKS_BINARY} build ${ROCK} ${VER} ${LUAROCKS_BUILDARGS} - DEPENDS ${CURRENT_DEP}) - add_custom_target(${ROCK} DEPENDS ${OUTPUT}) - set(CURRENT_DEP ${ROCK} PARENT_SCOPE) -endfunction() - -if(WIN32) - set(LUACHECK_EXE "${DEPS_BIN_DIR}/luacheck.bat") -else() - set(LUACHECK_EXE "${DEPS_BIN_DIR}/luacheck") -endif() - -add_custom_target(test_deps) - -Download(luacheck 1.1.0-1 ${LUACHECK_EXE}) -- cgit From f859d16aea0d58e572edc9aaf1de3542569e10a9 Mon Sep 17 00:00:00 2001 From: Sergey Slipchenko Date: Mon, 11 Sep 2023 21:01:00 +0400 Subject: fix(tests): set SHELL=sh #24941 Problem: Some tests fail with $SHELL=fish #6172 Related: https://github.com/neovim/neovim/pull/6176 Solution: Replace "echo -n" with "printf", because "echo" in sh may be provided as a shell builtin, which does not accept an "-n" flag to avoid a trailing newline (e.g. on macos). "printf" is more portable (defined by POSIX) and it does not output a trailing newline by itself. Fixes #6172 TODO: Other test failures may be related to "session leader" issue: https://github.com/neovim/neovim/issues/2354 Checked by running `:terminal ./build/bin/tty-test` from Nvim with `shell=/bin/fish` (inherited from `$SHELL`) and it indeed complains about "process does not own the terminal". With `shell=sh` it doesn't complain. And unsetting `$SHELL` seems to make `nvim` to fall back to `shell=sh`. FAILED test/functional/terminal/tui_spec.lua @ 1017: TUI paste: terminal mode test/functional/terminal/tui_spec.lua:1024: Row 1 did not match. Expected: |*tty ready | |*{1: } | |* | | | |{5:^^^^^^^ }| |{3:-- TERMINAL --} | |{3:-- TERMINAL --} | Actual: |*process does not own the terminal | |* | |*[Process exited 2]{1: } | | | |{5:^^^^^^^ }| |{3:-- TERMINAL --} | |{3:-- TERMINAL --} | To print the expect() call that would assert the current screen state, use screen:snapshot_util(). In case of non-deterministic failures, use screen:redraw_debug() to show all intermediate screen states. stack traceback: test/functional/ui/screen.lua:622: in function '_wait' test/functional/ui/screen.lua:352: in function 'expect' test/functional/terminal/tui_spec.lua:1024: in function FAILED test/functional/terminal/tui_spec.lua @ 1551: TUI forwards :term palette colors with termguicolors test/functional/terminal/tui_spec.lua:1567: Row 1 did not match. Expected: |*{1:t}ty ready | | | |* | | | |{2:^^^^^^^ }| | | |{3:-- TERMINAL --} | Actual: |*{1:p}rocess does not own the terminal | | | |*[Process exited 2] | | | |{2:^^^^^^^ }| | | |{3:-- TERMINAL --} | To print the expect() call that would assert the current screen state, use screen:snapshot_util(). In case of non-deterministic failures, use screen:redraw_debug() to show all intermediate screen states. stack traceback: test/functional/ui/screen.lua:622: in function '_wait' test/functional/ui/screen.lua:352: in function 'expect' test/functional/terminal/tui_spec.lua:1567: in function --- cmake/RunTests.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index d470793a27..8d5b0d2402 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -64,6 +64,11 @@ endif() set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. +if(NOT WIN32) + # Tests assume POSIX "sh" and may fail if SHELL=fish. #24941 #6172 + set(ENV{SHELL} sh) +endif() + execute_process( # Note: because of "-ll" (low-level interpreter mode), some modules like # _editor.lua are not loaded. -- cgit From b80a8e2c16b6d6eb16ac84232c27eb7cfa4a434a Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 10 Oct 2023 23:18:45 +0200 Subject: build: adjust how find order is prioritized Ensure bundled libraries and include directories are always searched first before any others. This will provide a more consistent experience as the search order of the builtin find_ functions can vary depending on system. This should make the build process faster when building with bundled deps as we limit the search to only the .deps directory. Separating the search between .deps and everything makes debugging find_-related problems simpler if you need to check how dependencies are found. For libraries, we divide the search process into the following order: 1. Only search in .deps directory and only search for static libraries. 2. Only search in .deps directory and search for all libraries. 3. Search everywhere and search for all libraries. Make an exception for FindLibintl.cmake as changing the search order seems to break some tests on macos. --- cmake/Find.cmake | 39 +++++++++++++++++++++++++++++++++++++++ cmake/FindIconv.cmake | 4 ++-- cmake/FindLibtermkey.cmake | 4 ++-- cmake/FindLibuv.cmake | 4 ++-- cmake/FindLibvterm.cmake | 4 ++-- cmake/FindLpeg.cmake | 2 +- cmake/FindLuajit.cmake | 4 ++-- cmake/FindLuv.cmake | 4 ++-- cmake/FindMsgpack.cmake | 4 ++-- cmake/FindTreesitter.cmake | 4 ++-- cmake/FindUnibilium.cmake | 4 ++-- 11 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 cmake/Find.cmake (limited to 'cmake') diff --git a/cmake/Find.cmake b/cmake/Find.cmake new file mode 100644 index 0000000000..b363052510 --- /dev/null +++ b/cmake/Find.cmake @@ -0,0 +1,39 @@ +# Functions to aid the built-in find_ functions + +# Same as find_path, but always search in .deps directory first and then everything else. +function(find_path2) + find_path_nvim(${ARGV}) + find_path(${ARGV}) +endfunction() + +function(find_path_nvim) + set(CMAKE_FIND_FRAMEWORK NEVER) + set(CMAKE_FIND_APPBUNDLE NEVER) + find_path(${ARGV} NO_CMAKE_SYSTEM_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH) +endfunction() + +# Same as find_library, but with the following search order: +# 1. Only search in .deps directory. Only search for static libraries. +# 2. Only search in .deps directory. Search all libraries +# 3. Search everywhere, all libraries +function(find_library2) + find_library_nvim(STATIC ${ARGV}) + find_library_nvim(${ARGV}) + find_library(${ARGV}) +endfunction() + +function(find_library_nvim) + cmake_parse_arguments(ARG + "STATIC" + "" + "" + ${ARGN}) + list(REMOVE_ITEM ARGN STATIC) + + if(ARG_STATIC) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() + set(CMAKE_FIND_FRAMEWORK NEVER) + set(CMAKE_FIND_APPBUNDLE NEVER) + find_library(${ARGN} NO_CMAKE_SYSTEM_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH) +endfunction() diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake index 48c1514ff2..e607c59cf6 100644 --- a/cmake/FindIconv.cmake +++ b/cmake/FindIconv.cmake @@ -1,8 +1,8 @@ # TODO(dundargoc): FindIconv is shipped by default on cmake version 3.11+. This # file can be removed once we decide to upgrade minimum cmake version. -find_path(ICONV_INCLUDE_DIR NAMES iconv.h) -find_library(ICONV_LIBRARY NAMES iconv libiconv) +find_path2(ICONV_INCLUDE_DIR NAMES iconv.h) +find_library2(ICONV_LIBRARY NAMES iconv libiconv) find_package_handle_standard_args(Iconv DEFAULT_MSG ICONV_INCLUDE_DIR) mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY) diff --git a/cmake/FindLibtermkey.cmake b/cmake/FindLibtermkey.cmake index 1fc8ac78f2..8039ae7994 100644 --- a/cmake/FindLibtermkey.cmake +++ b/cmake/FindLibtermkey.cmake @@ -1,5 +1,5 @@ -find_path(LIBTERMKEY_INCLUDE_DIR termkey.h) -find_library(LIBTERMKEY_LIBRARY NAMES termkey) +find_path2(LIBTERMKEY_INCLUDE_DIR termkey.h) +find_library2(LIBTERMKEY_LIBRARY NAMES termkey) find_package_handle_standard_args(Libtermkey DEFAULT_MSG LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR) mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) diff --git a/cmake/FindLibuv.cmake b/cmake/FindLibuv.cmake index fa1d51370f..19315388dd 100644 --- a/cmake/FindLibuv.cmake +++ b/cmake/FindLibuv.cmake @@ -1,5 +1,5 @@ -find_path(LIBUV_INCLUDE_DIR uv.h) -find_library(LIBUV_LIBRARY NAMES uv_a uv) +find_path2(LIBUV_INCLUDE_DIR uv.h) +find_library2(LIBUV_LIBRARY NAMES uv_a uv) set(LIBUV_LIBRARIES ${LIBUV_LIBRARY}) diff --git a/cmake/FindLibvterm.cmake b/cmake/FindLibvterm.cmake index ad2e682b30..f591f6853f 100644 --- a/cmake/FindLibvterm.cmake +++ b/cmake/FindLibvterm.cmake @@ -1,5 +1,5 @@ -find_path(LIBVTERM_INCLUDE_DIR vterm.h) -find_library(LIBVTERM_LIBRARY vterm) +find_path2(LIBVTERM_INCLUDE_DIR vterm.h) +find_library2(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") diff --git a/cmake/FindLpeg.cmake b/cmake/FindLpeg.cmake index 43c839da9a..3d0ff5929d 100644 --- a/cmake/FindLpeg.cmake +++ b/cmake/FindLpeg.cmake @@ -1,4 +1,4 @@ -find_library(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a lpeg${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) +find_library2(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a lpeg${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) find_package_handle_standard_args(Lpeg DEFAULT_MSG LPEG_LIBRARY) mark_as_advanced(LPEG_LIBRARY) diff --git a/cmake/FindLuajit.cmake b/cmake/FindLuajit.cmake index f06b7ca6ad..457ceafdd4 100644 --- a/cmake/FindLuajit.cmake +++ b/cmake/FindLuajit.cmake @@ -1,4 +1,4 @@ -find_path(LUAJIT_INCLUDE_DIR luajit.h +find_path2(LUAJIT_INCLUDE_DIR luajit.h PATH_SUFFIXES luajit-2.1) if(MSVC) @@ -9,7 +9,7 @@ else() list(APPEND LUAJIT_NAMES luajit-5.1) endif() -find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) +find_library2(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}) find_package_handle_standard_args(Luajit DEFAULT_MSG LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) diff --git a/cmake/FindLuv.cmake b/cmake/FindLuv.cmake index 7544859ceb..a4408fe659 100644 --- a/cmake/FindLuv.cmake +++ b/cmake/FindLuv.cmake @@ -1,5 +1,5 @@ -find_path(LUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) -find_library(LUV_LIBRARY NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) +find_path2(LUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1) +find_library2(LUV_LIBRARY NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) find_package_handle_standard_args(Luv DEFAULT_MSG LUV_LIBRARY LUV_INCLUDE_DIR) diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index a2b0174f8d..9ef18122ab 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -1,4 +1,4 @@ -find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h) +find_path2(MSGPACK_INCLUDE_DIR msgpack/version_master.h) if(MSGPACK_INCLUDE_DIR) file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h) @@ -10,7 +10,7 @@ else() set(MSGPACK_VERSION_STRING) endif() -find_library(MSGPACK_LIBRARY NAMES msgpackc msgpack msgpackc_import msgpack-c +find_library2(MSGPACK_LIBRARY NAMES msgpackc msgpack msgpackc_import msgpack-c NAMES_PER_DIR) mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) diff --git a/cmake/FindTreesitter.cmake b/cmake/FindTreesitter.cmake index 23214283c0..8dac13337b 100644 --- a/cmake/FindTreesitter.cmake +++ b/cmake/FindTreesitter.cmake @@ -1,5 +1,5 @@ -find_path(TREESITTER_INCLUDE_DIR tree_sitter/api.h) -find_library(TREESITTER_LIBRARY NAMES tree-sitter) +find_path2(TREESITTER_INCLUDE_DIR tree_sitter/api.h) +find_library2(TREESITTER_LIBRARY NAMES tree-sitter) find_package_handle_standard_args(Treesitter DEFAULT_MSG TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR) mark_as_advanced(TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR) diff --git a/cmake/FindUnibilium.cmake b/cmake/FindUnibilium.cmake index 91906e6660..4f62815793 100644 --- a/cmake/FindUnibilium.cmake +++ b/cmake/FindUnibilium.cmake @@ -1,5 +1,5 @@ -find_path(UNIBILIUM_INCLUDE_DIR unibilium.h) -find_library(UNIBILIUM_LIBRARY unibilium) +find_path2(UNIBILIUM_INCLUDE_DIR unibilium.h) +find_library2(UNIBILIUM_LIBRARY unibilium) find_package_handle_standard_args(Unibilium REQUIRED_VARS UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY) -- cgit From 25cfe3fd432d77689446fe5a0bb972479298387c Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 23 Oct 2023 21:03:15 +0200 Subject: build: enable formatting during rebase Closes https://github.com/neovim/neovim/issues/25654 --- cmake/Format.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/Format.cmake b/cmake/Format.cmake index 7e8ca3547d..7097e5766f 100644 --- a/cmake/Format.cmake +++ b/cmake/Format.cmake @@ -1,15 +1,13 @@ # Returns a list of all files that has been changed in current branch compared # to master branch. This includes unstaged, staged and committed files. function(get_changed_files outvar) - set(default_branch master) - execute_process( COMMAND git branch --show-current OUTPUT_VARIABLE current_branch OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( - COMMAND git merge-base ${default_branch} ${current_branch} + COMMAND git merge-base master HEAD OUTPUT_VARIABLE ancestor_commit OUTPUT_STRIP_TRAILING_WHITESPACE) -- cgit From 7a5effb0f95e295c265fe09e7414d859a6d79657 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 25 Oct 2023 16:54:20 +0200 Subject: build: bump required minimum libvterm version to 0.3.3 Also add detection for libvterm patch version. --- cmake/FindLibvterm.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/FindLibvterm.cmake b/cmake/FindLibvterm.cmake index f591f6853f..68c2646d47 100644 --- a/cmake/FindLibvterm.cmake +++ b/cmake/FindLibvterm.cmake @@ -8,7 +8,16 @@ if(LIBVTERM_INCLUDE_DIR AND EXISTS "${LIBVTERM_INCLUDE_DIR}/vterm.h") 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}) + file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_PATCH REGEX "#define VTERM_VERSION_PATCH") + + # The following is needed to give a coherent error for versions 0.3.2 and + # smaller. + if(VTERM_VERSION_PATCH) + string(REGEX MATCH "[0-9]+" VTERM_VERSION_PATCH ${VTERM_VERSION_PATCH}) + string(PREPEND VTERM_VERSION_PATCH ".") + endif() + + set(VTERM_VERSION ${VTERM_VERSION_MAJOR}.${VTERM_VERSION_MINOR}${VTERM_VERSION_PATCH}) endif() find_package_handle_standard_args(Libvterm -- cgit From 7a80e169c5b128e1aea961e888ca6e9c7b48dd27 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 20 Nov 2023 02:01:39 +0100 Subject: build: disable all compiler warnings from dependencies --- cmake/Deps.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmake') diff --git a/cmake/Deps.cmake b/cmake/Deps.cmake index e8dcbaa79d..6a7fd77aa8 100644 --- a/cmake/Deps.cmake +++ b/cmake/Deps.cmake @@ -18,6 +18,12 @@ if(APPLE) list(APPEND DEPS_CMAKE_ARGS -D CMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK}) endif() +if(MSVC) + list(APPEND DEPS_CMAKE_ARGS -D CMAKE_C_FLAGS="/w") +else() + list(APPEND DEPS_CMAKE_ARGS -D CMAKE_C_FLAGS="-w") +endif() + set(DEPS_CMAKE_CACHE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}) # MAKE_PRG -- cgit From 99b8a343e197cdec53f752e1cce01ae25eb45c12 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 20 Nov 2023 12:42:54 +0100 Subject: fixup: quick update, squash later --- cmake/Deps.cmake | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'cmake') diff --git a/cmake/Deps.cmake b/cmake/Deps.cmake index 6a7fd77aa8..9966e42084 100644 --- a/cmake/Deps.cmake +++ b/cmake/Deps.cmake @@ -18,13 +18,8 @@ if(APPLE) list(APPEND DEPS_CMAKE_ARGS -D CMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK}) endif() -if(MSVC) - list(APPEND DEPS_CMAKE_ARGS -D CMAKE_C_FLAGS="/w") -else() - list(APPEND DEPS_CMAKE_ARGS -D CMAKE_C_FLAGS="-w") -endif() - set(DEPS_CMAKE_CACHE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}) +set(EXTERNALPROJECT_OPTIONS DOWNLOAD_NO_PROGRESS TRUE) # MAKE_PRG if(UNIX) -- cgit From 2c16c6a6c42f46e290df5441c37572f296aeb09f Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Mon, 27 Nov 2023 10:43:13 +0100 Subject: docs: small fixes (#26154) --- cmake/Util.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/Util.cmake b/cmake/Util.cmake index 0d6fa2a4ce..01d34d6752 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -162,8 +162,8 @@ endfunction() # cmake -B build # cmake --build build --config Release # -# Passing CMAKE_BUILD_TYPE for multi-config generators will now not only -# not be used, but also generate a warning for the user. +# Passing CMAKE_BUILD_TYPE for multi-config generators will not only not be +# used, but also generate a warning for the user. function(set_default_buildtype) set(allowableBuildTypes Debug Release MinSizeRel RelWithDebInfo) -- cgit