Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ArcaneDriverMain.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ArcaneDriverMain.cc (C) 2000-2026 */
9/* */
10/* Default main program. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/CommandLineArguments.h"
15#include "arcane/utils/ApplicationInfo.h"
16#include "arcane/utils/Exception.h"
17
18#include "arcane/impl/ArcaneMain.h"
19
20using namespace Arcane;
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25int _mainHelper(int argc, char* argv[])
26{
28 app_info.setCommandLineArguments(CommandLineArguments(&argc, &argv));
29 app_info.setCodeName("ArcaneDriver");
30 app_info.setCodeVersion(VersionInfo(1, 0, 0));
31 app_info.addDynamicLibrary("arcane_mpi");
32 app_info.addDynamicLibrary("arcane_ios");
33 app_info.addDynamicLibrary("arcane_std");
34 app_info.addDynamicLibrary("arcane_mesh");
35 return ArcaneMain::run();
36}
37
38/*---------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------*/
40
41int main(int argc, char* argv[])
42{
43 int r = 0;
44 int r2 = arcaneCallFunctionAndCatchException([&]() { r = _mainHelper(argc, argv); });
45 if (r2 != 0)
46 return r2;
47 return r;
48}
49
50/*---------------------------------------------------------------------------*/
51/*---------------------------------------------------------------------------*/
Application information.
void setCommandLineArguments(const CommandLineArguments &args)
Sets the command line arguments.
void setCodeVersion(const VersionInfo &version_info)
Sets the version number.
void addDynamicLibrary(const String &lib_name)
Adds the library lib_name to the list of dynamically loaded libraries.
void setCodeName(const String &code_name)
Sets the code name.
static int run()
Entry point of the executable in Arcane.
static ApplicationInfo & defaultApplicationInfo()
Default application info.
Information about a version.
Definition VersionInfo.h:47
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Integer arcaneCallFunctionAndCatchException(std::function< void()> function)
Calls the function function while catching potential exceptions.