justinfrankel / reaper-sdk

REAPER C/C++ extension SDK
125 stars 20 forks source link

Add CMake build files #7

Open Erriez opened 3 months ago

Erriez commented 3 months ago

I've plans to develop a DAW integration for a new surface controller in REAPER 7. In the early days, the build files were only available for VisualStudio for Windows. REAPER currently supports Windows, Linux and MAC which is probably based on CMake.

Would it be possible to add the platform independent build files to this repository? Or should I use a different repository to build a platform independent reaper_csurf?

Erriez commented 1 week ago

Possible workaround:

Install Visual Studio 2022
Open `reaper-plugins/reaper_csurf/reaper_csurf-x64.vcproj` once, close project and save `.sln` to default location.

# Install Python3 and cmake_converter
pip install cmake_converter

cd reaper-plugins/reaper_csurf

cmake-converter -s reaper_csurf-x64.sln
cmake -S . -B build
cmake --build build

Edit CMakeLists.txt and set OUTPUT_DIRECTORY_DEBUG to absolute path "C:\\Users\\Username\\AppData\\Roaming\\REAPER\\UserPlugins"

Open directory reaper-plugins/reaper_csurf with VCode.
At the bottom of VCode:
- Set CMake: [Debug]
- Set default kit to Visual Studio Community 2022 Release - amd64.
- Set the default build target: reaper_csurf.

Create .vscode/launch.json:
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "C:\\Program Files\\REAPER (x64)\\reaper.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
        }
    ]
}

Press F5 to start debugging.

Update: The resource file is not included and is not working:

image