diff --git a/src/win32/Make-tests b/src/win/Make-tests similarity index 100% rename from src/win32/Make-tests rename to src/win/Make-tests diff --git a/src/win/README.md b/src/win/README.md new file mode 100644 index 000000000..1007eabcc --- /dev/null +++ b/src/win/README.md @@ -0,0 +1,8 @@ +# Instructions to compile on Windows + +## This is solution is tested in Visual Studio 2022 CE. + +Clone the latest version of libmodbus source code from Github. + +1. Open libmodbus solution in VS (`src/win/libmodbus.sln`). +2. Build solution ("CTRL+SHIFT+B"). diff --git a/src/win32/config.h.win32 b/src/win/config.h.win32 similarity index 100% rename from src/win32/config.h.win32 rename to src/win/config.h.win32 diff --git a/src/win32/configure.js b/src/win/configure.js similarity index 100% rename from src/win32/configure.js rename to src/win/configure.js diff --git a/src/win/libmodbus.sln b/src/win/libmodbus.sln new file mode 100644 index 000000000..5c7bd0cb6 --- /dev/null +++ b/src/win/libmodbus.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmodbus", "libmodbus.vcxproj", "{498E0845-C7F4-438B-8EDE-EF7FC9A74430}" +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 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|x64.ActiveCfg = Debug|x64 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|x64.Build.0 = Debug|x64 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|x86.ActiveCfg = Debug|Win32 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|x86.Build.0 = Debug|Win32 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|x64.ActiveCfg = Release|x64 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|x64.Build.0 = Release|x64 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|x86.ActiveCfg = Release|Win32 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A44358E6-8E35-4B20-A35A-8CD98DDF11C7} + EndGlobalSection +EndGlobal diff --git a/src/win/libmodbus.vcxproj b/src/win/libmodbus.vcxproj new file mode 100644 index 000000000..49babbc19 --- /dev/null +++ b/src/win/libmodbus.vcxproj @@ -0,0 +1,256 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 17.0 + {498E0845-C7F4-438B-8EDE-EF7FC9A74430} + modbus + Win32Proj + libmodbus + 10.0 + + + + DynamicLibrary + v143 + MultiByte + true + + + DynamicLibrary + v143 + MultiByte + true + + + DynamicLibrary + v143 + MultiByte + + + DynamicLibrary + v143 + MultiByte + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.33815.168 + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(ProjectDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + cscript configure.js + Setup config.h and modbus-version.h + + + + + + + X64 + + + Disabled + false + $(SolutionDir);%(AdditionalIncludeDirectories) + false + EnableFastChecks + MultiThreadedDLL + + Level3 + ProgramDatabase + CompileAsC + 4244;4267;%(DisableSpecificWarnings) + + + true + Console + 1048576 + 524288 + MachineX64 + "WS2_32.lib";"msvcrt.lib";%(AdditionalDependencies) + + + + + cscript configure.js + Setup config.h and modbus-version.h + + + + + + + + + + Disabled + false + $(SolutionDir);%(AdditionalIncludeDirectories) + false + EnableFastChecks + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + 4244;4267;%(DisableSpecificWarnings) + + + true + Console + 1048576 + 524288 + "WS2_32.lib";"msvcrt.lib";%(AdditionalDependencies) + + + + + cscript configure.js + Setup config.h and modbus-version.h + + + + + + + X64 + + + MaxSpeed + true + false + $(ProjectDir);%(AdditionalIncludeDirectories) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + CompileAsC + 4244;4267;%(DisableSpecificWarnings) + + + true + Console + 1048576 + 524288 + true + true + + MachineX64 + "WS2_32.lib";"msvcrt.lib";%(AdditionalDependencies) + + + + + cscript configure.js + Setup config.h and modbus-version.h + + + + + + + + + + MaxSpeed + true + false + $(SolutionDir);%(AdditionalIncludeDirectories) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + CompileAsC + 4244;4267;%(DisableSpecificWarnings) + + + true + Console + 1048576 + 524288 + true + true + + + "WS2_32.lib";"msvcrt.lib";%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/win/libmodbus.vcxproj.filters b/src/win/libmodbus.vcxproj.filters new file mode 100644 index 000000000..ebfdc5c36 --- /dev/null +++ b/src/win/libmodbus.vcxproj.filters @@ -0,0 +1,62 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;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 + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/src/win32/modbus.dll.manifest.in b/src/win/modbus.dll.manifest.in similarity index 100% rename from src/win32/modbus.dll.manifest.in rename to src/win/modbus.dll.manifest.in diff --git a/src/win32/modbus.rc b/src/win/modbus.rc similarity index 100% rename from src/win32/modbus.rc rename to src/win/modbus.rc diff --git a/src/win32/README.md b/src/win32/README.md deleted file mode 100644 index 6b3957df0..000000000 --- a/src/win32/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Instructions to compile on Windows - -## Create a new Visual Studio project with the library included - -Download the latest version of libmodbus source code from Github -`https://github.com/stephane/libmodbus` -> Code -> Download ZIP. - -Once the archive is decompressed, launch a Windows terminal (`cmd`) in -`src/win32` directory and run `cscript configure.js`. - -1. copy the file `config.h` from `src/win32` to `src`. -2. create a new 'Console App' project under Visual Studio. -3. create a new directory called `libmodbus` inside your VS project (same level - as the `.vcxproj` file). -4. copy all `*.c` and `*.h` from libmodbus `src` in the new `libmodbus` folder - of your VS project. -5. copy `modbus.rc` in your VS project (same level as the `.vcxproj` file). -6. drag and drop `libmodbus/*.c` files (4) in *Solution Explorer -> Source Files*. -7. drag and drop `libmodbus/*.h` files (8) in *Solution Explorer -> Header Files*. -8. drag and drop `modbus.rc` file in *Solution Explorer -> Resource Files*. -9. check path is `#include "modbus-version.h"` in `modbus.rc`. -10. in the **Property Pages** of the project *Configuration Properties -> C/C++ - -> General -> Additional Include Directories*, add `libmodbus` folder. -11. in the **Property Pages** of the project *Configuration Properties -> - Resources -> Additional Include Directories*, add `libmodbus` folder. -12. in the **Property Pages** of the project *Configuration Properties -> Linker - -> Input*, define `ws2_32.lib`. -13. if required, add `_CRT_SECURE_NO_WARNINGS` to *C/C++ -> Preprocessor -> - Preprocessor Definitions*. - -## Create a libmodbus DLL - -This directory contains the project file for Visual Studio to build `modbus.dll` -and import library `modbus.lib`. - -In the Windows terminal, run `cscript configure.js` to generate: - -- `config.h` -- `modbus-version.h` are generated using configure.js. - -To write... diff --git a/src/win32/modbus-9.sln b/src/win32/modbus-9.sln deleted file mode 100644 index b84f0f5a7..000000000 --- a/src/win32/modbus-9.sln +++ /dev/null @@ -1,20 +0,0 @@ - -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.vcproj b/src/win32/modbus.vcproj deleted file mode 100644 index a7acb6b5c..000000000 --- a/src/win32/modbus.vcproj +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -