opus_config.cmake 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. include(opus_functions.cmake)
  2. configure_file(config.h.cmake.in config.h @ONLY)
  3. add_definitions(-DHAVE_CONFIG_H)
  4. set_property(GLOBAL PROPERTY USE_FOLDERS ON)
  5. set_property(GLOBAL PROPERTY C_STANDARD 99)
  6. if(MSVC)
  7. add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  8. endif()
  9. include(CheckLibraryExists)
  10. check_library_exists(m floor "" HAVE_LIBM)
  11. if(HAVE_LIBM)
  12. list(APPEND OPUS_REQUIRED_LIBRARIES m)
  13. endif()
  14. if(CMAKE_SYSTEM_PROCESSOR MATCHES "(i[0-9]86|x86|X86|amd64|AMD64|x86_64)")
  15. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  16. set(OPUS_CPU_X64 1)
  17. else()
  18. set(OPUS_CPU_X86 1)
  19. endif()
  20. elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
  21. set(OPUS_CPU_ARM 1)
  22. endif()
  23. opus_supports_cpu_detection(RUNTIME_CPU_CAPABILITY_DETECTION)
  24. if(OPUS_CPU_X86 OR OPUS_CPU_X64)
  25. opus_detect_sse(COMPILER_SUPPORT_SIMD)
  26. elseif(OPUS_CPU_ARM)
  27. opus_detect_neon(COMPILER_SUPPORT_NEON)
  28. if(COMPILER_SUPPORT_NEON)
  29. option(OPUS_USE_NEON "Option to turn off SSE" ON)
  30. option(OPUS_MAY_SUPPORT_NEON "Does runtime check for neon support" ON)
  31. option(OPUS_PRESUME_NEON "Assume target CPU has NEON support" OFF)
  32. if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
  33. set(OPUS_PRESUME_NEON ON)
  34. endif()
  35. endif()
  36. endif()