CLion is a cross platform C/C++ IDE by jetbrains with great features like code analysis and an integrated debugger. While it's not free you can test if for 30 days or get a free license as a student or apply for a license if you work on a larger open source project.
Since I use it only on linux this guide was only tested there it should technically work on macOS, but I can't confirm that.
1. Getting the source code
Nothing special here, just follow the guide up on github, which boils down to:
- Install dependencies (Depends on your distribution)
- clone the repository with
$ git clone https://github.com/obsproject/obs-studio.git --recursive
- Make a build directory
$ cd obs-studio && mkdir build-debug
Now you can open the repository folder in CLion. It'll go over it's usual setup routine, but it won't work or otherwise you wouldn't be reading this. You can let it finish though. After that you'll have to configure CMake to build a portable version of obs, because the normal build won't find the obs data for some reason.
To do this open the settings dialog (
File > Settings
or Ctrl + Alt + S
) and navigate to Build, Execution, Deployment > CMake
. Here you can configure different profiles (eg. if you want a separate release and debug profile), but for this we'll just use the existing debug profile and set the following two options in CMake options
:-DUNIX_STRUCTURE=0
-DCMAKE_INSTALL_PREFIX="${HOME}/git/obs-studio/build-debug"
-j 4
where '4' can be replaced with any number, usually the amount of CPU cores to speed up building.After you click apply CLion will reload the CMake project and you should be able to build and run obs-studio. For that select
Edit configurations...
in the top right drop-down menu (Note that if you have two profiles you'll have to repeat this step with both and select the correct path).Now select obs on the left:
Before Launch
section click the plus and then Run External Tool
.name
and program
to make
, arguments
to install
and the working directory to .../obs-studio/cmake-build-debug
where '...' is the parent folder of the obs-studio repository (Once again this is for the debug profile, for the release profile there's a separate folder). Now you're ready to build obs studio.First make sure obs is selected in the top right drop down menu. Then click the green play button in the top right corner of the main window or
Shift+ F9
to run the selected target.Don't worry obs won't run correctly, because it uses the wrong binary, which won't be able to find the obs-data (and even if it does it'll usually report an error about the GPU not being supported).
After the compilation is done, you can dismiss the error dialogs from obs and click
Edit Configurations...
in the top right drop-down again. Make sure 'obs' is still be selected on the leftand then set
Exectuable
with 'Select other' to .../build-debug/bin/64bit/obs
.This should now tell CLion to first build and install the binaries into the 'build-debug' folder and then execute the new binary.
So that's it, hope it helps if you ran into the same issues I had.