meson.build 2.3 KB

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