Skip to content

πŸŽ› πŸ”Š A Python library for audio.

#62 Adding shim scripts to allow ccache to be used during linking on linux (#130)

Wild8cb264bc7d2
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1541606..9f3cc67 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -20,11 +20,23 @@ python3 setup.py build develop
Then, you can `import pedalboard` from Python (or run the tests with `tox`) to test out your local changes.
-> If you're on macOS, you can try to compile a debug build _faster_ by using [Ccache](https://ccache.dev/) (`brew install ccache`):
+> If you're on macOS or Linux, you can try to compile a debug build _faster_ by using [Ccache](https://ccache.dev/):
+> ## macOS
> ```shell
-> rm -rf build && CC="ccache clang" CXX="ccache clang++" DEBUG=1 python3 setup.py build -j8 develop
+> brew install ccache
+> rm -rf build && CC="ccache clang" CXX="ccache clang++" DEBUG=1 python3 -j8 -m pip install -e .
+> ```
+> ## Linux
+> e.g.
+> ```shell
+> sudo yum install ccache # or apt, if on a Debian
+>
+> # If using GCC:
+> rm -rf build && CC="ccache gcc" CXX="scripts/ccache_g++" DEBUG=1 python3 setup.py build -j8 develop
+>
+> # ...or if using Clang:
+> rm -rf build && CC="ccache clang" CXX="scripts/ccache_clang++" DEBUG=1 python3 setup.py build -j8 develop
> ```
-> Note that `ccache` may or may not work out-of-the-box on other platforms - see https://github.com/spotify/pedalboard/issues/62 for more information.
By default, [all `.cpp` and `.mm` files in the `pedalboard` directory (or subdirectories)](https://github.com/spotify/pedalboard/blob/master/setup.py#L129) will be automatically compiled by `setup.py`.
diff --git a/scripts/ccache_clang++ b/scripts/ccache_clang++
new file mode 100755
index 0000000..52deb3c
--- /dev/null
+++ b/scripts/ccache_clang++
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+#
+# ccache_clang++
+#
+# This script is a shim to allow the passing of the ccache command in to the
+# CXX environmental variable on linux, which increases the speed of compilation
+
+$(ccache clang++ $@)
diff --git a/scripts/ccache_g++ b/scripts/ccache_g++
new file mode 100755
index 0000000..f3543a7
--- /dev/null
+++ b/scripts/ccache_g++
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+#
+# ccache_g++
+#
+# This script is a shim to allow the passing of the ccache command in to the
+# CXX environmental variable on linux, which increases the speed of compilation
+
+$(ccache g++ $@)