Commit | Line | Data |
---|---|---|
06ed1dba VL |
1 | Unbundling tinyxml2 from gromacs and using our own, which is newer, broke gromacs |
2 | build. | |
3 | ||
4 | This patch fixes three issues: | |
5 | ||
6 | - cmake now errors out if using multiple target_link_libraries with mixed styles | |
7 | of signatures. | |
8 | ||
9 | - Error handling API changed, fix the testutils/refdata_xml.cpp code by using the | |
10 | new API: document.ErrorStr() & tinyxml2::XML_SUCCESS. | |
11 | ||
12 | Those fixes will be submitted for inclusion to upstream, but may not be suitable | |
13 | there as long as they still keep the old version bundled. | |
14 | ||
15 | First hunk has already been requested for merging. Third is in discussion. Second | |
16 | will only be sent if third is OK'ed. | |
17 | ||
18 | diff -ruN gromacs-2020.2/src/testutils/CMakeLists.txt gromacs-2020.2-fixed/src/testutils/CMakeLists.txt | |
19 | --- gromacs-2020.2/src/testutils/CMakeLists.txt 2020-04-30 18:33:44.000000000 +0200 | |
20 | +++ gromacs-2020.2-fixed/src/testutils/CMakeLists.txt 2020-05-01 22:52:16.356000000 +0200 | |
21 | @@ -73,7 +73,7 @@ | |
22 | ||
23 | if(HAVE_TINYXML2) | |
24 | include_directories(SYSTEM ${TinyXML2_INCLUDE_DIR}) | |
25 | - target_link_libraries(testutils ${TinyXML2_LIBRARIES}) | |
26 | + target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES}) | |
27 | else() | |
28 | include_directories(BEFORE SYSTEM "../external/tinyxml2") | |
29 | endif() | |
30 | diff -ruN gromacs-2020.2/src/testutils/refdata_xml.cpp gromacs-2020.2-fixed/src/testutils/refdata_xml.cpp | |
31 | --- gromacs-2020.2/src/testutils/refdata_xml.cpp 2020-04-30 18:33:44.000000000 +0200 | |
32 | +++ gromacs-2020.2-fixed/src/testutils/refdata_xml.cpp 2020-05-01 23:17:09.556000000 +0200 | |
33 | @@ -206,21 +206,12 @@ | |
34 | document.LoadFile(path.c_str()); | |
35 | if (document.Error()) | |
36 | { | |
37 | - const char* errorStr1 = document.GetErrorStr1(); | |
38 | - const char* errorStr2 = document.GetErrorStr2(); | |
39 | + const char* errorStr = document.ErrorStr(); | |
40 | std::string errorString("Error was "); | |
41 | - if (errorStr1) | |
42 | - { | |
43 | - errorString += errorStr1; | |
44 | - } | |
45 | - if (errorStr2) | |
46 | - { | |
47 | - errorString += errorStr2; | |
48 | - } | |
49 | - if (!errorStr1 && !errorStr2) | |
50 | - { | |
51 | + if (errorStr) | |
52 | + errorString += errorStr; | |
53 | + else | |
54 | errorString += "not specified."; | |
55 | - } | |
56 | GMX_THROW(TestException("Reference data not parsed successfully: " + path + "\n." | |
57 | + errorString + "\n")); | |
58 | } | |
59 | @@ -371,7 +362,7 @@ | |
60 | XMLElementPtr rootElement = createRootElement(&document); | |
61 | createChildElements(rootElement, rootEntry); | |
62 | ||
63 | - if (document.SaveFile(path.c_str()) != tinyxml2::XML_NO_ERROR) | |
64 | + if (document.SaveFile(path.c_str()) != tinyxml2::XML_SUCCESS) | |
65 | { | |
66 | GMX_THROW(TestException("Reference data saving failed in " + path)); | |
67 | } |