Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
5b8bb8e7
Commit
5b8bb8e7
authored
Dec 07, 2010
by
Peter Drahos
Committed by
Vicent Marti
Dec 12, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor modifications for MinGW/Cygwin compatibility.
parent
64840082
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
CMakeLists.txt
+19
-6
tests/test_main.c
+2
-2
No files found.
CMakeLists.txt
View file @
5b8bb8e7
...
...
@@ -16,7 +16,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Find required dependencies
FIND_PACKAGE
(
ZLIB REQUIRED
)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
src
)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
${
PTHREAD_INCLUDE_DIR
}
src
)
# Try finding openssl
FIND_PACKAGE
(
OpenSSL
)
...
...
@@ -26,12 +26,17 @@ ELSEIF ()
SET
(
SHA1_TYPE
"builtin"
CACHE STRING
"Which SHA1 implementation to use: builtin, ppc"
)
ENDIF
()
#
Sane defaults and option
s
#
Installation path
s
SET
(
INSTALL_BIN bin CACHE PATH
"Where to install binaries to."
)
SET
(
INSTALL_LIB lib CACHE PATH
"Where to install libraries to."
)
SET
(
INSTALL_INC include/git CACHE PATH
"Where to install headers to."
)
# Build options
OPTION
(
BUILD_SHARED_LIBS
"Build Shared Library (OFF for Static)"
ON
)
OPTION
(
BUILD_TESTS
"Build Tests"
ON
)
OPTION
(
BACKTRACE
"Use GCC backtrace in tests (Not available on Cygwin/MinGW)"
OFF
)
# Build Release by default
IF
(
NOT CMAKE_BUILD_TYPE
)
SET
(
CMAKE_BUILD_TYPE
"Release"
CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
ENDIF
()
...
...
@@ -43,12 +48,20 @@ FILE(GLOB SRC_PLAT src/unix/*.c)
FILE
(
GLOB SRC_H src/git/*.h
)
# On Windows use specific platform sources
IF
(
WIN32
)
ADD_DEFINITIONS
(
WIN32 _DEBUG _LIB
ZLIB_WINAPI
)
IF
(
WIN32
AND NOT CYGWIN
)
ADD_DEFINITIONS
(
-DWIN32 -D_DEBUG -D_LIB -D
ZLIB_WINAPI
)
FILE
(
GLOB SRC_PLAT src/win32/*.c
)
IF
(
MINGW
)
SET
(
PTHREAD_LIBRARY pthread
)
ENDIF
()
ENDIF
()
# When desired build with backtrace
IF
(
BACKTRACE
)
ADD_DEFINITIONS
(
-DBACKTRACE
)
ENDIF
()
# sha1 implementation
#
Specify
sha1 implementation
IF
(
SHA1_TYPE STREQUAL
"ppc"
)
ADD_DEFINITIONS
(
-DPPC_SHA1
)
FILE
(
GLOB SRC_SHA1 src/ppc/*.c
)
...
...
@@ -61,7 +74,7 @@ ENDIF ()
# Compile and link libgit2
ADD_LIBRARY
(
git2
${
SRC
}
${
SRC_PLAT
}
${
SRC_SHA1
}
)
TARGET_LINK_LIBRARIES
(
git2
${
ZLIB_LIBRARY
}
${
LIB_SHA1
}
)
TARGET_LINK_LIBRARIES
(
git2
${
ZLIB_LIBRARY
}
${
LIB_SHA1
}
${
PTHREAD_LIBRARY
}
)
# Install
INSTALL
(
TARGETS git2
...
...
tests/test_main.c
View file @
5b8bb8e7
...
...
@@ -31,7 +31,7 @@
* print backtrace when a test fails;
* GCC only
*/
#ifdef
__GNUC__
#ifdef
BACKTRACE
#include <stdio.h>
#include <execinfo.h>
#include <signal.h>
...
...
@@ -71,7 +71,7 @@ int main(int argc, char **argv)
{
struct
test_def
*
t
;
#ifdef
__GNUC__
#ifdef
BACKTRACE
signal
(
SIGSEGV
,
crash_handler
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment