meson.build 2.3 KB

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