-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (30 loc) · 923 Bytes
/
main.cpp
File metadata and controls
33 lines (30 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "CAE/Application.hpp"
#include "Utils/Logger.hpp"
int main(const int argc, const char *const *argv, const char *const *envp)
{
std::unique_ptr<cae::Application> app = nullptr;
utl::Logger::init();
try
{
cae::ArgsConfig argsConfig = cae::ArgsHandler::ParseArgs(argc, argv);
cae::EnvConfig envConfig = cae::ArgsHandler::ParseEnv(envp);
if (!argsConfig.run)
{
return EXIT_SUCCESS;
}
app = std::make_unique<cae::Application>(argsConfig, envConfig);
app->start();
app->stop();
}
catch (const std::exception &e)
{
utl::Logger::log(std::string("Exception: ") + e.what() + '\n', utl::LogLevel::WARNING);
return EXIT_FAILURE;
}
catch (...)
{
utl::Logger::log(std::string("Unknown exception"), utl::LogLevel::WARNING);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}