Browse code

This fixes MSVS 2013 compilation.

* Tools version changed to 12
* Added comp.c/h and compat.c/h to project files
* Workaround for missing __attribute__ support

Also, as a preparation for MSVS2015, ensured that snprintf is not defined
for that VS version.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1443786401-30416-1-git-send-email-lstipakov@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10174

Signed-off-by: Gert Doering <gert@greenie.muc.de>

Lev Stipakov authored on 2015/10/02 20:46:41
Showing 5 changed files
... ...
@@ -90,7 +90,10 @@
90 90
 
91 91
 #define strncasecmp strnicmp
92 92
 #define strcasecmp _stricmp
93
+
94
+#if _MSC_VER<1900
93 95
 #define snprintf _snprintf
96
+#endif
94 97
 
95 98
 #if _MSC_VER < 1800
96 99
 #define strtoull strtoul
... ...
@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 3
   <ItemGroup Label="ProjectConfigurations">
4 4
     <ProjectConfiguration Include="Debug|Win32">
5 5
       <Configuration>Debug</Configuration>
... ...
@@ -20,10 +20,12 @@
20 20
     <ConfigurationType>StaticLibrary</ConfigurationType>
21 21
     <CharacterSet>MultiByte</CharacterSet>
22 22
     <WholeProgramOptimization>true</WholeProgramOptimization>
23
+    <PlatformToolset>v120</PlatformToolset>
23 24
   </PropertyGroup>
24 25
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
25 26
     <ConfigurationType>StaticLibrary</ConfigurationType>
26 27
     <CharacterSet>MultiByte</CharacterSet>
28
+    <PlatformToolset>v120</PlatformToolset>
27 29
   </PropertyGroup>
28 30
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
29 31
   <ImportGroup Label="ExtensionSettings">
... ...
@@ -84,4 +86,4 @@
84 84
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
85 85
   <ImportGroup Label="ExtensionTargets">
86 86
   </ImportGroup>
87
-</Project>
88 87
\ No newline at end of file
88
+</Project>
... ...
@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 3
   <ItemGroup Label="ProjectConfigurations">
4 4
     <ProjectConfiguration Include="Debug|Win32">
5 5
       <Configuration>Debug</Configuration>
... ...
@@ -20,10 +20,12 @@
20 20
     <ConfigurationType>Application</ConfigurationType>
21 21
     <WholeProgramOptimization>true</WholeProgramOptimization>
22 22
     <CharacterSet>Unicode</CharacterSet>
23
+    <PlatformToolset>v120</PlatformToolset>
23 24
   </PropertyGroup>
24 25
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
25 26
     <ConfigurationType>Application</ConfigurationType>
26 27
     <CharacterSet>Unicode</CharacterSet>
28
+    <PlatformToolset>v120</PlatformToolset>
27 29
   </PropertyGroup>
28 30
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
29 31
   <ImportGroup Label="ExtensionSettings">
... ...
@@ -100,6 +102,8 @@
100 100
     <ClCompile Include="base64.c" />
101 101
     <ClCompile Include="buffer.c" />
102 102
     <ClCompile Include="clinat.c" />
103
+    <ClCompile Include="comp.c" />
104
+    <ClCompile Include="compstub.c" />
103 105
     <ClCompile Include="console.c" />
104 106
     <ClCompile Include="crypto.c" />
105 107
     <ClCompile Include="crypto_openssl.c" />
... ...
@@ -168,6 +172,8 @@
168 168
     <ClInclude Include="buffer.h" />
169 169
     <ClInclude Include="circ_list.h" />
170 170
     <ClInclude Include="clinat.h" />
171
+    <ClInclude Include="comp.h" />
172
+    <ClInclude Include="compstub.h" />
171 173
     <ClInclude Include="common.h" />
172 174
     <ClInclude Include="console.h" />
173 175
     <ClInclude Include="crypto.h" />
... ...
@@ -260,4 +266,4 @@
260 260
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
261 261
   <ImportGroup Label="ExtensionTargets">
262 262
   </ImportGroup>
263
-</Project>
264 263
\ No newline at end of file
264
+</Project>
... ...
@@ -47,6 +47,7 @@
47 47
 
48 48
 #ifdef _MSC_VER // Visual Studio
49 49
 #define __func__ __FUNCTION__
50
+#define __attribute__(x)
50 51
 #endif
51 52
 
52 53
 #if defined(__APPLE__)
... ...
@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 3
   <ItemGroup Label="ProjectConfigurations">
4 4
     <ProjectConfiguration Include="Debug|Win32">
5 5
       <Configuration>Debug</Configuration>
... ...
@@ -20,10 +20,12 @@
20 20
     <ConfigurationType>Application</ConfigurationType>
21 21
     <CharacterSet>MultiByte</CharacterSet>
22 22
     <WholeProgramOptimization>true</WholeProgramOptimization>
23
+    <PlatformToolset>v120</PlatformToolset>
23 24
   </PropertyGroup>
24 25
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
25 26
     <ConfigurationType>Application</ConfigurationType>
26 27
     <CharacterSet>MultiByte</CharacterSet>
28
+    <PlatformToolset>v120</PlatformToolset>
27 29
   </PropertyGroup>
28 30
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
29 31
   <ImportGroup Label="ExtensionSettings">
... ...
@@ -109,4 +111,4 @@
109 109
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
110 110
   <ImportGroup Label="ExtensionTargets">
111 111
   </ImportGroup>
112
-</Project>
113 112
\ No newline at end of file
113
+</Project>