Skip to content

Commit 76d41e1

Browse files
committed
Improved stability on mips generation.
1 parent 075a59e commit 76d41e1

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

FlashCap.V4L2Generator/Program.cs

+9-7
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ private static void GenerateStructureDumper(
174174
string dumperFileName,
175175
string architecture,
176176
string clangVersion,
177-
string gccVersion)
177+
string gccVersion,
178+
string dateTime)
178179
{
179180
var versionLabel = LoadVersionLabel();
180181

@@ -224,7 +225,7 @@ private static void GenerateStructureDumper(
224225
tw.WriteLine($"// {versionLabel}");
225226
tw.WriteLine($"// {clangVersion.Replace("\r", "").Replace("\n", "")}");
226227
tw.WriteLine($"// {gccVersion.Replace("\r", "").Replace("\n", "")}");
227-
tw.WriteLine($"// {DateTimeOffset.Now:R}");
228+
tw.WriteLine($"// {dateTime}");
228229
tw.WriteLine();
229230

230231
tw.WriteLine("#include <stdio.h>");
@@ -389,7 +390,8 @@ private enum FieldTypes
389390
private static void GenerateInteropCode(
390391
string structureDumperJsonFileName,
391392
string basePath,
392-
bool isBase)
393+
bool isBase,
394+
string dateTime)
393395
{
394396
var root = LoadMembersJson(structureDumperJsonFileName);
395397
if (root == null)
@@ -408,7 +410,7 @@ private static void GenerateInteropCode(
408410
tw.WriteLine($"// {root.Label}");
409411
tw.WriteLine($"// {root.ClangVersion}");
410412
tw.WriteLine($"// {root.GccVersion}");
411-
tw.WriteLine($"// {DateTimeOffset.Now:R}");
413+
tw.WriteLine($"// {dateTime}");
412414
tw.WriteLine();
413415

414416
tw.WriteLine("using System;");
@@ -668,17 +670,17 @@ public static void Main(string[] args)
668670
{
669671
case 1:
670672
Console.Write(" Generating dumper source code ...");
671-
GenerateStructureDumper(args[1], args[2], args[3], args[4], args[5], args[6]);
673+
GenerateStructureDumper(args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
672674
Console.WriteLine(" done.");
673675
break;
674676
case 2:
675677
Console.Write(" Generating C# source code ...");
676-
GenerateInteropCode(args[1], args[2], false);
678+
GenerateInteropCode(args[1], args[2], false, args[3]);
677679
Console.WriteLine(" done.");
678680
break;
679681
case 3:
680682
Console.Write(" Generating C# base class source code ...");
681-
GenerateInteropCode(args[1], args[2], true);
683+
GenerateInteropCode(args[1], args[2], true, args[3]);
682684
Console.WriteLine(" done.");
683685
break;
684686
}

FlashCap.V4L2Generator/dumper.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,26 @@ Configuration=Debug; export Configuration
1111

1212
#===============================================================
1313

14+
Timestamp=`date`; export Timestamp
15+
1416
$Clang -v |& head -n 1 > clang_version.txt
1517
gcc -v |& tail -n 1 > gcc_version.txt
1618

1719
echo "Step 1: Dump video2dev.h AST by Clang."
1820
$Clang -Xclang -ast-dump=json -fsyntax-only /usr/include/linux/videodev2.h > videodev2.h.ast.json
1921

2022
echo "Step 2: Generate members dumper."
21-
mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 1 /usr/include/linux/videodev2.h videodev2.h.ast.json videodev2.dumper.cpp `uname -m` "`cat clang_version.txt`" "`cat gcc_version.txt`"
23+
mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 1 /usr/include/linux/videodev2.h videodev2.h.ast.json videodev2.dumper.cpp `uname -m` "`cat clang_version.txt`" "`cat gcc_version.txt`" "$Timestamp"
2224

2325
echo "Step 3: Execute members dumper."
2426
gcc -o videodev2.dumper videodev2.dumper.cpp
2527
./videodev2.dumper > videodev2.h.members.json
2628

2729
echo "Step 4: Generate interop code."
28-
mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 2 videodev2.h.members.json ../FlashCap.Core/Internal/V4L2/
30+
mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 2 videodev2.h.members.json ../FlashCap.Core/Internal/V4L2/ "$Timestamp"
2931

3032
echo "Step 5: Generate base interop code."
31-
mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 3 videodev2.h.members.json .
33+
mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 3 videodev2.h.members.json . "$Timestamp"
3234

3335
echo ""
3436
echo "Done, you have to check './NativeMethods_V4L2_Interop.cs' to merge manually some symbols into '../FlashCap.Core/Internal/V4L2/NativeMethods_V4L2_Interop.cs'."

0 commit comments

Comments
 (0)