mirror of https://github.com/KLayout/klayout.git
klayout -v and -h now work without a display
This commit is contained in:
parent
de83fb7e8a
commit
7a6364506d
|
|
@ -202,20 +202,6 @@ static int klayout_main_cont (int &argc, char **argv);
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
klayout_main (int &argc, char **argv)
|
klayout_main (int &argc, char **argv)
|
||||||
{
|
|
||||||
// This special initialization is required by the Ruby interpreter because it wants to mark the stack
|
|
||||||
int ret = rba::RubyInterpreter::initialize (argc, argv, &klayout_main_cont);
|
|
||||||
|
|
||||||
// clean up all static data now, since we don't trust the static destructors.
|
|
||||||
// NOTE: this needs to happen after the Ruby interpreter went down since otherwise the GC will
|
|
||||||
// access objects that are already cleaned up.
|
|
||||||
tl::StaticObjects::cleanup ();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
klayout_main_cont (int &argc, char **argv)
|
|
||||||
{
|
{
|
||||||
// install the version strings
|
// install the version strings
|
||||||
lay::Version::set_exe_name (prg_exe_name);
|
lay::Version::set_exe_name (prg_exe_name);
|
||||||
|
|
@ -237,6 +223,37 @@ klayout_main_cont (int &argc, char **argv)
|
||||||
about_text += prg_about_text;
|
about_text += prg_about_text;
|
||||||
lay::Version::set_about_text (about_text.c_str ());
|
lay::Version::set_about_text (about_text.c_str ());
|
||||||
|
|
||||||
|
// Capture the shortcut command line arguments
|
||||||
|
for (int i = 1; i < argc; ++i) {
|
||||||
|
|
||||||
|
if (argv [i] == std::string ("-v")) {
|
||||||
|
|
||||||
|
tl::info << lay::ApplicationBase::version ();
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
} else if (argv [i] == std::string ("-h")) {
|
||||||
|
|
||||||
|
tl::info << lay::ApplicationBase::usage () << tl::noendl;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// This special initialization is required by the Ruby interpreter because it wants to mark the stack
|
||||||
|
int ret = rba::RubyInterpreter::initialize (argc, argv, &klayout_main_cont);
|
||||||
|
|
||||||
|
// clean up all static data now, since we don't trust the static destructors.
|
||||||
|
// NOTE: this needs to happen after the Ruby interpreter went down since otherwise the GC will
|
||||||
|
// access objects that are already cleaned up.
|
||||||
|
tl::StaticObjects::cleanup ();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
klayout_main_cont (int &argc, char **argv)
|
||||||
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
qInstallMessageHandler (myMessageOutput);
|
qInstallMessageHandler (myMessageOutput);
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,12 @@ static std::string arch (C *)
|
||||||
return tl::arch_string ();
|
return tl::arch_string ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
static std::string version (C *)
|
||||||
|
{
|
||||||
|
return C::version ();
|
||||||
|
}
|
||||||
|
|
||||||
template <class C>
|
template <class C>
|
||||||
static gsi::Methods application_methods ()
|
static gsi::Methods application_methods ()
|
||||||
{
|
{
|
||||||
|
|
@ -213,7 +219,7 @@ static gsi::Methods application_methods ()
|
||||||
"\n"
|
"\n"
|
||||||
"This method has been added in version 0.22."
|
"This method has been added in version 0.22."
|
||||||
) +
|
) +
|
||||||
method<C, std::string> ("version", &C::version,
|
method_ext<C, std::string> ("version", &version<C>,
|
||||||
"@brief Returns the application's version string\n"
|
"@brief Returns the application's version string\n"
|
||||||
) +
|
) +
|
||||||
method_ext<C, std::string> ("arch", &arch<C>,
|
method_ext<C, std::string> ("arch", &arch<C>,
|
||||||
|
|
|
||||||
|
|
@ -483,16 +483,6 @@ ApplicationBase::parse_cmd (int &argc, char **argv)
|
||||||
|
|
||||||
m_packages_with_dep = true;
|
m_packages_with_dep = true;
|
||||||
|
|
||||||
} else if (a == "-v") {
|
|
||||||
|
|
||||||
tl::info << lay::Version::name () << " " << lay::Version::version ();
|
|
||||||
exit (0);
|
|
||||||
|
|
||||||
} else if (a == "-h") {
|
|
||||||
|
|
||||||
tl::info << usage () << tl::noendl;
|
|
||||||
exit (0);
|
|
||||||
|
|
||||||
} else if (a == "-m" && (i + 1) < argc) {
|
} else if (a == "-m" && (i + 1) < argc) {
|
||||||
|
|
||||||
m_files.push_back (std::make_pair (rdb_file, std::make_pair (std::string (args [++i]), std::string ())));
|
m_files.push_back (std::make_pair (rdb_file, std::make_pair (std::string (args [++i]), std::string ())));
|
||||||
|
|
@ -929,7 +919,7 @@ ApplicationBase::instance ()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
ApplicationBase::version () const
|
ApplicationBase::version ()
|
||||||
{
|
{
|
||||||
return std::string (lay::Version::name ()) + " " + lay::Version::version ();
|
return std::string (lay::Version::name ()) + " " + lay::Version::version ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,12 +100,12 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Return the program's version
|
* @brief Return the program's version
|
||||||
*/
|
*/
|
||||||
std::string version () const;
|
static std::string version ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the program's usage string
|
* @brief Return the program's usage string
|
||||||
*/
|
*/
|
||||||
std::string usage ();
|
static std::string usage ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the main window's reference
|
* @brief Returns the main window's reference
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ HelpSource::initialize_index ()
|
||||||
try {
|
try {
|
||||||
tl::XMLFileSource in (*c);
|
tl::XMLFileSource in (*c);
|
||||||
help_index_structure.parse (in, *this);
|
help_index_structure.parse (in, *this);
|
||||||
if (m_klayout_version == lay::ApplicationBase::instance ()->version ()) {
|
if (m_klayout_version == lay::ApplicationBase::version ()) {
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
} catch (tl::Exception &ex) {
|
} catch (tl::Exception &ex) {
|
||||||
|
|
@ -352,7 +352,7 @@ HelpSource::create_index_file (const std::string &path)
|
||||||
std::string
|
std::string
|
||||||
HelpSource::klayout_version () const
|
HelpSource::klayout_version () const
|
||||||
{
|
{
|
||||||
return lay::ApplicationBase::instance ()->version ();
|
return lay::ApplicationBase::version ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -3543,9 +3543,9 @@ MainWindow::update_window_title ()
|
||||||
if (current_view ()->is_dirty ()) {
|
if (current_view ()->is_dirty ()) {
|
||||||
sep += "[+] ";
|
sep += "[+] ";
|
||||||
}
|
}
|
||||||
setWindowTitle (tl::to_qstring (lay::ApplicationBase::instance ()->version () + sep + current_view ()->title ()));
|
setWindowTitle (tl::to_qstring (lay::ApplicationBase::version () + sep + current_view ()->title ()));
|
||||||
} else {
|
} else {
|
||||||
setWindowTitle (tl::to_qstring (lay::ApplicationBase::instance ()->version ()));
|
setWindowTitle (tl::to_qstring (lay::ApplicationBase::version ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue