native.ini 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #
  2. # Marlin Firmware
  3. # PlatformIO Configuration File
  4. #
  5. #################################
  6. # #
  7. # Native / Simulation #
  8. # #
  9. #################################
  10. #
  11. # No supported Arduino libraries, base Marlin only
  12. #
  13. [env:linux_native]
  14. platform = native
  15. framework =
  16. build_flags = ${common.build_flags} -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined
  17. build_src_flags = -Wall -IMarlin/src/HAL/LINUX/include
  18. build_unflags = -Wall
  19. lib_ldf_mode = off
  20. build_src_filter = ${common.default_src_filter} +<src/HAL/LINUX>
  21. # Environment specifically for unit testing through the Makefile
  22. # This is somewhat unorthodox, in that it uses the PlatformIO Unity testing framework,
  23. # but actual targets are dynamically generated during the build. This seems to prevent
  24. # Unity from being automatically included, so it is added here.
  25. [env:linux_native_test]
  26. extends = env:linux_native
  27. extra_scripts = ${common.extra_scripts}
  28. post:buildroot/share/PlatformIO/scripts/collect-code-tests.py
  29. build_src_filter = ${env:linux_native.build_src_filter} +<tests>
  30. lib_deps = throwtheswitch/Unity@^2.5.2
  31. test_build_src = true
  32. build_unflags =
  33. build_flags = ${env:linux_native.build_flags} -Werror
  34. #
  35. # Native Simulation
  36. # Builds with a small subset of available features
  37. # Required system libraries: SDL2, SDL2-net, OpenGL, GLM
  38. # sudo apt-get install python3-venv build-essential libsdl2-dev libsdl2-net-dev libglm-dev
  39. # See https://docs.platformio.org/en/latest/platforms/native.html for more information
  40. #
  41. # Tested with Linux (Mint 20) : gcc [9.3.0, 10.2.0]: libsdl2-dev[2.0.10], libsdl2-net-dev[2.0.1], libglm-dev[0.9.9.7, 0.9.9.8]
  42. #
  43. # For VSCode debugging see buildroot/share/PlatformIO/debugging/launch.json
  44. #
  45. [simulator_common]
  46. platform = native
  47. framework =
  48. build_flags = ${common.build_flags} -std=gnu++17
  49. -I/usr/include/SDL2 -IMarlin -IMarlin/src/HAL/NATIVE_SIM/u8g
  50. -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS -DGLM_ENABLE_EXPERIMENTAL
  51. build_src_flags = -Wall -Wno-expansion-to-defined -Wno-deprecated-declarations -Wcast-align
  52. release_flags = -g0 -O3 -flto
  53. debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
  54. lib_compat_mode = off
  55. build_src_filter = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
  56. lib_deps = ${common.lib_deps}
  57. MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/afe7c1c293.zip
  58. Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip
  59. LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip
  60. extra_scripts = ${common.extra_scripts}
  61. pre:buildroot/share/PlatformIO/scripts/simulator.py
  62. [simulator_linux]
  63. extends = simulator_common
  64. build_flags = ${simulator_common.build_flags} -ldl -lpthread -lSDL2 -lSDL2_net -lGL
  65. [env:simulator_linux_debug]
  66. extends = simulator_linux
  67. build_type = debug
  68. [env:simulator_linux_release]
  69. extends = simulator_linux
  70. build_type = release
  71. build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags}
  72. #
  73. # Simulator for macOS (MacPorts)
  74. #
  75. #
  76. # MacPorts:
  77. # sudo port install gcc14 glm mesa libsdl2 libsdl2_net
  78. #
  79. # cd /opt/local/bin
  80. # sudo rm gcc g++ cc ld
  81. # sudo ln -s gcc-mp-14 gcc ; sudo ln -s g++-mp-14 g++ ; sudo ln -s g++ cc
  82. # sudo ln -s ld-classic ld
  83. # cd -
  84. # rehash
  85. #
  86. #==================================================================================
  87. #
  88. # Homebrew:
  89. # /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  90. #
  91. # brew install gcc@14 glm mesa sdl2 sdl2_net
  92. #
  93. # cd /opt/homebrew/bin
  94. # sudo rm -f gcc g++ cc
  95. # sudo ln -s gcc-14 gcc ; sudo ln -s g++-14 g++ ; sudo ln -s g++ cc
  96. # cd -
  97. #
  98. [simulator_macos]
  99. build_unflags = -g3 -lGL -fstack-protector-strong
  100. build_flags = -g2
  101. -DHAS_LIBBSD
  102. -I/opt/local/include
  103. -I/opt/local/include/freetype2
  104. -I/opt/local/include/SDL2/
  105. -L/opt/local/lib
  106. -Wl,-framework,OpenGl
  107. -Wl,-framework,CoreFoundation
  108. -lSDL2
  109. -fno-stack-protector
  110. [env:simulator_macos_debug]
  111. extends = env:simulator_linux_debug
  112. build_flags = ${env:simulator_linux_debug.build_flags} ${simulator_macos.build_flags} -ggdb -Og -D_THREAD_SAFE
  113. build_unflags = ${simulator_macos.build_unflags}
  114. custom_verbose = 0
  115. custom_gcc = g++
  116. [env:simulator_macos_release]
  117. extends = env:simulator_linux_release
  118. build_flags = ${env:simulator_linux_release.build_flags} ${simulator_macos.build_flags}
  119. build_unflags = ${simulator_macos.build_unflags}
  120. custom_verbose = 0
  121. custom_gcc = g++
  122. #
  123. # Simulator for Windows 10
  124. #
  125. # MSYS2 mingw-w64-x86_64 with these packages:
  126. # pacman -S --needed base-devel mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-glm mingw64/mingw-w64-x86_64-SDL2 mingw64/mingw-w64-x86_64-SDL2_net mingw-w64-x86_64-dlfcn
  127. #
  128. # Ensure the following paths have been added to the PATH system environment variable:
  129. # C:\msys64\mingw64\bin, C:\msys64\ucrt64\bin, C:\msys64\usr\bin
  130. #
  131. [env:simulator_windows]
  132. extends = simulator_common
  133. build_src_flags = ${simulator_common.build_src_flags} -fpermissive
  134. build_flags = ${simulator_common.build_flags} ${simulator_common.debug_build_flags}
  135. -IC:\\msys64\\mingw64\\include\\SDL2 -fno-stack-protector -Wl,-subsystem,windows
  136. -ldl -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lopengl32 -lssp
  137. build_type = debug