The game engine core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8 KiB

1 year ago
  1. add_languages('c')
  2. libenet_src = [
  3. 'callbacks.c',
  4. 'compress.c',
  5. 'host.c',
  6. 'list.c',
  7. 'packet.c',
  8. 'peer.c',
  9. 'protocol.c',
  10. 'unix.c',
  11. 'win32.c'
  12. ]
  13. cc = meson.get_compiler('c')
  14. libenet_cflags = []
  15. if target_machine.system() != 'windows'
  16. if cc.has_function('getaddrinfo', prefix: '#include <netdb.h>')
  17. libenet_cflags += ['-DHAS_GETADDRINFO']
  18. endif
  19. if cc.has_function('getnameinfo', prefix: '#include <netdb.h>')
  20. libenet_cflags += ['-DHAS_GETNAMEINFO']
  21. endif
  22. if cc.has_function('gethostbyaddr_r', prefix: '#include <netdb.h>')
  23. libenet_cflags += ['-DHAS_GETHOSTBYADDR_R']
  24. endif
  25. if cc.has_function('gethostbyname_r', prefix: '#include <netdb.h>')
  26. libenet_cflags += ['-DHAS_GETHOSTBYNAME_R']
  27. endif
  28. if cc.has_function('poll', prefix: '#include <poll.h>')
  29. libenet_cflags += ['-DHAS_POLL']
  30. endif
  31. if cc.has_function('fcntl', prefix: '#include <fcntl.h>')
  32. libenet_cflags += ['-DHAS_FCNTL']
  33. endif
  34. if cc.has_function('inet_pton', prefix: '#include <arpa/inet.h>')
  35. libenet_cflags += ['-DHAS_INET_PTON']
  36. endif
  37. if cc.has_function('inet_ntop', prefix: '#include <arpa/inet.h>')
  38. libenet_cflags += ['-DHAS_INET_NTOP']
  39. endif
  40. if cc.has_member('struct msghdr', 'msg_flags', prefix: '#include <sys/socket.h>')
  41. libenet_cflags += ['-DHAS_MSGHDR_FLAGS']
  42. endif
  43. if cc.has_type('socklen_t', prefix: '#include <sys/socket.h>')
  44. libenet_cflags += ['-DHAS_SOCKLEN_T']
  45. endif
  46. endif
  47. libenet_lib = static_library('enet',
  48. libenet_src,
  49. include_directories: include_directories('include'),
  50. c_args: libenet_cflags,
  51. install: false
  52. )
  53. libenet = declare_dependency(
  54. include_directories: include_directories('include'),
  55. link_with: libenet_lib
  56. )