mirror of
https://github.com/neovim/neovim
synced 2025-07-15 08:41:47 +00:00
fix(tests): use correct include path for unittest
Copy whatever was made to work for generated headers: (1) we need to consider all cmake targets not just main_lib (2) we need to add the sysroot for macOS
This commit is contained in:
@ -408,6 +408,7 @@ pub fn test_config(b: *std.Build, gen_dir: LazyPath) ![]u8 {
|
||||
\\local M = {{}}
|
||||
\\
|
||||
\\M.include_paths = {{}}
|
||||
\\M.apple_sysroot = ""
|
||||
\\M.translations_enabled = "$ENABLE_TRANSLATIONS" == "ON"
|
||||
\\M.is_asan = "$ENABLE_ASAN_UBSAN" == "ON"
|
||||
\\M.is_zig_build = true
|
||||
|
@ -481,11 +481,13 @@ foreach(target ${targets})
|
||||
message(STATUS "${target} props '${prop}'")
|
||||
foreach(gen_include ${prop})
|
||||
list(APPEND gen_cflags "-I${gen_include}")
|
||||
list(APPEND TEST_INCLUDE_DIRS "${gen_include}")
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES gen_cflags)
|
||||
list(REMOVE_DUPLICATES TEST_INCLUDE_DIRS)
|
||||
|
||||
if(APPLE AND CMAKE_OSX_SYSROOT)
|
||||
list(APPEND gen_cflags "-isysroot" "${CMAKE_OSX_SYSROOT}")
|
||||
|
@ -1,6 +1,6 @@
|
||||
add_subdirectory(functional/fixtures) # compile test programs
|
||||
|
||||
get_target_property(TEST_INCLUDE_DIRS main_lib INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_directory_property(TEST_INCLUDE_DIRS DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEFINITION TEST_INCLUDE_DIRS)
|
||||
|
||||
set(TEST_OPTIONS
|
||||
-D BUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
|
@ -4,6 +4,7 @@ M.include_paths = {}
|
||||
for p in ("${TEST_INCLUDE_DIRS}" .. ";"):gmatch("[^;]+") do
|
||||
table.insert(M.include_paths, p)
|
||||
end
|
||||
M.apple_sysroot = "${CMAKE_OSX_SYSROOT}"
|
||||
|
||||
M.translations_enabled = "${ENABLE_TRANSLATIONS}" == "ON"
|
||||
M.is_asan = "${ENABLE_ASAN_UBSAN}" == "ON"
|
||||
|
@ -146,13 +146,20 @@ end
|
||||
|
||||
--- @param ... string
|
||||
function Gcc:add_to_include_path(...)
|
||||
local ef = self.preprocessor_extra_flags
|
||||
for i = 1, select('#', ...) do
|
||||
local path = select(i, ...)
|
||||
local ef = self.preprocessor_extra_flags
|
||||
ef[#ef + 1] = '-I' .. path
|
||||
end
|
||||
end
|
||||
|
||||
function Gcc:add_apple_sysroot(sysroot)
|
||||
local ef = self.preprocessor_extra_flags
|
||||
|
||||
table.insert(ef, '-isysroot')
|
||||
table.insert(ef, sysroot)
|
||||
end
|
||||
|
||||
-- returns a list of the headers files upon which this file relies
|
||||
--- @param hdr string
|
||||
--- @return string[]?
|
||||
@ -278,4 +285,9 @@ function M.add_to_include_path(...)
|
||||
return cc:add_to_include_path(...)
|
||||
end
|
||||
|
||||
--- @param ... string
|
||||
function M.add_apple_sysroot(...)
|
||||
return cc:add_apple_sysroot(...)
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -19,6 +19,11 @@ for _, p in ipairs(paths.include_paths) do
|
||||
Preprocess.add_to_include_path(p)
|
||||
end
|
||||
|
||||
-- add some nonstandard header locations
|
||||
if paths.apple_sysroot ~= '' then
|
||||
Preprocess.add_apple_sysroot(paths.apple_sysroot)
|
||||
end
|
||||
|
||||
local child_pid = nil --- @type integer?
|
||||
--- @generic F: function
|
||||
--- @param func F
|
||||
|
Reference in New Issue
Block a user