-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
4,530 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#[=======================================================================[.rst | ||
FindWIL | ||
------- | ||
|
||
FindModule for WIL and associated headers | ||
|
||
Imported Targets | ||
^^^^^^^^^^^^^^^^ | ||
|
||
.. versionadded:: 1.0.240122.1 #double check version | ||
|
||
This module defines the :prop_tgt:`IMPORTED` target ``WIL::WIL``. | ||
|
||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
|
||
This module sets the following variables: | ||
|
||
``WIL_FOUND`` | ||
True, if headers were found. | ||
``WIL_VERSION`` | ||
Detected version of found WIL headers. | ||
|
||
Cache variables | ||
^^^^^^^^^^^^^^^ | ||
|
||
The following cache variables may also be set: | ||
|
||
``WIL_INCLUDE_DIR`` | ||
Directory containing ``cppwinrt.h``. | ||
|
||
#]=======================================================================] | ||
|
||
# cmake-format: off | ||
# cmake-lint: disable=C0103 | ||
# cmake-lint: disable=C0301 | ||
# cmake-format: on | ||
|
||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_search_module(_WIL QUIET wil) | ||
endif() | ||
|
||
find_path( | ||
WIL_INCLUDE_DIR | ||
NAMES wil/cppwinrt.h | ||
HINTS ${_WI_INCLUDE_DIRS} ${_WIL_INCLUDE_DIRS} | ||
PATHS /usr/include /usr/local/include /opt/local/include /sw/include | ||
DOC "WIL include directory") | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
WIL | ||
REQUIRED_VARS WIL_INCLUDE_DIR | ||
VERSION_VAR WIL_VERSION REASON_FAILURE_MESSAGE "${WIL_ERROR_REASON}") | ||
mark_as_advanced(WIL_INCLUDE_DIR) | ||
unset(WIL_ERROR_REASON) | ||
|
||
if(EXISTS "${WIL_INCLUDE_DIR}/wil/cppwinrt.h") | ||
file(STRINGS "${WIL_INCLUDE_DIR}/wil/cppwinrt.h" _version_string REGEX "^.*VERSION_(MAJOR|MINOR)[ \t]+[0-9]+[ \t]*$") | ||
|
||
string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" _version_major "${_version_string}") | ||
string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" _version_minor "${_version_string}") | ||
|
||
set(WIL_VERSION "${_version_major}.${_version_minor}") | ||
unset(_version_major) | ||
unset(_version_minor) | ||
else() | ||
if(NOT WIL_FIND_QUIETLY) | ||
message(AUTHOR_WARNING "Failed to find WIL version.") | ||
endif() | ||
set(WIL_VERSION 0.0.0) | ||
endif() | ||
|
||
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") | ||
set(WIL_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") | ||
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") | ||
set(WIL_ERROR_REASON "Ensure WIL headers are available in local library paths.") | ||
endif() | ||
|
||
if(WIL_FOUND) | ||
set(WIL_INCLUDE_DIRS ${WIL_INCLUDE_DIR}) | ||
|
||
if(NOT TARGET WIL::WIL) | ||
add_library(WIL::WIL INTERFACE IMPORTED) | ||
set_target_properties( | ||
WIL::WIL | ||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${WIL_INCLUDE_DIRS}") | ||
|
||
endif() | ||
endif() | ||
|
||
include(FeatureSummary) | ||
set_package_properties( | ||
WIL PROPERTIES | ||
URL "https://github.com/microsoft/wil.git" | ||
DESCRIPTION | ||
"The Windows Implementation Libraries (WIL) is a header-only C++ library created to make life easier for developers on Windows through readable type-safe C++ interfaces for common Windows coding patterns." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#[=======================================================================[.rst | ||
FindWIL | ||
------- | ||
|
||
FindModule for WIL and associated headers | ||
|
||
Imported Targets | ||
^^^^^^^^^^^^^^^^ | ||
|
||
.. versionadded:: 1.0.240122.1 #double check version | ||
|
||
This module defines the :prop_tgt:`IMPORTED` target ``WIL::WIL``. | ||
|
||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
|
||
This module sets the following variables: | ||
|
||
``WIL_FOUND`` | ||
True, if headers were found. | ||
``WIL_VERSION`` | ||
Detected version of found WIL headers. | ||
|
||
Cache variables | ||
^^^^^^^^^^^^^^^ | ||
|
||
The following cache variables may also be set: | ||
|
||
``WIL_INCLUDE_DIR`` | ||
Directory containing ``cppwinrt.h``. | ||
|
||
#]=======================================================================] | ||
|
||
# cmake-format: off | ||
# cmake-lint: disable=C0103 | ||
# cmake-lint: disable=C0301 | ||
# cmake-format: on | ||
|
||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_search_module(_WIL QUIET wil) | ||
endif() | ||
|
||
find_path( | ||
WIL_INCLUDE_DIR | ||
NAMES wil/cppwinrt.h | ||
HINTS ${_WI_INCLUDE_DIRS} ${_WIL_INCLUDE_DIRS} | ||
PATHS /usr/include /usr/local/include /opt/local/include /sw/include | ||
DOC "WIL include directory") | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
WIL | ||
REQUIRED_VARS WIL_INCLUDE_DIR | ||
VERSION_VAR WIL_VERSION REASON_FAILURE_MESSAGE "${WIL_ERROR_REASON}") | ||
mark_as_advanced(WIL_INCLUDE_DIR) | ||
unset(WIL_ERROR_REASON) | ||
|
||
if(EXISTS "${WIL_INCLUDE_DIR}/wil/cppwinrt.h") | ||
file(STRINGS "${WIL_INCLUDE_DIR}/wil/cppwinrt.h" _version_string REGEX "^.*VERSION_(MAJOR|MINOR)[ \t]+[0-9]+[ \t]*$") | ||
|
||
string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" _version_major "${_version_string}") | ||
string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" _version_minor "${_version_string}") | ||
|
||
set(WIL_VERSION "${_version_major}.${_version_minor}") | ||
unset(_version_major) | ||
unset(_version_minor) | ||
else() | ||
if(NOT WIL_FIND_QUIETLY) | ||
message(AUTHOR_WARNING "Failed to find WIL version.") | ||
endif() | ||
set(WIL_VERSION 0.0.0) | ||
endif() | ||
|
||
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") | ||
set(WIL_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") | ||
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") | ||
set(WIL_ERROR_REASON "Ensure WIL headers are available in local library paths.") | ||
endif() | ||
|
||
if(WIL_FOUND) | ||
set(WIL_INCLUDE_DIRS ${WIL_INCLUDE_DIR}) | ||
|
||
if(NOT TARGET WIL::WIL) | ||
add_library(WIL::WIL INTERFACE IMPORTED) | ||
set_target_properties( | ||
WIL::WIL | ||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${WIL_INCLUDE_DIRS}") | ||
|
||
endif() | ||
endif() | ||
|
||
include(FeatureSummary) | ||
set_package_properties( | ||
WIL PROPERTIES | ||
URL "https://github.com/microsoft/wil.git" | ||
DESCRIPTION | ||
"The Windows Implementation Libraries (WIL) is a header-only C++ library created to make life easier for developers on Windows through readable type-safe C++ interfaces for common Windows coding patterns." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
cmake_minimum_required(VERSION 3.24...3.25) | ||
|
||
legacy_check() | ||
|
||
find_package(FFmpeg REQUIRED avcodec avutil) | ||
find_package(WIL REQUIRED) | ||
|
||
add_library(win-mf MODULE) | ||
add_library(OBS::mf ALIAS win-mf) | ||
|
||
target_sources(win-mf PUBLIC mf-plugin.cpp win-mf.cpp) | ||
|
||
add_library(libmfcapture INTERFACE) | ||
add_library(OBS::libmfcapture ALIAS libmfcapture) | ||
|
||
target_include_directories(libmfcapture INTERFACE libmfcapture | ||
libmfcapture/source) | ||
|
||
target_sources(libmfcapture INTERFACE | ||
libmfcapture/source/DeviceControlChangeListener.cpp | ||
libmfcapture/source/mfcapture.cpp | ||
libmfcapture/source/PhysicalCamera.cpp) | ||
|
||
configure_file(cmake/windows/obs-module.rc.in win-mf.rc) | ||
target_sources(win-mf PRIVATE win-mf.rc) | ||
|
||
target_precompile_headers( | ||
win-mf | ||
PRIVATE <wil/cppwinrt.h> | ||
<wil/result.h> | ||
<wil/com.h>) | ||
|
||
target_link_libraries( | ||
win-mf | ||
PRIVATE OBS::libobs | ||
OBS::w32-pthreads | ||
OBS::winrt-headers | ||
FFmpeg::avcodec | ||
FFmpeg::avutil | ||
strmiids | ||
winmm | ||
dxcore | ||
dxguid | ||
libmfcapture) | ||
|
||
# cmake-format: off | ||
set_target_properties_obs(win-mf PROPERTIES FOLDER plugins/win-mf PREFIX "") | ||
# cmake-format: on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
project(win-mf) | ||
|
||
find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil) | ||
|
||
add_library(win-mf MODULE) | ||
add_library(OBS::mf ALIAS win-mf) | ||
|
||
target_sources(win-mf PRIVATE mf-plugin.cpp plugin-macros.generated.h win-mf.cpp) | ||
|
||
add_library(libmfcapture INTERFACE) | ||
add_library(OBS::libmfcapture ALIAS libmfcapture) | ||
|
||
target_sources( | ||
libmfcapture | ||
INTERFACE libmfcapture/mfcapture.hpp | ||
libmfcapture/source/DeviceControlChangeListener.cpp | ||
libmfcapture/source/DeviceControlChangeListener.hpp | ||
libmfcapture/source/mfcapture.cpp | ||
libmfcapture/source/framework.hpp | ||
libmfcapture/source/mfcapture.rc | ||
libmfcapture/source/PhysicalCamera.cpp | ||
libmfcapture/source/PhysicalCamera.hpp | ||
libmfcapture/source/resource.hpp) | ||
|
||
target_include_directories( | ||
libmfcapture INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libmfcapture) | ||
|
||
target_compile_definitions(libmfcapture INTERFACE _UP_WINDOWS=1) | ||
|
||
set(MODULE_DESCRIPTION "OBS MediaFoundation module") | ||
|
||
configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-mf.rc) | ||
|
||
target_sources(win-mf PRIVATE win-mf.rc) | ||
|
||
target_compile_definitions(win-mf PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS | ||
OBS_LEGACY) | ||
|
||
target_link_libraries( | ||
win-mf | ||
PRIVATE OBS::libobs | ||
OBS::w32-pthreads | ||
setupapi | ||
strmiids | ||
ksuser | ||
winmm | ||
wmcodecdspuuid | ||
FFmpeg::avcodec | ||
FFmpeg::avutil | ||
dxcore | ||
dxguid | ||
libmfcapture) | ||
|
||
source_group( | ||
"libmfcapture\\Source Files" | ||
FILES libmfcapture/source/DeviceControlChangeListener.cpp | ||
libmfcapture/source/mfcapture.cpp | ||
libmfcapture/source/mfcapture.rc | ||
libmfcapture/source/PhysicalCamera.cpp) | ||
source_group( | ||
"libmfcapture\\Header Files" | ||
FILES libmfcapture/source/DeviceControlChangeListener.hpp | ||
libmfcapture/source/framework.hpp | ||
libmfcapture/source/mfcapture.hpp | ||
libmfcapture/source/PhysicalCamera.hpp | ||
libmfcapture/source/resource.hpp) | ||
|
||
set_target_properties(win-mf PROPERTIES FOLDER "plugins/win-mf") | ||
|
||
setup_plugin_target(win-mf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
1 VERSIONINFO | ||
FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "040904B0" | ||
BEGIN | ||
VALUE "CompanyName", "${OBS_COMPANY_NAME}" | ||
VALUE "FileDescription", "OBS MediaFoundation module" | ||
VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" | ||
VALUE "ProductName", "${OBS_PRODUCT_NAME}" | ||
VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" | ||
VALUE "Comments", "${OBS_COMMENTS}" | ||
VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" | ||
VALUE "InternalName", "win-mf" | ||
VALUE "OriginalFilename", "win-mf" | ||
END | ||
END | ||
|
||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x0409, 0x04B0 | ||
END | ||
END |
Oops, something went wrong.