make_win.py 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # ########################################################## ##
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # http://flatcam.org #
  4. # Author: Juan Pablo Caram (c) #
  5. # Date: 12/20/2018 #
  6. # MIT Licence #
  7. # #
  8. # Creates a portable copy of FlatCAM, including Python #
  9. # itself and all dependencies. #
  10. # #
  11. # This is not an aid to install FlatCAM from source on #
  12. # Windows platforms. It is only useful when FlatCAM is up #
  13. # and running and ready to be packaged. #
  14. # ########################################################## ##
  15. # ########################################################## ##
  16. # File Modified (major mod): Marius Adrian Stanciu #
  17. # Date: 3/10/2019 #
  18. # ########################################################## ##
  19. # Files not needed: Qt, tk.dll, tcl.dll, tk/, tcl/, vtk/,
  20. # scipy.lib.lapack.flapack.pyd, scipy.lib.blas.fblas.pyd,
  21. # numpy.core._dotblas.pyd, scipy.sparse.sparsetools._bsr.pyd,
  22. # scipy.sparse.sparsetools._csr.pyd, scipy.sparse.sparsetools._csc.pyd,
  23. # scipy.sparse.sparsetools._coo.pyd
  24. import os, site, sys, platform
  25. from cx_Freeze import setup, Executable
  26. # this is done to solve the tkinter not being found
  27. PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
  28. os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
  29. os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
  30. # Get the site-package folder, not everybody will install
  31. # Python into C:\PythonXX
  32. site_dir = site.getsitepackages()[1]
  33. include_files = []
  34. include_files.append((os.path.join(site_dir, "shapely"), "shapely"))
  35. include_files.append((os.path.join(site_dir, "svg"), "svg"))
  36. include_files.append((os.path.join(site_dir, "svg/path"), "svg"))
  37. include_files.append((os.path.join(site_dir, "vispy"), "vispy"))
  38. include_files.append((os.path.join(site_dir, "vispy/app"), "vispy/app"))
  39. include_files.append((os.path.join(site_dir, "vispy/app/backends"), "vispy/app/backends"))
  40. include_files.append((os.path.join(site_dir, "rtree"), "rtree"))
  41. if platform.architecture()[0] == '64bit':
  42. include_files.append((os.path.join(site_dir, "google"), "google"))
  43. include_files.append((os.path.join(site_dir, "google/protobuf"), "google/protobuf"))
  44. include_files.append((os.path.join(site_dir, "ortools"), "ortools"))
  45. include_files.append(("locale", "lib/locale"))
  46. include_files.append(("postprocessors", "lib/postprocessors"))
  47. include_files.append(("share", "lib/share"))
  48. include_files.append(("README.md", "README.md"))
  49. include_files.append(("LICENSE", "LICENSE"))
  50. base = None
  51. # Lets not open the console while running the app
  52. if sys.platform == "win32":
  53. base = "Win32GUI"
  54. if platform.architecture()[0] == '64bit':
  55. buildOptions = dict(
  56. include_files=include_files,
  57. excludes=['scipy','pytz'],
  58. # packages=['OpenGL','numpy','vispy','ortools','google']
  59. # packages=['numpy','google', 'rasterio'] # works for Python 3.7
  60. packages = ['opengl', 'numpy', 'google', 'rasterio'] # works for Python 3.6.5 and Python 3.7.1
  61. )
  62. else:
  63. buildOptions = dict(
  64. include_files=include_files,
  65. excludes=['scipy', 'pytz'],
  66. # packages=['OpenGL','numpy','vispy','ortools','google']
  67. # packages=['numpy', 'rasterio'] # works for Python 3.7
  68. packages = ['opengl', 'numpy', 'rasterio'] # works for Python 3.6.5 and Python 3.7.1
  69. )
  70. print("INCLUDE_FILES", include_files)
  71. # execfile('clean.py')
  72. setup(
  73. name="FlatCAM",
  74. author="Juan Pablo Caram",
  75. version="8.9",
  76. description="FlatCAM: 2D Computer Aided PCB Manufacturing",
  77. options=dict(build_exe=buildOptions),
  78. executables=[Executable("FlatCAM.py", icon='share/flatcam_icon48.ico', base=base)]
  79. )