Skip to content

Add in-tree build support#21

Closed
tytan652 wants to merge 2 commits into
obsproject:masterfrom
tytan652:allow_in_tree_build
Closed

Add in-tree build support#21
tytan652 wants to merge 2 commits into
obsproject:masterfrom
tytan652:allow_in_tree_build

Conversation

@tytan652
Copy link
Copy Markdown
Contributor

@tytan652 tytan652 commented Mar 21, 2022

Description

Resolve #10

  • The plugin template can be built outside or inside OBS Studio Build tree.
  • Linkage to the frontend API and Qt are "disabled" since they are not used by the example.
  • I tried to keep the template simple

Note: The Windows only RC file was not added, I just don't know if it's needed for testing and debugging.

Motivation and Context

I just wanted to do it.

How Has This Been Tested?

  • Build the plugin out of tree, and test the plugin with OBS Studio
  • Build the plugin in OBS Studio build tree, and run the built OBS Studio and check if the plugin is built and loaded.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Documentation (a change to documentation pages)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@tytan652 tytan652 force-pushed the allow_in_tree_build branch 2 times, most recently from a51bd1d to 1fa7adb Compare March 21, 2022 16:29
@tytan652 tytan652 force-pushed the allow_in_tree_build branch from 1fa7adb to 17b9b72 Compare March 24, 2022 06:23
@tytan652 tytan652 changed the title Add in-tree build support and Qt version selector Add in-tree build support Mar 24, 2022
@PatTheMav
Copy link
Copy Markdown
Member

The whole idea of the plugintemplate is to move people away from in-tree builds, but instead manage plugins as their own independent projects with libobs (and if necessary obs-frontend-api) as external library dependencies.

This also gently forces developers to write their plugins in a more standalone fashion which helps us down the line with API changes, plugin sandboxing, or other security-related functionality we might envision.

There is a CMake option to have the resulting artifact be copied into an OBS build's rundir automatically for testing, but development wise in-tree development is discouraged.

@RytoEX
Copy link
Copy Markdown
Member

RytoEX commented Mar 26, 2022

I agree with @PatTheMav . We should not be encouraging in-tree building for plugins that are not the core plugins already in the obs-studio repo.

@tytan652
Copy link
Copy Markdown
Contributor Author

Ok, so I close the PR.

@tytan652 tytan652 closed this Mar 26, 2022
@PatTheMav
Copy link
Copy Markdown
Member

@tytan652 If you got any feedback about any issues arising from this change (i.e. pain points, missing explanation, unclearities), please let us know.

I guess the discussions forum on the obs-studio project would be a good place to let us know.

@tytan652
Copy link
Copy Markdown
Contributor Author

Like #10 explains it, I just though that enabling in-tree build for easier testing and debugging purpose would be a good idea. This feature is not meant for releasing plugins.

  • I wanted to avoid the whole copy paste at each plugins build, and just put the project in the plugins folder and add a cmake add_subdirectory.
  • Many plugins have already this behavior in their CMake.

@PatTheMav
Copy link
Copy Markdown
Member

Well the easiest way to achieve that is to tell CMake to install the plugin into the plugins path of the OBS instance you test with.

That will ensure the plugin ends up automatically where it should be and you don't have to re-build OBS every time you changed something about the plugin and just restart your OBS instance.

@cpyarger
Copy link
Copy Markdown

cpyarger commented Aug 9, 2022

To be fair, you don't end up rebuilding obs each time you make a plugin change, as cmake handles only rebuilding things that have changed.

The biggest issues I have had previously with building out of tree is based around debugging and occasionally function autocompletion for obs api functions. I have never been able to figure out how to get Visual Studio to properly resolve all of the debugging symbols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: Modify CMakeLists.txt to allow for building in or out of tree

4 participants