Skip to content

Commit

Permalink
attempt to bring build up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Oct 27, 2023
1 parent 6355ec5 commit fc85341
Show file tree
Hide file tree
Showing 48 changed files with 2,151 additions and 799 deletions.
56 changes: 11 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
cmake_minimum_required(VERSION 3.24)

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)

project(OBSInfoWriter 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 "Patrick Quist")
option(ENABLE_FRONTEND_API "Use obs-frontend-api for UI functionality" OFF)
option(ENABLE_QT "Use Qt functionality" OFF)

include(compilerconfig)
include(defaults)
include(helpers)

add_library(${CMAKE_PROJECT_NAME} MODULE)

# 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)
Expand Down Expand Up @@ -49,50 +55,10 @@ target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/_de
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Groundfloor)
find_package(Crosscables REQUIRED)

# /!\ TAKE NOTE: No need to edit things past this point /!\

# --- Platform-independent build settings ---
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src)

target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::libobs)

# --- 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)

configure_file(cmake/bundle/windows/resource.rc.in ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc)
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc)

if(MSVC)
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE /W0)
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 -Wno-unused-parameter
-Wno-unused-private-field)

# --- End of section ---

# --- Linux-specific build settings and tasks ---
else()
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE rt)

target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wall -Wno-unused-parameter
-Wno-unused-private-field)
endif()

# --- End of section ---
setup_plugin_target(${CMAKE_PROJECT_NAME})
set_target_properties_plugin(${CMAKE_PROJECT_NAME} PROPERTIES OUTPUT_NAME ${_name})
186 changes: 186 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"patch": 0
},
"configurePresets": [
{
"name": "macos",
"displayName": "macOS Universal",
"description": "Build for macOS 11.0+ (Universal binary)",
"binaryDir": "${sourceDir}/build_macos",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"generator": "Xcode",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0",
"CODESIGN_IDENTITY": "$penv{CODESIGN_IDENT}",
"CODESIGN_TEAM": "$penv{CODESIGN_TEAM}",
"ENABLE_FRONTEND_API": false,
"ENABLE_QT": false
}
},
{
"name": "macos-ci",
"inherits": ["macos"],
"displayName": "macOS Universal CI build",
"description": "Build for macOS 11.0+ (Universal binary) for CI",
"generator": "Xcode",
"cacheVariables": {
"CMAKE_COMPILE_WARNING_AS_ERROR": true
}
},
{
"name": "windows-x64",
"displayName": "Windows x64",
"description": "Build for Windows x64",
"binaryDir": "${sourceDir}/build_x64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_SYSTEM_VERSION": "10.0.18363.657",
"ENABLE_FRONTEND_API": false,
"ENABLE_QT": false
}
},
{
"name": "windows-ci-x64",
"inherits": ["windows-x64"],
"displayName": "Windows x64 CI build",
"description": "Build for Windows x64 on CI",
"cacheVariables": {
"CMAKE_COMPILE_WARNING_AS_ERROR": true
}
},
{
"name": "linux-x86_64",
"displayName": "Linux x86_64",
"description": "Build for Linux x86_64",
"binaryDir": "${sourceDir}/build_x86_64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"generator": "Ninja",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"ENABLE_FRONTEND_API": false,
"ENABLE_QT": false
}
},
{
"name": "linux-ci-x86_64",
"inherits": ["linux-x86_64"],
"displayName": "Linux x86_64 CI build",
"description": "Build for Linux x86_64 on CI",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_COMPILE_WARNING_AS_ERROR": true
}
},
{
"name": "linux-aarch64",
"displayName": "Linux aarch64",
"description": "Build for Linux aarch64",
"binaryDir": "${sourceDir}/build_aarch64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"generator": "Ninja",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"ENABLE_FRONTEND_API": false,
"ENABLE_QT": false
}
},
{
"name": "linux-ci-aarch64",
"inherits": ["linux-aarch64"],
"displayName": "Linux aarch64 CI build",
"description": "Build for Linux aarch64 on CI",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_COMPILE_WARNING_AS_ERROR": true
}
}
],
"buildPresets": [
{
"name": "macos",
"configurePreset": "macos",
"displayName": "macOS Universal",
"description": "macOS build for Universal architectures",
"configuration": "Release"
},
{
"name": "macos-ci",
"configurePreset": "macos-ci",
"displayName": "macOS Universal CI",
"description": "macOS CI build for Universal architectures",
"configuration": "RelWithDebInfo"
},
{
"name": "windows-x64",
"configurePreset": "windows-x64",
"displayName": "Windows x64",
"description": "Windows build for x64",
"configuration": "RelWithDebInfo"
},
{
"name": "windows-ci-x64",
"configurePreset": "windows-ci-x64",
"displayName": "Windows x64 CI",
"description": "Windows CI build for x64 (RelWithDebInfo configuration)",
"configuration": "RelWithDebInfo"
},
{
"name": "linux-x86_64",
"configurePreset": "linux-x86_64",
"displayName": "Linux x86_64",
"description": "Linux build for x86_64",
"configuration": "RelWithDebInfo"
},
{
"name": "linux-ci-x86_64",
"configurePreset": "linux-ci-x86_64",
"displayName": "Linux x86_64 CI",
"description": "Linux CI build for x86_64",
"configuration": "RelWithDebInfo"
},
{
"name": "linux-aarch64",
"configurePreset": "linux-aarch64",
"displayName": "Linux aarch64",
"description": "Linux build for aarch64",
"configuration": "RelWithDebInfo"
},
{
"name": "linux-ci-aarch64",
"configurePreset": "linux-ci-aarch64",
"displayName": "Linux aarch64 CI",
"description": "Linux CI build for aarch64",
"configuration": "RelWithDebInfo"
}
]
}
3 changes: 3 additions & 0 deletions build-aux/.functions/log_debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1

