Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
bcedee0
CLI experiment with singed commit
TonyXiang8787 Jul 1, 2026
1b0d2f6
Merge branch 'main' into feature/pgm-cli
mgovers Jul 9, 2026
ce329a6
down merge
TonyXiang8787 Jul 17, 2026
9f0e593
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Jul 20, 2026
63b2c0e
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Jul 21, 2026
13e1f18
Remove GitHub release job from workflow
TonyXiang8787 Jul 21, 2026
3b2548f
help cli
TonyXiang8787 Jul 22, 2026
d9b2015
try sign
TonyXiang8787 Jul 22, 2026
10ae34f
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Jul 22, 2026
aaa70c0
try to split
TonyXiang8787 Jul 22, 2026
417b17b
reuse python shim
TonyXiang8787 Jul 22, 2026
fc99c28
add mutex
TonyXiang8787 Jul 22, 2026
532316a
call back
TonyXiang8787 Jul 22, 2026
21fd9c3
message call back
TonyXiang8787 Jul 22, 2026
bccf944
get cli test
TonyXiang8787 Jul 22, 2026
0e090a4
cli test
TonyXiang8787 Jul 22, 2026
dd4c74a
test more
TonyXiang8787 Jul 22, 2026
b919bac
use c
TonyXiang8787 Jul 22, 2026
42eb6ce
test shim
TonyXiang8787 Jul 22, 2026
0899a7d
Update test target file path for PGMCLI
TonyXiang8787 Jul 23, 2026
d282788
Fix CLI linker language for GCC sanitizer builds
Copilot Jul 23, 2026
b8be263
sonar
TonyXiang8787 Jul 23, 2026
534bc34
clang tidy
TonyXiang8787 Jul 23, 2026
45c9338
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Jul 24, 2026
72a8be0
cmake
TonyXiang8787 Jul 26, 2026
f6215fe
cpp cli
TonyXiang8787 Jul 26, 2026
3c26909
cli
TonyXiang8787 Jul 26, 2026
5767dce
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Jul 27, 2026
b763826
use ranges transform
TonyXiang8787 Jul 27, 2026
f35a02e
test more
TonyXiang8787 Jul 27, 2026
e5c16fe
fix clang tidy
TonyXiang8787 Aug 2, 2026
104c70e
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Aug 19, 2026
bd7f158
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Aug 25, 2026
2fea14d
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Aug 28, 2026
47f4a86
trigger ci
TonyXiang8787 Aug 30, 2026
2c17bd2
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Sep 6, 2026
9a689eb
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Sep 15, 2026
966b155
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Sep 18, 2026
fc934dd
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Oct 1, 2026
05d0cac
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Oct 5, 2026
3e9b45c
start docs
TonyXiang8787 Oct 5, 2026
eb3291a
docs
TonyXiang8787 Oct 5, 2026
1812083
fix name
TonyXiang8787 Oct 5, 2026
5250946
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Oct 6, 2026
6f55d49
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Oct 12, 2026
1bf768d
use std format
TonyXiang8787 Oct 12, 2026
ec0695b
msgpack check comment
TonyXiang8787 Oct 12, 2026
2444fc2
add user doc
TonyXiang8787 Oct 12, 2026
12f6e7c
add build guide
TonyXiang8787 Oct 12, 2026
41aae17
remove shorthand for many options
TonyXiang8787 Oct 12, 2026
9934062
explain mutex:'
TonyXiang8787 Oct 12, 2026
0e3a08d
add initialization
TonyXiang8787 Oct 12, 2026
e7cc31f
more explanation
TonyXiang8787 Oct 12, 2026
24114ad
fix typo
TonyXiang8787 Oct 13, 2026
7e4a73b
typo
TonyXiang8787 Oct 16, 2026
6e8ab9a
typo cli option
TonyXiang8787 Oct 16, 2026
5517f9a
some typos
TonyXiang8787 Oct 19, 2026
0e854f0
revision on docs
TonyXiang8787 Oct 19, 2026
4c0a1f2
adjust some docs
TonyXiang8787 Oct 19, 2026
4fb95f3
fix build guide
TonyXiang8787 Oct 19, 2026
025ac4e
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Oct 19, 2026
754b5e6
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Oct 19, 2026
8af19c9
use transformer pair
TonyXiang8787 Oct 19, 2026
195ba36
Merge branch 'feature/pgm-cli' of https://github.com/PowerGridModel/p…
TonyXiang8787 Oct 19, 2026
7deae24
fix enum
TonyXiang8787 Oct 19, 2026
2ef1247
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Oct 20, 2026
1f9ef1a
Merge branch 'main' into feature/pgm-cli
TonyXiang8787 Oct 20, 2026
5698d2d
use new injection
TonyXiang8787 Oct 20, 2026
dbbc93f
dosstring
TonyXiang8787 Oct 20, 2026
723f09e
doc in toml
TonyXiang8787 Oct 20, 2026
8487ce4
add empty tables
TonyXiang8787 Oct 20, 2026
29c496d
verbose to show
TonyXiang8787 Oct 20, 2026
a6788b3
use new env
TonyXiang8787 Oct 20, 2026
0232ffa
try again with conda
TonyXiang8787 Oct 20, 2026
de66550
Update CMakeLists.txt
TonyXiang8787 Oct 21, 2026
3b968e9
Update CMakeLists.txt
TonyXiang8787 Oct 21, 2026
a0bd2ac
Update docs/advanced_documentation/build-guide.md
TonyXiang8787 Oct 21, 2026
edf67f1
Update power_grid_model_c/power_grid_model_cli_backend/src/cli_option…
TonyXiang8787 Oct 21, 2026
f8b5fd4
Update power_grid_model_c/power_grid_model_cli_backend/src/cli_main.cpp
TonyXiang8787 Oct 21, 2026
37811e8
Update power_grid_model_c/power_grid_model_cli_backend/src/cli_option…
TonyXiang8787 Oct 21, 2026
a5455a3
Update power_grid_model_c/power_grid_model_cli_backend/src/cli_option…
TonyXiang8787 Oct 21, 2026
588cbfb
fix typo
TonyXiang8787 Oct 21, 2026
e470be9
Merge branch 'feature/pgm-cli' of git@github.com:PowerGridModel/power…
TonyXiang8787 Oct 21, 2026
f6e7378
fix cmake
TonyXiang8787 Oct 21, 2026
7733152
fix error
TonyXiang8787 Oct 21, 2026
7b7b514
revert back to stream
TonyXiang8787 Oct 21, 2026
4d288d4
remove vvv
TonyXiang8787 Oct 21, 2026
53b6256
add sstream
TonyXiang8787 Oct 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/conda_pgm_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: conda-pgm-env
dependencies:
# build env
- python=3.12
- python=3.14
- pip
- scikit-build-core
# build deps
Expand All @@ -16,7 +16,9 @@ dependencies:
- numpy
- cmake
- ninja
- cli11
# test deps
- pytest
- pytest-cov
- msgpack-python
- dynamic-metadata
16 changes: 13 additions & 3 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,18 @@ jobs:
cmake --build build/ --verbose -j1
cmake --install build/

