native.ini 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 = -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. lib_deps =
  21. build_src_filter = ${common.default_src_filter} +<src/HAL/LINUX>
  22. #
  23. # Native Simulation
  24. # Builds with a small subset of available features
  25. # Required system libraries: SDL2, SDL2-net, OpenGL, GLM
  26. # sudo apt-get install python3-venv build-essential libsdl2-dev libsdl2-net-dev libglm-dev
  27. # See https://docs.platformio.org/en/latest/platforms/native.html for more information
  28. #
  29. # 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]
  30. #
  31. # For VSCode debugging see buildroot/share/PlatformIO/debugging/launch.json
  32. #
  33. [simulator_common]
  34. platform = native
  35. framework =
  36. build_flags = ${common.build_flags} -std=gnu++17 -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS -I/usr/include/SDL2 -IMarlin -IMarlin/src/HAL/NATIVE_SIM/u8g
  37. build_src_flags = -Wall -Wno-expansion-to-defined -Wno-deprecated-declarations -Wcast-align
  38. release_flags = -g0 -O3 -flto
  39. debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
  40. lib_compat_mode = off
  41. build_src_filter = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
  42. lib_deps = ${common.lib_deps}
  43. MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/refs/heads/bugfix-2.1.x.zip
  44. Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip
  45. LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/master.zip
  46. extra_scripts = ${common.extra_scripts}
  47. pre:buildroot/share/PlatformIO/scripts/simulator.py
  48. [simulator_linux]
  49. extends = simulator_common
  50. build_flags = ${simulator_common.build_flags} -ldl -lpthread -lSDL2 -lSDL2_net -lGL
  51. [env:simulator_linux_debug]
  52. extends = simulator_linux
  53. build_type = debug
  54. [env:simulator_linux_release]
  55. extends = simulator_linux
  56. build_type = release
  57. build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags}
  58. #
  59. # Simulator for macOS (MacPorts)
  60. #
  61. #
  62. # MacPorts:
  63. # sudo port install gcc12 glm libsdl2 libsdl2_net
  64. #
  65. # cd /opt/local/bin
  66. # sudo rm -f gcc g++ cc
  67. # sudo ln -s gcc-mp-12 gcc ; sudo ln -s g++-mp-12 g++ ; sudo ln -s g++ cc
  68. # cd -
  69. # rehash
  70. #
  71. # Use 'sudo port install mesa' to get a <GL/gl.h> if no Xcode is installed.
  72. # If Xcode is installed be sure to run `xcode-select --install` first.
  73. #
  74. #==================================================================================
  75. #
  76. # Homebrew:
  77. # /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  78. #
  79. # brew install gcc@12 glm sdl2 sdl2_net
  80. #
  81. # cd /opt/homebrew/bin
  82. # sudo rm -f gcc g++ cc
  83. # sudo ln -s gcc-12 gcc ; sudo ln -s g++-12 g++ ; sudo ln -s g++ cc
  84. # cd -
  85. #
  86. # Use 'brew install mesa' to get a <GL/gl.h> if no Xcode is installed.
  87. # If Xcode is installed be sure to run `xcode-select --install` first.
  88. #
  89. [simulator_macos]
  90. build_unflags = -lGL -fstack-protector-strong
  91. build_flags =
  92. -I/opt/local/include
  93. -I/opt/local/include/freetype2
  94. -I/opt/local/include/SDL2/
  95. -L/opt/local/lib
  96. -Wl,-framework,OpenGl
  97. -Wl,-framework,CoreFoundation
  98. -lSDL2
  99. -fno-stack-protector
  100. [env:simulator_macos_debug]
  101. extends = env:simulator_linux_debug
  102. build_flags = ${env:simulator_linux_debug.build_flags} ${simulator_macos.build_flags} -ggdb -Og -D_THREAD_SAFE
  103. build_unflags = ${simulator_macos.build_unflags}
  104. custom_verbose = 0
  105. custom_gcc = g++
  106. [env:simulator_macos_release]
  107. extends = env:simulator_linux_release
  108. build_flags = ${env:simulator_linux_release.build_flags} ${simulator_macos.build_flags}
  109. build_unflags = ${simulator_macos.build_unflags}
  110. custom_verbose = 0
  111. custom_gcc = g++
  112. #
  113. # Simulator for Windows 10
  114. #
  115. # MSYS2 mingw-w64-x86_64 with these packages:
  116. # 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
  117. #
  118. # Ensure the following paths have been added to the PATH system environment variable:
  119. # C:\msys64\mingw64\bin, C:\msys64\ucrt64\bin, C:\msys64\usr\bin
  120. #
  121. [env:simulator_windows]
  122. extends = simulator_common
  123. build_src_flags = ${simulator_common.build_src_flags} -fpermissive
  124. build_flags = ${simulator_common.build_flags} ${simulator_common.debug_build_flags} -IC:\\msys64\\mingw64\\include\\SDL2 -fno-stack-protector -Wl,-subsystem,windows -ldl -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lopengl32 -lssp
  125. build_type = debug