obs-studio/plugins/win-capture/CMakeLists.txt
PatTheMav 2966c4030e libobs: Use static library for version string information
Switching to a static library that contains version information as
const char strings has multiple benefits:

* The version information provided externally via compiler definitions
  will fail compilation early if malformed
* An updated version string (which will happen with every commit) will
  not invalidate existing compilation units, because only the static
  library is affected by the change
* An update of the version change just requires a recompilation of the
  static library and a linker update
* An update of the version will _not_ infect the rest of the codebase
  (as it does currently, because everything includes obsconfig.h one
  way or another)
* Other modules which used the macro definition directly have been
  updated as much as possible to use the proper getter method from
  `libobs` instead (some Windows-specific modules use preprocessor
  string composition, the value has been added as a compiler definition
  directly in those cases)
* Because the impact of a version change due to a commit hash change
  is limited to the static library, ccache hit rates should be
  improved considerably
2023-05-27 16:48:24 -07:00

64 lines
1.9 KiB
CMake

project(win-capture)
option(ENABLE_COMPAT_UPDATES "Checks for service updates" OFF)
set(COMPAT_URL
"https://obsproject.com/obs2_update/win-capture"
CACHE STRING "Default services package URL")
mark_as_advanced(COMPAT_URL)
add_library(win-capture MODULE)
add_library(OBS::capture ALIAS win-capture)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compat-config.h.in ${CMAKE_BINARY_DIR}/config/compat-config.h)
target_sources(
win-capture
PRIVATE plugin-main.c
app-helpers.c
app-helpers.h
cursor-capture.c
cursor-capture.h
dc-capture.c
dc-capture.h
duplicator-monitor-capture.c
game-capture.c
game-capture-file-init.c
graphics-hook-info.h
graphics-hook-ver.h
hook-helpers.h
inject-library.c
inject-library.h
load-graphics-offsets.c
monitor-capture.c
nt-stuff.c
nt-stuff.h
window-capture.c
compat-helpers.c
compat-helpers.h
compat-format-ver.h
../../libobs/util/windows/obfuscate.c
../../libobs/util/windows/obfuscate.h
${CMAKE_BINARY_DIR}/config/compat-config.h)
target_link_libraries(win-capture PRIVATE OBS::libobs OBS::ipc-util OBS::file-updater Jansson::Jansson)
set_target_properties(win-capture PROPERTIES FOLDER "plugins/win-capture")
if(MSVC)
target_link_libraries(win-capture PRIVATE OBS::w32-pthreads)
target_link_options(win-capture PRIVATE "LINKER:/IGNORE:4098")
endif()
target_compile_definitions(win-capture PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS
OBS_VERSION="${OBS_VERSION_CANONICAL}")
set_property(GLOBAL APPEND PROPERTY OBS_MODULE_LIST "win-capture")
setup_plugin_target(win-capture)
add_subdirectory(graphics-hook)
add_subdirectory(get-graphics-offsets)
add_subdirectory(inject-helper)