ComputationalBiomechanicsLab / opensim-creator

A UI for building OpenSim models
https://opensimcreator.com
Apache License 2.0
137 stars 16 forks source link

Fix CI fails after switching to `gtest_discover_tests` #785

Closed adamkewley closed 10 months ago

adamkewley commented 10 months ago

This action fails:

With this error:

   testoscar.vcxproj -> D:\a\opensim-creator\opensim-creator\osc\osc-build\tests\testoscar\RelWithDebInfo\testoscar.exe
  CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/GoogleTestAddTests.cmake:112 (message):
    Error running test executable.

      Path: 'D:/a/opensim-creator/opensim-creator/osc/osc-build/tests/testoscar/RelWithDebInfo/testoscar.exe'
      Result: Exit code 0xc0000135

      Output:

Because of this changeset ("works on my machine"):

And I believe (not confirmed) the reason why is because gtest_discover_tests runs the binary before my "copy runtime DLLs" POST_BUILD action, which is necessary for running windows executables because they don't have an rpath etc.:

Thanks to @zonmen for mentioning the idea of this being the problem on a googletest issue:

adamkewley commented 10 months ago

Adding PRE_TEST didn't fix it :(

adamkewley commented 10 months ago

The fix for this was to tell CMake exactly which TARGET_RUNTIME_DLLS are needed on Windows, and to make the build command copy the runtime binaries in a PRE_BUILD step