Skip to content

Commit 7ca67c5

Browse files
author
Nathan Ho
authored
Revise building instructions
1 parent ae5780c commit 7ca67c5

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ Beyond this repository, the reader is encouraged to look at [sc3-plugins](https:
1919

2020
This is how you build one of the examples in this directory. The examples are kept separate with duplicated code so that you can simply copy out a directory to start your own ugen (see [Development workflow](#development-workflow)). **Currently, this build system is missing Windows. Sorry, we're working on it...**
2121

22+
### Step 1: Obtain header files
23+
2224
Before you can compile any plugin, you will need a copy of the SuperCollider *source code* (NOT the app itself). The source code version should match your SuperCollider app version. Slight differences will probably be tolerated, but if they're too far apart you will get an "API version mismatch" error when you boot the server.
2325

2426
You will **not** need to recompile SuperCollider itself in order to get a plugin working. You only need the source code to get the C++ headers.
2527

28+
### Step 2: Create build directory and set `SC_PATH`
29+
2630
CMake dumps a lot of files into your working directory, so you should always start by creating the `build/` directory:
2731

2832
```shell
@@ -39,13 +43,28 @@ Here, `/path/to/sc3source/` is the path to the source code. Once again, this is
3943

4044
The path should contain a file at `include/plugin_interface/SC_PlugIn.h`. If you get a warning that `SC_PlugIn.h` could not be found, then `SC_PATH` is not set correctly. If no `SC_PATH` is provided, the build system assumes the SuperCollider include files in `/usr/include/SuperCollider/`.
4145

42-
CMake will remember your `SC_PATH`, so you only need to run that once.
46+
CMake will remember your `SC_PATH`, so you only need to run that once per plugin.
4347

44-
If you also want to build a UGen for Supernova, then you need to set the 'SUPERNOVA' flag. The CMake command would then look like this:
48+
### Step 3: Set flags (optional)
49+
50+
If you don't plan on using a debugger, it's advisable to build in release mode so that the compiler optimizes:
4551

4652
```shell
47-
example-plugins/01a-BoringMixer/build/$ cmake -DSC_PATH=/path/to/sc3source/ -DSUPERNOVA=ON ..
53+
example-plugins/01a-BoringMixer/build/$ cmake -DCMAKE_BUILD_TYPE=RELEASE ..
4854
```
55+
56+
Switch back to debug mode with `-DCMAKE_BUILD_TYPE=DEBUG`.
57+
58+
If you also want to build the UGen for Supernova, then you need to set the 'SUPERNOVA' flag:
59+
60+
```shell
61+
example-plugins/01a-BoringMixer/build/$ cmake -DSUPERNOVA=ON ..
62+
```
63+
64+
Again, all these flags are persistent, and you only need to run them once.
65+
66+
### Step 4: Build it!
67+
4968
After that, simply build using `make`:
5069

5170
```shell
@@ -54,6 +73,8 @@ example-plugins/01a-BoringMixer/build/$ make
5473

5574
This will produce a "shared library" file ending in `.scx`. On Linux, the extension is `.so`.
5675

76+
You can freely alternate between steps 3 and 4. If you decide to go back and change some CMake flags, just hit `make` again.
77+
5778
## Installing
5879

5980
Copy, move, or symbolic link the folder into your Extensions folder. You can find out which one that is by evaluating `Platform.userExtensionDir` in sclang. You can install the plugin(s) system-wide by copying to `Platform.systemExtensionDir`.
@@ -63,7 +84,8 @@ Please note that on macOS Supernova is more picky about location of UGens (as of
6384
If you're not using sclang, the installation method varies. Ask the developer(s) of the client if you're not sure how.
6485

6586
## Development workflow
66-
In order to start developing a new UGen, make a copy of one of the example's directory. Change the `.cpp` filename, as well as the name and contents of the corresponding `.sc` file, and update the beginning of `CMakeLists.txt` with your new `.cpp` filename. Then you're ready to work on the code.
87+
88+
In order to start developing a new UGen, make a copy of one of the example's directory. Change the `.cpp` filename, as well as the name and contents of the corresponding `.sc` file, and update the beginning of `CMakeLists.txt` with your new `.cpp` filename. Then you're ready to work on the code. If you are using `git`
6789

6890
If you change your source file(s) or `CMakeLists.txt`, simply use `make` to recompile the shared library. You will need to restart scsynth/supernova for your changes to take effect.
6991

0 commit comments

Comments
 (0)