refactor: re-implement the project, which should be available for both org and com version of OpenFOAM

This commit is contained in:
2024-09-11 21:19:50 +08:00
parent 412142f88e
commit 9b874ad9b9
7 changed files with 168 additions and 164 deletions

View File

@ -1,21 +1,24 @@
# of_cmake_config
[中文](./README.zh_CN.md) | [English](./README.md)
#### Description
This project is used to generate CMakeLists.txt for OpenFOAM project.
#### Introduction
This project is used to generate `CMakeLists.txt` for OpenFOAM projects.
#### Installation
0. Activate OpenFOAM environment:
- Using alias `of2012clang` or `of2012clangdebug`
- source directly: `source $HOME/OpenFOAM/OpenFOAM-v2012/etc/bashrc WM_COMPILER=Clang ...`
1. Get this project: `git clone https://github.com/zhyang-dev/of_cmake_config.git`
#### Installation Guide
0. Activate the required OpenFOAM environment (otherwise the installation will fail).
1. Obtain the project source code: `git clone https://github.com/zhyang-dev/of_cmake_config.git`
2. Install: `cd of_cmake_config && ./install`
#### Instructions
#### Usage Instructions
1. Activate OpenFOAM environment
2. In project root path,
- run `ofCmakeConfig` to generate `CMakeLists.txt`
- or run `occ`, which is a wrapper of `ofCmakeConfig` script, to generate `CMakeLists.txt` and `compile_commands.json`.
0. Activate the OpenFOAM environment.
1. In the project's root directory:
- Run `ofCmakeConfig` to generate `CMakeLists.txt`.
- Or run `occ`, which will execute `ofCmakeConfig` and call `cmake -B build`, eventually generating `compile_commands.json` in the build directory.
![video demo](demo/occ_demo.gif)
#### Testing Environment
- `vscode` + `clangd`
- `vim` + `coc-clangd`
The following demonstrates the second scenario based on the icoFoam case.
![Video Demo](demo/occ_demo.gif)