Skip to content

Commit c8b6d48

Browse files
committed
Generation of commit_id.h for windows build
1 parent f8d732a commit c8b6d48

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/tools/msvc/Solution.pm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,22 @@ EOF
499499
last;
500500
}
501501
}
502+
# Generate commit_id file
503+
# If there is .git rewrite file whenever gitlog succeeds
504+
if ( -d ".git" ) {
505+
open P,"git log -1 --format='%h' |";
506+
my $commit_id = <P>;
507+
if (close(P)) {
508+
open(O, ">src/include/commit_id.h");
509+
print O "#define COMMIT_ID \"$commit_id\"\n";
510+
close O;
511+
}
512+
} elsif (! -f "src/include/commit_id.h" ) {
513+
# Otheriwse write file only if it not exists
514+
open(O, ">src/include/commit_id.h");
515+
print O "#define COMMIT_ID \"00000000\"\n";
516+
close O;
517+
}
502518

503519
open(O, ">doc/src/sgml/version.sgml")
504520
|| croak "Could not write to version.sgml\n";

0 commit comments

Comments
 (0)