blob: ee35eb9610e4379338f7f9672b47b239fb0dd9df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# util: a shared library for common utility functions for libgit2 projects
add_library(util OBJECT)
set_target_properties(util PROPERTIES C_STANDARD 90)
set_target_properties(util PROPERTIES C_EXTENSIONS OFF)
configure_file(git2_features.h.in git2_features.h)
set(UTIL_INCLUDES
"${PROJECT_BINARY_DIR}/src/util"
"${PROJECT_BINARY_DIR}/include"
"${PROJECT_SOURCE_DIR}/src/util"
"${PROJECT_SOURCE_DIR}/include")
file(GLOB UTIL_SRC *.c *.h allocators/*.c allocators/*.h hash.h)
list(SORT UTIL_SRC)
#
# Platform specific sources
#
if(WIN32 AND NOT CYGWIN)
file(GLOB UTIL_SRC_OS win32/*.c win32/*.h)
list(SORT UTIL_SRC_OS)
elseif(NOT AMIGA)
file(GLOB UTIL_SRC_OS unix/*.c unix/*.h)
list(SORT UTIL_SRC_OS)
endif()
#
# Hash backend selection
#
if(USE_SHA1 STREQUAL "CollisionDetection")
file(GLOB UTIL_SRC_SHA1 hash/collisiondetect.* hash/sha1dc/*)
target_compile_definitions(util PRIVATE SHA1DC_NO_STANDARD_INCLUDES=1)
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\")
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\")
elseif(USE_SHA1 STREQUAL "OpenSSL" OR USE_SHA1 STREQUAL "OpenSSL-Dynamic")
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
file(GLOB UTIL_SRC_SHA1 hash/openssl.*)
elseif(USE_SHA1 STREQUAL "CommonCrypto")
file(GLOB UTIL_SRC_SHA1 hash/common_crypto.*)
elseif(USE_SHA1 STREQUAL "mbedTLS")
file(GLOB UTIL_SRC_SHA1 hash/mbedtls.*)
elseif(USE_SHA1 STREQUAL "Win32")
file(GLOB UTIL_SRC_SHA1 hash/win32.*)
else()
message(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
endif()
list(SORT UTIL_SRC_SHA1)
if(USE_SHA256 STREQUAL "Builtin")
file(GLOB UTIL_SRC_SHA256 hash/builtin.* hash/rfc6234/*)
elseif(USE_SHA256 STREQUAL "OpenSSL" OR USE_SHA256 STREQUAL "OpenSSL-Dynamic")
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
file(GLOB UTIL_SRC_SHA256 hash/openssl.*)
elseif(USE_SHA256 STREQUAL "CommonCrypto")
file(GLOB UTIL_SRC_SHA256 hash/common_crypto.*)
elseif(USE_SHA256 STREQUAL "mbedTLS")
file(GLOB UTIL_SRC_SHA256 hash/mbedtls.*)
elseif(USE_SHA256 STREQUAL "Win32")
file(GLOB UTIL_SRC_SHA256 hash/win32.*)
else()
message(FATAL_ERROR "Asked for unknown SHA256 backend: ${USE_SHA256}")
endif()
list(SORT UTIL_SRC_SHA256)
#
# Build the library
#
target_sources(util PRIVATE ${UTIL_SRC} ${UTIL_SRC_OS} ${UTIL_SRC_SHA1} ${UTIL_SRC_SHA256})
ide_split_sources(util)
target_include_directories(util PRIVATE ${UTIL_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES} PUBLIC ${libgit2_SOURCE_DIR}/include)
target_include_directories(util SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
|