Skip to content

Commit c29cfaf

Browse files
author
Luca Geretti
committed
Fix CommandLineInterface graphics backend instantiation when either Cairo or Gnuplot are missing
1 parent f93f156 commit c29cfaf

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

source/io/command_line_interface.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* along with Ariadne. If not, see <https://www.gnu.org/licenses/>.
2323
*/
2424

25+
#include "config.hpp"
2526
#include "concurrency/task_manager.hpp"
2627
#include "utility/handle.hpp"
2728
#include "drawer.hpp"
@@ -205,9 +206,13 @@ class GraphicsBackendArgumentParser : public ValuedArgumentParserBase {
205206

206207
VoidFunction _create_processor(ArgumentStream& stream) const override {
207208
String val = stream.pop();
208-
if (val == "cairo") return []{ GraphicsManager::instance().set_backend(CairoGraphicsBackend()); };
209-
else if (val == "gnuplot") return []{ GraphicsManager::instance().set_backend(GnuplotGraphicsBackend()); };
210-
else throw std::exception();
209+
#ifdef HAVE_CAIRO_H
210+
if (val == "cairo") return []{ GraphicsManager::instance().set_backend(CairoGraphicsBackend()); };
211+
#endif
212+
#ifdef HAVE_GNUPLOT_H
213+
if (val == "gnuplot") return []{ GraphicsManager::instance().set_backend(GnuplotGraphicsBackend()); };
214+
#endif
215+
throw std::exception();
211216
}
212217
};
213218

@@ -336,4 +341,4 @@ void CommandLineInterface::_print_help() const {
336341
}
337342
}
338343

339-
} // namespace Ariadne
344+
} // namespace Ariadne

0 commit comments

Comments
 (0)