cae  0.0.0
Cross-API graphics engine
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1#include "CAE/Application.hpp"
2
3#include "Utils/Logger.hpp"
4
5int main(const int argc, const char *const *argv, const char *const *envp)
6{
7 std::unique_ptr<cae::Application> app = nullptr;
8
10 try
11 {
12 cae::ArgsConfig argsConfig = cae::ArgsHandler::ParseArgs(argc, argv);
14 if (!argsConfig.run)
15 {
16 return EXIT_SUCCESS;
17 }
18 app = std::make_unique<cae::Application>(argsConfig, envConfig);
19 app->start();
20 app->stop();
21 }
22 catch (const std::exception &e)
23 {
24 utl::Logger::log(std::string("Exception: ") + e.what() + '\n', utl::LogLevel::WARNING);
25 return EXIT_FAILURE;
26 }
27 catch (...)
28 {
29 utl::Logger::log(std::string("Unknown exception"), utl::LogLevel::WARNING);
30 return EXIT_FAILURE;
31 }
32 return EXIT_SUCCESS;
33}
This file contains the Application class declaration.
This file contains the Logger class.
static ArgsConfig ParseArgs(int argc, const char *const *argv)
Parse command line arguments.
static EnvConfig ParseEnv(const char *const *envp)
Parse environment variables.
static void init()
Initialize the logger.
Definition logger.cpp:7
static void log(const std::string &message, const LogLevel &logLevel)
Log a message with a specific log level.
Definition Logger.hpp:71
int main(const int argc, const char *const *argv, const char *const *envp)
Definition main.cpp:5
Struct for command line arguments configuration.
Struct for environment variables configuration.