summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anylike.org>2010-01-03 16:19:01 +0000
committerChristian Pointner <equinox@anylike.org>2010-01-03 16:19:01 +0000
commitc89fa4d230dbdf2d3f12301a916a7b2373d2de14 (patch)
tree503d9d7116bc972dafee170c5c4ed1adf11e69b9
parentfinally found the gnutls_strerror function ;) (diff)
added Visual Studio Project
not working yet .. :(
-rw-r--r--README25
-rw-r--r--src/anylike.c6
-rw-r--r--src/datatypes.h11
-rw-r--r--src/win32/anylike.sln20
-rw-r--r--src/win32/anylike.suobin0 -> 13824 bytes
-rw-r--r--src/win32/anylike.vcproj275
-rw-r--r--src/win32/make_lua_bytecode.bat10
-rw-r--r--src/win32/make_version_h.bat22
8 files changed, 369 insertions, 0 deletions
diff --git a/README b/README
index f04ca4c..2da8920 100644
--- a/README
+++ b/README
@@ -51,6 +51,13 @@ using openssl:
security/openssl
+Windows
+-------
+
+common:
+ Visual Studio C++ (Express Edition is just fine)
+ lua-5.1.x
+
Installation
============
@@ -82,6 +89,24 @@ Notes:
- on FreeBSD you have to use gmake instead of make
+Building on Windows
+-------------------
+
+Download Lua 5.1 from www.lua.org and extract it inside the anylike
+root directory. Open the vcproj file inside src\win32 directory. Open
+the Visual Studio Prompt from the Tools menu and change to the Lua
+directory you just created (i.e.: cd c:\anylike\lua-5.1.4\).
+Use the following command to build lua:
+
+etc\luavs.bat
+
+After this there should be a lua51.lib as well as a lua.exe and a luac.exe
+inside the src directory of the Lua tree.
+Close the Command Prompt select the target (Release or Debug) and compile
+the project. Now there should be an anylike.exe inside src\win32\Release or
+src\win32\Debug depending on the target you have selected.
+
+
Installing
----------
diff --git a/src/anylike.c b/src/anylike.c
index 855a072..70f03c5 100644
--- a/src/anylike.c
+++ b/src/anylike.c
@@ -49,7 +49,9 @@
#include <gnutls/gnutls.h>
#endif
+#ifndef _MSC_VER
#include "daemon.h"
+#endif
#ifndef USE_OPENSSL
@@ -241,6 +243,7 @@ int main(int argc, char* argv[])
log_printf(NOTICE, "just started...");
options_parse_post(&opt);
+#ifndef _MSC_VER
priv_info_t priv;
if(opt.username_)
if(priv_init(&priv, opt.username_, opt.groupname_)) {
@@ -248,6 +251,7 @@ int main(int argc, char* argv[])
log_close();
exit(-1);
}
+#endif
#ifndef USE_OPENSSL
ret = init_gnutls();
@@ -259,6 +263,7 @@ int main(int argc, char* argv[])
}
#endif
+#ifndef _MSC_VER
FILE* pid_file = NULL;
if(opt.pid_file_) {
pid_file = fopen(opt.pid_file_, "w");
@@ -293,6 +298,7 @@ int main(int argc, char* argv[])
fprintf(pid_file, "%d", pid);
fclose(pid_file);
}
+#endif
ret = main_loop(&opt);
diff --git a/src/datatypes.h b/src/datatypes.h
index 051d62e..e9ee657 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -32,6 +32,7 @@
#ifndef ANYLIKE_datatypes_h_INCLUDED
#define ANYLIKE_datatypes_h_INCLUDED
+#ifndef _MSC_VER
#include <stdint.h>
typedef uint8_t u_int8_t;
@@ -42,6 +43,16 @@ typedef uint64_t u_int64_t;
/* typedef int16_t int16_t; */
/* typedef int32_t int32_t; */
/* typedef int64_t int64_t; */
+#else
+typedef signed __int8 int8_t;
+typedef unsigned __int8 u_int8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 u_int16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 u_int32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 u_int64_t;
+#endif
struct buffer_struct {
u_int32_t length_;
diff --git a/src/win32/anylike.sln b/src/win32/anylike.sln
new file mode 100644
index 0000000..fc673bc
--- /dev/null
+++ b/src/win32/anylike.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "anylike", "anylike.vcproj", "{5C3917F1-A0E2-46CE-AC2F-BB59A69AC320}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5C3917F1-A0E2-46CE-AC2F-BB59A69AC320}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5C3917F1-A0E2-46CE-AC2F-BB59A69AC320}.Debug|Win32.Build.0 = Debug|Win32
+ {5C3917F1-A0E2-46CE-AC2F-BB59A69AC320}.Release|Win32.ActiveCfg = Release|Win32
+ {5C3917F1-A0E2-46CE-AC2F-BB59A69AC320}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/win32/anylike.suo b/src/win32/anylike.suo
new file mode 100644
index 0000000..e215eb4
--- /dev/null
+++ b/src/win32/anylike.suo
Binary files differ
diff --git a/src/win32/anylike.vcproj b/src/win32/anylike.vcproj
new file mode 100644
index 0000000..3240d64
--- /dev/null
+++ b/src/win32/anylike.vcproj
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="anylike"
+ ProjectGUID="{5C3917F1-A0E2-46CE-AC2F-BB59A69AC320}"
+ RootNamespace="anylike"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ Description="Generating Lua Bytecode and version.h"
+ CommandLine="cd .. &amp;&amp; win32\make_lua_bytecode.bat ..\lua-5.1.4 &amp;&amp; win32\make_version_h.bat &amp;&amp; cd win32"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;..\..\lua-5.1.4\src&quot;"
+ PreprocessorDefinitions="USE_OPENSSL"
+ MinimalRebuild="true"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="false"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="..\..\lua-5.1.4\src\lua51.lib"
+ GenerateDebugInformation="true"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ Description="Generating Lua Bytecode and version.h"
+ CommandLine="cd .. &amp;&amp; win32\make_lua_bytecode.bat ..\lua-5.1.4 &amp;&amp; win32\make_version_h.bat &amp;&amp; cd win32"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="&quot;..\..\lua-5.1.4\src&quot;"
+ PreprocessorDefinitions="USE_OPENSSL"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ TreatWChar_tAsBuiltInType="false"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="..\..\lua-5.1.4\src\lua51.lib"
+ GenerateDebugInformation="true"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Quelldateien"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\anylike.c"
+ >
+ </File>
+ <File
+ RelativePath="..\anylike_lua_bytecode.c"
+ >
+ </File>
+ <File
+ RelativePath="..\l_crypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\l_log.c"
+ >
+ </File>
+ <File
+ RelativePath="..\l_sig_handler.c"
+ >
+ </File>
+ <File
+ RelativePath="..\log.c"
+ >
+ </File>
+ <File
+ RelativePath="..\options.c"
+ >
+ </File>
+ <File
+ RelativePath="..\sig_handler.c"
+ >
+ </File>
+ <File
+ RelativePath="..\string_list.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Headerdateien"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\daemon.h"
+ >
+ </File>
+ <File
+ RelativePath="..\datatypes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\l_crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\l_log.h"
+ >
+ </File>
+ <File
+ RelativePath="..\l_sig_handler.h"
+ >
+ </File>
+ <File
+ RelativePath="..\log.h"
+ >
+ </File>
+ <File
+ RelativePath="..\log_targets.h"
+ >
+ </File>
+ <File
+ RelativePath="..\options.h"
+ >
+ </File>
+ <File
+ RelativePath="..\sig_handler.h"
+ >
+ </File>
+ <File
+ RelativePath="..\string_list.h"
+ >
+ </File>
+ <File
+ RelativePath="..\version.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Ressourcendateien"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/win32/make_lua_bytecode.bat b/src/win32/make_lua_bytecode.bat
new file mode 100644
index 0000000..f9a8e61
--- /dev/null
+++ b/src/win32/make_lua_bytecode.bat
@@ -0,0 +1,10 @@
+@echo off
+
+@setlocal
+@set LUATOP=%1
+@set LUA_BYTECODE=anylike.lc
+@set LUA_BYTECODE_SRC=anylike_lua_bytecode
+@set LUA_SRC=main_loop.lua echo_server.lua
+
+%LUATOP%\src\luac.exe -o %LUA_BYTECODE% %LUA_SRC%
+%LUATOP%\src\lua.exe ..\tools\bin2c.lua %LUA_BYTECODE% %LUA_BYTECODE_SRC% > %LUA_BYTECODE_SRC%.c \ No newline at end of file
diff --git a/src/win32/make_version_h.bat b/src/win32/make_version_h.bat
new file mode 100644
index 0000000..f68f52e
--- /dev/null
+++ b/src/win32/make_version_h.bat
@@ -0,0 +1,22 @@
+@echo off
+
+@setlocal
+@set /p VERSION=<..\version
+@set OUTPUT_FILE=version.h
+
+echo /* > %OUTPUT_FILE%
+echo * anylike version info >> %OUTPUT_FILE%
+echo * >> %OUTPUT_FILE%
+echo * this file was created automatically >> %OUTPUT_FILE%
+echo * do not edit this file directly >> %OUTPUT_FILE%
+echo * use win32/make_version_h.bat instead >> %OUTPUT_FILE%
+echo */ >> %OUTPUT_FILE%
+echo. >> %OUTPUT_FILE%
+echo #ifndef ANYLIKE_version_h_INCLUDED >> %OUTPUT_FILE%
+echo #define ANYLIKE_version_h_INCLUDED >> %OUTPUT_FILE%
+echo. >> %OUTPUT_FILE%
+echo #define VERSION_STRING_0 "anylike version %VERSION%" >> %OUTPUT_FILE%
+echo #define VERSION_STRING_1 "built on %COMPUTERNAME%, %DATE% %TIME%" >> %OUTPUT_FILE%
+echo. >> %OUTPUT_FILE%
+echo #endif >> %OUTPUT_FILE%
+