compile-flags.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. add_compile_flags(LD
  2. -nostartfiles
  3. -static
  4. -Wl,--gc-sections
  5. -Wl,-static
  6. -Wl,--start-group
  7. -Wl,--whole-archive
  8. -Wl,--no-whole-archive
  9. -Wl,--end-group
  10. -Wl,-EL
  11. -Wl,--no-relax
  12. -T ${SDK_ROOT}/lds/kendryte.ld
  13. )
  14. # C Flags Settings
  15. add_compile_flags(BOTH
  16. -mcmodel=medany
  17. -mabi=lp64f
  18. -march=rv64imafc
  19. -fno-common
  20. -ffunction-sections
  21. -fdata-sections
  22. -fstrict-volatile-bitfields
  23. -fno-zero-initialized-in-bss
  24. -ffast-math
  25. -fno-math-errno
  26. -fsingle-precision-constant
  27. -Os
  28. -ggdb
  29. )
  30. add_compile_flags(C -std=gnu11 -Wno-pointer-to-int-cast)
  31. add_compile_flags(CXX -std=gnu++17)
  32. if (BUILDING_SDK)
  33. add_compile_flags(BOTH
  34. -Wall
  35. -Werror=all
  36. -Wno-error=unused-function
  37. -Wno-error=unused-but-set-variable
  38. -Wno-error=unused-variable
  39. -Wno-error=deprecated-declarations
  40. -Wno-multichar
  41. -Wextra
  42. -Werror=frame-larger-than=32768
  43. -Wno-unused-parameter
  44. -Wno-sign-compare
  45. -Wno-error=missing-braces
  46. -Wno-error=return-type
  47. -Wno-error=pointer-sign
  48. -Wno-missing-braces
  49. -Wno-strict-aliasing
  50. -Wno-implicit-fallthrough
  51. -Wno-missing-field-initializers
  52. -Wno-int-to-pointer-cast
  53. -Wno-error=comment
  54. -Wno-error=logical-not-parentheses
  55. -Wno-error=duplicate-decl-specifier
  56. -Wno-error=parentheses
  57. )
  58. add_compile_flags(C -Wno-old-style-declaration)
  59. else ()
  60. add_compile_flags(BOTH -L${SDK_ROOT}/include/)
  61. endif ()