Commit 462dbe21 by Edward Thomson Committed by Edward Thomson

xdiff: move xdiff to 'deps'

xdiff is a dependency (from git core) and more properly belongs in the
'deps' directory. Move it there, and add a stub for cmake to resolve
xdiff from the system location in the future. (At present, bundled xdiff
remains hardcoded.)
parent af12fc11
...@@ -36,6 +36,7 @@ option(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON ...@@ -36,6 +36,7 @@ option(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON
option(USE_SHA256 "Enable SHA256. Can be set to HTTPS/Builtin" ON) option(USE_SHA256 "Enable SHA256. Can be set to HTTPS/Builtin" ON)
option(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF) option(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
set(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.") set(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
# set(USE_XDIFF "" CACHE STRING "Specifies the xdiff implementation; either system or builtin.")
set(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.") set(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
option(USE_BUNDLED_ZLIB "Use the bundled version of zlib. Can be set to one of Bundled(ON)/Chromium. The Chromium option requires a x86_64 processor with SSE4.2 and CLMUL" OFF) option(USE_BUNDLED_ZLIB "Use the bundled version of zlib. Can be set to one of Bundled(ON)/Chromium. The Chromium option requires a x86_64 processor with SSE4.2 and CLMUL" OFF)
......
# Optional external dependency: xdiff
if(USE_XDIFF STREQUAL "system")
message(FATAL_ERROR "external/system xdiff is not yet supported")
else()
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/xdiff" "${PROJECT_BINARY_DIR}/deps/xdiff")
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/xdiff")
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS "$<TARGET_OBJECTS:xdiff>")
add_feature_info(xdiff ON "xdiff support (bundled)")
endif()
file(GLOB SRC_XDIFF "*.c" "*.h")
list(SORT SRC_XDIFF)
add_library(xdiff OBJECT ${SRC_XDIFF})
target_include_directories(xdiff SYSTEM PRIVATE
"${PROJECT_SOURCE_DIR}/include"
"${PROJECT_SOURCE_DIR}/src/util"
"${PROJECT_BINARY_DIR}/src/util"
${LIBGIT2_SYSTEM_INCLUDES}
${LIBGIT2_DEPENDENCY_INCLUDES})
# the xdiff dependency is not (yet) warning-free, disable warnings
# as errors for the xdiff sources until we've sorted them out
if(MSVC)
set_source_files_properties(xdiffi.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xemit.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xhistogram.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xmerge.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xutils.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xpatience.c PROPERTIES COMPILE_FLAGS -WX-)
else()
set_source_files_properties(xdiffi.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
set_source_files_properties(xemit.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
set_source_files_properties(xhistogram.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
set_source_files_properties(xutils.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
set_source_files_properties(xpatience.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
endif()
...@@ -41,6 +41,7 @@ include(SelectHTTPSBackend) ...@@ -41,6 +41,7 @@ include(SelectHTTPSBackend)
include(SelectHashes) include(SelectHashes)
include(SelectHTTPParser) include(SelectHTTPParser)
include(SelectRegex) include(SelectRegex)
include(SelectXdiff)
include(SelectSSH) include(SelectSSH)
include(SelectWinHTTP) include(SelectWinHTTP)
include(SelectZlib) include(SelectZlib)
......
...@@ -25,8 +25,7 @@ target_sources(libgit2 PRIVATE ${SRC_H}) ...@@ -25,8 +25,7 @@ target_sources(libgit2 PRIVATE ${SRC_H})
file(GLOB SRC_GIT2 *.c *.h file(GLOB SRC_GIT2 *.c *.h
streams/*.c streams/*.h streams/*.c streams/*.h
transports/*.c transports/*.h transports/*.c transports/*.h)
xdiff/*.c xdiff/*.h)
list(SORT SRC_GIT2) list(SORT SRC_GIT2)
target_sources(libgit2 PRIVATE ${SRC_GIT2}) target_sources(libgit2 PRIVATE ${SRC_GIT2})
...@@ -40,23 +39,6 @@ if(APPLE) ...@@ -40,23 +39,6 @@ if(APPLE)
set_source_files_properties(streams/stransport.c PROPERTIES COMPILE_FLAGS -Wno-deprecated) set_source_files_properties(streams/stransport.c PROPERTIES COMPILE_FLAGS -Wno-deprecated)
endif() endif()
# the xdiff dependency is not (yet) warning-free, disable warnings
# as errors for the xdiff sources until we've sorted them out
if(MSVC)
set_source_files_properties(xdiff/xdiffi.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xdiff/xemit.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xdiff/xhistogram.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xdiff/xmerge.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xdiff/xutils.c PROPERTIES COMPILE_FLAGS -WX-)
set_source_files_properties(xdiff/xpatience.c PROPERTIES COMPILE_FLAGS -WX-)
else()
set_source_files_properties(xdiff/xdiffi.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
set_source_files_properties(xdiff/xemit.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
set_source_files_properties(xdiff/xhistogram.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
set_source_files_properties(xdiff/xutils.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
set_source_files_properties(xdiff/xpatience.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
endif()
ide_split_sources(libgit2) ide_split_sources(libgit2)
list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:util> $<TARGET_OBJECTS:libgit2> ${LIBGIT2_DEPENDENCY_OBJECTS}) list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:util> $<TARGET_OBJECTS:libgit2> ${LIBGIT2_DEPENDENCY_OBJECTS})
list(APPEND LIBGIT2_INCLUDES ${LIBGIT2_DEPENDENCY_INCLUDES}) list(APPEND LIBGIT2_INCLUDES ${LIBGIT2_DEPENDENCY_INCLUDES})
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "commit.h" #include "commit.h"
#include "blob.h" #include "blob.h"
#include "xdiff/xinclude.h"
#include "diff_xdiff.h" #include "diff_xdiff.h"
/* /*
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "common.h" #include "common.h"
#include "diff.h" #include "diff.h"
#include "xdiff/xdiff.h" #include "xdiff.h"
#include "patch_generate.h" #include "patch_generate.h"
/* xdiff cannot cope with large files. these files should not be passed to /* xdiff cannot cope with large files. these files should not be passed to
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "git2/index.h" #include "git2/index.h"
#include "git2/merge.h" #include "git2/merge.h"
#include "xdiff/xdiff.h"
/* only examine the first 8000 bytes for binaryness. /* only examine the first 8000 bytes for binaryness.
* https://github.com/git/git/blob/77bd3ea9f54f1584147b594abc04c26ca516d987/xdiff-interface.c#L197 * https://github.com/git/git/blob/77bd3ea9f54f1584147b594abc04c26ca516d987/xdiff-interface.c#L197
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment