CMakeLists.txt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. cmake_minimum_required(VERSION 3.28...3.30)
  2. if(NOT TARGET OBS::obfuscate)
  3. add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
  4. endif()
  5. if(NOT TARGET OBS::inject-library)
  6. add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-inject-library" obs-inject-library)
  7. endif()
  8. add_executable(inject-helper)
  9. target_sources(inject-helper PRIVATE inject-helper.c)
  10. target_link_libraries(inject-helper PRIVATE OBS::inject-library OBS::obfuscate)
  11. if(OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_VS_PLATFORM_NAME)
  12. if(CMAKE_VS_PLATFORM_NAME STREQUAL ARM64)
  13. add_custom_command(
  14. TARGET inject-helper
  15. POST_BUILD
  16. COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x64 --config $<CONFIG> -t inject-helper
  17. COMMENT "Build x64 inject-helper"
  18. )
  19. endif()
  20. if(CMAKE_VS_PLATFORM_NAME MATCHES "(ARM64|x64)")
  21. add_custom_command(
  22. TARGET inject-helper
  23. POST_BUILD
  24. COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $<CONFIG> -t inject-helper
  25. COMMENT "Build x86 inject-helper"
  26. )
  27. endif()
  28. add_dependencies(win-capture inject-helper)
  29. endif()
  30. if(CMAKE_VS_PLATFORM_NAME STREQUAL ARM64)
  31. set(_OUTPUT_NAME inject-helper-arm64)
  32. elseif(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
  33. set(_OUTPUT_NAME inject-helper64)
  34. else()
  35. set(_OUTPUT_NAME inject-helper32)
  36. endif()
  37. set_target_properties_obs(
  38. inject-helper PROPERTIES
  39. FOLDER plugins/win-capture
  40. OUTPUT_NAME ${_OUTPUT_NAME}
  41. MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
  42. )