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
c7c5f2c4
Commit
c7c5f2c4
authored
Sep 28, 2017
by
Carlos Martín Nieto
Committed by
GitHub
Sep 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4339 from pks-t/pks/static-linking
Static linking for bundled deps
parents
524c1d3c
366f4136
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
28 deletions
+24
-28
.travis.yml
+0
-4
CMakeLists.txt
+1
-1
deps/http-parser/CMakeLists.txt
+1
-1
deps/regex/CMakeLists.txt
+1
-1
deps/zlib/CMakeLists.txt
+1
-1
src/CMakeLists.txt
+16
-18
tests/CMakeLists.txt
+4
-2
No files found.
.travis.yml
View file @
c7c5f2c4
...
...
@@ -31,10 +31,6 @@ matrix:
compiler
:
gcc
include
:
-
compiler
:
gcc
env
:
PRECISE=1
os
:
linux
dist
:
precise
-
compiler
:
gcc
env
:
COVERITY=1
os
:
linux
dist
:
trusty
...
...
CMakeLists.txt
View file @
c7c5f2c4
...
...
@@ -12,7 +12,7 @@
# > cmake --build . --target install
PROJECT
(
libgit2 C
)
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
.11
)
CMAKE_POLICY
(
SET CMP0015 NEW
)
IF
(
CMAKE_VERSION VERSION_GREATER 3.0
)
CMAKE_POLICY
(
SET CMP0051 NEW
)
...
...
deps/http-parser/CMakeLists.txt
View file @
c7c5f2c4
FILE
(
GLOB SRC_HTTP
"*.c"
"*.h"
)
ADD_LIBRARY
(
http-parser
STATIC
${
SRC_HTTP
}
)
ADD_LIBRARY
(
http-parser
OBJECT
${
SRC_HTTP
}
)
deps/regex/CMakeLists.txt
View file @
c7c5f2c4
INCLUDE_DIRECTORIES
(
"."
)
ADD_LIBRARY
(
regex
STATIC
"regex.c"
"regex.h"
)
ADD_LIBRARY
(
regex
OBJECT
"regex.c"
"regex.h"
)
deps/zlib/CMakeLists.txt
View file @
c7c5f2c4
ADD_DEFINITIONS
(
-DNO_VIZ -DSTDC -DNO_GZIP
)
FILE
(
GLOB SRC_ZLIB
"*.c"
"*.h"
)
INCLUDE_DIRECTORIES
(
"."
)
ADD_LIBRARY
(
zlib
STATIC
${
SRC_ZLIB
}
)
ADD_LIBRARY
(
zlib
OBJECT
${
SRC_ZLIB
}
)
src/CMakeLists.txt
View file @
c7c5f2c4
...
...
@@ -2,6 +2,8 @@ IF(DEBUG_POOL)
SET
(
GIT_DEBUG_POOL 1
)
ENDIF
()
SET
(
LIBGIT2_OBJECTS
""
)
# This variable will contain the libraries we need to put into
# libgit2.pc's Requires.private. That is, what we're linking to or
# what someone who's statically linking us needs to link to.
...
...
@@ -181,7 +183,7 @@ ENDIF()
IF(WIN32 OR AMIGA OR CMAKE_SYSTEM_NAME MATCHES "
(
Solaris|SunOS
)
")
ADD_SUBDIRECTORY("
${
CMAKE_SOURCE_DIR
}
/deps/regex
" "
${
CMAKE_BINARY_DIR
}
/deps/regex
")
LIST(APPEND LIBGIT2_INCLUDES "
${
CMAKE_SOURCE_DIR
}
/deps/regex
")
LIST(APPEND LIBGIT2_
LIBS regex
)
LIST(APPEND LIBGIT2_
OBJECTS $<TARGET_OBJECTS:regex>
)
ENDIF()
# Optional external dependency: http-parser
...
...
@@ -194,7 +196,7 @@ ELSE()
MESSAGE(STATUS "
http-parser version 2 was not found or disabled; using bundled 3rd-party sources.
")
ADD_SUBDIRECTORY("
${
CMAKE_SOURCE_DIR
}
/deps/http-parser
" "
${
CMAKE_BINARY_DIR
}
/deps/http-parser
")
LIST(APPEND LIBGIT2_INCLUDES "
${
CMAKE_SOURCE_DIR
}
/deps/http-parser
")
LIST(APPEND LIBGIT2_
LIBS http-parser
)
LIST(APPEND LIBGIT2_
OBJECTS "
$<TARGET_OBJECTS:http-parser>
"
)
ENDIF()
# Optional external dependency: zlib
...
...
@@ -212,7 +214,7 @@ ELSE()
MESSAGE(STATUS "
zlib was not found; using bundled 3rd-party sources.
" )
ADD_SUBDIRECTORY("
${
CMAKE_SOURCE_DIR
}
/deps/zlib
" "
${
CMAKE_BINARY_DIR
}
/deps/zlib
")
LIST(APPEND LIBGIT2_INCLUDES "
${
CMAKE_SOURCE_DIR
}
/deps/zlib
")
LIST(APPEND LIBGIT2_
LIBS zlib
)
LIST(APPEND LIBGIT2_
OBJECTS $<TARGET_OBJECTS:zlib>
)
ENDIF()
# Optional external dependency: libssh2
...
...
@@ -330,32 +332,28 @@ ENDIF()
CONFIGURE_FILE(features.h.in git2/sys/features.h)
SET(
GIT2INTERNAL_OBJECT
S
${
SRC_H
}
${
SRC_GIT2
}
${
SRC_OS
}
${
SRC_SSH
}
${
SRC_SHA1
}
)
SET(
LIBGIT2_SOURCE
S
${
SRC_H
}
${
SRC_GIT2
}
${
SRC_OS
}
${
SRC_SSH
}
${
SRC_SHA1
}
)
IF (CMAKE_VERSION VERSION_GREATER 2.8.7)
ADD_LIBRARY(git2internal OBJECT
${
GIT2INTERNAL_OBJECTS
}
)
IDE_SPLIT_SOURCES(git2internal)
SET(GIT2INTERNAL_OBJECTS $<TARGET_OBJECTS:git2internal>)
ADD_LIBRARY(git2internal OBJECT
${
LIBGIT2_SOURCES
}
)
IDE_SPLIT_SOURCES(git2internal)
LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:git2internal>)
IF (
${
CMAKE_VERSION
}
VERSION_LESS 2.8.12)
INCLUDE_DIRECTORIES(
${
LIBGIT2_INCLUDES
}
)
ELSE()
TARGET_INCLUDE_DIRECTORIES(git2internal
PRIVATE
${
LIBGIT2_INCLUDES
}
PUBLIC
${
CMAKE_SOURCE_DIR
}
/include)
ENDIF()
ELSE()
IF (
${
CMAKE_VERSION
}
VERSION_LESS 2.8.12)
INCLUDE_DIRECTORIES(
${
LIBGIT2_INCLUDES
}
)
ELSE()
TARGET_INCLUDE_DIRECTORIES(git2internal
PRIVATE
${
LIBGIT2_INCLUDES
}
PUBLIC
${
CMAKE_SOURCE_DIR
}
/include)
ENDIF()
SET(
GIT2INTERNAL_OBJECTS
${
GIT2INTERNAL
_OBJECTS
}
PARENT_SCOPE)
SET(
LIBGIT2_OBJECTS
${
LIBGIT2
_OBJECTS
}
PARENT_SCOPE)
SET(LIBGIT2_INCLUDES
${
LIBGIT2_INCLUDES
}
PARENT_SCOPE)
SET(LIBGIT2_LIBS
${
LIBGIT2_LIBS
}
PARENT_SCOPE)
SET(LIBGIT2_LIBDIRS
${
LIBGIT2_LIBDIRS
}
PARENT_SCOPE)
# Compile and link libgit2
LINK_DIRECTORIES(
${
LIBGIT2_LIBDIRS
}
)
ADD_LIBRARY(git2
${
WIN_RC
}
${
GIT2INTERNAL
_OBJECTS
}
)
ADD_LIBRARY(git2
${
WIN_RC
}
${
LIBGIT2
_OBJECTS
}
)
TARGET_LINK_LIBRARIES(git2
${
LIBGIT2_LIBS
}
)
SET_TARGET_PROPERTIES(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
tests/CMakeLists.txt
View file @
c7c5f2c4
...
...
@@ -33,11 +33,13 @@ SET_SOURCE_FILES_PROPERTIES(
LINK_DIRECTORIES(
${
LIBGIT2_LIBDIRS
}
)
INCLUDE_DIRECTORIES(
${
LIBGIT2_INCLUDES
}
)
ADD_EXECUTABLE(libgit2_clar
${
SRC_CLAR
}
${
SRC_TEST
}
${
GIT2INTERNAL
_OBJECTS
}
)
ADD_EXECUTABLE(libgit2_clar
${
SRC_CLAR
}
${
SRC_TEST
}
${
LIBGIT2
_OBJECTS
}
)
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
IF (
${
CMAKE_VERSION
}
VERSION_GREATER 2.8.11)
IF (
${
CMAKE_VERSION
}
VERSION_LESS 2.8.12)
# Already handled by a global INCLUDE_DIRECTORY()
ELSE()
TARGET_INCLUDE_DIRECTORIES(libgit2_clar PRIVATE ../src PUBLIC ../include)
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