${OPENGL_gl_LIBRARY}
${BOOST_PROGRAM_OPTIONS_LIBRARY}
${BOOST_FILESYSTEM_LIBRARY}
- ${BOOST_PYTHON_LIBRARY}
- optimized ${PYTHON_LIBRARIES}
- debug ${PYTHON_DEBUG_LIBRARIES}
+ )
+IF(USE_PYTHON)
+ TARGET_LINK_LIBRARIES(mussagl
+ ${BOOST_PYTHON_LIBRARY}
+ optimized ${PYTHON_LIBRARIES}
+ debug ${PYTHON_DEBUG_LIBRARIES}
)
+ENDIF(USE_PYTHON)
#include <boost/filesystem/operations.hpp>
+#ifdef USE_PYTHON
#include <boost/python.hpp>
+#endif
using namespace boost::filesystem;
QApplication app(argc, argv, opts.useGUI);
Q_INIT_RESOURCE(icons);
- //PyImport_AppendInittab("mussa", initmussa);
- Py_Initialize();
initialize_mussa(opts, argc, argv);
}
try {
+#ifdef USE_PYTHON
if (opts.runAsPythonInterpeter) {
+ Py_Initialize();
boost::python::object main_module((boost::python::handle<>(boost::python::borrowed(PyImport_AddModule("__main__")))));
boost::python::object main_namespace = main_module.attr("__dict__");
int result = boost::python::extract<int>(square(3));
std::cout << "C++ has " << result << std::endl;
PyRun_InteractiveLoop(stdin, "mussa");
- } else if (opts.useGUI) {
+ } else
+#endif /* USE_PYTHON */
+ if (opts.useGUI) {
MussaWindow win(opts.analysis);
win.show();
app.exec();
qFatal(e.what());
} catch (boost::filesystem::filesystem_error e) {
qFatal(e.what());
- } catch (boost::python::error_already_set e) {
+ }
+#ifdef USE_PYTHON
+ catch (boost::python::error_already_set e) {
PyErr_Print();
- } catch (std::runtime_error e) {
+ }
+#endif /* USE_PYTHON */
+ catch (std::runtime_error e) {
qFatal(e.what());
} catch (...) {
qFatal("unrecognized exception");
}
- Py_Finalize();
return 1;
}