Ejemplo n.º 1
0
/**
 * @brief main
 * @return exit code
 * @param argc argument count
 * @param argv array of argument strings
 *
 * Main entry point function
 */
int main(int argc, char* argv[])
{
// PROFILE builds exit on execv ...
// HEADLESS run mostly in parallel for testing purposes, 100% omp threads wouldn't help then
#if !defined(PROFILE) && !defined(HEADLESS)
	bool restart = false;
	restart |= SetNvOptimusProfile(argv);
	restart |= SetOpenMpEnvVars(argv);

  #ifndef WIN32
	if (restart) {
		std::vector<std::string> args(argc-1);
		for (int i=1; i<argc; i++) {
			args[i-1] = argv[i];
		}
		const std::string err = Platform::ExecuteProcess(argv[0], args);
		ErrorMessageBox(err, "Execv error:", MBF_OK | MBF_EXCL);
	}
  #endif
#endif
	int ret = Run(argc, argv);
	std::string exe = EngineTypeHandler::GetRestartExecutable();
	if (exe != "") {
		std::vector<std::string> args;
		for (int i=1; i<argc; i++)
			args.push_back(argv[i]);
		if (!EngineTypeHandler::RestartEngine(exe, args)) {
			handleerror(NULL, EngineTypeHandler::GetRestartErrorMessage(), "Missing engine type", MBF_OK | MBF_EXCL);
		}
	}
	return ret;
}
Ejemplo n.º 2
0
/**
 * @brief main
 * @return exit code
 * @param argc argument count
 * @param argv array of argument strings
 *
 * Main entry point function
 */
int main(int argc, char* argv[])
{
// PROFILE builds exit on execv ...
// HEADLESS run mostly in parallel for testing purposes, 100% omp threads wouldn't help then
#if !defined(PROFILE) && !defined(HEADLESS)
	if (SetNvOptimusProfile(FileSystem::GetFilename(argv[0]))) {
		// prepare for restart
		std::vector<std::string> args(argc - 1);

		for (int i = 1; i < argc; i++)
			args[i - 1] = argv[i];

		// ExecProc normally does not return; if it does the retval is an error-string
		ErrorMessageBox(Platform::ExecuteProcess(argv[0], args), "Execv error:", MBF_OK | MBF_EXCL);
	}
#endif

	return (Run(argc, argv));
}
Ejemplo n.º 3
0
/**
 * @brief main
 * @return exit code
 * @param argc argument count
 * @param argv array of argument strings
 *
 * Main entry point function
 */
int main(int argc, char* argv[])
{
// PROFILE builds exit on execv ...
// HEADLESS run mostly in parallel for testing purposes, 100% omp threads wouldn't help then
#if !defined(PROFILE) && !defined(HEADLESS)
	bool restart = false;
	restart |= SetNvOptimusProfile(argv);

  #ifndef WIN32
	if (restart) {
		std::vector<std::string> args(argc-1);
		for (int i=1; i<argc; i++) {
			args[i-1] = argv[i];
		}
		const std::string err = Platform::ExecuteProcess(argv[0], args);
		ErrorMessageBox(err, "Execv error:", MBF_OK | MBF_EXCL);
	}
  #endif
#endif
	return Run(argc, argv);
}