My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

simulator.py 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #
  2. # simulator.py
  3. # PlatformIO pre: script for simulator builds
  4. #
  5. import pioutil
  6. if pioutil.is_pio_build():
  7. # Get the environment thus far for the build
  8. Import("env")
  9. #print(env.Dump())
  10. #
  11. # Give the binary a distinctive name
  12. #
  13. env['PROGNAME'] = "MarlinSimulator"
  14. #
  15. # If Xcode is installed add the path to its Frameworks folder,
  16. # or if Mesa is installed try to use its GL/gl.h.
  17. #
  18. import sys
  19. if sys.platform == 'darwin':
  20. #
  21. # Silence half of the ranlib warnings. (No equivalent for 'ARFLAGS')
  22. #
  23. env['RANLIBFLAGS'] += [ "-no_warning_for_no_symbols" ]
  24. # Default paths for Xcode and a lucky GL/gl.h dropped by Mesa
  25. xcode_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
  26. mesa_path = "/opt/local/include/GL/gl.h"
  27. import os.path
  28. if os.path.exists(xcode_path):
  29. env['BUILD_FLAGS'] += [ "-F" + xcode_path ]
  30. print("Using OpenGL framework headers from Xcode.app")
  31. elif os.path.exists(mesa_path):
  32. env['BUILD_FLAGS'] += [ '-D__MESA__' ]
  33. print("Using OpenGL header from", mesa_path)
  34. else:
  35. print("\n\nNo OpenGL headers found. Install Xcode for matching headers, or use 'sudo port install mesa' to get a GL/gl.h.\n\n")
  36. # Break out of the PIO build immediately
  37. sys.exit(1)
  38. env.AddCustomTarget("upload", "$BUILD_DIR/${PROGNAME}", "$BUILD_DIR/${PROGNAME}")