Skip to content

Commit 23c391f

Browse files
jcfrRafaelPalomar
authored andcommitted
Update PythonTest.h to support building using GCC v7
This commit fixes the error reported below by copying and adapting compatibility logic already used in source file like PluginManager.cpp Error: [ 78%] Built target Sofa.Component.LinearSystem_test In file included from /path/to/Slicer-SOFA-build/SofaPython3/Testing/src/SofaPython3Testing/PythonTestExtractor.h:22:0, from /path/to/Slicer-SOFA-build/SofaPython3/Testing/src/SofaPython3Testing/PythonTestExtractor.cpp:21: /path/to/Slicer-SOFA-build/SofaPython3/Testing/src/SofaPython3Testing/PythonTest.h:28:12: error: ‘std::filesystem’ has not been declared using std::filesystem::path; ^~~~~~~~~~
1 parent aa0ccbe commit 23c391f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Testing/src/SofaPython3Testing/PythonTest.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
#include <string>
2424
#include <SofaPython3Testing/config.h>
2525
#include <sofa/testing/BaseTest.h>
26+
#if __has_include(<filesystem>)
27+
#include <filesystem>
28+
#elif __has_include(<experimental/filesystem>)
29+
#include <experimental/filesystem>
30+
namespace std {
31+
namespace filesystem = experimental::filesystem;
32+
}
33+
#else
34+
error "Missing the <filesystem> header."
35+
#endif
2636

2737
#if __has_include(<filesystem>)
2838
#include <filesystem>

0 commit comments

Comments
 (0)