mirror of
https://github.com/git/git.git
synced 2026-01-21 16:06:04 +00:00
Merge branch 'visual-studio'
This topic branch teaches the project generator to generate a Visual Studio solution, ready to be opened in Visual Studio 2010 or later. The idea, of course, is to let some automatic build job generate and commit the project files with make MSVC=1 vcxproj and then (force-)push to a special-purpose branch. The major part of this branch thicket concerns itself not only with generating the Visual Studio project files, but making sure that the user can then run the test suite from a regular Git Bash (i.e. *not* requiring a Git for Windows SDK), e.g. by running cd t prove --timer --jobs 15 ./t[0-9]*.sh Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
47
.gitignore
vendored
47
.gitignore
vendored
@@ -179,7 +179,43 @@
|
||||
/gitweb/gitweb.cgi
|
||||
/gitweb/static/gitweb.js
|
||||
/gitweb/static/gitweb.min.*
|
||||
/libgit
|
||||
/test-chmtime
|
||||
/test-ctype
|
||||
/test-config
|
||||
/test-date
|
||||
/test-delta
|
||||
/test-dump-cache-tree
|
||||
/test-dump-split-index
|
||||
/test-dump-untracked-cache
|
||||
/test-fake-ssh
|
||||
/test-scrap-cache-tree
|
||||
/test-genrandom
|
||||
/test-hashmap
|
||||
/test-index-version
|
||||
/test-line-buffer
|
||||
/test-match-trees
|
||||
/test-mergesort
|
||||
/test-mktemp
|
||||
/test-parse-options
|
||||
/test-path-utils
|
||||
/test-prio-queue
|
||||
/test-read-cache
|
||||
/test-regex
|
||||
/test-revision-walking
|
||||
/test-run-command
|
||||
/test-sha1
|
||||
/test-sha1-array
|
||||
/test-sigchain
|
||||
/test-string-list
|
||||
/test-submodule-config
|
||||
/test-subprocess
|
||||
/test-svn-fe
|
||||
/test-urlmatch-normalization
|
||||
/test-wildmatch
|
||||
/common-cmds.h
|
||||
/vcs-svn_lib
|
||||
/xdiff_lib
|
||||
*.tar.gz
|
||||
*.dsc
|
||||
*.deb
|
||||
@@ -217,6 +253,13 @@
|
||||
*.idb
|
||||
*.pdb
|
||||
*.ilk
|
||||
*.iobj
|
||||
*.ipdb
|
||||
*.dll
|
||||
.vs/
|
||||
/Debug/
|
||||
/Release/
|
||||
*.manifest
|
||||
Debug/
|
||||
Release/
|
||||
/UpgradeLog*.htm
|
||||
/git.VC.VC.opendb
|
||||
/git.VC.db
|
||||
|
||||
6
.nuget/NuGet.config
Normal file
6
.nuget/NuGet.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key="repositoryPath" value="..\compat\vcbuild\GEN.PKGS" />
|
||||
</config>
|
||||
</configuration>
|
||||
8
Makefile
8
Makefile
@@ -2155,7 +2155,7 @@ exec_cmd.sp exec_cmd.s exec_cmd.o: GIT-PREFIX
|
||||
exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
|
||||
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
|
||||
'-DBINDIR="$(bindir_relative_SQ)"' \
|
||||
'-DPREFIX="$(prefix_SQ)"'
|
||||
'-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
|
||||
|
||||
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
|
||||
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
|
||||
@@ -2391,6 +2391,7 @@ GIT-BUILD-OPTIONS: FORCE
|
||||
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
|
||||
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
|
||||
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
|
||||
@echo X=\'$(X)\' >>$@+
|
||||
ifdef TEST_OUTPUT_DIRECTORY
|
||||
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
|
||||
endif
|
||||
@@ -2425,6 +2426,9 @@ ifdef GIT_INTEROP_MAKE_OPTS
|
||||
endif
|
||||
ifdef TEST_GIT_INDEX_VERSION
|
||||
@echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@+
|
||||
endif
|
||||
ifdef MSVC_DEPS
|
||||
@echo MSVC_DEPS=\''$(subst ','\'',$(subst ','\'',$(MSVC_DEPS)))'\' >>$@+
|
||||
endif
|
||||
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
|
||||
|
||||
@@ -2449,7 +2453,7 @@ bin-wrappers/%: wrap-for-bin.sh
|
||||
@mkdir -p bin-wrappers
|
||||
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
||||
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
|
||||
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
|
||||
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
|
||||
chmod +x $@
|
||||
|
||||
# GNU make supports exporting all variables by "export" without parameters.
|
||||
|
||||
@@ -479,7 +479,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
mark_edges_uninteresting(&revs, show_edge);
|
||||
|
||||
if (bisect_list) {
|
||||
int reaches = reaches, all = all;
|
||||
FAKE_INIT(int, reaches, 0);
|
||||
FAKE_INIT(int, all, 0);
|
||||
|
||||
find_bisection(&revs.commits, &reaches, &all, bisect_find_all);
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#include <malloc.h>
|
||||
#include <io.h>
|
||||
|
||||
#pragma warning(disable: 4018) /* signed/unsigned comparison */
|
||||
#pragma warning(disable: 4244) /* type conversion, possible loss of data */
|
||||
#pragma warning(disable: 4090) /* 'function' : different 'const' qualifiers (ALLOC_GROW etc.)*/
|
||||
|
||||
/* porting function */
|
||||
#define inline __inline
|
||||
#define __inline__ __inline
|
||||
|
||||
@@ -492,7 +492,7 @@ __extension__ \
|
||||
( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
|
||||
((((h)->temp.tempint > 0 \
|
||||
&& (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
|
||||
? (int) ((h)->next_free = (h)->object_base \
|
||||
? (ptrdiff_t) ((h)->next_free = (h)->object_base \
|
||||
= (h)->temp.tempint + (char *) (h)->chunk) \
|
||||
: (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#ifndef NO_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include "git-compat-util.h"
|
||||
#include "run-command.h"
|
||||
#include "compat/terminal.h"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Platform specific Makefile tweaks based on uname detection
|
||||
|
||||
# Define NO_SAFESEH if you need MSVC/Visual Studio to ignore the lack of
|
||||
# Microsoft's Safe Exception Handling in libraries (such as zlib).
|
||||
# Typically required for VS2013+/32-bit compilation on Vista+ versions.
|
||||
|
||||
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
|
||||
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
|
||||
@@ -354,6 +358,7 @@ ifeq ($(uname_S),Windows)
|
||||
NEEDS_LIBICONV = YesPlease
|
||||
NO_STRTOUMAX = YesPlease
|
||||
NO_MKDTEMP = YesPlease
|
||||
NO_INTTYPES_H = YesPlease
|
||||
# VS2015 with UCRT claims that snprintf and friends are C99 compliant,
|
||||
# so we don't need this.
|
||||
#
|
||||
@@ -388,6 +393,9 @@ ifeq ($(uname_S),Windows)
|
||||
compat/win32/dirent.o compat/win32/fscache.o
|
||||
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
|
||||
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
|
||||
# invalidcontinue.obj allows Git's source code to close the same file
|
||||
# handle twice, or to access the osfhandle of an already-closed stdout
|
||||
# See https://msdn.microsoft.com/en-us/library/ms235330.aspx
|
||||
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
|
||||
PTHREAD_LIBS =
|
||||
lib =
|
||||
@@ -420,6 +428,11 @@ ifeq ($(uname_S),Windows)
|
||||
# release mode) to force a PDB to be generated (like RelWithDebInfo).
|
||||
BASIC_CFLAGS += -Zi
|
||||
BASIC_LDFLAGS += -debug
|
||||
|
||||
ifdef NO_SAFESEH
|
||||
LDFLAGS += -SAFESEH:NO
|
||||
endif
|
||||
|
||||
ifndef DEBUG
|
||||
BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
|
||||
BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
|
||||
@@ -430,6 +443,65 @@ endif
|
||||
X = .exe
|
||||
|
||||
compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
|
||||
|
||||
vcxproj:
|
||||
# Require clean work tree
|
||||
git update-index -q --refresh && \
|
||||
git diff-files --quiet && \
|
||||
git diff-index --cached --quiet HEAD --
|
||||
|
||||
# Make .vcxproj files and add them
|
||||
unset QUIET_GEN QUIET_BUILT_IN; \
|
||||
perl contrib/buildsystems/generate -g Vcxproj
|
||||
git add -f git.sln {*,*/lib,t/helper/*}/{packages.config,*.vcxproj}
|
||||
|
||||
# Add common-cmds.h
|
||||
$(MAKE) MSVC=1 prefix=/mingw64 common-cmds.h
|
||||
git add -f common-cmds.h
|
||||
|
||||
# Add scripts
|
||||
rm -f perl/perl.mak
|
||||
$(MAKE) MSVC=1 prefix=/mingw64 \
|
||||
$(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
|
||||
# Strip out the sane tool path, needed only for building
|
||||
sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
|
||||
git add -f $(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
|
||||
|
||||
# Add Perl module
|
||||
$(MAKE) -C perl
|
||||
git add -f perl/blib/lib
|
||||
|
||||
# Add bin-wrappers, for testing
|
||||
rm -rf bin-wrappers/
|
||||
$(MAKE) MSVC=1 prefix=/mingw64 $(test_bindir_programs)
|
||||
# Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
|
||||
# path of the repository is not hard-coded (GIT_EXEC_PATH will be set
|
||||
# by test-lib.sh according to the current setup)
|
||||
sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
|
||||
\1="$$(cygpath -u "$$\1")"/' \
|
||||
-e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
|
||||
# Ensure that test-* helpers find the .dll files copied to top-level
|
||||
sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
|
||||
# We do not want to force hard-linking builtins
|
||||
sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
|
||||
bin-wrappers/git-{receive-pack,upload-archive}
|
||||
git add -f $(test_bindir_programs)
|
||||
# remote-ext is a builtin, but invoked as if it were external
|
||||
sed 's|receive-pack|remote-ext|g' \
|
||||
<bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
|
||||
git add -f bin-wrappers/git-remote-ext
|
||||
|
||||
# Add templates
|
||||
$(MAKE) -C templates
|
||||
git add -f templates/boilerplates.made templates/blt/
|
||||
|
||||
# Add build options
|
||||
$(MAKE) MSVC=1 prefix=/mingw64 GIT-BUILD-OPTIONS
|
||||
git add -f GIT-BUILD-OPTIONS
|
||||
|
||||
# Commit the whole shebang
|
||||
git commit -m "Generate Visual Studio solution" \
|
||||
-m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"
|
||||
endif
|
||||
ifeq ($(uname_S),Interix)
|
||||
NO_INITGROUPS = YesPlease
|
||||
|
||||
@@ -17,7 +17,7 @@ BEGIN {
|
||||
$me = dirname($me);
|
||||
if (opendir(D,"$me/Generators")) {
|
||||
foreach my $gen (readdir(D)) {
|
||||
next if ($gen =~ /^\.\.?$/);
|
||||
next unless ($gen =~ /\.pm$/);
|
||||
require "${me}/Generators/$gen";
|
||||
$gen =~ s,\.pm,,;
|
||||
push(@AVAILABLE, $gen);
|
||||
|
||||
@@ -52,7 +52,6 @@ my @GUIDS = (
|
||||
"{00785268-A9CC-4E40-AC29-BAC0019159CE}",
|
||||
"{4C06F56A-DCDB-46A6-B67C-02339935CF12}",
|
||||
"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}",
|
||||
"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}",
|
||||
"{9392EB58-D7BA-410B-B1F0-B2FAA6BC89A7}",
|
||||
"{2ACAB2D5-E0CE-4027-BCA0-D78B2D7A6C66}",
|
||||
"{86E216C3-43CE-481A-BCB2-BE5E62850635}",
|
||||
@@ -63,7 +62,14 @@ my @GUIDS = (
|
||||
"{294BDC5A-F448-48B6-8110-DD0A81820F8C}",
|
||||
"{4B9F66E9-FAC9-47AB-B1EF-C16756FBFD06}",
|
||||
"{72EA49C6-2806-48BD-B81B-D4905102E19C}",
|
||||
"{5728EB7E-8929-486C-8CD5-3238D060E768}"
|
||||
"{5728EB7E-8929-486C-8CD5-3238D060E768}",
|
||||
"{A3E300FC-5630-4850-A470-E9F2C2EFA7E7}",
|
||||
"{CEA071D4-D9F3-4250-98F7-44AFDC8ACAA1}",
|
||||
"{3FD87BB4-2236-4A1B-ADD2-46211A302442}",
|
||||
"{49B03F41-5157-4079-95A7-64D728BCF74F}",
|
||||
"{95D5A28B-80E2-40A9-BEA3-C52B9CA488E3}",
|
||||
"{B85E6545-D523-4323-9F29-45389D090343}",
|
||||
"{06840CEF-746C-4B71-9442-C395DD6590A5}"
|
||||
);
|
||||
|
||||
sub generate {
|
||||
@@ -106,6 +112,8 @@ sub createLibProject {
|
||||
my $includes= join(";", sort(map(""$rel_dir\\$_"", @{$$build_structure{"LIBS_${libname}_INCLUDES"}})));
|
||||
my $cflags = join(" ", sort(@{$$build_structure{"LIBS_${libname}_CFLAGS"}}));
|
||||
$cflags =~ s/\"/"/g;
|
||||
$cflags =~ s/</</g;
|
||||
$cflags =~ s/>/>/g;
|
||||
|
||||
my $cflags_debug = $cflags;
|
||||
$cflags_debug =~ s/-MT/-MTd/;
|
||||
@@ -127,6 +135,8 @@ sub createLibProject {
|
||||
|
||||
$defines =~ s/-D//g;
|
||||
$defines =~ s/\"/\\"/g;
|
||||
$defines =~ s/</</g;
|
||||
$defines =~ s/>/>/g;
|
||||
$defines =~ s/\'//g;
|
||||
$includes =~ s/-I//g;
|
||||
mkdir "$target" || die "Could not create the directory $target for lib project!\n";
|
||||
@@ -162,9 +172,6 @@ sub createLibProject {
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
@@ -228,9 +235,6 @@ sub createLibProject {
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
@@ -325,6 +329,8 @@ sub createAppProject {
|
||||
my $includes= join(";", sort(map(""$rel_dir\\$_"", @{$$build_structure{"APPS_${appname}_INCLUDES"}})));
|
||||
my $cflags = join(" ", sort(@{$$build_structure{"APPS_${appname}_CFLAGS"}}));
|
||||
$cflags =~ s/\"/"/g;
|
||||
$cflags =~ s/</</g;
|
||||
$cflags =~ s/>/>/g;
|
||||
|
||||
my $cflags_debug = $cflags;
|
||||
$cflags_debug =~ s/-MT/-MTd/;
|
||||
@@ -351,6 +357,8 @@ sub createAppProject {
|
||||
|
||||
$defines =~ s/-D//g;
|
||||
$defines =~ s/\"/\\"/g;
|
||||
$defines =~ s/</</g;
|
||||
$defines =~ s/>/>/g;
|
||||
$defines =~ s/\'//g;
|
||||
$defines =~ s/\\\\/\\/g;
|
||||
$includes =~ s/-I//g;
|
||||
@@ -387,9 +395,6 @@ sub createAppProject {
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
@@ -458,9 +463,6 @@ sub createAppProject {
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
@@ -561,20 +563,18 @@ sub createGlueProject {
|
||||
foreach (@apps) {
|
||||
$_ =~ s/\//_/g;
|
||||
$_ =~ s/\.exe//;
|
||||
push(@tmp, $_);
|
||||
if ($_ eq "git" ) {
|
||||
unshift(@tmp, $_);
|
||||
} else {
|
||||
push(@tmp, $_);
|
||||
}
|
||||
}
|
||||
@apps = @tmp;
|
||||
|
||||
open F, ">git.sln" || die "Could not open git.sln for writing!\n";
|
||||
binmode F, ":crlf";
|
||||
print F "$SLN_HEAD";
|
||||
foreach (@libs) {
|
||||
my $libname = $_;
|
||||
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
|
||||
print F "$SLN_PRE";
|
||||
print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
|
||||
print F "$SLN_POST";
|
||||
}
|
||||
|
||||
my $uuid_libgit = $build_structure{"LIBS_libgit_GUID"};
|
||||
my $uuid_xdiff_lib = $build_structure{"LIBS_xdiff_lib_GUID"};
|
||||
foreach (@apps) {
|
||||
@@ -588,6 +588,13 @@ sub createGlueProject {
|
||||
print F " EndProjectSection";
|
||||
print F "$SLN_POST";
|
||||
}
|
||||
foreach (@libs) {
|
||||
my $libname = $_;
|
||||
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
|
||||
print F "$SLN_PRE";
|
||||
print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
|
||||
print F "$SLN_POST";
|
||||
}
|
||||
|
||||
print F << "EOM";
|
||||
Global
|
||||
@@ -599,17 +606,17 @@ EOM
|
||||
print F << "EOM";
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
EOM
|
||||
foreach (@libs) {
|
||||
my $libname = $_;
|
||||
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
|
||||
foreach (@apps) {
|
||||
my $appname = $_;
|
||||
my $uuid = $build_structure{"APPS_${appname}_GUID"};
|
||||
print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";
|
||||
print F "\t\t${uuid}.Release|Win32.Build.0 = Release|Win32\n";
|
||||
}
|
||||
foreach (@apps) {
|
||||
my $appname = $_;
|
||||
my $uuid = $build_structure{"APPS_${appname}_GUID"};
|
||||
foreach (@libs) {
|
||||
my $libname = $_;
|
||||
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
|
||||
print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";
|
||||
|
||||
447
contrib/buildsystems/Generators/Vcxproj.pm
Normal file
447
contrib/buildsystems/Generators/Vcxproj.pm
Normal file
@@ -0,0 +1,447 @@
|
||||
package Generators::Vcxproj;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use vars qw($VERSION);
|
||||
|
||||
our $VERSION = '1.00';
|
||||
our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
|
||||
@ISA = qw(Exporter);
|
||||
|
||||
BEGIN {
|
||||
push @EXPORT_OK, qw(generate);
|
||||
}
|
||||
|
||||
my $guid_index = 0;
|
||||
my @GUIDS = (
|
||||
"{E07B9989-2BF7-4F21-8918-BE22BA467AC3}",
|
||||
"{278FFB51-0296-4A44-A81A-22B87B7C3592}",
|
||||
"{7346A2C4-F0FD-444F-9EBE-1AF23B2B5650}",
|
||||
"{67F421AC-EB34-4D49-820B-3196807B423F}",
|
||||
"{385DCFE1-CC8C-4211-A451-80FCFC31CA51}",
|
||||
"{97CC46C5-D2CC-4D26-B634-E75792B79916}",
|
||||
"{C7CE21FE-6EF8-4012-A5C7-A22BCEDFBA11}",
|
||||
"{51575134-3FDF-42D1-BABD-3FB12669C6C9}",
|
||||
"{0AE195E4-9823-4B87-8E6F-20C5614AF2FF}",
|
||||
"{4B918255-67CA-43BB-A46C-26704B666E6B}",
|
||||
"{18CCFEEF-C8EE-4CC1-A265-26F95C9F4649}",
|
||||
"{5D5D90FA-01B7-4973-AFE5-CA88C53AC197}",
|
||||
"{1F054320-036D-49E1-B384-FB5DF0BC8AC0}",
|
||||
"{7CED65EE-F2D9-4171-825B-C7D561FE5786}",
|
||||
"{8D341679-0F07-4664-9A56-3BA0DE88B9BC}",
|
||||
"{C189FEDC-2957-4BD7-9FA4-7622241EA145}",
|
||||
"{66844203-1B9F-4C53-9274-164FFF95B847}",
|
||||
"{E4FEA145-DECC-440D-AEEA-598CF381FD43}",
|
||||
"{73300A8E-C8AC-41B0-B555-4F596B681BA7}",
|
||||
"{873FDEB1-D01D-40BF-A1BF-8BBC58EC0F51}",
|
||||
"{7922C8BE-76C5-4AC6-8BF7-885C0F93B782}",
|
||||
"{E245D370-308B-4A49-BFC1-1E527827975F}",
|
||||
"{F6FA957B-66FC-4ED7-B260-E59BBE4FE813}",
|
||||
"{E6055070-0198-431A-BC49-8DB6CEE770AE}",
|
||||
"{54159234-C3EB-43DA-906B-CE5DA5C74654}",
|
||||
"{594CFC35-0B60-46F6-B8EF-9983ACC1187D}",
|
||||
"{D93FCAB7-1F01-48D2-B832-F761B83231A5}",
|
||||
"{DBA5E6AC-E7BE-42D3-8703-4E787141526E}",
|
||||
"{6171953F-DD26-44C7-A3BE-CC45F86FC11F}",
|
||||
"{9E19DDBE-F5E4-4A26-A2FE-0616E04879B8}",
|
||||
"{AE81A615-99E3-4885-9CE0-D9CAA193E867}",
|
||||
"{FBF4067E-1855-4F6C-8BCD-4D62E801A04D}",
|
||||
"{17007948-6593-4AEB-8106-F7884B4F2C19}",
|
||||
"{199D4C8D-8639-4DA6-82EF-08668C35DEE0}",
|
||||
"{E085E50E-C140-4CF3-BE4B-094B14F0DDD6}",
|
||||
"{00785268-A9CC-4E40-AC29-BAC0019159CE}",
|
||||
"{4C06F56A-DCDB-46A6-B67C-02339935CF12}",
|
||||
"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}",
|
||||
"{9392EB58-D7BA-410B-B1F0-B2FAA6BC89A7}",
|
||||
"{2ACAB2D5-E0CE-4027-BCA0-D78B2D7A6C66}",
|
||||
"{86E216C3-43CE-481A-BCB2-BE5E62850635}",
|
||||
"{FB631291-7923-4B91-9A57-7B18FDBB7A42}",
|
||||
"{0A176EC9-E934-45B8-B87F-16C7F4C80039}",
|
||||
"{DF55CA80-46E8-4C53-B65B-4990A23DD444}",
|
||||
"{3A0F9895-55D2-4710-BE5E-AD7498B5BF44}",
|
||||
"{294BDC5A-F448-48B6-8110-DD0A81820F8C}",
|
||||
"{4B9F66E9-FAC9-47AB-B1EF-C16756FBFD06}",
|
||||
"{72EA49C6-2806-48BD-B81B-D4905102E19C}",
|
||||
"{5728EB7E-8929-486C-8CD5-3238D060E768}",
|
||||
"{A3E300FC-5630-4850-A470-E9F2C2EFA7E7}",
|
||||
"{CEA071D4-D9F3-4250-98F7-44AFDC8ACAA1}",
|
||||
"{3FD87BB4-2236-4A1B-ADD2-46211A302442}",
|
||||
"{49B03F41-5157-4079-95A7-64D728BCF74F}",
|
||||
"{95D5A28B-80E2-40A9-BEA3-C52B9CA488E3}",
|
||||
"{B85E6545-D523-4323-9F29-45389D090343}",
|
||||
"{06840CEF-746C-4B71-9442-C395DD6590A5}"
|
||||
);
|
||||
|
||||
sub generate {
|
||||
my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
|
||||
my @libs = @{$build_structure{"LIBS"}};
|
||||
foreach (@libs) {
|
||||
createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 1);
|
||||
}
|
||||
|
||||
my @apps = @{$build_structure{"APPS"}};
|
||||
foreach (@apps) {
|
||||
createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 0);
|
||||
}
|
||||
|
||||
createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub createProject {
|
||||
my ($name, $git_dir, $out_dir, $rel_dir, $build_structure, $static_library) = @_;
|
||||
my $label = $static_library ? "lib" : "app";
|
||||
my $prefix = $static_library ? "LIBS_" : "APPS_";
|
||||
my $config_type = $static_library ? "StaticLibrary" : "Application";
|
||||
print "Generate $name vcxproj $label project\n";
|
||||
my $cdup = $name;
|
||||
$cdup =~ s/[^\/]+/../g;
|
||||
$cdup =~ s/\//\\/g;
|
||||
$rel_dir = $rel_dir eq "." ? $cdup : "$cdup\\$rel_dir";
|
||||
$rel_dir =~ s/\//\\/g;
|
||||
|
||||
my $target = $name;
|
||||
if ($static_library) {
|
||||
$target =~ s/\.a//;
|
||||
} else {
|
||||
$target =~ s/\.exe//;
|
||||
}
|
||||
|
||||
my $uuid = $GUIDS[$guid_index++];
|
||||
$$build_structure{"$prefix${target}_GUID"} = $uuid;
|
||||
my $vcxproj = $target;
|
||||
$vcxproj =~ s/(.*\/)?(.*)/$&\/$2.vcxproj/;
|
||||
$vcxproj =~ s/([^\/]*)(\/lib)\/(lib.vcxproj)/$1$2\/$1_$3/;
|
||||
$$build_structure{"$prefix${target}_VCXPROJ"} = $vcxproj;
|
||||
|
||||
my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"$prefix${name}_SOURCES"}}));
|
||||
my @sources;
|
||||
foreach (@srcs) {
|
||||
$_ =~ s/\//\\/g;
|
||||
push(@sources, $_);
|
||||
}
|
||||
my $defines = join(";", sort(@{$$build_structure{"$prefix${name}_DEFINES"}}));
|
||||
my $includes= join(";", sort(map { s/^-I//; s/\//\\/g; File::Spec->file_name_is_absolute($_) ? $_ : "$rel_dir\\$_" } @{$$build_structure{"$prefix${name}_INCLUDES"}}));
|
||||
my $cflags = join(" ", sort(map { s/^-[GLMOZ].*//; s/.* .*/"$&"/; $_; } @{$$build_structure{"$prefix${name}_CFLAGS"}}));
|
||||
$cflags =~ s/\"/"/g;
|
||||
$cflags =~ s/</</g;
|
||||
$cflags =~ s/>/>/g;
|
||||
|
||||
my $libs = '';
|
||||
if (!$static_library) {
|
||||
$libs = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|libcurl\.lib|libeay32\.lib|libiconv\.lib|ssleay32\.lib|zlib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
|
||||
}
|
||||
|
||||
$defines =~ s/-D//g;
|
||||
$defines =~ s/\"/"/g;
|
||||
$defines =~ s/</</g;
|
||||
$defines =~ s/>/>/g;
|
||||
$defines =~ s/\'//g;
|
||||
|
||||
die "Could not create the directory $target for $label project!\n" unless (-d "$target" || mkdir "$target");
|
||||
|
||||
use File::Copy;
|
||||
copy("$git_dir/compat/vcbuild/packages.config", "$target/packages.config");
|
||||
|
||||
my $needsCurl = grep(/libcurl.lib/, @{$$build_structure{"$prefix${name}_LIBS"}});
|
||||
my $targetsImport = '';
|
||||
my $targetsErrors = '';
|
||||
my $afterTargets = '';
|
||||
open F, "<$git_dir/compat/vcbuild/packages.config";
|
||||
while (<F>) {
|
||||
if (/<package id="([^"]+)" version="([^"]+)"/) {
|
||||
if ($1 eq 'libiconv') {
|
||||
# we have to link with the Release builds already because libiconv
|
||||
# is only available targeting v100 and v110, see
|
||||
# https://github.com/coapp-packages/libiconv/issues/2
|
||||
$libs .= ";$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.$2\\build\\native\\lib\\v110\\\$(Platform)\\Release\\dynamic\\cdecl\\libiconv.lib";
|
||||
$afterTargets .= "\n <Copy SourceFiles=\"$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.redist.$2\\build\\native\\bin\\v110\\\$(Platform)\\Release\\dynamic\\cdecl\\libiconv.dll\" DestinationFolder=\"\$(TargetDir)\" SkipUnchangedFiles=\"true\" />";
|
||||
} elsif ($needsCurl && $1 eq 'curl') {
|
||||
# libcurl is only available targeting v100 and v110
|
||||
$libs .= ";$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.$2\\build\\native\\lib\\v110\\\$(Platform)\\Release\\dynamic\\libcurl.lib";
|
||||
$afterTargets .= "\n <Copy SourceFiles=\"$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.redist.$2\\build\\native\\bin\\v110\\\$(Platform)\\Release\\dynamic\\libcurl.dll\" DestinationFolder=\"\$(TargetDir)\" SkipUnchangedFiles=\"true\" />";
|
||||
} elsif ($needsCurl && $1 eq 'expat') {
|
||||
# libexpat is only available targeting v100 and v110
|
||||
$libs .= ";$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.$2\\build\\native\\lib\\v110\\\$(Platform)\\Release\\dynamic\\utf8\\libexpat.lib";
|
||||
}
|
||||
next if ($1 =~ /^(zlib$|openssl(?!.*(x64|x86)$))/);
|
||||
my $targetsFile = "$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.$2\\build\\native\\$1.targets";
|
||||
$targetsImport .= "\n <Import Project=\"$targetsFile\" Condition=\"Exists('$targetsFile')\" />";
|
||||
$targetsErrors .= "\n <Error Condition=\"!Exists('$targetsFile')\" Text=\"\$([System.String]::Format('\$(ErrorText)', '$targetsFile'))\" />";
|
||||
}
|
||||
}
|
||||
close F;
|
||||
|
||||
open F, ">$vcxproj" or die "Could not open $vcxproj for writing!\n";
|
||||
binmode F, ":crlf :utf8";
|
||||
print F chr(0xFEFF);
|
||||
print F << "EOM";
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>$uuid</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'\$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'\$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>$config_type</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<!-- <CharacterSet>UTF-8</CharacterSet> -->
|
||||
<OutDir>..\\</OutDir>
|
||||
<!-- <IntDir>\$(ProjectDir)\$(Configuration)\\</IntDir> -->
|
||||
</PropertyGroup>
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<EnableManagedIncrementalBuild>true</EnableManagedIncrementalBuild>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalOptions>$cflags %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<EnableParallelCodeGeneration />
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<PrecompiledHeader />
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
<Link>
|
||||
<AdditionalDependencies>$libs;\$(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
|
||||
<ManifestFile>$cdup\\compat\\win32\\git.manifest</ManifestFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'\$(Platform)'=='Win32'">
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'\$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'\$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
EOM
|
||||
foreach(@sources) {
|
||||
print F << "EOM";
|
||||
<ClCompile Include="$_" />
|
||||
EOM
|
||||
}
|
||||
print F << "EOM";
|
||||
</ItemGroup>
|
||||
EOM
|
||||
if (!$static_library) {
|
||||
my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
|
||||
my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
|
||||
|
||||
print F << "EOM";
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$cdup\\libgit\\libgit.vcxproj">
|
||||
<Project>$uuid_libgit</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
|
||||
<Project>$uuid_xdiff_lib</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
EOM
|
||||
if ($name =~ /(test-(line-buffer|svn-fe)|^git-remote-testsvn)\.exe$/) {
|
||||
my $uuid_vcs_svn_lib = $$build_structure{"LIBS_vcs-svn/lib_GUID"};
|
||||
print F << "EOM";
|
||||
<ProjectReference Include="$cdup\\vcs-svn\\lib\\vcs-svn_lib.vcxproj">
|
||||
<Project>$uuid_vcs_svn_lib</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
EOM
|
||||
}
|
||||
print F << "EOM";
|
||||
</ItemGroup>
|
||||
EOM
|
||||
}
|
||||
print F << "EOM";
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">$targetsImport
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>$targetsErrors
|
||||
</Target>
|
||||
EOM
|
||||
if (!$static_library && $afterTargets ne '') {
|
||||
print F << "EOM";
|
||||
<Target Name="${target}_AfterBuild" AfterTargets="AfterBuild">$afterTargets
|
||||
</Target>
|
||||
EOM
|
||||
}
|
||||
print F << "EOM";
|
||||
</Project>
|
||||
EOM
|
||||
close F;
|
||||
}
|
||||
|
||||
sub createGlueProject {
|
||||
my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
|
||||
print "Generate solutions file\n";
|
||||
$rel_dir = "..\\$rel_dir";
|
||||
$rel_dir =~ s/\//\\/g;
|
||||
my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\n";
|
||||
my $SLN_PRE = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
|
||||
my $SLN_POST = "\nEndProject\n";
|
||||
|
||||
my @libs = @{$build_structure{"LIBS"}};
|
||||
my @tmp;
|
||||
foreach (@libs) {
|
||||
$_ =~ s/\.a//;
|
||||
push(@tmp, $_);
|
||||
}
|
||||
@libs = @tmp;
|
||||
|
||||
my @apps = @{$build_structure{"APPS"}};
|
||||
@tmp = ();
|
||||
foreach (@apps) {
|
||||
$_ =~ s/\.exe//;
|
||||
if ($_ eq "git" ) {
|
||||
unshift(@tmp, $_);
|
||||
} else {
|
||||
push(@tmp, $_);
|
||||
}
|
||||
}
|
||||
@apps = @tmp;
|
||||
|
||||
open F, ">git.sln" || die "Could not open git.sln for writing!\n";
|
||||
binmode F, ":crlf :utf8";
|
||||
print F chr(0xFEFF);
|
||||
print F "$SLN_HEAD";
|
||||
|
||||
foreach (@apps) {
|
||||
my $appname = $_;
|
||||
my $uuid = $build_structure{"APPS_${appname}_GUID"};
|
||||
print F "$SLN_PRE";
|
||||
my $vcxproj = $build_structure{"APPS_${appname}_VCXPROJ"};
|
||||
$vcxproj =~ s/\//\\/g;
|
||||
$appname =~ s/.*\///;
|
||||
print F "\"${appname}\", \"${vcxproj}\", \"${uuid}\"";
|
||||
print F "$SLN_POST";
|
||||
}
|
||||
foreach (@libs) {
|
||||
my $libname = $_;
|
||||
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
|
||||
print F "$SLN_PRE";
|
||||
my $vcxproj = $build_structure{"LIBS_${libname}_VCXPROJ"};
|
||||
$vcxproj =~ s/\//\\/g;
|
||||
$libname =~ s/\//_/g;
|
||||
print F "\"${libname}\", \"${vcxproj}\", \"${uuid}\"";
|
||||
print F "$SLN_POST";
|
||||
}
|
||||
|
||||
print F << "EOM";
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
EOM
|
||||
print F << "EOM";
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
EOM
|
||||
foreach (@apps) {
|
||||
my $appname = $_;
|
||||
my $uuid = $build_structure{"APPS_${appname}_GUID"};
|
||||
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
|
||||
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
|
||||
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
|
||||
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
|
||||
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
|
||||
print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
|
||||
}
|
||||
foreach (@libs) {
|
||||
my $libname = $_;
|
||||
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
|
||||
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
|
||||
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
|
||||
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
|
||||
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
|
||||
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
|
||||
print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
|
||||
}
|
||||
|
||||
print F << "EOM";
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
EOM
|
||||
close F;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -12,6 +12,7 @@ use File::Basename;
|
||||
use File::Spec;
|
||||
use Cwd;
|
||||
use Generators;
|
||||
use Text::ParseWords;
|
||||
|
||||
my (%build_structure, %compile_options, @makedry);
|
||||
my $out_dir = getcwd();
|
||||
@@ -31,6 +32,7 @@ generate usage:
|
||||
-g <GENERATOR> --gen <GENERATOR> Specify the buildsystem generator (default: $gen)
|
||||
Available: $genlist
|
||||
-o <PATH> --out <PATH> Specify output directory generation (default: .)
|
||||
--make-out <PATH> Write the output of GNU Make into a file
|
||||
-i <FILE> --in <FILE> Specify input file, instead of running GNU Make
|
||||
-h,-? --help This help
|
||||
EOM
|
||||
@@ -38,6 +40,7 @@ EOM
|
||||
}
|
||||
|
||||
# Parse command-line options
|
||||
my $make_out;
|
||||
while (@ARGV) {
|
||||
my $arg = shift @ARGV;
|
||||
if ("$arg" eq "-h" || "$arg" eq "--help" || "$arg" eq "-?") {
|
||||
@@ -45,6 +48,8 @@ while (@ARGV) {
|
||||
exit(0);
|
||||
} elsif("$arg" eq "--out" || "$arg" eq "-o") {
|
||||
$out_dir = shift @ARGV;
|
||||
} elsif("$arg" eq "--make-out") {
|
||||
$make_out = shift @ARGV;
|
||||
} elsif("$arg" eq "--gen" || "$arg" eq "-g") {
|
||||
$gen = shift @ARGV;
|
||||
} elsif("$arg" eq "--in" || "$arg" eq "-i") {
|
||||
@@ -72,7 +77,18 @@ Running GNU Make to figure out build structure...
|
||||
EOM
|
||||
|
||||
# Pipe a make --dry-run into a variable, if not already loaded from file
|
||||
@makedry = `cd $git_dir && make -n MSVC=1 V=1 2>/dev/null` if !@makedry;
|
||||
# Capture the make dry stderr to file for review (will be empty for a release build).
|
||||
|
||||
my $ErrsFile = "msvc-build-makedryerrors.txt";
|
||||
@makedry = `cd $git_dir && make -n MSVC=1 V=1 2>$ErrsFile` if !@makedry;
|
||||
# test for an empty Errors file and remove it
|
||||
unlink $ErrsFile if -f -z $ErrsFile;
|
||||
|
||||
if (defined $make_out) {
|
||||
open OUT, ">" . $make_out;
|
||||
print OUT @makedry;
|
||||
close OUT;
|
||||
}
|
||||
|
||||
# Parse the make output into usable info
|
||||
parseMakeOutput();
|
||||
@@ -140,6 +156,12 @@ sub parseMakeOutput
|
||||
next;
|
||||
}
|
||||
|
||||
if ($text =~ /^(mkdir|msgfmt) /) {
|
||||
# options to the Portable Object translations
|
||||
# the line "mkdir ... && msgfmt ..." contains no linker options
|
||||
next;
|
||||
}
|
||||
|
||||
if($text =~ / -c /) {
|
||||
# compilation
|
||||
handleCompileLine($text, $line);
|
||||
@@ -231,7 +253,7 @@ sub removeDuplicates
|
||||
sub handleCompileLine
|
||||
{
|
||||
my ($line, $lineno) = @_;
|
||||
my @parts = split(' ', $line);
|
||||
my @parts = shellwords($line);
|
||||
my $sourcefile;
|
||||
shift(@parts); # ignore cmd
|
||||
while (my $part = shift @parts) {
|
||||
@@ -265,7 +287,7 @@ sub handleLibLine
|
||||
my (@objfiles, @lflags, $libout, $part);
|
||||
# kill cmd and rm 'prefix'
|
||||
$line =~ s/^rm -f .* && .* rcs //;
|
||||
my @parts = split(' ', $line);
|
||||
my @parts = shellwords($line);
|
||||
while ($part = shift @parts) {
|
||||
if ($part =~ /^-/) {
|
||||
push(@lflags, $part);
|
||||
@@ -306,7 +328,7 @@ sub handleLinkLine
|
||||
{
|
||||
my ($line, $lineno) = @_;
|
||||
my (@objfiles, @lflags, @libs, $appout, $part);
|
||||
my @parts = split(' ', $line);
|
||||
my @parts = shellwords($line);
|
||||
shift(@parts); # ignore cmd
|
||||
while ($part = shift @parts) {
|
||||
if ($part =~ /^-IGNORE/) {
|
||||
@@ -317,11 +339,15 @@ sub handleLinkLine
|
||||
$appout = shift @parts;
|
||||
} elsif ("$part" eq "-lz") {
|
||||
push(@libs, "zlib.lib");
|
||||
} elsif ("$part" eq "-lcrypto") {
|
||||
} elsif ("$part" eq "-lcrypto") {
|
||||
push(@libs, "libeay32.lib");
|
||||
} elsif ("$part" eq "-lssl") {
|
||||
push(@libs, "ssleay32.lib");
|
||||
} elsif ($part =~ /^-/) {
|
||||
} elsif ("$part" eq "-lcurl") {
|
||||
push(@libs, "libcurl.lib");
|
||||
} elsif ("$part" eq "-liconv") {
|
||||
push(@libs, "libiconv.lib");
|
||||
} elsif ($part =~ /^[-\/]/) {
|
||||
push(@lflags, $part);
|
||||
} elsif ($part =~ /\.(a|lib)$/) {
|
||||
$part =~ s/\.a$/.lib/;
|
||||
@@ -333,7 +359,7 @@ sub handleLinkLine
|
||||
} elsif ($part =~ /\.obj$/) {
|
||||
# do nothing, 'make' should not be producing .obj, only .o files
|
||||
} else {
|
||||
die "Unhandled lib option @ line $lineno: $part";
|
||||
die "Unhandled link option @ line $lineno: $part";
|
||||
}
|
||||
}
|
||||
# print "AppOut: '$appout'\nLFlags: @lflags\nLibs : @libs\nOfiles: @objfiles\n";
|
||||
|
||||
@@ -20,7 +20,7 @@ static const char *system_prefix(void)
|
||||
!(prefix = strip_path_suffix(argv0_path, GIT_EXEC_PATH)) &&
|
||||
!(prefix = strip_path_suffix(argv0_path, BINDIR)) &&
|
||||
!(prefix = strip_path_suffix(argv0_path, "git"))) {
|
||||
prefix = PREFIX;
|
||||
prefix = FALLBACK_RUNTIME_PREFIX;
|
||||
trace_printf("RUNTIME_PREFIX requested, "
|
||||
"but prefix computation failed. "
|
||||
"Using static fallback '%s'.\n", prefix);
|
||||
@@ -45,7 +45,7 @@ void git_extract_argv0_path(const char *argv0)
|
||||
|
||||
static const char *system_prefix(void)
|
||||
{
|
||||
return PREFIX;
|
||||
return FALLBACK_RUNTIME_PREFIX;
|
||||
}
|
||||
|
||||
void git_extract_argv0_path(const char *argv0)
|
||||
|
||||
@@ -3003,7 +3003,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
|
||||
|
||||
static void parse_get_mark(const char *p)
|
||||
{
|
||||
struct object_entry *oe = oe;
|
||||
FAKE_INIT(struct object_entry *, oe, NULL);
|
||||
char output[GIT_MAX_HEXSZ + 2];
|
||||
|
||||
/* get-mark SP <object> LF */
|
||||
@@ -3020,7 +3020,7 @@ static void parse_get_mark(const char *p)
|
||||
|
||||
static void parse_cat_blob(const char *p)
|
||||
{
|
||||
struct object_entry *oe = oe;
|
||||
FAKE_INIT(struct object_entry *, oe, NULL);
|
||||
struct object_id oid;
|
||||
|
||||
/* cat-blob SP <object> LF */
|
||||
|
||||
@@ -51,6 +51,23 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Under certain circumstances Git's source code is cleverer than the C
|
||||
* compiler when the latter warns about some "uninitialized value", e.g. when
|
||||
* a value is both initialized and used under the same condition.
|
||||
*
|
||||
* GCC can be fooled to not spit out this warning by using the construct:
|
||||
* "int value = value;". Other C compilers are not that easily fooled and would
|
||||
* require a #pragma (which is not portable, and would litter the source code).
|
||||
*
|
||||
* To keep things simple, we only fool GCC, and initialize such values instead
|
||||
* when compiling with other C compilers.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#define FAKE_INIT(a, b, c) a b = b
|
||||
#else
|
||||
#define FAKE_INIT(a, b, c) a b = c
|
||||
#endif
|
||||
|
||||
/*
|
||||
* BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression.
|
||||
|
||||
@@ -69,7 +69,7 @@ call_merge () {
|
||||
test -z "$strategy" && strategy=recursive
|
||||
# If cmt doesn't have a parent, don't include it as a base
|
||||
base=$(git rev-parse --verify --quiet $cmt^)
|
||||
eval 'git-merge-$strategy' $strategy_opts $base ' -- "$hd" "$cmt"'
|
||||
eval 'git merge-$strategy' $strategy_opts $base ' -- "$hd" "$cmt"'
|
||||
rv=$?
|
||||
case "$rv" in
|
||||
0)
|
||||
|
||||
25
git.c
25
git.c
@@ -604,6 +604,31 @@ static int run_argv(int *argcp, const char ***argv)
|
||||
*/
|
||||
if (!done_alias)
|
||||
handle_builtin(*argcp, *argv);
|
||||
else if (get_builtin(**argv)) {
|
||||
struct argv_array args = ARGV_ARRAY_INIT;
|
||||
int i;
|
||||
|
||||
if (get_super_prefix())
|
||||
die("%s doesn't support --super-prefix", **argv);
|
||||
|
||||
commit_pager_choice();
|
||||
|
||||
argv_array_push(&args, "git");
|
||||
for (i = 0; i < *argcp; i++)
|
||||
argv_array_push(&args, (*argv)[i]);
|
||||
|
||||
trace_argv_printf(args.argv, "trace: exec:");
|
||||
|
||||
/*
|
||||
* if we fail because the command is not found, it is
|
||||
* OK to return. Otherwise, we just pass along the status code.
|
||||
*/
|
||||
i = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE |
|
||||
RUN_CLEAN_ON_EXIT);
|
||||
if (i >= 0 || errno != ENOENT)
|
||||
exit(i);
|
||||
die("could not execute builtin %s", **argv);
|
||||
}
|
||||
|
||||
/* .. then try the external ones */
|
||||
execv_dashed_external(*argv);
|
||||
|
||||
@@ -2061,7 +2061,7 @@ int merge_recursive(struct merge_options *o,
|
||||
{
|
||||
struct commit_list *iter;
|
||||
struct commit *merged_common_ancestors;
|
||||
struct tree *mrtree = mrtree;
|
||||
FAKE_INIT(struct tree *, mrtree, NULL);
|
||||
int clean;
|
||||
|
||||
if (show(o, 4)) {
|
||||
|
||||
@@ -22,7 +22,9 @@ clean:
|
||||
$(RM) $(makfile).old
|
||||
$(RM) PM.stamp
|
||||
|
||||
ifneq (,$(wildcard PM.stamp))
|
||||
$(makfile): PM.stamp
|
||||
endif
|
||||
|
||||
ifdef NO_PERL_MAKEMAKER
|
||||
instdir_SQ = $(subst ','\'',$(prefix)/lib)
|
||||
|
||||
@@ -2104,7 +2104,7 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce,
|
||||
struct strbuf *previous_name, struct ondisk_cache_entry *ondisk)
|
||||
{
|
||||
int size;
|
||||
int saved_namelen = saved_namelen; /* compiler workaround */
|
||||
FAKE_INIT(int, saved_namelen, 0);
|
||||
int result;
|
||||
static unsigned char padding[8] = { 0x00 };
|
||||
|
||||
|
||||
10
sideband.c
10
sideband.c
@@ -13,7 +13,7 @@
|
||||
* the remote died unexpectedly. A flush() concludes the stream.
|
||||
*/
|
||||
|
||||
#define PREFIX "remote: "
|
||||
#define DISPLAY_PREFIX "remote: "
|
||||
|
||||
#define ANSI_SUFFIX "\033[K"
|
||||
#define DUMB_SUFFIX " "
|
||||
@@ -49,7 +49,7 @@ int recv_sideband(const char *me, int in_stream, int out)
|
||||
switch (band) {
|
||||
case 3:
|
||||
strbuf_addf(&outbuf, "%s%s%s", outbuf.len ? "\n" : "",
|
||||
PREFIX, buf + 1);
|
||||
DISPLAY_PREFIX, buf + 1);
|
||||
retval = SIDEBAND_REMOTE_ERROR;
|
||||
break;
|
||||
case 2:
|
||||
@@ -67,7 +67,7 @@ int recv_sideband(const char *me, int in_stream, int out)
|
||||
int linelen = brk - b;
|
||||
|
||||
if (!outbuf.len)
|
||||
strbuf_addstr(&outbuf, PREFIX);
|
||||
strbuf_addstr(&outbuf, DISPLAY_PREFIX);
|
||||
if (linelen > 0) {
|
||||
strbuf_addf(&outbuf, "%.*s%s%c",
|
||||
linelen, b, suffix, *brk);
|
||||
@@ -81,8 +81,8 @@ int recv_sideband(const char *me, int in_stream, int out)
|
||||
}
|
||||
|
||||
if (*b)
|
||||
strbuf_addf(&outbuf, "%s%s",
|
||||
outbuf.len ? "" : PREFIX, b);
|
||||
strbuf_addf(&outbuf, "%s%s", outbuf.len ?
|
||||
"" : DISPLAY_PREFIX, b);
|
||||
break;
|
||||
case 1:
|
||||
write_or_die(out, buf + 1, len);
|
||||
|
||||
@@ -830,6 +830,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
|
||||
(
|
||||
cd six &&
|
||||
git remote rm origin &&
|
||||
mkdir -p .git/branches &&
|
||||
echo "$origin_url" >.git/branches/origin &&
|
||||
git remote rename origin origin &&
|
||||
test_path_is_missing .git/branches/origin &&
|
||||
@@ -844,6 +845,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)'
|
||||
(
|
||||
cd seven &&
|
||||
git remote rm origin &&
|
||||
mkdir -p .git/branches &&
|
||||
echo "quux#foom" > .git/branches/origin &&
|
||||
git remote rename origin origin &&
|
||||
test_path_is_missing .git/branches/origin &&
|
||||
|
||||
@@ -866,6 +866,7 @@ test_expect_success 'fetch with branches' '
|
||||
mk_empty testrepo &&
|
||||
git branch second $the_first_commit &&
|
||||
git checkout second &&
|
||||
mkdir -p testrepo/.git/branches &&
|
||||
echo ".." > testrepo/.git/branches/branch1 &&
|
||||
(
|
||||
cd testrepo &&
|
||||
@@ -879,6 +880,7 @@ test_expect_success 'fetch with branches' '
|
||||
|
||||
test_expect_success 'fetch with branches containing #' '
|
||||
mk_empty testrepo &&
|
||||
mkdir -p testrepo/.git/branches &&
|
||||
echo "..#second" > testrepo/.git/branches/branch2 &&
|
||||
(
|
||||
cd testrepo &&
|
||||
@@ -893,6 +895,7 @@ test_expect_success 'fetch with branches containing #' '
|
||||
test_expect_success 'push with branches' '
|
||||
mk_empty testrepo &&
|
||||
git checkout second &&
|
||||
mkdir -p .git/branches &&
|
||||
echo "testrepo" > .git/branches/branch1 &&
|
||||
git push branch1 &&
|
||||
(
|
||||
@@ -905,6 +908,7 @@ test_expect_success 'push with branches' '
|
||||
|
||||
test_expect_success 'push with branches containing #' '
|
||||
mk_empty testrepo &&
|
||||
mkdir -p .git/branches &&
|
||||
echo "testrepo#branch3" > .git/branches/branch2 &&
|
||||
git push branch2 &&
|
||||
(
|
||||
|
||||
@@ -797,7 +797,7 @@ test_create_repo () {
|
||||
mkdir -p "$repo"
|
||||
(
|
||||
cd "$repo" || error "Cannot setup test environment"
|
||||
"$GIT_EXEC_PATH/git-init" "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
|
||||
"$GIT_EXEC_PATH/git$X" init "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
|
||||
error "cannot run git init -- have you built things yet?"
|
||||
mv .git/hooks .git/hooks-disabled
|
||||
) || exit
|
||||
|
||||
@@ -49,18 +49,26 @@ export ASAN_OPTIONS
|
||||
: ${LSAN_OPTIONS=abort_on_error=1}
|
||||
export LSAN_OPTIONS
|
||||
|
||||
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
|
||||
then
|
||||
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
|
||||
exit 1
|
||||
fi
|
||||
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
|
||||
export PERL_PATH SHELL_PATH
|
||||
|
||||
test -z "$MSVC_DEPS" ||
|
||||
PATH="$GIT_BUILD_DIR/$MSVC_DEPS/bin:$PATH"
|
||||
|
||||
################################################################
|
||||
# It appears that people try to run tests without building...
|
||||
"$GIT_BUILD_DIR/git" >/dev/null
|
||||
"$GIT_BUILD_DIR/git$X" >/dev/null
|
||||
if test $? != 1
|
||||
then
|
||||
echo >&2 'error: you do not seem to have built git yet.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
|
||||
export PERL_PATH SHELL_PATH
|
||||
|
||||
# if --tee was passed, write the output not only to the terminal, but
|
||||
# additionally to the file test-results/$BASENAME.out, too.
|
||||
case "$GIT_TEST_TEE_STARTED, $* " in
|
||||
|
||||
Reference in New Issue
Block a user