Skip to content
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
39 changes: 0 additions & 39 deletions .github/actions/setup_conan_macos/action.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,3 @@ updates:
commit-message:
prefix: "ci: [DEPENDABOT] "
target-branch: develop

- package-ecosystem: github-actions
directory: .github/actions/setup_conan_macos/
schedule:
interval: weekly
day: monday
time: "04:00"
timezone: Etc/GMT
reviewers:
- XRPLF/clio-dev-team
commit-message:
prefix: "ci: [DEPENDABOT] "
target-branch: develop
43 changes: 43 additions & 0 deletions .github/scripts/conan/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -ex

CURRENT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_DIR="$(cd "$CURRENT_DIR/../../../" && pwd)"

CONAN_DIR="${CONAN_HOME:-$HOME/.conan2}"
PROFILES_DIR="$CONAN_DIR/profiles"

APPLE_CLANG_PROFILE="$CURRENT_DIR/apple-clang.profile"

GCC_PROFILE="$REPO_DIR/docker/ci/conan/gcc.profile"
CLANG_PROFILE="$REPO_DIR/docker/ci/conan/clang.profile"

SANITIZER_TEMPLATE_FILE="$REPO_DIR/docker/ci/conan/sanitizer_template.profile"

rm -rf "$CONAN_DIR"

conan remote add --index 0 ripple http://18.143.149.228:8081/artifactory/api/conan/dev

cp "$REPO_DIR/docker/ci/conan/global.conf" "$CONAN_DIR/global.conf"

create_profile_with_sanitizers() {
profile_name="$1"
profile_source="$2"

cp "$profile_source" "$PROFILES_DIR/$profile_name"
cp "$SANITIZER_TEMPLATE_FILE" "$PROFILES_DIR/$profile_name.asan"
cp "$SANITIZER_TEMPLATE_FILE" "$PROFILES_DIR/$profile_name.tsan"
cp "$SANITIZER_TEMPLATE_FILE" "$PROFILES_DIR/$profile_name.ubsan"
}

mkdir -p "$PROFILES_DIR"

if [[ "$(uname)" == "Darwin" ]]; then
create_profile_with_sanitizers "apple-clang" "$APPLE_CLANG_PROFILE"
echo "include(apple-clang)" > "$PROFILES_DIR/default"
else
create_profile_with_sanitizers "clang" "$CLANG_PROFILE"
create_profile_with_sanitizers "gcc" "$GCC_PROFILE"
echo "include(gcc)" > "$PROFILES_DIR/default"
fi
7 changes: 3 additions & 4 deletions .github/workflows/build_impl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ jobs:
with:
disable_ccache: ${{ inputs.disable_cache }}

- name: Setup conan
- name: Setup conan on macOS
if: runner.os == 'macOS'
uses: ./.github/actions/setup_conan_macos
with:
conan_files_dir: docker/ci/conan/
shell: bash
run: ./.github/scripts/conan/init.sh

- name: Restore cache
if: ${{ !inputs.disable_cache }}
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/upload_conan_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,25 @@ on:
- develop
paths:
- .github/workflows/upload_conan_deps.yml
- .github/scripts/generate_conan_matrix.py

- .github/actions/generate/action.yml
- .github/actions/prepare_runner/action.yml
- .github/scripts/conan/generate_matrix.py
- .github/scripts/conan/init.sh

- conanfile.py
- conan.lock
push:
branches:
- develop
paths:
- .github/workflows/upload_conan_deps.yml
- .github/scripts/generate_conan_matrix.py

- .github/actions/generate/action.yml
- .github/actions/prepare_runner/action.yml
- .github/scripts/conan/generate_matrix.py
- .github/scripts/conan/init.sh

- conanfile.py
- conan.lock

Expand All @@ -41,7 +51,7 @@ jobs:

