projects.cmake 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # OBS CMake 32-bit slice module
  2. # cmake-format: off
  3. # cmake-lint: disable=C0103
  4. # cmake-lint: disable=E1121
  5. # cmake-format: on
  6. include_guard(GLOBAL)
  7. include(compilerconfig)
  8. # legacy_check: Helper macro to automatically include available 32-bit build script
  9. macro(legacy_check)
  10. if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/32bit-build.cmake")
  11. include(cmake/32bit-build.cmake)
  12. endif()
  13. return()
  14. endmacro()
  15. # cmake-format: off
  16. # target_disable_feature: Stub macro for 32-bit projects
  17. macro(target_disable_feature)
  18. endmacro()
  19. # target_disable: Stub macro for 32-bit projects
  20. macro(target_disable)
  21. endmacro()
  22. # cmake-format: on
  23. # check_uuid: Helper function to check for valid UUID
  24. function(check_uuid uuid_string return_value)
  25. set(valid_uuid TRUE)
  26. set(uuid_token_lengths 8 4 4 4 12)
  27. set(token_num 0)
  28. string(REPLACE "-" ";" uuid_tokens ${uuid_string})
  29. list(LENGTH uuid_tokens uuid_num_tokens)
  30. if(uuid_num_tokens EQUAL 5)
  31. message(DEBUG "UUID ${uuid_string} is valid with 5 tokens.")
  32. foreach(uuid_token IN LISTS uuid_tokens)
  33. list(GET uuid_token_lengths ${token_num} uuid_target_length)
  34. string(LENGTH "${uuid_token}" uuid_actual_length)
  35. if(uuid_actual_length EQUAL uuid_target_length)
  36. string(REGEX MATCH "[0-9a-fA-F]+" uuid_hex_match ${uuid_token})
  37. if(NOT uuid_hex_match STREQUAL uuid_token)
  38. set(valid_uuid FALSE)
  39. break()
  40. endif()
  41. else()
  42. set(valid_uuid FALSE)
  43. break()
  44. endif()
  45. math(EXPR token_num "${token_num}+1")
  46. endforeach()
  47. else()
  48. set(valid_uuid FALSE)
  49. endif()
  50. message(DEBUG "UUID ${uuid_string} valid: ${valid_uuid}")
  51. # cmake-format: off
  52. set(${return_value} ${valid_uuid} PARENT_SCOPE)
  53. # cmake-format: on
  54. endfunction()
  55. if(OS_WINDOWS)
  56. include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/buildspec.cmake")
  57. add_subdirectory(libobs)
  58. add_subdirectory(plugins/win-capture)
  59. add_subdirectory(plugins/win-dshow)
  60. endif()