if (( _loglevel > 2 )) print -PR -e -- "${CI:+::debug::}%F{220}DEBUG: ${@}%f"
3 changes: 3 additions & 0 deletions build-aux/.functions/log_error
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
local icon=' ✖︎ '

print -u2 -PR "${CI:+::error::}%F{1} ${icon} %f ${@}"
16 changes: 16 additions & 0 deletions build-aux/.functions/log_group
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
autoload -Uz log_info

if (( ! ${+_log_group} )) typeset -g _log_group=0

if (( ${+CI} )) {
if (( _log_group )) {
print "::endgroup::"
typeset -g _log_group=0
}
if (( # )) {
print "::group::${@}"
typeset -g _log_group=1
}
} else {
if (( # )) log_info ${@}
}
7 changes: 7 additions & 0 deletions build-aux/.functions/log_info
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1

if (( _loglevel > 0 )) {
local icon=' =>'

print -PR "%F{4} ${(r:5:)icon}%f %B${@}%b"
}
7 changes: 7 additions & 0 deletions build-aux/.functions/log_output
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1

if (( _loglevel > 0 )) {
local icon=''

print -PR " ${(r:5:)icon} ${@}"
}
7 changes: 7 additions & 0 deletions build-aux/.functions/log_status
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1

if (( _loglevel > 0 )) {
local icon=' >'

print -PR "%F{2} ${(r:5:)icon}%f ${@}"
}
7 changes: 7 additions & 0 deletions build-aux/.functions/log_warning
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1

if (( _loglevel > 0 )) {
local icon=' =>'

print -PR "${CI:+::warning::}%F{3} ${(r:5:)icon} ${@}%f"
}
17 changes: 17 additions & 0 deletions build-aux/.functions/set_loglevel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
autoload -Uz log_debug log_error

local -r _usage="Usage: %B${0}%b <loglevel>

Set log level, following levels are supported: 0 (quiet), 1 (normal), 2 (verbose), 3 (debug)"

if (( ! # )); then
log_error 'Called without arguments.'
log_output ${_usage}
return 2
elif (( ${1} >= 4 )); then
log_error 'Called with loglevel > 3.'
log_output ${_usage}
fi

typeset -g -i -r _loglevel=${1}
log_debug "Log level set to '${1}'"
Loading

0 comments on commit fc85341

Please sign in to comment.