Commit 17d52304 by Vicent Marti

build: Simplify build structure

This will make libgit2 more suitable for embedding.
parent b2cef77c
...@@ -60,22 +60,20 @@ IF (THREADSAFE) ...@@ -60,22 +60,20 @@ IF (THREADSAFE)
ENDIF() ENDIF()
# Collect sourcefiles # Collect sourcefiles
FILE(GLOB SRC src/*.c src/backends/*.c) FILE(GLOB SRC src/*.c)
FILE(GLOB SRC_ZLIB deps/zlib/*.c) FILE(GLOB SRC_ZLIB deps/zlib/*.c)
FILE(GLOB SRC_SHA1 src/block-sha1/*.c)
FILE(GLOB SRC_PLAT src/unix/*.c)
FILE(GLOB SRC_H include/git2/*.h) FILE(GLOB SRC_H include/git2/*.h)
# On Windows use specific platform sources # On Windows use specific platform sources
IF (WIN32 AND NOT CYGWIN) IF (WIN32 AND NOT CYGWIN)
ADD_DEFINITIONS(-DWIN32 -D_DEBUG -D_LIB) ADD_DEFINITIONS(-DWIN32 -D_DEBUG -D_LIB)
FILE(GLOB SRC_PLAT src/win32/*.c) FILE(GLOB SRC src/*.c src/win32/*.c)
ENDIF () ENDIF ()
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64) ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
# Compile and link libgit2 # Compile and link libgit2
ADD_LIBRARY(git2 ${SRC} ${SRC_PLAT} ${SRC_SHA1} ${SRC_ZLIB}) ADD_LIBRARY(git2 ${SRC} ${SRC_ZLIB})
TARGET_LINK_LIBRARIES(git2 ${CMAKE_THREAD_LIBS_INIT}) TARGET_LINK_LIBRARIES(git2 ${CMAKE_THREAD_LIBS_INIT})
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING}) SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR}) SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR})
...@@ -97,7 +95,7 @@ IF (BUILD_TESTS) ...@@ -97,7 +95,7 @@ IF (BUILD_TESTS)
INCLUDE_DIRECTORIES(tests) INCLUDE_DIRECTORIES(tests)
FILE(GLOB SRC_TEST tests/t??-*.c) FILE(GLOB SRC_TEST tests/t??-*.c)
ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_PLAT} ${SRC_SHA1} ${SRC_TEST} ${SRC_ZLIB}) ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_TEST} ${SRC_ZLIB})
TARGET_LINK_LIBRARIES(libgit2_test ${CMAKE_THREAD_LIBS_INIT}) TARGET_LINK_LIBRARIES(libgit2_test ${CMAKE_THREAD_LIBS_INIT})
ENABLE_TESTING() ENABLE_TESTING()
......
...@@ -28,10 +28,8 @@ ...@@ -28,10 +28,8 @@
#if defined(PPC_SHA1) #if defined(PPC_SHA1)
# include "ppc/sha1.h" # include "ppc/sha1.h"
#elif defined(OPENSSL_SHA1)
# include <openssl/sha.h>
#else #else
# include "block-sha1/sha1.h" # include "sha1.h"
#endif #endif
struct git_hash_ctx { struct git_hash_ctx {
......
#include <git2/common.h>
#ifndef GIT_WIN32
#include "map.h" #include "map.h"
#include <sys/mman.h> #include <sys/mman.h>
#include <errno.h> #include <errno.h>
int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset) int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
{ {
int mprot = 0; int mprot = 0;
...@@ -58,4 +60,5 @@ int git__munmap(git_map *map) ...@@ -58,4 +60,5 @@ int git__munmap(git_map *map)
return GIT_SUCCESS; return GIT_SUCCESS;
} }
#endif
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