diff --git a/IndradriveAPI.vcxproj b/IndradriveAPI.vcxproj index 32fa59a..ec0a876 100644 --- a/IndradriveAPI.vcxproj +++ b/IndradriveAPI.vcxproj @@ -99,35 +99,35 @@ - + - + - + - + - + - + - + - + @@ -138,11 +138,9 @@ $(ProjectName)-LV - .dll $(ProjectName)-LV - .dll $(ProjectName) @@ -170,14 +168,9 @@ true %(AdditionalDependencies);ucrt.lib false - lib\ftdi\x86;%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x86) + lib\ftdi\$(Platform);%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x86) - - mkdir $(SolutionDir)bin\x86 2> NUL -copy "$(SolutionDir)$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\x86\" -copy "$(SolutionDir)lib\ftdi\x86\ftd2xx.dll" "$(SolutionDir)bin\x86\" -copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\x86\" - + $(ProjectDir)doc\$(TargetName).xml false @@ -190,14 +183,18 @@ copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\x86\" - - $(ProjectDir)tools\AutoIncreaseBuildNrs.exe $(ProjectDir)version.h -REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h - + + + + mkdir $(SolutionDir)bin\$(Platform) 2> NUL +copy "$(SolutionDir)build\$(Platform)\$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)lib\ftdi\$(Platform)\ftd2xx.dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\$(Platform)\" + @@ -216,10 +213,10 @@ REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(P lib\ftdi\x64;%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x64) - mkdir $(SolutionDir)bin\x64 2> NUL -copy "$(SolutionDir)$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\x64\" -copy "$(SolutionDir)lib\ftdi\x64\ftd2xx64.dll" "$(SolutionDir)bin\x64\" -copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\x64\" + mkdir $(SolutionDir)bin\$(Platform) 2> NUL +copy "$(SolutionDir)build\$(Platform)\$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)lib\ftdi\$(Platform)\ftd2xx.dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\$(Platform)\" $(ProjectDir)doc\$(TargetName).xml @@ -233,10 +230,7 @@ copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\x64\" - - $(ProjectDir)tools\AutoIncreaseBuildNrs.exe $(ProjectDir)version.h -REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h - + @@ -256,13 +250,13 @@ REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(P true %(AdditionalDependencies);ucrt.lib false - lib\ftdi\x86;%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x86) + lib\ftdi\$(Platform);%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x86) - mkdir $(SolutionDir)bin\x86 2> NUL -copy "$(SolutionDir)$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\x86\" -copy "$(SolutionDir)lib\ftdi\x86\ftd2xx.dll" "$(SolutionDir)bin\x86\" -copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\x86\" + mkdir $(SolutionDir)bin\$(Platform) 2> NUL +copy "$(SolutionDir)build\$(Platform)\$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)lib\ftdi\$(Platform)\ftd2xx.dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\$(Platform)\" $(ProjectDir)doc\$(TargetName).xml @@ -276,10 +270,7 @@ copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\x86\" - - $(ProjectDir)tools\AutoIncreaseBuildNrs.exe $(ProjectDir)version.h -REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h - + @@ -302,10 +293,10 @@ REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(P lib\ftdi\x64;%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x64) - mkdir $(SolutionDir)bin\x64 2> NUL -copy "$(SolutionDir)$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\x64\" -copy "$(SolutionDir)lib\ftdi\x64\ftd2xx64.dll" "$(SolutionDir)bin\x64\" -copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\x64\" + mkdir $(SolutionDir)bin\$(Platform) 2> NUL +copy "$(SolutionDir)build\$(Platform)\$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)lib\ftdi\$(Platform)\ftd2xx.dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\$(Platform)\" $(ProjectDir)doc\$(TargetName).xml @@ -319,10 +310,7 @@ copy "$(SolutionDir)$(Configuration)\$(TargetName).pdb" "$(SolutionDir)bin\x64\" - - $(ProjectDir)tools\AutoIncreaseBuildNrs.exe $(ProjectDir)version.h -REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h - + @@ -344,21 +332,14 @@ REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(P true true ucrt.lib;%(AdditionalDependencies) - lib\ftdi\x86;%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x86) + lib\ftdi\$(Platform);%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x86) false - - mkdir $(SolutionDir)bin\x86 2> NUL -copy "$(SolutionDir)lib\ftdi\x86\ftd2xx.dll" "$(SolutionDir)bin\x86\" -copy "$(SolutionDir)$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\x86\" - + false - - $(ProjectDir)tools\AutoIncreaseBuildNrs.exe $(ProjectDir)version.h -REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h - + @@ -379,18 +360,11 @@ REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(P lib\ftdi\x64;%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x64) false - - mkdir $(SolutionDir)bin\x64 2> NUL -copy "$(SolutionDir)lib\ftdi\x64\ftd2xx64.dll" "$(SolutionDir)bin\x64\" -copy "$(SolutionDir)$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\x64\" - + false - - $(ProjectDir)tools\AutoIncreaseBuildNrs.exe $(ProjectDir)version.h -REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h - + @@ -407,20 +381,13 @@ REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(P true ucrt.lib;%(AdditionalDependencies) false - lib\ftdi\x86;%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x86) + lib\ftdi\$(Platform);%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x86) - - mkdir $(SolutionDir)bin\x86 2> NUL -copy "$(SolutionDir)lib\ftdi\x86\ftd2xx.dll" "$(SolutionDir)bin\x86\" -copy "$(SolutionDir)$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\x86\" - + false - - $(ProjectDir)tools\AutoIncreaseBuildNrs.exe $(ProjectDir)version.h -REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h - + @@ -439,18 +406,11 @@ REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(P false lib\ftdi\x64;%(AdditionalLibraryDirectories);$(UniversalCRT_LibraryPath_x64) - - mkdir $(SolutionDir)bin\x64 2> NUL -copy "$(SolutionDir)lib\ftdi\x64\ftd2xx64.dll" "$(SolutionDir)bin\x64\" -copy "$(SolutionDir)$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\x64\" - + false - - $(ProjectDir)tools\AutoIncreaseBuildNrs.exe $(ProjectDir)version.h -REM python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h - + diff --git a/IndradriveAPIDefaults.props b/IndradriveAPIDefaults.props new file mode 100644 index 0000000..0719f11 --- /dev/null +++ b/IndradriveAPIDefaults.props @@ -0,0 +1,28 @@ + + + + + + $(SolutionDir)build\$(Platform)\$(Configuration)\ + $(SolutionDir)build\$(Platform)\$(Configuration)\ + + + + sis;serial;..\..\sis;..\..\serial;..\..;..;.;%(AdditionalIncludeDirectories) + + + %(AdditionalLibraryDirectories) + %(AdditionalDependencies) + + + python $(ProjectDir)tools\increment-VER_BUILDNO.py $(MSBuildProjectDirectory) version.h +python $(ProjectDir)tools\get-git-rev-HEAD.py $(MSBuildProjectDirectory) $(ProjectDir)version.h + + + mkdir $(SolutionDir)bin\$(Platform) 2> NUL +copy "$(SolutionDir)build\$(Platform)\$(Configuration)\$(TargetName).dll" "$(SolutionDir)bin\$(Platform)\" +copy "$(SolutionDir)lib\ftdi\$(Platform)\ftd2xx.dll" "$(SolutionDir)bin\$(Platform)\" + + + + \ No newline at end of file diff --git a/README.md b/README.md index 1b6eb1e..914a328 100644 --- a/README.md +++ b/README.md @@ -90,30 +90,26 @@ Speed Control | Programming functions for "Speed Control" drive mode The API is built for native programming languages such as Python or C#. However, a dedicated LabView variant can be also built, which utilizes specific memory allocation methods needed when the library is used in LabView. 1. Install Visual Studio 2017, or later (alternatively, install Visual Studio 2015 Express for Desktop) -2. Fetch the source code repository -3. If you have LabVIEW installed on your computer, paste the following code into your `UserDirectories.props` file (and adjust the cintools folder to your LabVIEW version): +2. Install Python 3.3 or higher, and make sure that python.exe is provided in the environment variables +3. Install git 1.9.5 or higher, and make sure that python.exe is provided in the environment variables +4. Fetch the source code repository +5. If you have LabVIEW installed on your computer, adjust the cintools folder to your LabVIEW version and adapt the `IndradriveAPIDefaults.props` as below: ```xml - - - - - - + ... C:\Program Files\National Instruments\LabVIEW 2015\cintools;sis;serial;..\..\sis;..\..\serial;..\..;..;.;%(AdditionalIncludeDirectories) + ... C:\Program Files\National Instruments\LabVIEW 2015\cintools;serial;%(AdditionalLibraryDirectories) %(AdditionalDependencies) - - - + ... ``` -4. Open the Visual Studio solution called Indradrive.sln -5. Choose configuration "Release" or "ReleaseLabview" (for LabView specific build) -6. Build the solution using the respective solution configuration +6. Open the Visual Studio solution called Indradrive.sln +7. Choose configuration "Release" or "ReleaseLabview" (for LabView specific build) +8. Build the solution using the respective solution configuration - "Release": Final DLLs are located in the bin/ folder - "ReleaseLabview": Final DLLs are located in the ../ folder diff --git a/Regex-Parameter-Filter.txt b/Regex-Parameter-Filter.txt deleted file mode 100644 index 13fe7c4..0000000 --- a/Regex-Parameter-Filter.txt +++ /dev/null @@ -1,13 +0,0 @@ -\|[\n\r]+(?#Parameter)(P-0-[0-9]{4}|S-0-[0-9]{4})[\n\r]+(?#Name)[^\n]*[\n\r]+[0-1]+[\n\r]+(?#Unit)[^\n]+[\n\r]+(?#Min)[bx.\-0-9A-F]+[\n\r]+(?#Max)[bx.\-0-9A-F]+[\n\r]+(?#Value)([^\|]+) - ---> 362 matches - - -\|[\n\r]+(?#Parameter)(P-0-[0-9]{4}|S-0-[0-9]{4})[\n\r]+(?#Name)[^\n]*[\n\r]+[0-1]+[\n\r]+(?#Unit)[^\n]+[\n\r]+(?#Min)[bx.\-0-9A-F]+[\n\r]+(?#Max)[bx.\-0-9A-F]+[\n\r]+(?#Value)(?:([\w\s.\-]+)\n)+ - ---> 362 matches and no linebreak at end of second group - - -\|[\n\r]+(?#Parameter)(P-0-[0-9]{4}|S-0-[0-9]{4})[\n\r]+(?#Name)[^\n]*[\n\r]+[0-1]+[\n\r]+(?#Unit)[^\n]+[\n\r]+(?#Min)[bx.\-0-9A-F]+[\n\r]+(?#Max)[bx.\-0-9A-F]+[\n\r]+(?#Value)(?:(?:([0-9\n.\-]{1,18})\n)?(?:([01]{4}.[01]{4}.[01]{4}.[01]{4})\n)?(?:([0-9A-Za-z\-\s]+)\n)?)+ - ---> 362 matches and no linebreak at end of second group and groups for each kind of value type \ No newline at end of file diff --git a/UserDirectories.props b/UserDirectories.props deleted file mode 100644 index 86ac6a1..0000000 --- a/UserDirectories.props +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - -sis;serial;..\..\sis;..\..\serial;..\..;..;.;%(AdditionalIncludeDirectories) - - -%(AdditionalLibraryDirectories) -%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/lib/ftdi/Win32/ftd2xx.dll b/lib/ftdi/Win32/ftd2xx.dll new file mode 100644 index 0000000..ecafeb7 Binary files /dev/null and b/lib/ftdi/Win32/ftd2xx.dll differ diff --git a/lib/ftdi/Win32/ftd2xx.lib b/lib/ftdi/Win32/ftd2xx.lib new file mode 100644 index 0000000..b2e0a53 Binary files /dev/null and b/lib/ftdi/Win32/ftd2xx.lib differ diff --git a/mainpage.dox b/mainpage.dox index 5bae8be..91bf26c 100644 --- a/mainpage.dox +++ b/mainpage.dox @@ -94,48 +94,25 @@ /// Installation is very easy, if IndradriveAPI.dll, or IndradriveAPI-LV.dll is already present: Just copy all the mentioned DLLs from above into your binary folder, where your target application will be started from. /// /// If the DLL IndradriveAPI.dll, or IndradriveAPI-LV.dll is missing, you have to compile the respective file first by doing the following steps: -/// -# Install Visual Studio 2015, or later (alternatively, install Visual Studio 2015 Express for Desktop) +/// -# Install Visual Studio 2017, or later (alternatively, install Visual Studio 2015 Express for Desktop) +/// -# Install Python 3.3 or higher, and make sure that python.exe is provided in the environment variables +/// -# Install git 1.9.5 or higher, and make sure that python.exe is provided in the environment variables /// -# Fetch the source code repository /// -# Open the text editor of your choice and copy in the following text: -/// - If you have LabVIEW installed on your computer, use this code (and adjust the cintools folder to your LabVIEW version) +/// - If you have LabVIEW installed on your computer, adjust the cintools folder to your LabVIEW version and adapt the IndradriveAPIDefaults.props as below: /// @code{.xml} -/// -/// -/// -/// -/// -/// +/// ... /// /// C:\Program Files\National Instruments\LabVIEW 2015\cintools;sis;serial;..\..\sis;..\..\serial;..\..;..;.;%(AdditionalIncludeDirectories) /// +/// ... /// /// C:\Program Files\National Instruments\LabVIEW 2015\cintools;serial;%(AdditionalLibraryDirectories) /// %(AdditionalDependencies) /// -/// -/// -/// +/// ... /// @endcode -/// - If LabVIEW is not installed on your computer, use this code: -/// @code{.xml} -/// -/// -/// -/// -/// -/// -/// -/// sis;serial;..\..\sis;..\..\serial;..\..;..;.;%(AdditionalIncludeDirectories) -/// -/// -/// serial;%(AdditionalLibraryDirectories) -/// %(AdditionalDependencies) -/// -/// -/// -/// -/// @endcode -/// -# Save this file as UserDirectories.props to the root directory of the source code (same level as IndradriveAPI.vcxproj) +/// Save IndradriveAPIDefaults.props to the root directory of the source code (same level as IndradriveAPI.vcxproj) /// -# Open the Visual Studio solution called Indradrive.sln /// -# Choose configuration "Release" or "ReleaseLabview" (for LabView specific build) /// -# Build the solution diff --git a/tools/AutoIncreaseBuildNrs.exe b/tools/AutoIncreaseBuildNrs.exe deleted file mode 100644 index 7767aaa..0000000 Binary files a/tools/AutoIncreaseBuildNrs.exe and /dev/null differ diff --git a/tools/Howto-AutoIncreaseBuildNrs.txt b/tools/Howto-AutoIncreaseBuildNrs.txt deleted file mode 100644 index 899b9fe..0000000 --- a/tools/Howto-AutoIncreaseBuildNrs.txt +++ /dev/null @@ -1,12 +0,0 @@ -AutoIncreaseBuildNrs automatically increments "VER_BUILDNR" in your source file. - -How to automatically execute after each compile step within Qt Creator? -1. Open the project -2. Change to "Projects" view, or press Ctrl+5 -3. Click on "Add Build Step" and choose "Custom Process Step" -4. Move up the process step right below the regular qmake step -5. As for the Command field, write "%{sourceDir}\tools\AutoIncreaseBuildNrs.exe" -6. As for the Arguments field, write "%{sourceDir}\BASE\version.h" -7. As for Working directly field, leave it to "%{buildDir}" - -Do this for both Edit build configurations, "Debug" and "Release". \ No newline at end of file diff --git a/tools/get-git-rev-HEAD.py b/tools/get-git-rev-HEAD.py index bf30b4b..2ae8510 100644 --- a/tools/get-git-rev-HEAD.py +++ b/tools/get-git-rev-HEAD.py @@ -5,14 +5,22 @@ from subprocess import call, Popen, PIPE import shlex +# Minimum Python 3.3 required +assert sys.version_info >= (3,3) + target_directory = False version_file = False arguments = sys.argv[1:] + +# 1st argument: target directory if len(arguments) > 0: target_directory = arguments[0] + +# 2nd argument: target file to be updated if len(arguments) > 1: version_file = arguments[1] + if target_directory == False: target_directory = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) if version_file == False: @@ -20,6 +28,8 @@ print('Target directory: ' + target_directory) + + cmd = 'git -C "' + target_directory + '" rev-parse --short HEAD' print(cmd) diff --git a/tools/increment-VER_BUILDNO.py b/tools/increment-VER_BUILDNO.py new file mode 100644 index 0000000..a1e142b --- /dev/null +++ b/tools/increment-VER_BUILDNO.py @@ -0,0 +1,53 @@ +import fileinput +import re +import sys +import inspect, os +from subprocess import call, Popen, PIPE +import shlex + +# Minimum Python 3.3 required +assert sys.version_info >= (3,3) + +version_file = False +arguments = sys.argv[1:] + +# 1st argument: target directory +if len(arguments) > 0: + target_directory = arguments[0] + +# 2nd argument: target file to be updated +if len(arguments) > 1: + version_file = arguments[1] + + +if target_directory == False: + target_directory = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) +if version_file == False: + version_file = 'version.h' + + +# Extracting current version number +versionbuildno = 0 +file = os.path.join(target_directory, version_file) +ofile = open(file, 'r') +ofilecontent = ofile.read() + +m1 = [] +r1 = re.compile(r"(#define VER_BUILDNO[\W]{1,})([\w]{1,})") +m1 = r1.findall(ofilecontent) + +if len(m1) > 0: + versionbuildno = int(m1[0][1]) + versionbuildno += 1 + +print('Current build no: ' + str(versionbuildno)) + +ofile.close() + + +# Updating version file +print('Updating version file ' + file + ' ...') + +r2 = re.compile(r"^(#define VER_BUILDNO[\W]{1,})([\w]{1,})") +for line in fileinput.input(file, inplace=True): + print(r2.sub(r"\g<1>" + str(versionbuildno), line), end="") \ No newline at end of file diff --git a/version.h b/version.h index 5c9f6dd..499f350 100644 --- a/version.h +++ b/version.h @@ -3,17 +3,17 @@ #define STRINGIZE2(s) #s #define STRINGIZE(s) STRINGIZE2(s) -// Will be automatically increased by AutoIncreaseBuildNrs.exe -// cmd: AutoIncreaseBuildNrs.exe version.h -#define VER_BUILDNR 13 +// Will be automatically increased by increment-VER_BUILDNO.py +// cmd: python increment-VER_BUILDNO.py $(MSBuildProjectDirectory) version.h +#define VER_BUILDNO 28 // Will be automatically increased by get-git-rev-HEAD.py -// cmd: python get-git-rev-HEAD.py $(MSBuildProjectDir) version.h -#define VER_BUILD 0 +// cmd: python get-git-rev-HEAD.py $(MSBuildProjectDirectory) version.h +#define VER_BUILD 1038c86 #define VERSION_MAJOR 0 #define VERSION_MINOR 9 -#define VERSION_REVISION VER_BUILDNR +#define VERSION_REVISION VER_BUILDNO #define VERSION_BUILD VER_BUILD #define VER_FILE_DESCRIPTION_STR "Rexroth Indradrive API"