diff --git a/CLAUDE.md b/CLAUDE.md index af747932f..216c14faf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -208,6 +208,10 @@ A before/after figure measures one quantity across many cases, so it is **horizo - **Category labels** โ€” two lines, right-aligned against the axis: case name on the first line, its size and any variant/config on the second, separated by a middle dot (e.g. `"cloth-ball"` over `"3,012 ยท two-pass"`); the second line is smaller and greyed. - **Legend** โ€” inside the plot, top right, vertical, no frame (`legend=dict(x=0.99, y=0.99, xanchor='right', yanchor='top', bgcolor='rgba(0,0,0,0)')`), no legend title; entries name themselves (`"before (main)"`, `"after"`). +## Branch Naming + +Branch names must match `^(feature|bugfix|fix|refactor|docs|chore|test|release)\/.+` (e.g. `feature/cuda`, `fix/eigen-github-fallback`). The only exceptions are `main`, release branches matching `v[0-9.]*` (e.g. `v1.2.1`), and `gh-pages`. + ## Writing PR Descriptions Start from `.github/pull_request_template.md` โ€” keep its section skeleton (`# Description`, `## Type of change`, `# How Has This Been Tested?`, `# Checklist`), but write each section of the project's best PRs (e.g. [#246](https://github.com/ipc-sim/ipc-toolkit/pull/246), [#248](https://github.com/ipc-sim/ipc-toolkit/pull/248), [#230](https://github.com/ipc-sim/ipc-toolkit/pull/230), [#228](https://github.com/ipc-sim/ipc-toolkit/pull/228), [#222](https://github.com/ipc-sim/ipc-toolkit/pull/222), [#210](https://github.com/ipc-sim/ipc-toolkit/pull/210), [#207](https://github.com/ipc-sim/ipc-toolkit/pull/207), [#192](https://github.com/ipc-sim/ipc-toolkit/pull/192), [#188](https://github.com/ipc-sim/ipc-toolkit/pull/188)) instead of a one-line fill-in-the-blank. diff --git a/cmake/recipes/eigen.cmake b/cmake/recipes/eigen.cmake index 884746b2a..5681016e6 100644 --- a/cmake/recipes/eigen.cmake +++ b/cmake/recipes/eigen.cmake @@ -1,4 +1,4 @@ -# Eigen (https://gitlab.com/libeigen/eigen) +# Eigen (https://gitlab.com/libeigen/eigen, mirrored at https://github.com/eigen-mirror/eigen) # License: MPL 2.0 if(TARGET Eigen3::Eigen) return() @@ -10,10 +10,49 @@ option(EIGEN_DONT_VECTORIZE "Disable Eigen vectorization" OFF) message(STATUS "Third-party: creating target 'Eigen3::Eigen'") include(CPM) + +set(EIGEN_GIT_TAG 5.0.1) +set(EIGEN_GITLAB_URL "https://gitlab.com/libeigen/eigen.git") +set(EIGEN_GITHUB_URL "https://github.com/eigen-mirror/eigen.git") + +# Cloning from GitLab fails often enough in CI that we fall back to the GitHub +# mirror, which carries the same tags and commits. A failed clone inside +# CPMAddPackage is a fatal error we can't recover from, so instead we probe +# GitLab up front with a cheap `git ls-remote` and pick the source before CPM +# runs. We skip the probe whenever no download will happen: Eigen is already in +# the CPM cache or this build's _deps, or the user pointed CPM at a local copy. +if(CPM_SOURCE_CACHE) + set(EIGEN_DOWNLOAD_DIR "${CPM_SOURCE_CACHE}/eigen/${EIGEN_GIT_TAG}") +else() + set(EIGEN_DOWNLOAD_DIR "${FETCHCONTENT_BASE_DIR}/eigen-src") +endif() +set(EIGEN_GIT_REPOSITORY "${EIGEN_GITLAB_URL}") +# CPM only looks for git once it starts downloading, so we look for it here. +find_package(Git QUIET) +if(GIT_FOUND AND NOT (EXISTS "${EIGEN_DOWNLOAD_DIR}" + OR DEFINED CPM_eigen_SOURCE OR FETCHCONTENT_FULLY_DISCONNECTED)) + execute_process( + COMMAND "${GIT_EXECUTABLE}" ls-remote --exit-code + "${EIGEN_GITLAB_URL}" "refs/tags/${EIGEN_GIT_TAG}" + RESULT_VARIABLE EIGEN_GITLAB_STATUS + OUTPUT_QUIET ERROR_QUIET + TIMEOUT 30 + ) + if(NOT EIGEN_GITLAB_STATUS EQUAL 0) + message(WARNING "Unable to reach ${EIGEN_GITLAB_URL}; " + "falling back to the GitHub mirror ${EIGEN_GITHUB_URL}.") + set(EIGEN_GIT_REPOSITORY "${EIGEN_GITHUB_URL}") + endif() +endif() + CPMAddPackage( NAME eigen - GITLAB_REPOSITORY libeigen/eigen - GIT_TAG 5.0.1 + GIT_REPOSITORY "${EIGEN_GIT_REPOSITORY}" + GIT_TAG ${EIGEN_GIT_TAG} + # Both sources hold identical commits, so we key the cache on the tag alone. + # Otherwise CPM hashes the repository URL into the cache path and a + # fallback would re-clone Eigen even when the GitLab copy is already cached. + CUSTOM_CACHE_KEY ${EIGEN_GIT_TAG} DOWNLOAD_ONLY YES )