1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- cmake_minimum_required(VERSION 3.16...3.21)
- # Change obs-plugintemplate to your plugin's name in a machine-readable format
- # (e.g.: obs-myawesomeplugin) and set
- project(obs-plugintemplate VERSION 1.0.0)
- add_library(${CMAKE_PROJECT_NAME} MODULE)
- # Replace `Your Name Here` with the name (yours or your organization's) you want
- # to see as the author of the plugin (in the plugin's metadata itself and in the
- # installers)
- set(PLUGIN_AUTHOR "Your Name Here")
- # Replace `com.example.obs-plugin-template` with a unique Bundle ID for macOS
- # releases (used both in the installer and when submitting the installer for
- # notarization)
- set(MACOS_BUNDLEID "com.example.${CMAKE_PROJECT_NAME}")
- # Replace `me@contoso.com` with the maintainer email address you want to put in
- # Linux packages
- set(LINUX_MAINTAINER_EMAIL "me@mymailhost.com")
- # Add your custom source files here - header files are optional and only
- # required for visibility e.g. in Xcode or Visual Studio
- target_sources(${CMAKE_PROJECT_NAME} PRIVATE src/plugin-main.c)
- # /!\ TAKE NOTE: No need to edit things past this point /!\
- find_package(libobs REQUIRED)
- find_package(obs-frontend-api REQUIRED)
- include(cmake/ObsPluginHelpers.cmake)
- find_qt(COMPONENTS Widgets Core)
- configure_file(src/plugin-macros.h.in
- ${CMAKE_SOURCE_DIR}/src/plugin-macros.generated.h)
- target_sources(${CMAKE_PROJECT_NAME} PRIVATE src/plugin-macros.generated.h)
- # --- Platform-independent build settings ---
- target_include_directories(${CMAKE_PROJECT_NAME}
- PRIVATE ${CMAKE_SOURCE_DIR}/src)
- target_link_libraries(
- ${CMAKE_PROJECT_NAME} PRIVATE OBS::libobs OBS::obs-frontend-api Qt::Core
- Qt::Widgets)
- set_target_properties(
- ${CMAKE_PROJECT_NAME}
- PROPERTIES AUTOMOC ON
- AUTOUIC ON
- AUTORCC ON)
- target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_17)
- # --- End of section ---
- # --- Windows-specific build settings and tasks ---
- if(OS_WINDOWS)
- configure_file(cmake/bundle/windows/installer-Windows.iss.in
- ${CMAKE_BINARY_DIR}/installer-Windows.generated.iss)
- if(MSVC)
- target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE /MP /d2FH4-)
- endif()
- # --- End of section ---
- # -- macOS specific build settings and tasks --
- elseif(OS_MACOS)
- configure_file(cmake/bundle/macos/installer-macOS.pkgproj.in
- ${CMAKE_BINARY_DIR}/installer-macOS.generated.pkgproj)
- set(MACOSX_PLUGIN_GUI_IDENTIFIER "${MACOS_BUNDLEID}")
- set(MACOSX_PLUGIN_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION}")
- set(MACOSX_PLUGIN_SHORT_VERSION_STRING "1")
- target_compile_options(
- ${CMAKE_PROJECT_NAME}
- PRIVATE -Wall -Wextra -Werror-implicit-function-declaration -stdlib=libc++
- -fvisibility=default)
- set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "")
- # --- End of section ---
- # --- Linux-specific build settings and tasks ---
- else()
- target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wall -Wextra)
- set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "")
- endif()
- # --- End of section ---
- setup_plugin_target(${CMAKE_PROJECT_NAME})
|