- name: Build python
run: python -m pip install . --no-build-isolation --no-deps -C wheel.cmake=false
- name: Build python (Linux)
if: matrix.os == 'ubuntu'
run: CONDA_BUILD=1 python -m pip install . --no-build-isolation --no-deps -C wheel.cmake=false

- name: Build python (Windows)
if: matrix.os == 'windows'
run: |
$env:CONDA_BUILD = "1"
python -m pip install . --no-build-isolation --no-deps -C wheel.cmake=false

- name: Test
run: pytest
run: |
pytest
power-grid-model --help
power-grid-model --version
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ bld/
# Visual Studio 2017 auto generated files
Generated\ Files/

# Generated during the Read the Docs build
/docs/api_reference/cli-help.txt

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
Expand Down
2 changes: 2 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ build:
- find power_grid_model_c/power_grid_model_c/include -name *.h -exec sed -i -r "s/ PGM_NOEXCEPT//g" {} \;
# build doxygen for C header
- cd docs/doxygen && doxygen && cd ../..
# capture CLI help for the reference page
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv run power-grid-model --help > docs/api_reference/cli-help.txt

# build class and package diagrams
- pyreverse --no-standalone -o dot src/power_grid_model
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ find_package(Boost REQUIRED)
find_package(Eigen3 CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(msgpack-cxx REQUIRED)
find_package(CLI11 CONFIG REQUIRED)
Comment thread
TonyXiang8787 marked this conversation as resolved.

if(NOT WIN32)
# thread
Expand Down
5 changes: 5 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@
.wy-table-responsive table td, .wy-table-responsive table th {
white-space: inherit;
}

.cli-help pre {
white-space: pre-wrap;
overflow-wrap: anywhere;
}
17 changes: 13 additions & 4 deletions docs/advanced_documentation/build-guide.md
Comment thread
TonyXiang8787 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ In this repository there are three builds:
* A dynamic library (`.dll` on Windows, `.so` on Linux, or `.dylib` on macOS) with a stable pure C API/ABI which can
be used by any application (enabled by default).
* An install target that installs the package containing the dynamic library (enabled by default).
* Native C++ unit tests.
* A shared library that provides the command-line interface backend.
* A command-line interface executable.
* Native C++ unit tests, including tests for the command-line interface.
* C API tests.
* A performance benchmark program.
* An example C program to call the shared library.
Expand Down Expand Up @@ -111,6 +113,7 @@ Manual installation is only required for standalone CMake builds.
| [eigen3](https://eigen.tuxfamily.org/) | Installed automatically | CMake needs to be able find `eigen3` | header-only | [Mozilla Public License, version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) |
| [nlohmann-json](https://github.com/nlohmann/json) | Installed automatically | CMake needs to be able find `nlohmann_json` | header-only | [MIT](https://github.com/nlohmann/json/blob/develop/LICENSE.MIT) |
| [msgpack-cxx](https://github.com/msgpack/msgpack-c/tree/cpp_master) | Installed automatically | CMake needs to be able find `msgpack-cxx` | header-only | [Boost Software License - Version 1.0](https://github.com/msgpack/msgpack-c/blob/cpp_master/LICENSE_1_0.txt) |
| [CLI11](https://github.com/CLIUtils/CLI11) | Installed automatically | CMake needs to be able find `CLI11` | header-only | [BSD 3-Clause](https://github.com/CLIUtils/CLI11/blob/main/LICENSE) |
| [doctest](https://github.com/doctest/doctest) | None | CMake needs to be able find `doctest` | header-only | [MIT](https://github.com/doctest/doctest/blob/master/LICENSE.txt) |
<!-- pyml enable line-length-->

Expand Down Expand Up @@ -209,8 +212,11 @@ In the developer build the following build targets (directories) are enabled:

* `power_grid_model_c`: a dynamic library (`.so` on Linux, `.dylib` on macOS, `.dll` on Windows) with stable pure
C API/ABI which can be used by any application.
* `power_grid_model_cli_backend`: a shared library that provides the command-line interface backend.
* `power_grid_model_cli`: the command-line interface executable (`power-grid-model`).
* `tests/cpp_unit_tests_*`: (including subdirectories) the different unit test targets for the C++ core using the
`doctest` framework.
* `tests/cpp_cli_tests`: the command-line interface test target using the `doctest` framework.
* `tests/cpp_validation_tests`: the validation test target using the `doctest` framework.
* `tests/native_api_tests`: the C API test target using the `doctest` framework.
* `tests/benchmark_cpp`: the C++ benchmark target for performance measure.
Expand Down Expand Up @@ -275,7 +281,7 @@ The recommended way to get the [C++ packages](#c) and `uv` is via [Homebrew](htt
```shell
brew install \
gdb gcovr lcov lld cmake ninja \
boost eigen nlohmann-json msgpack-cxx doctest uv
boost eigen nlohmann-json msgpack-cxx cli11 doctest uv
```

Append the following lines into the file `${HOME}/.bashrc` (required for `scikit-build` for the Python installation):
Expand All @@ -301,6 +307,7 @@ Install from source in develop mode and run the tests:
```shell
uv sync
uv run pytest
uv run power-grid-model -h
```

### Build CMake Project
Expand Down Expand Up @@ -357,7 +364,7 @@ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | ie
The recommended way to get [C++ packages](#c) is via `conda`. Open a miniforge console.

```shell
conda create --yes -p C:\conda_envs\cpp_pkgs -c conda-forge libboost-headers eigen nlohmann_json msgpack-cxx doctest
conda create --yes -p C:\conda_envs\cpp_pkgs -c conda-forge libboost-headers eigen nlohmann_json msgpack-cxx cli11 doctest
```

### Environment variables
Expand Down Expand Up @@ -389,6 +396,7 @@ Go to the repository folder in your powershell, build project from source and ru
```powershell
uv sync
uv run pytest
uv run power-grid-model -h
```

#### Build Python Library from Source with Native Debug Symbols
Expand Down Expand Up @@ -435,7 +443,7 @@ In this section, an example is given for setup in macOS Tahoe and the project's
The recommended way to get the [C++ packages](#c) and `uv` is via [Homebrew](https://brew.sh):

```shell
brew install ninja cmake boost eigen nlohmann-json msgpack-cxx doctest uv
brew install ninja cmake boost eigen nlohmann-json msgpack-cxx doctest uv cli11
```

### Environment variables
Expand All @@ -462,6 +470,7 @@ Install from source in develop mode and run the tests:
```shell
uv sync
uv run pytest
uv run power-grid-model -h
```

### Build CMake Project
Expand Down
19 changes: 19 additions & 0 deletions docs/api_reference/cli-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>

SPDX-License-Identifier: MPL-2.0
-->

# Power Grid Model CLI Reference

This is the CLI reference for the `power-grid-model`.

**The Power Grid Model CLI is still experimental. We offer no guarantee on stability of CLI arguments!**

See below the CLI Reference, you can also run `power-grid-model --help` to get them:

```{literalinclude} cli-help.txt
:language: text
:class: cli-help
```

1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ user_manual/serialization
:maxdepth: 2
api_reference/python-api-reference
api_reference/power-grid-model-c-api-reference
api_reference/cli-reference
```

```{toctree}
Expand Down
4 changes: 4 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,7 @@ This is what makes Power Grid Model a powerful calculation engine.
You need to create a batch update dataset and put it in the `update_data` argument of `calculate_power_flow`.
Please refer to [Power Flow Example](example_notebooks/Power%20Flow%20Example.ipynb) for a detailed tutorial about how to execute
batch calculations.

## Power Grid Model Command Line Interface (CLI)

Power Grid Model also provides an experimental CLI. See [CLI API Reference](api_reference/cli-reference.md) for more details.
24 changes: 24 additions & 0 deletions extra_project_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
#
# SPDX-License-Identifier: MPL-2.0

"""Provide Python package entry points outside Conda builds.

Regular builds expose the CMake root entry point and Python CLI shim through
package metadata. Conda builds use the native CLI executable directly, so provide empty tables for
these fields to avoid installing a Python shim that could conflict with it.
"""

import os
from collections.abc import Mapping
from typing import Any


def dynamic_metadata(_settings: Mapping[str, Any], _project: Mapping[str, Any]) -> dict[str, Any]:
if "CONDA_BUILD" in os.environ:
return {"entry-points": {}, "scripts": {}}

return {
"entry-points": {"cmake.root": {"power_grid_model": "power_grid_model._core.power_grid_model_c"}},
"scripts": {"power-grid-model": "power_grid_model._core.power_grid_model_c.run_pgm_cli:main"},
}
2 changes: 2 additions & 0 deletions power_grid_model_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
add_subdirectory("power_grid_model")
add_subdirectory("power_grid_model_c")
add_subdirectory("power_grid_model_cpp")
add_subdirectory("power_grid_model_cli_backend")
add_subdirectory("power_grid_model_cli")
Comment thread
TonyXiang8787 marked this conversation as resolved.
25 changes: 25 additions & 0 deletions power_grid_model_c/power_grid_model_cli/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
#
# SPDX-License-Identifier: MPL-2.0

add_executable(power_grid_model_cli main.cpp)

target_link_libraries(power_grid_model_cli PRIVATE power_grid_model_cli_backend)

set_target_properties(
power_grid_model_cli
PROPERTIES
INSTALL_RPATH_USE_LINK_PATH FALSE
OUTPUT_NAME "power-grid-model"
)
if(APPLE)
set_target_properties(power_grid_model_cli PROPERTIES INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}")
elseif(UNIX) # Linux, BSD (not Windows/macOS)
set_target_properties(power_grid_model_cli PROPERTIES INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
endif()

install(
TARGETS power_grid_model_cli
EXPORT power_grid_modelTargets
COMPONENT power_grid_model
)
7 changes: 7 additions & 0 deletions power_grid_model_c/power_grid_model_cli/main.cpp
Comment thread
TonyXiang8787 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
//
// SPDX-License-Identifier: MPL-2.0

#include <power_grid_model_cli_backend/cli_main.h>

int main(int argc, char** argv) { return PGM_cli_main(argc, argv, nullptr, nullptr, nullptr); }
73 changes: 73 additions & 0 deletions power_grid_model_c/power_grid_model_cli_backend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
#
# SPDX-License-Identifier: MPL-2.0

add_library(
power_grid_model_cli_backend
SHARED
"src/cli_main.cpp"
"src/cli_options.cpp"
"src/pgm_calculation.cpp"
)

target_include_directories(
power_grid_model_cli_backend
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)

file(
GLOB_RECURSE pgm_cli_backend_public_headers
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.h"
)

target_link_libraries(power_grid_model_cli_backend PRIVATE power_grid_model_c)
target_link_libraries(power_grid_model_cli_backend PRIVATE power_grid_model_cpp)
target_link_libraries(power_grid_model_cli_backend PRIVATE CLI11::CLI11)

target_compile_definitions(
power_grid_model_cli_backend
PRIVATE
PGM_CLI_BACKEND_EXPORTS
PGM_ENABLE_EXPERIMENTAL
)

target_sources(
power_grid_model_cli_backend
PUBLIC
FILE_SET pgm_cli_backend_public_headers
TYPE HEADERS
BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include/"
FILES "${pgm_cli_backend_public_headers}"
)

set_target_properties(
power_grid_model_cli_backend
PROPERTIES VERSION ${PGM_VERSION} SOVERSION ${PGM_VERSION_MAJOR}
)

set_target_properties(power_grid_model_cli_backend PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE)
if(APPLE)
set_target_properties(power_grid_model_cli_backend PROPERTIES INSTALL_RPATH "@loader_path")
elseif(UNIX) # Linux, BSD (not Windows/macOS)
set_target_properties(power_grid_model_cli_backend PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()

if(NOT PGM_MSVC_REPRODUCIBLE_BUILD)
set_target_properties(
power_grid_model_cli_backend
PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE
)
endif()

install(
TARGETS power_grid_model_cli_backend
EXPORT power_grid_modelTargets
COMPONENT power_grid_model
FILE_SET pgm_cli_backend_public_headers
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
//
// SPDX-License-Identifier: MPL-2.0

#pragma once
#ifndef POWER_GRID_MODEL_CLI_BACKEND_CLI_MAIN_H
#define POWER_GRID_MODEL_CLI_BACKEND_CLI_MAIN_H

#ifdef _WIN32
#define PGM_CLI_HELPER_DLL_IMPORT __declspec(dllimport)
#define PGM_CLI_HELPER_DLL_EXPORT __declspec(dllexport)
#define PGM_CLI_HELPER_DLL_LOCAL
#else
#if __GNUC__ >= 4
#define PGM_CLI_HELPER_DLL_IMPORT __attribute__((visibility("default")))
#define PGM_CLI_HELPER_DLL_EXPORT __attribute__((visibility("default")))
#define PGM_CLI_HELPER_DLL_LOCAL __attribute__((visibility("hidden")))
#else
#define PGM_CLI_HELPER_DLL_IMPORT
#define PGM_CLI_HELPER_DLL_EXPORT
#define PGM_CLI_HELPER_DLL_LOCAL
#endif
#endif

#ifdef PGM_CLI_BACKEND_EXPORTS
#define PGM_CLI_API PGM_CLI_HELPER_DLL_EXPORT
#else
#define PGM_CLI_API PGM_CLI_HELPER_DLL_IMPORT
#endif
#define PGM_CLI_LOCAL PGM_CLI_HELPER_DLL_LOCAL

#ifdef __cplusplus
#define PGM_CLI_NOEXCEPT noexcept
#else
#define PGM_CLI_NOEXCEPT
#endif

#ifdef __cplusplus
extern "C" {
#endif

// NOLINTNEXTLINE(modernize-use-using)
typedef void (*PGM_CLIMessageCallback)(char const* msg, void* user_data);

/**
* @brief CLI entry point for the Power Grid Model command line interface.
*
* @param argc Number of command line arguments.
* @param argv Command line arguments.
* @param cout_callback Callback used for standard output. When null, std::cout is used.
* @param cerr_callback Callback used for standard error. When null, std::cerr is used.
* @param user_data Opaque user data forwarded to the callbacks.
* @return Process exit code.
*/
PGM_CLI_API int PGM_cli_main(int argc, char** argv, PGM_CLIMessageCallback cout_callback,
PGM_CLIMessageCallback cerr_callback, void* user_data) PGM_CLI_NOEXCEPT;

#ifdef __cplusplus
}
#endif

#endif // POWER_GRID_MODEL_CLI_BACKEND_CLI_MAIN_H
Loading
Loading