summary refs log tree commit diff stats
path: root/win32/version
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-06-03 12:06:06 +0200
committerBerke Viktor <berkeviktor@aol.com>2012-06-03 12:06:06 +0200
commit39422d5503281030d712c39af25317b5e3ece0fe (patch)
treea7cece0454b70cf22b3d01e452ac77e5776e48b6 /win32/version
parent4f73128e9b71a786a57acac1aa0572e8ecefb915 (diff)
Initial Visual Studio solution
Diffstat (limited to 'win32/version')
-rw-r--r--win32/version/version.c144
-rw-r--r--win32/version/version.vcxproj93
-rw-r--r--win32/version/version.vcxproj.filters14
3 files changed, 251 insertions, 0 deletions
diff --git a/win32/version/version.c b/win32/version/version.c
new file mode 100644
index 00000000..d9e1ef9f
--- /dev/null
+++ b/win32/version/version.c
@@ -0,0 +1,144 @@
+/* XChat-WDK
+ * Copyright (c) 2011 Berke Viktor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+#include "../../config.h"
+
+char *
+comma ()
+{
+	int major, minor;
+	char *version_string; /* nnnn,n,n,n format */
+
+	version_string = (char*) malloc (11);
+
+	if (sscanf (PACKAGE_VERSION, "%d-%d", &major, &minor) > 1)
+	{
+		sprintf (version_string, "%d,%d,0,0", major, minor);
+	} else
+	{
+		sprintf (version_string, "%d,0,0,0", major);
+	}
+
+	return version_string;
+}
+
+char *
+point ()
+{
+	int major1, major2, major3, major4, minor;
+	char *version_string; /* nn.nn.nn.nn format */
+
+	version_string = (char*) malloc (12);
+
+	if (sscanf (PACKAGE_VERSION, "%c%c%c%c-%d", &major1, &major2, &major3, &major4, &minor) > 4)
+	{
+		sprintf (version_string, "%c%c.%c%c.%d.0", major1, major2, major3, major4, minor);
+	} else
+	{
+		sprintf (version_string, "%c%c.%c%c.0.0", major1, major2, major3, major4);
+	}
+
+	return version_string;
+}
+
+int
+main (int argc, char *argv[])
+{
+	if (argc > 1)
+	{
+		if (!strcmp (argv[1], "-r"))			/* xchat.rc/FILEVERSION, PRODUCTVERSION */
+		{
+			printf ("#define COMMA_VERSION %s\n", comma ());
+		}
+		else if (!strcmp (argv[1], "-a32"))	/* xchat-wdk.iss/AppVerName */
+		{
+			printf ("AppVerName=XChat-WDK %s (x86)\n", PACKAGE_VERSION);
+		}
+		else if (!strcmp (argv[1], "-a64"))	/* xchat-wdk.iss/AppVerName */
+		{
+			printf ("AppVerName=XChat-WDK %s (x64)\n", PACKAGE_VERSION);
+		}
+		else if (!strcmp (argv[1], "-v"))	/* xchat-wdk.iss/AppVersion */
+		{
+			printf ("AppVersion=%s\n", point ());
+		}
+		else if (!strcmp (argv[1], "-i"))	/* xchat-wdk.iss/VersionInfoVersion */
+		{
+			printf ("VersionInfoVersion=%s\n", point ());
+		}
+		else if (!strcmp (argv[1], "-o32"))	/* xchat-wdk.iss/OutputBaseFilename */
+		{
+			printf ("OutputBaseFilename=XChat-WDK %s x86\n", PACKAGE_VERSION);
+		}
+		else if (!strcmp (argv[1], "-o64"))	/* xchat-wdk.iss/OutputBaseFilename */
+		{
+			printf ("OutputBaseFilename=XChat-WDK %s x64\n", PACKAGE_VERSION);
+		}
+		else if (!strcmp (argv[1], "-v"))	/* version.txt */
+		{
+			printf ("%s", PACKAGE_VERSION);
+		} else
+		{
+			printf ("usage:\n\t-a\txchat-wdk.iss/AppVerName\n\t-i\txchat-wdk.iss/VersionInfoVersion\n\t-o\txchat-wdk.iss/OutputBaseFilename\n\t-r\txchat.rc/FILEVERSION, PRODUCTVERSION\n\t-v\txchat-wdk.iss/AppVersion\n");
+		}
+	} else
+	{
+		printf ("usage:\n\t-a\txchat-wdk.iss/AppVerName\n\t-i\txchat-wdk.iss/VersionInfoVersion\n\t-o\txchat-wdk.iss/OutputBaseFilename\n\t-r\txchat.rc/FILEVERSION, PRODUCTVERSION\n\t-v\txchat-wdk.iss/AppVersion\n");
+	}
+
+#if 0 /* ugly hack */
+	switch ((int) argv[1][0])
+	{
+		case 'r':	/* xchat.rc/FILEVERSION, PRODUCTVERSION*/
+			printf ("#define COMMA_VERSION \"%s\"\n", comma ());
+			break;
+		case 'a':	/* xchat-wdk.iss/AppVerName */
+			printf ("AppVerName=XChat-WDK %s\n", PACKAGE_VERSION);
+			break;
+		case 'v':	/* xchat-wdk.iss/AppVersion */
+			printf ("AppVersion=%s\n", point ());
+			break;
+		case 'i':	/* xchat-wdk.iss/VersionInfoVersion */
+			printf ("VersionInfoVersion=%s\n", point ());
+			break;
+		case 'o':	/* xchat-wdk.iss/OutputBaseFilename */
+			printf ("OutputBaseFilename=XChat-WDK %s\n", PACKAGE_VERSION);
+			break;
+		case 'u':	/* version.txt */
+			printf ("%s", PACKAGE_VERSION);
+			break;
+		default:
+			printf ("use a, i, o, r or v.\n");
+			break;
+	}
+#endif
+
+	return 0;
+}
diff --git a/win32/version/version.vcxproj b/win32/version/version.vcxproj
new file mode 100644
index 00000000..0498c72f
--- /dev/null
+++ b/win32/version/version.vcxproj
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>

