From fb7ae1149a80a22c77014d0ece33f6f4b965b631 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 31 Mar 2019 14:34:40 +0800 Subject: *misc --- build/modules/asura-box2d/asura-box2d.vcxproj | 50 +++--- .../asura-box2d/asura-box2d.vcxproj.filters | 111 +++++++++---- build/modules/asura-core/asura-core.vcxproj | 29 ++-- .../modules/asura-core/asura-core.vcxproj.filters | 173 ++++++++++++--------- build/modules/asura-json/asura-json.vcxproj | 4 +- .../modules/asura-json/asura-json.vcxproj.filters | 13 +- build/modules/asura-network/asura-network.vcxproj | 3 + .../asura-network/asura-network.vcxproj.filters | 11 +- build/modules/asura-openal/asura-openal.vcxproj | 32 ++-- .../asura-openal/asura-openal.vcxproj.filters | 71 ++++++--- .../modules/asura-plot/asura-plot.vcxproj.filters | 13 +- .../asura-steam/asura-steam.vcxproj.filters | 13 +- build/modules/asura-xml/asura-xml.vcxproj.filters | 8 +- build/tests/07-image/07-image.vcxproj | 1 + build/tests/07-image/07-image.vcxproj.filters | 13 +- build/tools/bindingGen/main.cs | 87 ++++++++--- .../DesignTimeResolveAssemblyReferencesInput.cache | Bin 6699 -> 6807 bytes .../Debug/bindingGen.csproj.FileListAbsolute.txt | 7 + build/tools/bindingGen/obj/Debug/bindingGen.exe | Bin 9728 -> 10240 bytes 19 files changed, 402 insertions(+), 237 deletions(-) (limited to 'build') diff --git a/build/modules/asura-box2d/asura-box2d.vcxproj b/build/modules/asura-box2d/asura-box2d.vcxproj index 9855a26..61c03c5 100644 --- a/build/modules/asura-box2d/asura-box2d.vcxproj +++ b/build/modules/asura-box2d/asura-box2d.vcxproj @@ -117,32 +117,34 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/build/modules/asura-box2d/asura-box2d.vcxproj.filters b/build/modules/asura-box2d/asura-box2d.vcxproj.filters index 4411d16..a7a33eb 100644 --- a/build/modules/asura-box2d/asura-box2d.vcxproj.filters +++ b/build/modules/asura-box2d/asura-box2d.vcxproj.filters @@ -1,40 +1,89 @@  - - - - - - - - - - - - - - - - - - - - - - + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + - - binding - - - binding - + + {c01b5c57-f3a7-445f-aed3-e0a27dbe74c2} + + + {3fb6587c-0c9d-4f6e-9e72-653032d9b238} + - - {a446fe08-e138-456d-bbc0-4e8d4aa79989} - + + + physics\binding + + + physics\binding + \ No newline at end of file diff --git a/build/modules/asura-core/asura-core.vcxproj b/build/modules/asura-core/asura-core.vcxproj index 1ad07c2..e539e72 100644 --- a/build/modules/asura-core/asura-core.vcxproj +++ b/build/modules/asura-core/asura-core.vcxproj @@ -131,7 +131,7 @@ - + @@ -153,16 +153,18 @@ + - - - - + + + + + @@ -190,6 +192,7 @@ + @@ -197,27 +200,29 @@ + + + + - - - - + + + + - - - + diff --git a/build/modules/asura-core/asura-core.vcxproj.filters b/build/modules/asura-core/asura-core.vcxproj.filters index 84a379f..eb4b20c 100644 --- a/build/modules/asura-core/asura-core.vcxproj.filters +++ b/build/modules/asura-core/asura-core.vcxproj.filters @@ -19,12 +19,18 @@ {4f6b2c19-1a06-48c9-b89d-52fa27bec5c1} - - {7a73607c-8da6-4865-a992-5c7c8764bd5a} - {05477a0e-f70b-4606-ae96-82ef7a7b8a1d} + + {7a73607c-8da6-4865-a992-5c7c8764bd5a} + + + {139aa01b-d038-4361-9edd-f81d8ba37730} + + + {66e43743-1be3-414a-9f3c-473d40613892} + @@ -70,18 +76,6 @@ graphics - - input - - - input - - - input - - - input - font @@ -101,9 +95,6 @@ graphics - - input - graphics\binding @@ -131,21 +122,6 @@ graphics\binding - - graphics\binding - - - window - - - window - - - window - - - window - threading @@ -161,6 +137,42 @@ graphics + + wnd + + + wnd + + + wnd + + + wnd + + + graphics\binding + + + wnd\binding + + + input + + + input + + + input + + + input + + + input + + + input + @@ -215,21 +227,6 @@ graphics - - input - - - input - - - input - - - input - - - input - font @@ -251,30 +248,9 @@ - - input - - - input - graphics - - input - - - window - - - window - - - window - - - window - threading @@ -293,6 +269,57 @@ graphics + + wnd + + + wnd + + + wnd + + + wnd + + + input + + + input + + + input + + + input + + + input + + + input + + + input + + + input + + + input + + + input + + + input + + + input + + + graphics + @@ -301,13 +328,7 @@ font - - input - - - input - - + input diff --git a/build/modules/asura-json/asura-json.vcxproj b/build/modules/asura-json/asura-json.vcxproj index 755ca25..d4a2521 100644 --- a/build/modules/asura-json/asura-json.vcxproj +++ b/build/modules/asura-json/asura-json.vcxproj @@ -117,11 +117,11 @@ - + - + diff --git a/build/modules/asura-json/asura-json.vcxproj.filters b/build/modules/asura-json/asura-json.vcxproj.filters index 988e477..97944e6 100644 --- a/build/modules/asura-json/asura-json.vcxproj.filters +++ b/build/modules/asura-json/asura-json.vcxproj.filters @@ -1,11 +1,20 @@  - + + json + - + + json + + + + + {2884af6d-6bc5-4714-8b32-32edd8099000} + \ No newline at end of file diff --git a/build/modules/asura-network/asura-network.vcxproj b/build/modules/asura-network/asura-network.vcxproj index 957bce0..0ed3418 100644 --- a/build/modules/asura-network/asura-network.vcxproj +++ b/build/modules/asura-network/asura-network.vcxproj @@ -18,6 +18,9 @@ x64 + + + 15.0 {6361701E-BD43-4AE9-8AE2-5C8F87D436BA} diff --git a/build/modules/asura-network/asura-network.vcxproj.filters b/build/modules/asura-network/asura-network.vcxproj.filters index 9cd8510..a475832 100644 --- a/build/modules/asura-network/asura-network.vcxproj.filters +++ b/build/modules/asura-network/asura-network.vcxproj.filters @@ -1,2 +1,11 @@  - \ No newline at end of file + + + + {c48e682b-c747-4a26-aabc-98e5d05c179c} + + + + + + \ No newline at end of file diff --git a/build/modules/asura-openal/asura-openal.vcxproj b/build/modules/asura-openal/asura-openal.vcxproj index 04827fa..3649648 100644 --- a/build/modules/asura-openal/asura-openal.vcxproj +++ b/build/modules/asura-openal/asura-openal.vcxproj @@ -117,24 +117,24 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/build/modules/asura-openal/asura-openal.vcxproj.filters b/build/modules/asura-openal/asura-openal.vcxproj.filters index ceb2b29..4a7af79 100644 --- a/build/modules/asura-openal/asura-openal.vcxproj.filters +++ b/build/modules/asura-openal/asura-openal.vcxproj.filters @@ -1,28 +1,63 @@  - - - - - - - - + + audio + + + audio + + + audio + + + audio + + + audio + + + audio + + + audio + + + audio + - - - - - - - - + + audio + + + audio + + + audio + + + audio + + + audio + + + audio + + + audio + + + audio + - - {006a5466-b1f4-4ab3-9f6c-eae54a78df37} + + {35f52c38-26da-43eb-9ca2-8c5d32f38b37} + + + {dbd7324a-d1b4-4370-ba8d-df87b31d984c} \ No newline at end of file diff --git a/build/modules/asura-plot/asura-plot.vcxproj.filters b/build/modules/asura-plot/asura-plot.vcxproj.filters index 3c6f4fd..13e717f 100644 --- a/build/modules/asura-plot/asura-plot.vcxproj.filters +++ b/build/modules/asura-plot/asura-plot.vcxproj.filters @@ -1,17 +1,8 @@  - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {0f829a34-bb64-4d78-b97a-32c6679fc43b} \ No newline at end of file diff --git a/build/modules/asura-steam/asura-steam.vcxproj.filters b/build/modules/asura-steam/asura-steam.vcxproj.filters index 3c6f4fd..d48ea8c 100644 --- a/build/modules/asura-steam/asura-steam.vcxproj.filters +++ b/build/modules/asura-steam/asura-steam.vcxproj.filters @@ -1,17 +1,8 @@  - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {73580bc7-0dec-4284-a31a-9a84f284326a} \ No newline at end of file diff --git a/build/modules/asura-xml/asura-xml.vcxproj.filters b/build/modules/asura-xml/asura-xml.vcxproj.filters index 9cd8510..d4c889c 100644 --- a/build/modules/asura-xml/asura-xml.vcxproj.filters +++ b/build/modules/asura-xml/asura-xml.vcxproj.filters @@ -1,2 +1,8 @@  - \ No newline at end of file + + + + {d8671556-9eb0-4627-a264-e7b667109bc4} + + + \ No newline at end of file diff --git a/build/tests/07-image/07-image.vcxproj b/build/tests/07-image/07-image.vcxproj index 11012d8..be7d160 100644 --- a/build/tests/07-image/07-image.vcxproj +++ b/build/tests/07-image/07-image.vcxproj @@ -115,6 +115,7 @@ + diff --git a/build/tests/07-image/07-image.vcxproj.filters b/build/tests/07-image/07-image.vcxproj.filters index 3c6f4fd..77b23f4 100644 --- a/build/tests/07-image/07-image.vcxproj.filters +++ b/build/tests/07-image/07-image.vcxproj.filters @@ -1,17 +1,6 @@  - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - + \ No newline at end of file diff --git a/build/tools/bindingGen/main.cs b/build/tools/bindingGen/main.cs index 7f99da4..f58b846 100644 --- a/build/tools/bindingGen/main.cs +++ b/build/tools/bindingGen/main.cs @@ -20,6 +20,7 @@ namespace bindingGen static string output = @"#include ""../{0}.h"" using namespace std; +using namespace Luax; namespace {1} {{ @@ -78,14 +79,14 @@ namespace {1} return ""; string register_methods = ""; register_methods += "\t\t\tLUAX_REGISTER_METHODS(state,\n"; - int maxlen = 0; - foreach(var m in methods) + int maxlen = 0; + foreach (var m in methods) { string method = m.ToString(); if (method.Count() > maxlen) - maxlen = method.Count(); + maxlen = method.Count(); } - for(int i = 0; i < methods.Count; ++i) + for (int i = 0; i < methods.Count; ++i) { Match m = methods[i]; string method = m.ToString(); @@ -107,12 +108,12 @@ namespace {1} if (mc.Count == 0) return ""; - string methods = ""; + string methods = ""; - foreach(var m in mc) + foreach (var m in mc) { string name = m.ToString(); - if(name != "_New") + if (name != "_New") { methods += String.Format(method, cname, name.Substring(1, name.Count() - 1), cname.ToLower()); } @@ -125,16 +126,36 @@ namespace {1} return methods; } + static int IndexOfChar(string str, char c, int n) + { + int j = 0; + for (int i = 0; i < str.Count(); ++i) + { + char ch = str[i]; + if (ch == c) + { + if (j == n) + return i; + ++j; + } + } + return -1; + } + static string make_register_enum(MatchCollection mc, string src) { if (mc.Count == 0) return ""; string reg_enum_l = @"(?<=enum\s*"; - string reg_enum_r = @"[\s\n]*\{((?!\})[\s\S])*)[A-Z_]+(?=\s*)"; + string reg_enum_r = @"[\s\n]*\{((?!\})[\s\S])*\s)[A-Z_0-9]+(?=[\s\=,]+)"; string enums = ""; - foreach(var m in mc) + // 尝试查找下划线索引号,如果没有,代表这个枚举字符串全部都是key + string reg_under_line_l = @"(?<=LUAX_DECL_ENUM\s*\(\s*"; + string reg_under_line_r = @"\s*,\s*)[0-9]+(?=\s*\))"; + + foreach (var m in mc) { string name = m.ToString(); enums += "\t\t\tLUAX_REGISTER_ENUM(state, "; @@ -142,15 +163,30 @@ namespace {1} MatchCollection values = Regex.Matches(src, reg_enum_l + name + reg_enum_r); string[] enames = new string[values.Count]; string[] keys = new string[values.Count]; + int underline_index = -1; + Match underline = Regex.Match(src, reg_under_line_l + name + reg_under_line_r); + if (underline.Success) + { + underline_index = int.Parse(underline.ToString()); + } int maxEname = 0, maxKey = 0; for (int i = 0; i < values.Count; ++i) { - enames[i] = values[i].ToString(); - keys[i] = enames[i].Substring(enames[i].LastIndexOf('_') + 1, enames[i].Count() - enames[i].LastIndexOf('_') -1); + enames[i] = values[i].ToString(); + if(underline_index != -1) + { + int start = IndexOfChar(enames[i], '_', underline_index) + 1; + keys[i] = enames[i].Substring(start, enames[i].Count() - start); + } + else + { + // 表明全部都是key + keys[i] = enames[i]; + } if (enames[i].Count() > maxEname) maxEname = enames[i].Count(); if (keys[i].Count() > maxKey) maxKey = keys[i].Count(); } - for(int i = 0; i < values.Count; ++i) + for (int i = 0; i < values.Count; ++i) { enums += "\t\t\t\t{ "; enums += ('"' + keys[i] + "\",").PadRight(maxKey + 4); @@ -183,17 +219,18 @@ namespace {1} return; string reg_class = @"(?<=Portable\<)[0-9a-zA-Z]+(?=\>)"; + string reg_abclass = @"(?<=LUAX_DECL_ABSTRACT_FACTORY\s*\(\s*)[0-9a-zA-Z]+(?=\s*\))"; string reg_methods = @"(?<=LUAX_DECL_METHOD\()[0-9a-zA-Z_]+(?=\))"; - string reg_enums = @"(?<=LUAX_DECL_ENUM\()[0-9a-zA-Z_]+(?=\))"; + string reg_enums = @"(?<=LUAX_DECL_ENUM\()[0-9a-zA-Z_]+(?=\s*[\),]+)"; string reg_namespace = @"(?<=namespace\s)[0-9a-zA-Z]+(?=[\s\n]*\{)"; - if(!Directory.Exists(dir + "/binding")) + if (!Directory.Exists(dir + "/binding")) { Directory.CreateDirectory(dir + "/binding"); } string[] files = Directory.GetFiles(dir); - for(int i = 0; i < files.Count(); ++i) + for (int i = 0; i < files.Count(); ++i) { string file = files[i]; if (!File.Exists(file)) @@ -204,14 +241,24 @@ namespace {1} if (File.Exists(bindingFile)) continue; string code = File.ReadAllText(file); - // + // 工厂和单例 Match m = Regex.Match(code, reg_class); + string className = ""; + if (m.Success) + { + className = m.ToString(); + } if (!m.Success) - continue; - string className = m.ToString(); + { + // 抽象类,不会继承Portable模板 + Match abstract_m = Regex.Match(code, reg_abclass); + if (!abstract_m.Success) + continue; + className = abstract_m.ToString(); + } MatchCollection mc = Regex.Matches(code, reg_namespace); // 应该两个名称空间 - if(mc.Count != 2) + if (mc.Count != 2) { Console.WriteLine("Error: 源文件没有两个名称空间 " + file); continue; @@ -227,7 +274,7 @@ namespace {1} mc = Regex.Matches(code, reg_methods); content += make_impl_methods(mc, className); string binding = String.Format(output, name, namespace1, namespace2, content); - Console.WriteLine("输出: "+bindingFile); + Console.WriteLine("输出: " + bindingFile); File.WriteAllText(bindingFile, binding); } } diff --git a/build/tools/bindingGen/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/build/tools/bindingGen/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index b89f8dd..78a75d8 100644 Binary files a/build/tools/bindingGen/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/build/tools/bindingGen/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/build/tools/bindingGen/obj/Debug/bindingGen.csproj.FileListAbsolute.txt b/build/tools/bindingGen/obj/Debug/bindingGen.csproj.FileListAbsolute.txt index 3656c65..091c0f8 100644 --- a/build/tools/bindingGen/obj/Debug/bindingGen.csproj.FileListAbsolute.txt +++ b/build/tools/bindingGen/obj/Debug/bindingGen.csproj.FileListAbsolute.txt @@ -8,3 +8,10 @@ D:\Asura\build\tools\bindingGen\obj\Debug\bindingGen.pdb D:\Asura\bin\win64\bindingGen.exe.config D:\Asura\bin\win64\bindingGen.exe D:\Asura\bin\win64\bindingGen.pdb +D:\Documents\VisualStudio2017\Projects\Asura\bin\win64\bindingGen.exe.config +D:\Documents\VisualStudio2017\Projects\Asura\bin\win64\bindingGen.exe +D:\Documents\VisualStudio2017\Projects\Asura\bin\win64\bindingGen.pdb +D:\Documents\VisualStudio2017\Projects\Asura\Build\tools\bindingGen\obj\Debug\bindingGen.csprojAssemblyReference.cache +D:\Documents\VisualStudio2017\Projects\Asura\Build\tools\bindingGen\obj\Debug\bindingGen.csproj.CoreCompileInputs.cache +D:\Documents\VisualStudio2017\Projects\Asura\Build\tools\bindingGen\obj\Debug\bindingGen.exe +D:\Documents\VisualStudio2017\Projects\Asura\Build\tools\bindingGen\obj\Debug\bindingGen.pdb diff --git a/build/tools/bindingGen/obj/Debug/bindingGen.exe b/build/tools/bindingGen/obj/Debug/bindingGen.exe index b196836..016c299 100644 Binary files a/build/tools/bindingGen/obj/Debug/bindingGen.exe and b/build/tools/bindingGen/obj/Debug/bindingGen.exe differ -- cgit v1.1-26-g67d0