meson.build 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. project('dolphin option', 'c')
  2. d = disabler()
  3. d2 = dependency(d)
  4. d3 = (d == d2)
  5. d4 = d + 0
  6. d5 = d2 or true
  7. assert(d, 'Disabler did not cause this to be skipped.')
  8. assert(d2, 'Function laundered disabler did not cause this to be skipped.')
  9. assert(d3, 'Disabler comparison should yield disabler and thus this would not be called.')
  10. assert(d4, 'Disabler addition should yield disabler and thus this would not be called.')
  11. assert(d5, 'Disabler logic op should yield disabler and thus this would not be called.')
  12. number = 0
  13. if d
  14. number = 1
  15. else
  16. number = 2
  17. endif
  18. assert(number == 0, 'Plain if handled incorrectly, value should be 0 but is @0@'.format(number))
  19. if d.found()
  20. number = 1
  21. else
  22. number = 2
  23. endif
  24. assert(number == 2, 'If found handled incorrectly, value should be 2 but is @0@'.format(number))
  25. dep = dependency('notfounddep', required : false, disabler : true)
  26. app = executable('myapp', 'notfound.c', dependencies : [dep])
  27. cc = meson.get_compiler('c')
  28. dep = cc.find_library('notfounddep', required : false, disabler : true)
  29. app = executable('myapp', 'notfound.c', dependencies : [dep])
  30. dep = find_program('donotfindme', required : false, disabler : true)
  31. app = executable('myapp', 'notfound.c', dependencies : [dep])