+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+  <ItemGroup Label="ProjectConfigurations">

+    <ProjectConfiguration Include="Debug|Win32">

+      <Configuration>Debug</Configuration>

+      <Platform>Win32</Platform>

+    </ProjectConfiguration>

+    <ProjectConfiguration Include="Release|Win32">

+      <Configuration>Release</Configuration>

+      <Platform>Win32</Platform>

+    </ProjectConfiguration>

+  </ItemGroup>

+  <ItemGroup>

+    <ClCompile Include="version.c" />

+  </ItemGroup>

+  <PropertyGroup Label="Globals">

+    <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>

+  </PropertyGroup>

+  <PropertyGroup Label="Globals">

+    <ProjectGuid>{B724C127-7151-421A-8CA0-3FBA6D96D8CE}</ProjectGuid>

+    <Keyword>Win32Proj</Keyword>

+    <RootNamespace>version</RootNamespace>

+  </PropertyGroup>

+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

+    <ConfigurationType>Application</ConfigurationType>

+    <UseDebugLibraries>true</UseDebugLibraries>

+    <PlatformToolset>v110</PlatformToolset>

+    <CharacterSet>Unicode</CharacterSet>

+  </PropertyGroup>

+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

+    <ConfigurationType>Application</ConfigurationType>

+    <UseDebugLibraries>false</UseDebugLibraries>

+    <PlatformToolset>v110</PlatformToolset>

+    <WholeProgramOptimization>true</WholeProgramOptimization>

+    <CharacterSet>MultiByte</CharacterSet>

+  </PropertyGroup>

+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

+  <ImportGroup Label="ExtensionSettings">

+  </ImportGroup>

+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

+    <Import Project="..\xchat.props" />

+  </ImportGroup>

+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

+    <Import Project="..\xchat.props" />

+  </ImportGroup>

+  <PropertyGroup Label="UserMacros" />

+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

+    <LinkIncremental>true</LinkIncremental>

+  </PropertyGroup>

+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

+    <LinkIncremental>false</LinkIncremental>

+  </PropertyGroup>

+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

+    <ClCompile>

+      <PrecompiledHeader>

+      </PrecompiledHeader>

+      <WarningLevel>Level3</WarningLevel>

+      <Optimization>Disabled</Optimization>

+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+    </ClCompile>

+    <Link>

+      <SubSystem>Console</SubSystem>

+      <GenerateDebugInformation>true</GenerateDebugInformation>

+    </Link>

+  </ItemDefinitionGroup>

+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

+    <ClCompile>

+      <WarningLevel>Level3</WarningLevel>

+      <PrecompiledHeader>

+      </PrecompiledHeader>

+      <Optimization>MaxSpeed</Optimization>

+      <FunctionLevelLinking>true</FunctionLevelLinking>

+      <IntrinsicFunctions>true</IntrinsicFunctions>

+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+      <CompileAs>CompileAsC</CompileAs>

+    </ClCompile>

+    <Link>

+      <SubSystem>Console</SubSystem>

+      <GenerateDebugInformation>true</GenerateDebugInformation>

+      <EnableCOMDATFolding>true</EnableCOMDATFolding>

+      <OptimizeReferences>true</OptimizeReferences>

+    </Link>

+    <PostBuildEvent>

+      <Command>"$(OutputPath)\$(TargetName)$(TargetExt)" -r &gt; "$(SolutionDir)\..\resource.h"</Command>

+    </PostBuildEvent>

+  </ItemDefinitionGroup>

+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+  <ImportGroup Label="ExtensionTargets">

+  </ImportGroup>

+</Project>
\ No newline at end of file
diff --git a/win32/version/version.vcxproj.filters b/win32/version/version.vcxproj.filters
new file mode 100644
index 00000000..decec7d0
--- /dev/null
+++ b/win32/version/version.vcxproj.filters
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>

+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+  <ItemGroup>

+    <Filter Include="Source Files">

+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>

+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>

+    </Filter>

+  </ItemGroup>

+  <ItemGroup>

+    <ClCompile Include="version.c">

+      <Filter>Source Files</Filter>

+    </ClCompile>

+  </ItemGroup>

+</Project>
\ No newline at end of file