diff --git a/src/win32/Make-tests b/src/win32/Make-tests new file mode 100644 index 0000000..d4a569e --- /dev/null +++ b/src/win32/Make-tests @@ -0,0 +1,62 @@ +# Windows makefile +# -- +# use mingw make +# Get make-3.82-5-mingw32-bin.tar.lzma from +# http://sourceforge.net/projects/mingw/files/MinGW/Extension/make/make-3.82-mingw32/ +# -- +# Set CC=gcc or CC=cl for the pre-defined compilers +# before using this Makefile +# -- +# Compile and link the bandwidth and random tests. +# Build modbus.dll and the import library before building the tests +# modbus.lib/libmodbus.a (the import library) should be in this directory +# modbus.dll should be in this directory or in path + +INCLUDES:=-I../.. -I.. -I. + +ifeq ($(CC),cl) +DEFS+=-D_CRT_SECURE_NO_DEPRECATE=1 -D_CRT_NONSTDC_NO_DEPRECATE=1 +CFLAGS=-Zi -W3 -MT -ID:/include/msvc_std +LDOPTS=-link -incremental:NO +LDLIBS=-Fe$@ ws2_32.lib modbus.lib $(LDOPTS) +RES:=res +RCOUT= +endif + +ifeq ($(CC),gcc) +CFLAGS=-g -Wall -O -static -static-libgcc +LDLIBS=-o$@ -lws2_32 -luser32 -L. -lmodbus +LDOPTS= +RES:=o +RCOUT=-o$@ +endif + +CFLAGS+=-DHAVE_CONFIG_H $(DEFS) $(INCLUDES) + +.SUFFIXES: +.SUFFIXES: .c .rc .$(RES) .$(oo) + +# pattern rule for resources +%.$(RES) : %.rc + $(RC) $< $(RCOUT) + +vpath %.c ../../tests +vpath %.h ../src + +all: random-test-client random-test-server bandwidth-client bandwidth-server-one + +random-test-client: random-test-client.c + $(LINK.c) $^ $(LDLIBS) + +random-test-server: random-test-server.c + $(LINK.c) $^ $(LDLIBS) + +bandwidth-server-one: bandwidth-server-one.c + $(LINK.c) $^ $(LDLIBS) + +bandwidth-client: bandwidth-client.c + $(LINK.c) $^ $(LDLIBS) + + +clean: + -@cmd "/c del /Q /S $(OBJS) *.o *.obj *.exe *.pdb *.ilk *.ncb *.res *.dll *.exp *.lib *.ncb *.a *.map *.asm" > NUL: 2>&1 diff --git a/src/win32/Readme-win32 b/src/win32/Readme-win32 new file mode 100644 index 0000000..31ebcdf --- /dev/null +++ b/src/win32/Readme-win32 @@ -0,0 +1,26 @@ + +Intro +----- + +This directory contains the project file for Visual +Studio 2008 to build a modbus.dll. + +The project file searches for D:/include/msvc_std to +find stdint.h. See ../../README.rst + +config.h and modbus-version.h were generated using +a Windows native experimental port of zsh and Microsoft cl. + +Please note that modbus.dll.manifest hardcodes +the version number ! + + + +TODO +---- + +Fix the ugly need to have config.h and modbus-version.h +in this directory. + + +oldfaber diff --git a/src/win32/modbus-9.sln b/src/win32/modbus-9.sln new file mode 100644 index 0000000..b84f0f5 --- /dev/null +++ b/src/win32/modbus-9.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modbus", "modbus.vcproj", "{498E0845-C7F4-438B-8EDE-EF7FC9A74430}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|Win32.ActiveCfg = Debug|Win32 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|Win32.Build.0 = Debug|Win32 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|Win32.ActiveCfg = Release|Win32 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/win32/modbus.dll.manifest b/src/win32/modbus.dll.manifest new file mode 100644 index 0000000..9934ce5 --- /dev/null +++ b/src/win32/modbus.dll.manifest @@ -0,0 +1,14 @@ + + + +Zsh shell + + + + + + + + + + diff --git a/src/win32/modbus.rc b/src/win32/modbus.rc new file mode 100644 index 0000000..51d19e5 --- /dev/null +++ b/src/win32/modbus.rc @@ -0,0 +1,55 @@ +#define WIN32_LEAN_AND_MEAN +#include +#include "config.h" +#include "modbus-version.h" + +#define VERSTRING PACKAGE_VERSION + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +VS_VERSION_INFO VERSIONINFO +FILEVERSION LIBMODBUS_VERSION_MAJOR, LIBMODBUS_VERSION_MINOR, LIBMODBUS_VERSION_MICRO, 2 +PRODUCTVERSION LIBMODBUS_VERSION_MAJOR, LIBMODBUS_VERSION_MINOR, LIBMODBUS_VERSION_MICRO, 2 +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_APP +{ + BLOCK "StringFileInfo" + { + BLOCK "000004E4" + { + VALUE "CompanyName", "\x0" + VALUE "FileDescription", "libmodbus DLL\x0" +#if defined(DEBUG) || defined(W32DEBUG) +# define XDBG " (debug)" +#else +# define XDBG "" +#endif +#if defined(__MINGW32__) && !defined(__MINGW64__) + VALUE "FileVersion", VERSTRING " (gcc)" XDBG "\x0" +#endif +#if defined(__MINGW64__) + VALUE "FileVersion", VERSTRING " (gcc64)" XDBG "\x0" +#endif +#if defined(_MSC_VER) +# if defined(MSC64) + VALUE "FileVersion", VERSTRING " (cl64)" XDBG "\x0" +# else + VALUE "FileVersion", VERSTRING " (cl)" XDBG "\x0" +# endif +#endif + VALUE "InternalName", "modbus.dll\x0" + VALUE "LegalCopyright", "© See libmodbus.org\x0" + VALUE "OriginalFilename", "modbus.dll\x0" + VALUE "ProductName", "Modbus\x0" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0, 1252 + } +} + +// Manifest +#if (_MSC_VER >= 1400) +// CAVEAT: the manifest has a version string THAT MUST MATCH the DLL version +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "modbus.dll.manifest" +#endif diff --git a/src/win32/modbus.vcproj b/src/win32/modbus.vcproj new file mode 100644 index 0000000..2513f93 --- /dev/null +++ b/src/win32/modbus.vcproj @@ -0,0 +1,457 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +