diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7417db81e..a4ba25e44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ uv sync --dev > [!TIP] > > - If sync fails with `missing field 'version'`, you may need to delete lockfile and rerun `rm uv.lock && uv sync --dev`. -> - If sync fails with failed compilation, you may need to install clang and rerun `uv sync --dev`. +> - If sync fails with failed compilation, you may need to install dependencies (see [install-deps.sh](scripts/install-deps.sh)) and rerun `uv sync --dev`. ### Running Tests diff --git a/hatch.toml b/hatch.toml index 118b460e5..a7bd23596 100644 --- a/hatch.toml +++ b/hatch.toml @@ -6,6 +6,7 @@ version-file = "src/codegen/sdk/__init__.py" allow-direct-references = true [envs.hatch-build] installer = "uv" + [[envs.hatch-build.matrix]] tool = ["uv", "pip"] @@ -36,6 +37,14 @@ compile_args = [ "darwin", ], arch = "arm64", arg = "-mcpu=apple-m1" }, ] +env = [ + { env = "CC", arg = "cc", platforms = [ + "linux", + ] }, + { env = "CC", arg = "clang", platforms = [ + "darwin", + ] }, +] cythonize_kwargs = { annotate = true, nthreads = 16, exclude_failures = false, cache = true } compiled_sdist = true compile_py = false diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index 77248fdcb..221e9790c 100755 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -5,7 +5,14 @@ if command -v sudo &> /dev/null; then fi if command -v apt &> /dev/null; then + if ! (command -v clang &> /dev/null || command -v gcc &> /dev/null); then + echo "Neither clang nor gcc found. Installing gcc..." + $SUDO apt update && $SUDO apt install -y gcc build-essential python3-dev + fi + $SUDO apt update && $SUDO apt install -y jq \ + build-essential \ + python3-dev \ libpixman-1-dev \ libcairo2-dev \ libpango1.0-dev \