-
Notifications
You must be signed in to change notification settings - Fork 11
/
guisetup.py
119 lines (108 loc) · 4.29 KB
/
guisetup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# This script is working but needs a major overhaulling
# Check https://github.com/makewitharduino/Scratio/blob/master/setup.py for inspiration
# X3msnake 180726
#
################################
#
# just build python guisetup.py build -b ..\ #Builds on the folder above
# build installer python guisetup.py build -b ..\ bdist_msi -d ..\ #Builds on the folder above
#
# OR make exe directory to zip
#
# 1) python guisetup.py build -b ..\PhotonSlicer.build install_exe -d ..\PhotonSlicer.install
#
# 2) in .build move the dlls tcl86t.dll,tk86t.dll,VCRUNTIME140.dll from install rootdir to libs folder
# DO NOT MOVE python36.dll, this needs to stay in the rootdir
#
# 3) in STLs folder remove all files except legocog.stl
#
# 4) remove 1 of 2 occurences:
# \lib\numpy\core\libopenblas.CSRRD7HKRKC3T3YXA7VY7TAZGLSWDKW6.gfortran-win_amd64
# \lib\numpy\.libs\libopenblas.CSRRD7HKRKC3T3YXA7VY7TAZGLSWDKW6.gfortran-win_amd64
#
# 5) 7-Zip file - use max part size of 24M - Results in 2x .7Z file.
#
# 6) Copy zip to github /Win64
#
# 7) python consetup.py build -b ..\PhotonSlicer.build install_exe -d ..\PhotonSlicer.install
#
# 8) Copy photonslicer.exe (console version) to github /Con64
################################
import os
import sys
from cx_Freeze import setup, Executable
import numpy
import tkinter
import OpenGL.platform.win32
import OpenGL.arrays.ctypesarrays
import OpenGL.arrays.ctypesparameters
import OpenGL.arrays.ctypespointers
import OpenGL.arrays.lists
import OpenGL.arrays.nones
import OpenGL.arrays.numbers
import OpenGL.arrays.strings
import OpenGL.platform.win32
import OpenGL.raw.GL
import OpenGL.GL
import OpenGL.GLU
import OpenGL.GLUT
shortcut_table = [
("DesktopShortcut", # Shortcut
"DesktopFolder", # Directory_
"PhotonSlicer", # Name
"TARGETDIR", # Component_
"[TARGETDIR]\PhotonSlicer.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
"", # Icon
0, # IconIndex
None, # ShowCmd
"TARGETDIR", # WkDir
)
]
# Now create the table dictionary
msi_data = {"Shortcut": shortcut_table}
# Change some default MSI options and specify the use of the above defined tables
bdist_msi_options = {'data': msi_data}
# Dependencies are automatically detected, but it might need fine tuning.
# build_exe_options = {"packages": ["os", "numpy"],"include_files": [""], "include_msvcr" : True}
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
build_exe_options = {
"packages": ["os", "numpy","OpenGL.arrays"],
"include_msvcr" : True,
"excludes":["email","html","https","json","urllib","xmlrpc","setuptools","pydoc_data"],
"includes":["OpenGL.platform.win32","OpenGL.GLU.glustruct","numpy"],
"include_files":[
os.path.join(PYTHON_INSTALL_DIR,'DLLs','tcl86t.dll'),
os.path.join(PYTHON_INSTALL_DIR,'DLLs','tk86t.dll'),
"PhotonSlicer.gif",
"newfile.photon",
"base.vert",
"mesh.vert",
"quad.vert",
"slice.vert",
"base.frag",
"mesh.frag",
"quad.frag",
"slice.frag",
"STLs/"
]
}
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
if 'bdist_msi' in sys.argv:
sys.argv += ['--initial-target-dir', 'c:\PhotonSlicer']
setup( name = "PhotonSlicer_GUI",
version = "0.1",
author= "Photonsters",
url="https://github.com/Photonsters",
description = "Converts STL (binary) files to Images or PhotonFile.",
options = {"build_exe": build_exe_options,"bdist_msi": bdist_msi_options},
executables = [Executable(script="PhotonSlicer.py", base=base,icon="PhotonSlicer.ico",)]
)