projects.cmake 1.7 KB

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