From da2281c7c0c450922533f6ee637d7bf59abc0fa3 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 9 Oct 2011 18:35:42 +0200 Subject: [PATCH 1/3] libgit2 doesn't use -LIB define Signed-off-by: Sven Strickroth --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 795a5851a..d517a74d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ FILE(GLOB SRC_H include/git2/*.h) # On Windows use specific platform sources IF (WIN32 AND NOT CYGWIN) - ADD_DEFINITIONS(-DWIN32 -D_DEBUG -D_LIB) + ADD_DEFINITIONS(-DWIN32 -D_DEBUG) FILE(GLOB SRC src/*.c src/win32/*.c) ELSE() FILE(GLOB SRC src/*.c src/unix/*.c) From 96fab093e3d7fa15e5085f36c51841fa6628cbe9 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 9 Oct 2011 18:37:41 +0200 Subject: [PATCH 2/3] put version information in separate file Signed-off-by: Sven Strickroth --- CMakeLists.txt | 2 +- include/git2.h | 5 +---- include/git2/version.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 include/git2/version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index d517a74d0..a2fad2d10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ PROJECT(libgit2 C) CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -FILE(STRINGS "include/git2.h" GIT2_HEADER REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$") +FILE(STRINGS "include/git2/version.h" GIT2_HEADER REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$") STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"([0-9]+).*$" "\\1" LIBGIT2_VERSION_MAJOR "${GIT2_HEADER}") STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_MINOR "${GIT2_HEADER}") diff --git a/include/git2.h b/include/git2.h index 9a0999a16..ad92809bb 100644 --- a/include/git2.h +++ b/include/git2.h @@ -8,10 +8,7 @@ #ifndef INCLUDE_git_git_h__ #define INCLUDE_git_git_h__ -#define LIBGIT2_VERSION "0.15.0" -#define LIBGIT2_VER_MAJOR 0 -#define LIBGIT2_VER_MINOR 15 -#define LIBGIT2_VER_REVISION 0 +#include "git2/version.h" #include "git2/common.h" #include "git2/errors.h" diff --git a/include/git2/version.h b/include/git2/version.h new file mode 100644 index 000000000..cb8b386d6 --- /dev/null +++ b/include/git2/version.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2009-2011 the libgit2 contributors + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_git_version_h__ +#define INCLUDE_git_version_h__ + +#define LIBGIT2_VERSION "0.15.0" +#define LIBGIT2_VER_MAJOR 0 +#define LIBGIT2_VER_MINOR 15 +#define LIBGIT2_VER_REVISION 0 + +#endif From cf9bf6b7875357eb8059a4957c1d649bb9ff7e3c Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 9 Oct 2011 18:45:23 +0200 Subject: [PATCH 3/3] include version information in git2.dll on Windows Signed-off-by: Sven Strickroth --- .gitignore | 1 + CMakeLists.txt | 2 +- src/win32/git2.rc | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/win32/git2.rc diff --git a/.gitignore b/.gitignore index 254e63db7..87ba3f34f 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ msvc/Release/ *.vc*proj* *.sdf *.opensdf +*.aps CMake* *.cmake .DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index a2fad2d10..aab897f32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,7 @@ FILE(GLOB SRC_H include/git2/*.h) # On Windows use specific platform sources IF (WIN32 AND NOT CYGWIN) ADD_DEFINITIONS(-DWIN32 -D_DEBUG) - FILE(GLOB SRC src/*.c src/win32/*.c) + FILE(GLOB SRC src/*.c src/win32/*.c src/win32/git2.rc) ELSE() FILE(GLOB SRC src/*.c src/unix/*.c) ENDIF () diff --git a/src/win32/git2.rc b/src/win32/git2.rc new file mode 100644 index 000000000..16a7b1f1b --- /dev/null +++ b/src/win32/git2.rc @@ -0,0 +1,42 @@ +#include +#include "../../include/git2/version.h" + +#ifndef INCLUDE_LIB +#define LIBGIT2_FILENAME "git2.dll" +#else +#define LIBGIT2_FILENAME "libgit2.dll" +#endif + +VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION LIBGIT2_VER_MAJOR,LIBGIT2_VER_MINOR,LIBGIT2_VER_REVISION,0 + PRODUCTVERSION LIBGIT2_VER_MAJOR,LIBGIT2_VER_MINOR,LIBGIT2_VER_REVISION,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS 1 +#else + FILEFLAGS 0 +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + BEGIN + VALUE "FileDescription", "libgit2 - the Git linkable library\0" + VALUE "FileVersion", LIBGIT2_VERSION "\0" + VALUE "InternalName", LIBGIT2_FILENAME "\0" + VALUE "LegalCopyright", "Copyright (C) 2009-2011 the libgit2 contributors\0" + VALUE "OriginalFilename", LIBGIT2_FILENAME "\0" + VALUE "ProductName", "libgit2\0" + VALUE "ProductVersion", LIBGIT2_VERSION "\0" + VALUE "Comments", "For more information visit http://libgit2.github.com/\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END