"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_BINARY_DIR}/cmake.config"
${GENERATED_INCLUDES_DIR})
file(MAKE_DIRECTORY ${TOUCHES_DIR} ${GENERATED_DIR} ${GENERATED_INCLUDES_DIR})
file(GLOB NVIM_SOURCES CONFIGURE_DEPENDS *.c)
file(GLOB NVIM_HEADERS CONFIGURE_DEPENDS *.h)
file(GLOB EXTERNAL_SOURCES CONFIGURE_DEPENDS ../xdiff/*.c ../mpack/*.c ../cjson/*.c ../klib/*.c)
file(GLOB EXTERNAL_HEADERS CONFIGURE_DEPENDS ../xdiff/*.h ../mpack/*.h ../cjson/*.h ../klib/*.h)
file(GLOB NLUA0_SOURCES CONFIGURE_DEPENDS ../mpack/*.c)
if(PREFER_LUA)
# luajit not used, use a vendored copy of the bit module
list(APPEND EXTERNAL_SOURCES ${PROJECT_SOURCE_DIR}/src/bit.c)
list(APPEND NLUA0_SOURCES ${PROJECT_SOURCE_DIR}/src/bit.c)
target_compile_definitions(main_lib INTERFACE NVIM_VENDOR_BIT)
endif()
# Inlined external projects, we don't maintain it. #9306
if(MSVC)
set_source_files_properties(
${EXTERNAL_SOURCES} PROPERTIES COMPILE_OPTIONS "-wd4090;-wd4244;-wd4267")
else()
set_source_files_properties(
${EXTERNAL_SOURCES} PROPERTIES COMPILE_OPTIONS "-Wno-conversion;-Wno-missing-noreturn;-Wno-missing-format-attribute;-Wno-double-promotion;-Wno-strict-prototypes;-Wno-misleading-indentation;-Wno-sign-compare;-Wno-implicit-fallthrough;-Wno-missing-prototypes;-Wno-missing-field-initializers")
endif()
list(APPEND NLUA0_SOURCES ${PROJECT_SOURCE_DIR}/src/nlua0.c)
foreach(subdir
os
api
api/private
msgpack_rpc
tui
tui/termkey
vterm
event
eval
lua
lib
viml
viml/parser
)
file(MAKE_DIRECTORY ${GENERATED_DIR}/${subdir})
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/${subdir})
file(GLOB sources CONFIGURE_DEPENDS ${subdir}/*.c)
file(GLOB headers CONFIGURE_DEPENDS ${subdir}/*.h)
list(APPEND NVIM_SOURCES ${sources})
list(APPEND NVIM_HEADERS ${headers})
endforeach()
# Sort file lists to ensure generated files are created in the same order from
# build to build.
list(SORT NVIM_SOURCES)
list(SORT NVIM_HEADERS)
foreach(sfile ${NVIM_SOURCES})
get_filename_component(f ${sfile} NAME)
if(WIN32 AND ${f} MATCHES "^(pty_proc_unix.c)$")
list(REMOVE_ITEM NVIM_SOURCES ${sfile})
endif()
if(NOT WIN32 AND ${f} MATCHES "^(pty_proc_win.c)$")
list(REMOVE_ITEM NVIM_SOURCES ${sfile})
endif()
if(NOT WIN32 AND ${f} MATCHES "^(pty_conpty_win.c)$")
list(REMOVE_ITEM NVIM_SOURCES ${sfile})
endif()
if(NOT WIN32 AND ${f} MATCHES "^(os_win_console.c)$")
list(REMOVE_ITEM NVIM_SOURCES ${sfile})
endif()
endforeach()
foreach(hfile ${NVIM_HEADERS})
get_filename_component(f ${hfile} NAME)
if(WIN32 AND ${f} MATCHES "^(unix_defs.h)$")
list(REMOVE_ITEM NVIM_HEADERS ${hfile})
endif()
if(WIN32 AND ${f} MATCHES "^(pty_proc_unix.h)$")
list(REMOVE_ITEM NVIM_HEADERS ${hfile})
endif()
if(NOT WIN32 AND ${f} MATCHES "^(win_defs.h)$")
list(REMOVE_ITEM NVIM_HEADERS ${hfile})
endif()
endforeach()
list(APPEND LINT_NVIM_SOURCES ${NVIM_SOURCES} ${NVIM_HEADERS})
# Log level (NVIM_LOG_DEBUG in log.h)
if(CI_BUILD)
# Don't debug log on CI, it gets too verbose in the main build log.
# TODO(bfredl): debug log level also exposes some errors with EXITFREE in ASAN build.
else()
# Minimize logging for release-type builds.
target_compile_definitions(nvim_bin PRIVATE $<$<CONFIG:Debug>:NVIM_LOG_DEBUG>)
endif()
if(ENABLE_ASAN_UBSAN OR ENABLE_MSAN OR ENABLE_TSAN)
target_compile_definitions(main_lib INTERFACE EXITFREE)
endif()
#-------------------------------------------------------------------------------
# Header generation
#-------------------------------------------------------------------------------
get_target_property(prop main_lib INTERFACE_COMPILE_DEFINITIONS)
if(NOT "${prop}" STREQUAL "prop-NOTFOUND")
foreach(gen_cdef ${prop})
if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS")
list(APPEND gen_cflags "-D${gen_cdef}")
endif()
endforeach()
endif()
get_directory_property(targets BUILDSYSTEM_TARGETS)