Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation] Update documentation for CoSimIO integration in C++, C, and Python for Windows #362

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 22 additions & 8 deletions docs/tutorials/c/integration_co_sim_io.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ Several options for using/integrating the _CoSimIO_ exist:
Here the _CoSimIO_ is directly integrated into the host code and added with `add_subdirectory(CoSimIO)`. CMake then takes care of compiling and installing the _CoSimIO_.
Kratos uses this way to integrate the CoSimIO, check the [`CMakeLists.txt` of the CoSimulationApplication for details](https://github.com/KratosMultiphysics/Kratos/blob/master/applications/CoSimulationApplication/CMakeLists.txt)
- Compiling _CoSimIO_ outside the host project:
One can use [build_c.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_c.sh) for compiling it.
One can use [build_c.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_c.sh) or [build_c.bat](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_c.bat) for compiling it.

```bash
$ bash scripts/build_c.sh
```
- For *GNU/Linux* or *MacOS*:
```bash
$ bash scripts/build_c.sh
```

- For Windows OS:

```cmd
$ scripts/build_c.bat
```

After compiling, the headers need to be included (e.g. with `include_directories`) and the `co_sim_io_c` shared library needs to be linked (e.g with `target_link_libraries`).
```
Expand All @@ -52,11 +59,18 @@ Several options for using/integrating the _CoSimIO_ exist:
```

- Compiling _CoSimIO_ outside the host and manually integrating it:
One can use [build_c.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_c.sh) for compiling it.
One can use [build_c.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_c.sh) or [build_c.bat](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_c.bat) for compiling it.

```bash
$ bash scripts/build_c.sh
```
- For *GNU/Linux* or *MacOS*:
```bash
$ bash scripts/build_c.sh
```

- For Windows OS:

```cmd
$ scripts/build_c.bat
```

Is important that the compiler can find the header files of the _CoSimIO_. For this, one can add the folder `co_sim_io` to the include path.
Example:
Expand Down
30 changes: 22 additions & 8 deletions docs/tutorials/cpp/integration_co_sim_io.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ Several options for using/integrating the _CoSimIO_ exist:
Here the _CoSimIO_ is directly integrated into the host code and added with `add_subdirectory(CoSimIO)`. CMake then takes care of compiling and installing the _CoSimIO_.
Kratos uses this way to integrate the CoSimIO, check the [`CMakeLists.txt` of the CoSimulationApplication for details](https://github.com/KratosMultiphysics/Kratos/blob/master/applications/CoSimulationApplication/CMakeLists.txt)
- Compiling _CoSimIO_ outside the host project:
One can use [build_cpp.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_cpp.sh) for compiling it.
One can use [build_cpp.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_cpp.sh) or [build_cpp.bat](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_cpp.bat) for compiling it.

```bash
$ bash scripts/build_cpp.sh
```
- For *GNU/Linux* or *MacOS*:
```bash
$ bash scripts/build_cpp.sh
```

- For Windows OS:

```cmd
$ scripts/build_cpp.bat
```

After compiling, the headers need to be included (e.g. with `include_directories`) and the `co_sim_io` shared library needs to be linked (e.g with `target_link_libraries`).
```
Expand All @@ -52,11 +59,18 @@ Several options for using/integrating the _CoSimIO_ exist:
```

- Compiling _CoSimIO_ outside the host and manually integrating it:
One can use [build_cpp.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_cpp.sh) for compiling it.
One can use [build_cpp.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_cpp.sh) or [build_cpp.bat](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_cpp.bat) for compiling it.

```bash
$ bash scripts/build_cpp.sh
```
- For *GNU/Linux* or *MacOS*:
```bash
$ bash scripts/build_cpp.sh
```

- For Windows OS:

```cmd
$ scripts/build_cpp.bat
```

Is important that the compiler can find the header files of the _CoSimIO_. For this, one can add the folder `co_sim_io` to the include path.
Example:
Expand Down
19 changes: 13 additions & 6 deletions docs/tutorials/python/integration_co_sim_io.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,19 @@ This tutorial helps you to integrate the _CoSimIO_ into a solver/software-tool u
## Building the CoSimIO
The Python interface is located in [co_sim_io/python](https://github.com/KratosMultiphysics/CoSimIO/tree/master/co_sim_io/python) folder of the repository. It uses the [pybind11 library](https://github.com/pybind/pybind11) for exposing the C++ code to Python. It is provided in the [expternal_libraries/pybind11](https://github.com/KratosMultiphysics/CoSimIO/tree/master/external_libraries/pybind11) folder of this repo.

One may use the [build_python.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_python.sh) script from the CoSimIO root folder to create a library of the python interface:
One may use the [build_python.sh](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_python.sh) or [build_python.bat](https://github.com/KratosMultiphysics/CoSimIO/blob/master/scripts/build_python.bat) script from the _CoSimIO_ root folder to create a library of the python interface:

```
sh scripts/build_python.sh
```
This will compile the binaries and install them into the `bin/` subfolder of _CoSimIO_, together with the CoSimIO Python module. Check [here](../../build_options.md) for the available build options.
- For *GNU/Linux* or *MacOS*:
```bash
$ bash scripts/build_python.sh
```

- For Windows OS:

```cmd
$ scripts/build_python.bat
```
This will compile the binaries and install them into the `bin/` subfolder of _CoSimIO_, together with the _CoSimIO_ Python module. Check [here](../../build_options.md) for the available build options.

The created folder structure should look like this:
```
Expand All @@ -56,7 +63,7 @@ Remember to add the `/bin` folder to your `PYTHONPATH`. For Linux this should lo
export PYTHONPATH=$PYTHONPATH:/path/to/CoSimIO/bin
```

Usually pybind automatically detects the Python installation. Sometimes it can however be necessary to explicitly specify the target Python version. This can be achieved through CMake by setting PYBIND11_PYTHON_VERSION or an exact Python installation can be specified with PYTHON_EXECUTABLE. For example:
Usually pybind automatically detects the Python installation. Sometimes it can however be necessary to explicitly specify the target Python version. This can be achieved through CMake by setting `PYBIND11_PYTHON_VERSION` or an exact Python installation can be specified with `PYTHON_EXECUTABLE`. For example:
```cmake
-DPYBIND11_PYTHON_VERSION=3.6
# or
Expand Down
Loading