|
| 1 | +# Compiling the PicoGK Runtime |
| 2 | + |
| 3 | +We compiled and tested PicoGKRuntime on Windows 64 bit and MacOS 14 Sonoma. Since Mac is our primary work environnment, we have tested it on Mac significantly more than on Windows. There is, however, nothing fundamentally platform-specific about PicoGK. The main platform dependencies are well-established libraries like OpenVDB. Our code is very straightforward and mostly header-only C++ code. |
| 4 | + |
| 5 | +## What you need |
| 6 | + |
| 7 | +On Windows, you need **Visual Studio 2022 Community Edition** (or higher) with C++ support installed (bare bones C++ is enough). |
| 8 | + |
| 9 | +On Mac, you need the latest version of **XCode** with C++ support, and the XCode command line tools. |
| 10 | + |
| 11 | +In addition you need a current version of **CMake** (Download at https://cmake.org/) |
| 12 | + |
| 13 | +## Installing dependent libraries |
| 14 | + |
| 15 | +First clone the **PicoGKRuntime** repository to your machine. |
| 16 | + |
| 17 | +Make sure to initialize the submodules (**git submodule update --init --recursive**), so that the OpenVDB submodule is properly initialized. |
| 18 | + |
| 19 | +PicoGKRuntime has no dependencies besides **OpenVDB** and **GLFW** (which is fetched automatically), but those libraries have plenty of dependencies (boost, blosc, etc). |
| 20 | + |
| 21 | +To facilitate the installation of these dependencies, we have provided you with two scripts that download and install everything needed. |
| 22 | + |
| 23 | +On Mac, please run **PicoGKRuntime/Install_Dependencies/Mac.sh** |
| 24 | + |
| 25 | +On Windows, please run **PicoGKRuntime/Install_Dependencies/Win.bat** |
| 26 | +Note: you may have to run Win.bat twice, due to a bug we haven't found yet. It works after the second time. |
| 27 | + |
| 28 | +The installation of the dependencies may take a while, especially on Windows. |
| 29 | + |
| 30 | +After you have done this, you can move onto compiling the PicoGK Runtime. |
| 31 | + |
| 32 | +## Preparing the PicoGK Runtime Build Environment |
| 33 | + |
| 34 | +Start the CMake GUI client and specify the path to the PicoGKRuntime repository in **"Where is the source code"**. |
| 35 | + |
| 36 | +Specify the Build subfolder under **"Where to build the libraries"**. It should like this |
| 37 | + |
| 38 | +<img src="images/image-20231017134154856.png" alt="image-20231017134154856" style="zoom:50%;" /> |
| 39 | + |
| 40 | +Hit **Configure** and accept all defaults. After Configure has run without errors, click **Generate**. |
| 41 | + |
| 42 | +Note: On Mac, we advise to use "Unix Makefiles" as target. If you target XCode, you will get an error in the OpenVDB CMake setup. We have reached out to the OpenVDB team why this happens. You can safely comment out the offending lines in the OpenVDB CMake files, but this should not happen and it seems like an issue on their side. |
| 43 | + |
| 44 | +Now you can compile PicoGKRuntime on your system. |
| 45 | + |
| 46 | +## Compiling |
| 47 | + |
| 48 | +On Mac, go to the **Build** subdirectory in **Terminal** and type **make** [enter] to run the make tool. The build process should start and you will get the compiled picogk.1.0.dylib in the Dist subfolder of PicoGKRuntime. |
| 49 | + |
| 50 | +On Windows, open the resulting project in Visual Studio and compile (use the release version). |
| 51 | + |
| 52 | +## Using the compiled Runtime |
| 53 | + |
| 54 | +You either copy the resulting library to /usr/local/lib on Mac or the System32 folder on Windows (or any other folder that is in your system path). |
| 55 | + |
| 56 | +A cleaner way, when you are still testing is to modify the path in the PicoGK C# library. You do this by opening PicoGK__Config.cs and pointing the path to your compiled library: |
| 57 | + |
| 58 | +<img src="images/image-20231014185209784.png" alt="image-20231017164620416" style="zoom:50%;" /> |
| 59 | + |
| 60 | +One last thing — on Mac, you may have to sign the library using the **codesign** tool. Otherwise the library may not load. |
| 61 | + |
| 62 | +## Code signing on the Mac |
| 63 | + |
| 64 | +The necessary command line is **codesign -s LEAP71 picogk.1.0.dylib** — you need to have a valid code signing certificate for this (we used one we named LEAP71 — you can self issue this certificate, but it's a few steps). |
| 65 | + |
| 66 | +Here is a relevant Apple article how to create self-signed certificates: https://support.apple.com/en-ae/guide/keychain-access/kyca8916/mac |
| 67 | + |
| 68 | +[You may have to adjust your security settings as described here.](../Runtime/readme.md) |
0 commit comments