modelica-3rdparty / Modelica_DeviceDrivers

Free library for interfacing hardware drivers to Modelica models. There is support for joysticks, keyboards, UDP, TCP/IP, LCM, MQTT, shared memory, AD/DA converters, serial port and other devices.
BSD 3-Clause "New" or "Revised" License
77 stars 31 forks source link

New real-time synchronization block (Closes #290) #291

Closed bernhard-thiele closed 5 years ago

bernhard-thiele commented 5 years ago

Added an enhanced real-time synchronization block (Blocks.OperatingSystem.RealtimeSynchronize) and deprecated the existing block (Blocks.OperatingSystem.SynchronizeRealtime).

beutlich commented 5 years ago

I can no longer build (and run) the new test models test_MDDRealtimeSynchronize and test_MDDRTSync when running CTest (locally on Win). Is it by intention that these new test are differently configured than the other tests?

bernhard-thiele commented 5 years ago

I can no longer build (and run) the new test models test_MDDRealtimeSynchronize and test_MDDRTSync when running CTest (locally on Win). Is it by intention that these new test are differently configured than the other tests?

Both tests use gtest but they still should work locally with CTest. I just checked that it works on my Linux machine at home. Haven't tested it with CTest on Windows. I only used the gtest Visual Studio plugin for running the tests there. Building on Windows (with Visual Studio) worked for me. Not sure if I have some stuff on my Windows machine which I didn't check in, but I don't think so.

bernhard-thiele commented 5 years ago

Tested CTest under my Windows machine and it worked. I'm not sure what is going wrong for you. Maybe you can check again if it is still failing and post the error message.

beutlich commented 5 years ago

CMake 3.13.3 reports during configuration:

CMake Warning (dev) at CMakeLists.txt:1 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR
    CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.
beutlich commented 5 years ago

I cannot build test_MDDRTSync due to failing build of gmock.

1>------ Erstellen gestartet: Projekt: gmock, Konfiguration: Debug x64 ------
1>  gmock-all.cc
1>C:\Projekte\Modelica_DeviceDrivers\Modelica_DeviceDrivers\Resources\thirdParty\googletest\googlemock\include\gmock/gmock-matchers.h(62): error C2220: warning treated as error - no 'object' file generated
1>C:\Projekte\Modelica_DeviceDrivers\Modelica_DeviceDrivers\Resources\thirdParty\googletest\googlemock\include\gmock/gmock-matchers.h(62): warning C4616: #pragma warning : warning number '5046' not a valid compiler warning
2>------ Erstellen gestartet: Projekt: test_MDDRTSync, Konfiguration: Debug x64 ------
2>LINK : fatal error LNK1104: cannot open file '..\..\Debug\gmockd.lib'
========== Erstellen: 0 erfolgreich, Fehler bei 2, 3 aktuell, 0 übersprungen ==========
bernhard-thiele commented 5 years ago

I generated the project with the GUI version of Cmake 3.12.0 and 3.13.1 under Windows 7 for Visual Studio 2017. Both versions didn't throw the configuration warnings which you got. This is my configuration:

grafik

If I build target test_MDDRTSync, it works without the gmock error, but it seems to use another build sequence:

2>------ Build started: Project: gtest, Configuration: Debug x64 ------
3>------ Build started: Project: gmock, Configuration: Debug x64 ------
2>Building Custom Rule D:/ModelicaLibs/Modelica_DeviceDrivers/Modelica_DeviceDrivers/Resources/thirdParty/googletest/googletest/CMakeLists.txt
2>CMake does not need to re-run because D:/ModelicaLibs/Modelica_DeviceDrivers/Modelica_DeviceDrivers/Resources/build-win64/test/thirdParty/googletest/googlemock/gtest/CMakeFiles/generate.stamp is up-to-date.
3>Building Custom Rule D:/ModelicaLibs/Modelica_DeviceDrivers/Modelica_DeviceDrivers/Resources/thirdParty/googletest/googlemock/CMakeLists.txt
2>gtest-all.cc
3>CMake does not need to re-run because D:/ModelicaLibs/Modelica_DeviceDrivers/Modelica_DeviceDrivers/Resources/build-win64/test/thirdParty/googletest/googlemock/CMakeFiles/generate.stamp is up-to-date.
3>gtest-all.cc
3>gmock-all.cc
2>gtest.vcxproj -> D:\ModelicaLibs\Modelica_DeviceDrivers\Modelica_DeviceDrivers\Resources\build-win64\Debug\gtestd.lib
4>------ Build started: Project: gtest_main, Configuration: Debug x64 ------
4>Building Custom Rule D:/ModelicaLibs/Modelica_DeviceDrivers/Modelica_DeviceDrivers/Resources/thirdParty/googletest/googletest/CMakeLists.txt
3>Generating Code...
4>CMake does not need to re-run because D:/ModelicaLibs/Modelica_DeviceDrivers/Modelica_DeviceDrivers/Resources/build-win64/test/thirdParty/googletest/googlemock/gtest/CMakeFiles/generate.stamp is up-to-date.
4>gtest_main.cc
3>gmock.vcxproj -> D:\ModelicaLibs\Modelica_DeviceDrivers\Modelica_DeviceDrivers\Resources\build-win64\Debug\gmockd.lib
4>gtest_main.vcxproj -> D:\ModelicaLibs\Modelica_DeviceDrivers\Modelica_DeviceDrivers\Resources\build-win64\Debug\gtest_maind.lib
5>------ Build started: Project: test_MDDRTSync, Configuration: Debug x64 ------
5>Building Custom Rule D:/ModelicaLibs/Modelica_DeviceDrivers/Modelica_DeviceDrivers/Resources/test/OperatingSystem/CMakeLists.txt
5>CMake does not need to re-run because D:/ModelicaLibs/Modelica_DeviceDrivers/Modelica_DeviceDrivers/Resources/build-win64/test/OperatingSystem/CMakeFiles/generate.stamp is up-to-date.
5>test_MDDRTSync.cpp
5>ModelicaUtilities.c
5>test_MDDRTSync.vcxproj -> D:\ModelicaLibs\Modelica_DeviceDrivers\Modelica_DeviceDrivers\Resources\build-win64\test\OperatingSystem\Debug\test_MDDRTSync.exe
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

This leaves me a bit puzzled.

beutlich commented 5 years ago

Never mind the CMake config warning, which is gone if I reconfigure in an empty directory.

The gmock issue was reported in https://github.com/google/googletest/issues/1848. My remedy is to not treat warnings as errors, i.e., change /WX to /WX- in VS 2010.

beutlich commented 5 years ago

Ah, the CMake config warning occurs, if you configure a second time.

bernhard-thiele commented 5 years ago

Ah, the issue is related to VS 2010 which I didn't test. Thanks for coming up with this nice fix, I integrated the logic into the CMake config.

bernhard-thiele commented 5 years ago

@beutlich Thanks for testing! Hopefully, everything works now as it should. I will merge the PR.