meson.build 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. ]
  23. compiler = meson.get_compiler('cpp')
  24. error_args = compiler.get_supported_arguments([
  25. '-Wcast-align=strict', '-pedantic', '-Wmissing-declarations', '-Wdate-time',
  26. '-Winit-self', '-Woverlength-strings', '-Wsign-promo', '-Wnon-virtual-dtor',
  27. '-Wconversion', '-Woverloaded-virtual', '-Wdeprecated-enum-enum-conversion',
  28. '-Wdisabled-optimization', '-Winvalid-imported-macros', '-Wduplicated-cond',
  29. '-Wdeprecated-enum-float-conversion', '-Wduplicated-branches', '-Wformat=2',
  30. '-Wmissing-braces', '-Wsuggest-override', '-Wcast-qual', '-Wbidi-chars=any',
  31. '-Wzero-as-null-pointer-constant', '-pedantic-errors', '-Wnull-dereference',
  32. '-Wformat-signedness', '-Wfloat-equal', '-Wvolatile', '-Wctor-dtor-privacy',
  33. '-Winfinite-recursion', '-Wshift-overflow=2', '-Wmultichar', '-Walloc-zero',
  34. '-Wcomma-subscript', '-Wold-style-cast', '-Wwrite-strings', '-Wswitch-enum',
  35. '-Wredundant-decls', '-Werror', '-Wsign-conversion', '-Walloca', '-Wshadow',
  36. '-Winvalid-pch', '-Wdeprecated-copy-dtor', '-Wundef', '-Wdouble-promotion',
  37. '-Warith-conversion', '-Wextra', '-Wtrivial-auto-var-init', '-Wlogical-op',
  38. '-Wall', '-Wenum-conversion'
  39. ])
  40. compile_args = compiler.get_supported_arguments([
  41. '-nostdinc++', '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics'
  42. ])
  43. link_args = compiler.get_supported_arguments([
  44. '-nodefaultlibs', '-lc'
  45. ])
  46. core_include = [include_directories('.')]
  47. core = static_library('core',
  48. sources: src,
  49. include_directories: core_include,
  50. cpp_args: error_args + compile_args,
  51. link_args: link_args)
  52. core_dep = declare_dependency(
  53. include_directories: core_include,
  54. link_with: core)
  55. executable('tests',
  56. sources: src_tests,
  57. dependencies: core_dep,
  58. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  59. link_args: link_args)