- name: Calculate conan matrix
id: set-matrix
run: .github/scripts/generate_conan_matrix.py >> "${GITHUB_OUTPUT}"
run: .github/scripts/conan/generate_matrix.py >> "${GITHUB_OUTPUT}"

upload-conan-deps:
name: Build ${{ matrix.compiler }}${{ matrix.sanitizer_ext }} ${{ matrix.build_type }}
Expand All @@ -66,11 +76,10 @@ jobs:
with:
disable_ccache: true

- name: Setup conan
- name: Setup conan on macOS
if: runner.os == 'macOS'
uses: ./.github/actions/setup_conan_macos
with:
conan_files_dir: docker/ci/conan/
shell: bash
run: ./.github/scripts/conan/init.sh

- name: Show conan profile
run: conan profile show --profile:all ${{ env.CONAN_PROFILE }}
Expand Down
38 changes: 24 additions & 14 deletions docs/build-clio.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Minimum Requirements

- [Python 3.7](https://www.python.org/downloads/)
- [Conan 1.55, <2.0](https://conan.io/downloads.html)
- [Conan 2.17.0](https://conan.io/downloads.html)
- [CMake 3.20, <4.0](https://cmake.org/download/)
- [**Optional**] [GCovr](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html): needed for code coverage generation
- [**Optional**] [CCache](https://ccache.dev/): speeds up compilation if you are going to compile Clio often
Expand All @@ -19,10 +19,21 @@

### Conan Configuration

Clio requires `compiler.cppstd=20` in your Conan profile (`~/.conan2/profiles/default`).
By default, Conan uses `~/.conan2` as it's home folder.
You can change it by using `$CONAN_HOME` env variable.
[More info about Conan home](https://docs.conan.io/2/reference/environment.html#conan-home).

> [!NOTE]
> Although Clio is built using C++23, it's required to set `compiler.cppstd=20` for the time being as some of Clio's dependencies are not yet capable of building under C++23.
> [!TIP]
> To setup Conan automatically, you can run `.github/scripts/conan/init.sh`.
> This will delete Conan home directory (if it exists), set up profiles and add Artifactory remote.

The instruction below assumes that `$CONAN_HOME` is not set.

#### Profiles

The default profile is the file in `~/.conan2/profiles/default`.

Here are some examples of possible profiles:

**Mac apple-clang 16 example**:

Expand Down Expand Up @@ -56,9 +67,16 @@ os=Linux
tools.build:compiler_executables={'c': '/usr/bin/gcc-12', 'cpp': '/usr/bin/g++-12'}
```

> [!NOTE]
> Although Clio is built using C++23, it's required to set `compiler.cppstd=20` in your profile for the time being as some of Clio's dependencies are not yet capable of building under C++23.

#### global.conf file

Add the following to the `~/.conan2/global.conf` file:

```text
core.download:parallel={{os.cpu_count()}}
core.upload:parallel={{os.cpu_count()}}
tools.info.package_id:confs = ["tools.build:cflags", "tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags"]
```

Expand All @@ -70,16 +88,7 @@ Make sure artifactory is setup with Conan.
conan remote add --index 0 ripple http://18.143.149.228:8081/artifactory/api/conan/dev
```

Now you should be able to download the prebuilt `xrpl` package on some platforms.

> [!NOTE]
> You may need to edit the `~/.conan2/remotes.json` file to ensure that this newly added artifactory is listed last. Otherwise, you could see compilation errors when building the project with gcc version 13 (or newer).

Remove old packages you may have cached interactively.

```sh
conan remove xrpl
```
Now you should be able to download the prebuilt dependencies (including `xrpl` package) on supported platforms.

#### Conan lockfile

Expand All @@ -102,6 +111,7 @@ Navigate to Clio's root directory and run:

```sh
mkdir build && cd build
# You can also specify profile explicitly by adding `--profile:all <PROFILE_NAME>`
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True'
# You can also add -GNinja to use Ninja build system instead of Make
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
Expand Down
Loading