meson.build 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. project('core', 'cpp', default_options : ['cpp_std=c++2a'])
  2. src = [
  3. 'utils/Logger.cpp',
  4. 'utils/Utility.cpp',
  5. 'utils/HashCode.cpp',
  6. 'data/BitArray.cpp',
  7. ]
  8. src_tests = [
  9. 'test/Main.cpp',
  10. 'test/Test.cpp',
  11. 'tests/ArrayTests.cpp',
  12. 'tests/ArrayStringTests.cpp',
  13. 'tests/UtilityTests.cpp',
  14. 'tests/ArrayListTests.cpp',
  15. 'tests/BitArrayTests.cpp',
  16. 'tests/MathTests.cpp',
  17. 'tests/ListTests.cpp',
  18. 'tests/LinkedListTests.cpp',
  19. 'tests/UniquePointerTests.cpp',
  20. 'tests/HashMapTests.cpp',
  21. 'tests/StackTests.cpp',
  22. 'tests/RingBufferTests.cpp',
  23. ]
  24. compiler = meson.get_compiler('cpp')
  25. error_args = compiler.get_supported_arguments([
  26. '-Wcast-align=strict', '-pedantic', '-Wmissing-declarations', '-Wdate-time',
  27. '-Winit-self', '-Woverlength-strings', '-Wsign-promo', '-Wnon-virtual-dtor',
  28. '-Wconversion', '-Woverloaded-virtual', '-Wdeprecated-enum-enum-conversion',
  29. '-Wdisabled-optimization', '-Winvalid-imported-macros', '-Wduplicated-cond',
  30. '-Wdeprecated-enum-float-conversion', '-Wduplicated-branches', '-Wformat=2',
  31. '-Wmissing-braces', '-Wsuggest-override', '-Wcast-qual', '-Wbidi-chars=any',
  32. '-Wzero-as-null-pointer-constant', '-pedantic-errors', '-Wnull-dereference',
  33. '-Wformat-signedness', '-Wfloat-equal', '-Wvolatile', '-Wctor-dtor-privacy',
  34. '-Winfinite-recursion', '-Wshift-overflow=2', '-Wmultichar', '-Walloc-zero',
  35. '-Wcomma-subscript', '-Wold-style-cast', '-Wwrite-strings', '-Wswitch-enum',
  36. '-Wredundant-decls', '-Werror', '-Wsign-conversion', '-Walloca', '-Wshadow',
  37. '-Winvalid-pch', '-Wdeprecated-copy-dtor', '-Wundef', '-Wdouble-promotion',
  38. '-Warith-conversion', '-Wextra', '-Wtrivial-auto-var-init', '-Wlogical-op',
  39. '-Wall', '-Wenum-conversion'
  40. ])
  41. compile_args = compiler.get_supported_arguments([
  42. '-nostdinc++', '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics'
  43. ])
  44. link_args = compiler.get_supported_arguments([
  45. '-nodefaultlibs', '-lc'
  46. ])
  47. core_include = [include_directories('.')]
  48. core = static_library('core',
  49. sources: src,
  50. include_directories: core_include,
  51. cpp_args: error_args + compile_args,
  52. link_args: link_args)
  53. core_dep = declare_dependency(
  54. include_directories: core_include,
  55. link_with: core)
  56. executable('tests',
  57. sources: src_tests,
  58. dependencies: core_dep,
  59. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  60. link_args: link_args)