0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 04:42:18 +02:00
obs-studio/plugins/obs-nvenc/CMakeLists.txt
gxalpha 922e2cc151 cmake: Remove remaining cmake-format comments
cmake-format was replaced with gersemi in
19d3e30a3a. As such, these comments no
longer have any effect.
2024-09-12 14:20:28 -04:00

60 lines
1.5 KiB
CMake

cmake_minimum_required(VERSION 3.22...3.25)
option(ENABLE_NVENC "Build NVIDIA Hardware Encoder Plugin" ON)
option(ENABLE_NVENC_FFMPEG_IDS "Register FFmpeg encoder IDs" ON)
mark_as_advanced(ENABLE_NVENC_FFMPEG_IDS)
if(NOT ENABLE_NVENC)
target_disable_feature(obs-nvenc "NVIDIA Hardware Encoder")
target_disable(obs-nvenc)
return()
endif()
if(NOT TARGET OBS::opts-parser)
add_subdirectory("${CMAKE_SOURCE_DIR}/shared/opts-parser" "${CMAKE_BINARY_DIR}/shared/opts-parser")
endif()
if(OS_LINUX AND NOT TARGET OBS::glad)
add_subdirectory("${CMAKE_SOURCE_DIR}/deps/glad" "${CMAKE_BINARY_DIR}/deps/glad")
endif()
find_package(FFnvcodec 12 REQUIRED)
add_library(obs-nvenc MODULE)
add_library(OBS::nvenc ALIAS obs-nvenc)
add_subdirectory(obs-nvenc-test)
target_sources(
obs-nvenc
PRIVATE
$<$<PLATFORM_ID:Linux>:nvenc-opengl.c>
$<$<PLATFORM_ID:Windows>:nvenc-d3d11.c>
cuda-helpers.c
cuda-helpers.h
nvenc-compat.c
nvenc-cuda.c
nvenc-helpers.c
nvenc-helpers.h
nvenc-internal.h
nvenc-opts-parser.c
nvenc-properties.c
nvenc.c
obs-nvenc.c
obs-nvenc.h
)
target_link_libraries(
obs-nvenc
PRIVATE OBS::libobs OBS::opts-parser FFnvcodec::FFnvcodec $<$<PLATFORM_ID:Linux>:OBS::glad>
)
target_compile_definitions(obs-nvenc PRIVATE $<$<BOOL:${ENABLE_NVENC_FFMPEG_IDS}>:REGISTER_FFMPEG_IDS>)
if(OS_WINDOWS)
configure_file(cmake/windows/obs-module.rc.in obs-nvenc.rc)
target_sources(obs-nvenc PRIVATE obs-nvenc.rc)
endif()
set_target_properties_obs(obs-nvenc PROPERTIES FOLDER plugins/obs-nvenc PREFIX "")