Browse Source

msvc sorting hack

Karel Miko 8 years ago
parent
commit
df258453ba
3 changed files with 224 additions and 211 deletions
  1. 14 1
      helper.pl
  2. 104 104
      libtomcrypt_VS2005.vcproj
  3. 106 106
      libtomcrypt_VS2008.vcproj

+ 14 - 1
helper.pl

@@ -74,8 +74,21 @@ sub prepare_msvc_files_xml {
   my ($all, $exclude_re, $targets) = @_;
   my $last = [];
   my $depth = 2;
+
+  # sort files in the same order as visual studio (ugly, I know)
+  my @parts = ();
+  for my $orig (@$all) {
+    my $p = $orig;
+    $p =~ s|/|/~|g;
+    $p =~ s|/~([^/]+)$|/$1|g;
+    # now we have: 'src/pk/rsa/rsa_verify_hash.c' > 'src/~pk/~rsa/rsa_verify_hash.c'
+    my @l = map { sprintf "% -99s", $_ } split /\//, $p;
+    push @parts, [ $orig, join(':', @l) ];
+  }
+  my @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] } @parts;
+
   my $files = "<Files>\r\n";
-  for my $full (sort @$all) {
+  for my $full (@sorted) {
     my @items = split /\//, $full; # split by '/'
     $full =~ s|/|\\|g;             # replace '/' bt '\'
     shift @items; # drop first one (src)

+ 104 - 104
libtomcrypt_VS2005.vcproj

@@ -170,38 +170,6 @@
 		<Filter
 			Name="ciphers"
 			>
-			<Filter
-				Name="aes"
-				>
-				<File
-					RelativePath="src\ciphers\aes\aes.c"
-					>
-				</File>
-				<File
-					RelativePath="src\ciphers\aes\aes_tab.c"
-					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						ExcludedFromBuild="true"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						ExcludedFromBuild="true"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-			</Filter>
 			<File
 				RelativePath="src\ciphers\anubis.c"
 				>
@@ -254,6 +222,46 @@
 				RelativePath="src\ciphers\rc6.c"
 				>
 			</File>
+			<File
+				RelativePath="src\ciphers\skipjack.c"
+				>
+			</File>
+			<File
+				RelativePath="src\ciphers\xtea.c"
+				>
+			</File>
+			<Filter
+				Name="aes"
+				>
+				<File
+					RelativePath="src\ciphers\aes\aes.c"
+					>
+				</File>
+				<File
+					RelativePath="src\ciphers\aes\aes_tab.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
 			<Filter
 				Name="safer"
 				>
@@ -290,10 +298,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\ciphers\skipjack.c"
-				>
-			</File>
 			<Filter
 				Name="twofish"
 				>
@@ -326,10 +330,6 @@
 					</FileConfiguration>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\ciphers\xtea.c"
-				>
-			</File>
 		</Filter>
 		<Filter
 			Name="encauth"
@@ -566,34 +566,6 @@
 		<Filter
 			Name="hashes"
 			>
-			<Filter
-				Name="chc"
-				>
-				<File
-					RelativePath="src\hashes\chc\chc.c"
-					>
-				</File>
-			</Filter>
-			<Filter
-				Name="helper"
-				>
-				<File
-					RelativePath="src\hashes\helper\hash_file.c"
-					>
-				</File>
-				<File
-					RelativePath="src\hashes\helper\hash_filehandle.c"
-					>
-				</File>
-				<File
-					RelativePath="src\hashes\helper\hash_memory.c"
-					>
-				</File>
-				<File
-					RelativePath="src\hashes\helper\hash_memory_multi.c"
-					>
-				</File>
-			</Filter>
 			<File
 				RelativePath="src\hashes\md2.c"
 				>
@@ -626,6 +598,38 @@
 				RelativePath="src\hashes\sha1.c"
 				>
 			</File>
+			<File
+				RelativePath="src\hashes\tiger.c"
+				>
+			</File>
+			<Filter
+				Name="chc"
+				>
+				<File
+					RelativePath="src\hashes\chc\chc.c"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="helper"
+				>
+				<File
+					RelativePath="src\hashes\helper\hash_file.c"
+					>
+				</File>
+				<File
+					RelativePath="src\hashes\helper\hash_filehandle.c"
+					>
+				</File>
+				<File
+					RelativePath="src\hashes\helper\hash_memory.c"
+					>
+				</File>
+				<File
+					RelativePath="src\hashes\helper\hash_memory_multi.c"
+					>
+				</File>
+			</Filter>
 			<Filter
 				Name="sha2"
 				>
@@ -654,10 +658,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\hashes\tiger.c"
-				>
-			</File>
 			<Filter
 				Name="whirl"
 				>
@@ -938,14 +938,6 @@
 		<Filter
 			Name="math"
 			>
-			<Filter
-				Name="fp"
-				>
-				<File
-					RelativePath="src\math\fp\ltc_ecc_fp_mulmod.c"
-					>
-				</File>
-			</Filter>
 			<File
 				RelativePath="src\math\gmp_desc.c"
 				>
@@ -970,6 +962,14 @@
 				RelativePath="src\math\tfm_desc.c"
 				>
 			</File>
+			<Filter
+				Name="fp"
+				>
+				<File
+					RelativePath="src\math\fp\ltc_ecc_fp_mulmod.c"
+					>
+				</File>
+			</Filter>
 		</Filter>
 		<Filter
 			Name="misc"
@@ -978,6 +978,30 @@
 				RelativePath="src\misc\adler32.c"
 				>
 			</File>
+			<File
+				RelativePath="src\misc\burn_stack.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\crc32.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\error_to_string.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\mem_neq.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\pk_get_oid.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\zeromem.c"
+				>
+			</File>
 			<Filter
 				Name="base64"
 				>
@@ -990,14 +1014,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\misc\burn_stack.c"
-				>
-			</File>
-			<File
-				RelativePath="src\misc\crc32.c"
-				>
-			</File>
 			<Filter
 				Name="crypt"
 				>
@@ -1110,10 +1126,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\misc\error_to_string.c"
-				>
-			</File>
 			<Filter
 				Name="hkdf"
 				>
@@ -1126,14 +1138,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\misc\mem_neq.c"
-				>
-			</File>
-			<File
-				RelativePath="src\misc\pk_get_oid.c"
-				>
-			</File>
 			<Filter
 				Name="pkcs5"
 				>
@@ -1150,10 +1154,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\misc\zeromem.c"
-				>
-			</File>
 		</Filter>
 		<Filter
 			Name="modes"

+ 106 - 106
libtomcrypt_VS2008.vcproj

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="9.00"
+	Version="9,00"
 	Name="libtomcrypt"
 	ProjectGUID="{E3802982-DCB6-4D85-A2BD-6B08F0657E79}"
 	RootNamespace="libtomcrypt"
@@ -120,7 +120,7 @@
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="src\headers,..\libtommath"
-				PreprocessorDefinitions="NDEBUG;LTM_DESC;WIN32;_LIB;LTC_SOURCE;USE_LTM"
+				PreprocessorDefinitions="NDEBUG;LTM_DESC;WIN32;_LIB;LTC_SOURCE;USE_LTM;;LTC_NO_TEST"
 				StringPooling="true"
 				RuntimeLibrary="0"
 				EnableFunctionLevelLinking="true"
@@ -172,38 +172,6 @@
 		<Filter
 			Name="ciphers"
 			>
-			<Filter
-				Name="aes"
-				>
-				<File
-					RelativePath="src\ciphers\aes\aes.c"
-					>
-				</File>
-				<File
-					RelativePath="src\ciphers\aes\aes_tab.c"
-					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						ExcludedFromBuild="true"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						ExcludedFromBuild="true"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-			</Filter>
 			<File
 				RelativePath="src\ciphers\anubis.c"
 				>
@@ -256,6 +224,46 @@
 				RelativePath="src\ciphers\rc6.c"
 				>
 			</File>
+			<File
+				RelativePath="src\ciphers\skipjack.c"
+				>
+			</File>
+			<File
+				RelativePath="src\ciphers\xtea.c"
+				>
+			</File>
+			<Filter
+				Name="aes"
+				>
+				<File
+					RelativePath="src\ciphers\aes\aes.c"
+					>
+				</File>
+				<File
+					RelativePath="src\ciphers\aes\aes_tab.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
 			<Filter
 				Name="safer"
 				>
@@ -292,10 +300,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\ciphers\skipjack.c"
-				>
-			</File>
 			<Filter
 				Name="twofish"
 				>
@@ -328,10 +332,6 @@
 					</FileConfiguration>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\ciphers\xtea.c"
-				>
-			</File>
 		</Filter>
 		<Filter
 			Name="encauth"
@@ -568,34 +568,6 @@
 		<Filter
 			Name="hashes"
 			>
-			<Filter
-				Name="chc"
-				>
-				<File
-					RelativePath="src\hashes\chc\chc.c"
-					>
-				</File>
-			</Filter>
-			<Filter
-				Name="helper"
-				>
-				<File
-					RelativePath="src\hashes\helper\hash_file.c"
-					>
-				</File>
-				<File
-					RelativePath="src\hashes\helper\hash_filehandle.c"
-					>
-				</File>
-				<File
-					RelativePath="src\hashes\helper\hash_memory.c"
-					>
-				</File>
-				<File
-					RelativePath="src\hashes\helper\hash_memory_multi.c"
-					>
-				</File>
-			</Filter>
 			<File
 				RelativePath="src\hashes\md2.c"
 				>
@@ -628,6 +600,38 @@
 				RelativePath="src\hashes\sha1.c"
 				>
 			</File>
+			<File
+				RelativePath="src\hashes\tiger.c"
+				>
+			</File>
+			<Filter
+				Name="chc"
+				>
+				<File
+					RelativePath="src\hashes\chc\chc.c"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="helper"
+				>
+				<File
+					RelativePath="src\hashes\helper\hash_file.c"
+					>
+				</File>
+				<File
+					RelativePath="src\hashes\helper\hash_filehandle.c"
+					>
+				</File>
+				<File
+					RelativePath="src\hashes\helper\hash_memory.c"
+					>
+				</File>
+				<File
+					RelativePath="src\hashes\helper\hash_memory_multi.c"
+					>
+				</File>
+			</Filter>
 			<Filter
 				Name="sha2"
 				>
@@ -656,10 +660,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\hashes\tiger.c"
-				>
-			</File>
 			<Filter
 				Name="whirl"
 				>
@@ -940,14 +940,6 @@
 		<Filter
 			Name="math"
 			>
-			<Filter
-				Name="fp"
-				>
-				<File
-					RelativePath="src\math\fp\ltc_ecc_fp_mulmod.c"
-					>
-				</File>
-			</Filter>
 			<File
 				RelativePath="src\math\gmp_desc.c"
 				>
@@ -972,6 +964,14 @@
 				RelativePath="src\math\tfm_desc.c"
 				>
 			</File>
+			<Filter
+				Name="fp"
+				>
+				<File
+					RelativePath="src\math\fp\ltc_ecc_fp_mulmod.c"
+					>
+				</File>
+			</Filter>
 		</Filter>
 		<Filter
 			Name="misc"
@@ -980,6 +980,30 @@
 				RelativePath="src\misc\adler32.c"
 				>
 			</File>
+			<File
+				RelativePath="src\misc\burn_stack.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\crc32.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\error_to_string.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\mem_neq.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\pk_get_oid.c"
+				>
+			</File>
+			<File
+				RelativePath="src\misc\zeromem.c"
+				>
+			</File>
 			<Filter
 				Name="base64"
 				>
@@ -992,14 +1016,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\misc\burn_stack.c"
-				>
-			</File>
-			<File
-				RelativePath="src\misc\crc32.c"
-				>
-			</File>
 			<Filter
 				Name="crypt"
 				>
@@ -1112,10 +1128,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\misc\error_to_string.c"
-				>
-			</File>
 			<Filter
 				Name="hkdf"
 				>
@@ -1128,14 +1140,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\misc\mem_neq.c"
-				>
-			</File>
-			<File
-				RelativePath="src\misc\pk_get_oid.c"
-				>
-			</File>
 			<Filter
 				Name="pkcs5"
 				>
@@ -1152,10 +1156,6 @@
 					>
 				</File>
 			</Filter>
-			<File
-				RelativePath="src\misc\zeromem.c"
-				>
-			</File>
 		</Filter>
 		<Filter
 			Name="modes"