os-windows.cmake 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. if(NOT TARGET OBS::blake2)
  2. add_subdirectory("${CMAKE_SOURCE_DIR}/deps/blake2" "${CMAKE_BINARY_DIR}/deps/blake2")
  3. endif()
  4. if(NOT TARGET OBS::w32-pthreads)
  5. add_subdirectory("${CMAKE_SOURCE_DIR}/deps/w32-pthreads" "${CMAKE_BINARY_DIR}/deps/w32-pthreads")
  6. endif()
  7. set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
  8. find_package(MbedTLS REQUIRED)
  9. set(CMAKE_FIND_PACKAGE_PREFER_CONFIG FALSE)
  10. find_package(Detours REQUIRED)
  11. find_package(nlohmann_json 3.11 REQUIRED)
  12. configure_file(cmake/windows/obs.rc.in obs.rc)
  13. target_sources(
  14. obs-studio
  15. PRIVATE
  16. cmake/windows/obs.manifest
  17. obs.rc
  18. platform-windows.cpp
  19. update/crypto-helpers-mbedtls.cpp
  20. update/crypto-helpers.hpp
  21. update/models/branches.hpp
  22. update/models/whatsnew.hpp
  23. update/shared-update.cpp
  24. update/shared-update.hpp
  25. update/update-helpers.cpp
  26. update/update-helpers.hpp
  27. update/update-window.cpp
  28. update/update-window.hpp
  29. update/win-update.cpp
  30. update/win-update.hpp
  31. win-dll-blocklist.c
  32. win-update/updater/manifest.hpp
  33. )
  34. target_sources(obs-studio PRIVATE system-info-windows.cpp)
  35. target_link_libraries(
  36. obs-studio
  37. PRIVATE crypt32 OBS::blake2 OBS::w32-pthreads MbedTLS::mbedtls nlohmann_json::nlohmann_json Detours::Detours
  38. )
  39. target_compile_definitions(obs-studio PRIVATE PSAPI_VERSION=2)
  40. target_link_options(obs-studio PRIVATE /IGNORE:4099 $<$<CONFIG:DEBUG>:/NODEFAULTLIB:MSVCRT>)
  41. add_library(obs-update-helpers INTERFACE)
  42. add_library(OBS::update-helpers ALIAS obs-update-helpers)
  43. target_sources(obs-update-helpers INTERFACE win-update/win-update-helpers.cpp win-update/win-update-helpers.hpp)
  44. target_include_directories(obs-update-helpers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/win-update")
  45. # Set commit for untagged version comparisons in the Windows updater
  46. if(OBS_VERSION MATCHES ".+g[a-f0-9]+.*")
  47. string(REGEX REPLACE ".+g([a-f0-9]+).*$" "\\1" OBS_COMMIT ${OBS_VERSION})
  48. else()
  49. set(OBS_COMMIT "")
  50. endif()
  51. set_source_files_properties(update/win-update.cpp PROPERTIES COMPILE_DEFINITIONS OBS_COMMIT="${OBS_COMMIT}")
  52. add_subdirectory(win-update/updater)
  53. set_property(TARGET obs-studio APPEND PROPERTY AUTORCC_OPTIONS --format-version 1)
  54. set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT obs-studio)
  55. set_target_properties(
  56. obs-studio
  57. PROPERTIES
  58. WIN32_EXECUTABLE TRUE
  59. VS_DEBUGGER_COMMAND "${CMAKE_BINARY_DIR}/rundir/$<CONFIG>/bin/64bit/$<TARGET_FILE_NAME:obs-studio>"
  60. VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/rundir/$<CONFIG>/bin/64bit"
  61. )