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

doc(godel-script): Provide supplementary explanations regarding the c… #101

Merged
merged 2 commits into from
Mar 11, 2025
Merged
Changes from 1 commit
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
68 changes: 61 additions & 7 deletions godel-script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,77 @@ Structure of this project:
+-- src godel-frontend source code
```

### Environment

Need C++ standard at least `-std=c++17`.

You can refer to the following Dockerfile to prepare your development environment.

```Dockerfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里描述还是尽量简洁一些,去除不必要的信息噪音,只保留当时我们讨论的核心问题,也就是将 ubuntu 环境下编译时可能缺少的相关包在这里列出来,在系统方面目前项目支持 macOS / Ubuntu 2204 LTS / Ubuntu 2404 LTS 的本地编译,环境尽量不要限制死。

FROM ubuntu:24.04

RUN echo "Types: deb\n\
URIs: http://mirrors.cloud.tencent.com/ubuntu/\n\
Suites: noble noble-updates noble-security\n\
Components: main restricted universe multiverse\n\
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" > /etc/apt/sources.list.d/ubuntu.sources

RUN apt update && apt upgrade -y && apt install -y git build-essential m4 cmake ninja-build clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python3-clang libsqlite3-dev sqlite3 zlib1g-dev
```

For convenience, we recommend directly using the [Dev Container plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) of VSCode. Here is `devcontainer.json`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devcontainer 虽然很有用,但是这里还是请去掉吧,对于文档来说信息过多了


```json
{
"name": "godel-script",
"build": {
"context": "..",
"dockerfile": "./Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"xaver.clang-format",
"twxs.cmake",
"ms-vscode.cmake-tools",
"vadimcn.vscode-lldb",
"llvm-vs-code-extensions.vscode-clangd"
],
"settings": {
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"cmake.generator": "Ninja"
}
}
},
"remoteUser": "root"
}
```


### Apply Patch On Soufflé Submodule

GödelScript uses a self-modified soufflé from a much older branch of public soufflé,
now we use patch to make sure it could be built successfully.
GödelScript uses a self-modified soufflé from a much older branch of public soufflé. Use these commands to clone.

```bash
git submodule init
git submodule update --recursive
```

Use this command to apply patch:
Now we use patch to make sure it could be built successfully. Use these commands to apply patch:

```bash
cd souffle
cd godel-backend/souffle
git am ../0001-init-self-used-souffle-from-public-souffle.patch
```

Use these commands to revert:

```bash
cd souffle
cd godel-backend/souffle
git apply -R ../0001-init-self-used-souffle-from-public-souffle.patch
git reset HEAD~
```
Expand All @@ -79,8 +132,9 @@ git reset HEAD~
Use command below:

```bash
mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release
make -j6
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ --no-warn-unused-cli -G Ninja
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为了配合目前项目配置的 CI,建议仍然使用 cmake 与 make,没有特殊需求尽量不要增加其他实体

cmake --build . --config Release --target all -j 8
```

After building, you'll find `build/godel` in the `build` folder.
Expand Down