From 1ce9aa236ee2f357f3599b5fee4c4a2f87237411 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Mon, 9 Oct 2017 15:06:25 +0400 Subject: [PATCH] Building under Windows. Initial commit. --- OSlibs/win/mingw.h | 2 + iguana/exchanges/LP_coins.c | 4 +- iguana/exchanges/mm.c | 8 +- iguana/exchanges/stats.c | 20 ++- marketmaker.sln | 28 ++++ marketmaker.vcxproj | 257 +++++++++++++++++++++++++++++++ marketmaker.vcxproj.filters | 297 ++++++++++++++++++++++++++++++++++++ 7 files changed, 612 insertions(+), 4 deletions(-) create mode 100644 marketmaker.sln create mode 100644 marketmaker.vcxproj create mode 100644 marketmaker.vcxproj.filters diff --git a/OSlibs/win/mingw.h b/OSlibs/win/mingw.h index 6be81f99b..aa5ae5274 100755 --- a/OSlibs/win/mingw.h +++ b/OSlibs/win/mingw.h @@ -38,6 +38,8 @@ * @author - fadedreamz@gmail.com */ //TODO: need to update other values to match with WSAPoll() function +#define POLLRDNORM 0x0100 +#define POLLRDBAND 0x0200 #define POLLIN POLLRDNORM | POLLRDBAND /* There is data to read */ #define POLLOUT POLLWRNORM /* Writing now will not block */ #else diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index e1eca4ab0..6cc7fe983 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -96,7 +96,7 @@ void LP_statefname(char *fname,char *symbol,char *assetname,char *str,char *name #endif if ( strcmp(symbol,"BTC") == 0 ) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(NATIVE_WINDOWS) strcat(fname,"Bitcoin"); #else strcat(fname,".bitcoin"); @@ -120,7 +120,7 @@ void LP_statefname(char *fname,char *symbol,char *assetname,char *str,char *name } else { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(NATIVE_WINDOWS) strcat(fname,"Komodo"); #else strcat(fname,".komodo"); diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index 618b9d494..84758ac24 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -22,7 +22,13 @@ #define FROM_MARKETMAKER #include #include -#include "OS_portable.h" +#ifndef NATIVE_WINDOWS + #include "OS_portable.h" +#else + #include "../../crypto777/OS_portable.h" +#endif // !_WIN_32 + + #define MAX(a,b) ((a) > (b) ? (a) : (b)) char *stats_JSON(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,char *remoteaddr,uint16_t port); #include "stats.c" diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 81562a46c..94a99ab53 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -19,6 +19,8 @@ // Copyright © 2017 SuperNET. All rights reserved. // + + #include #include #include "../../crypto777/OS_portable.h" @@ -70,7 +72,23 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) * it is standard posix function and is correctly supported in win32/win64/linux * @author - fadedreamz@gmail.com */ + + + #if defined(_M_X64) + typedef struct addrinfo + { + int ai_flags; // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST + int ai_family; // PF_xxx + int ai_socktype; // SOCK_xxx + int ai_protocol; // 0 or IPPROTO_xxx for IPv4 and IPv6 + size_t ai_addrlen; // Length of ai_addr + char * ai_canonname; // Canonical name for nodename + _Field_size_bytes_(ai_addrlen) struct sockaddr * ai_addr; // Binary address + struct addrinfo * ai_next; // Next structure in linked list + } + ADDRINFOA, *PADDRINFOA; + struct addrinfo *addrresult = NULL; struct addrinfo *returnptr = NULL; struct addrinfo hints; @@ -82,7 +100,7 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; #endif - + if ( parse_ipaddr(ipaddr,hostname) != 0 ) port = parse_ipaddr(ipaddr,hostname); diff --git a/marketmaker.sln b/marketmaker.sln new file mode 100644 index 000000000..98097205c --- /dev/null +++ b/marketmaker.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "marketmaker", "marketmaker.vcxproj", "{BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}.Debug|x64.ActiveCfg = Debug|x64 + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}.Debug|x64.Build.0 = Debug|x64 + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}.Debug|x86.ActiveCfg = Debug|Win32 + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}.Debug|x86.Build.0 = Debug|Win32 + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}.Release|x64.ActiveCfg = Release|x64 + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}.Release|x64.Build.0 = Release|x64 + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}.Release|x86.ActiveCfg = Release|Win32 + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/marketmaker.vcxproj b/marketmaker.vcxproj new file mode 100644 index 000000000..20a6dec01 --- /dev/null +++ b/marketmaker.vcxproj @@ -0,0 +1,257 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {BE4A118A-115D-44B5-B9D9-AD17C1C1AAE8} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + $(ProjectDir)\includes;$(ProjectDir)\includes\curl;$(IncludePath) + $(ProjectDir)\OSlibs\win;$(LibraryPath) + + + true + $(SolutionDir)/includes;$(SolutionDir)/includes/curl;$(IncludePath) + + + false + $(ProjectDir)\includes;$(ProjectDir)\includes\curl;$(IncludePath) + $(ProjectDir)\OSlibs\win;$(LibraryPath) + + + false + false + $(ProjectDir)\includes;$(ProjectDir)\includes\curl;$(IncludePath) + + + + + + Level2 + Disabled + _CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;_DEBUG;_CONSOLE;IGUANA_LOG2PACKETSIZE=20;IGUANA_MAXPACKETSIZE=1572864;%(PreprocessorDefinitions) + 1Byte + .\iguana;%(AdditionalIncludeDirectories) + + + Console + true + Ws2_32.lib;pthreadVC2.lib;nanomsg.lib;libcurl.lib;%(AdditionalDependencies) + .\iguana;.\OSlibs\win;%(AdditionalLibraryDirectories) + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;NATIVE_WINDOWS;WIN32;IGUANA_LOG2PACKETSIZE=20;IGUANA_MAXPACKETSIZE=1572864;%(PreprocessorDefinitions) + 1Byte + + + Console + true + .\OSlibs\win\x64;%(AdditionalLibraryDirectories) + pthread_lib.lib;Ws2_32.lib;nanomsg.lib;libcurl.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + _CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;_CONSOLE;NDEBUG;IGUANA_LOG2PACKETSIZE=20;IGUANA_MAXPACKETSIZE=1572864;%(PreprocessorDefinitions) + 1Byte + + + MachineX86 + true + Console + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN64;_WIN64;_CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;_CONSOLE;NDEBUG;IGUANA_LOG2PACKETSIZE=20;IGUANA_MAXPACKETSIZE=1572864;%(PreprocessorDefinitions) + 1Byte + MultiThreaded + + + Console + true + true + true + Ws2_32.lib;Advapi32.lib;$(SolutionDir)OSlibs\win\x64\pthread_lib.lib;libcurl.lib;nanomsg.lib;%(AdditionalDependencies) + .\OSlibs\win\x64\release;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/marketmaker.vcxproj.filters b/marketmaker.vcxproj.filters new file mode 100644 index 000000000..7875d7cf3 --- /dev/null +++ b/marketmaker.vcxproj.filters @@ -0,0 +1,297 @@ + + + + + {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;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + \ No newline at end of file