chiark / gitweb /
Fix pyserial 3.0 compatibility issue
[cura.git] / README.md
1 IMPORTANT: The definitive location for Aleph Object's Cura source code is here: https://code.alephobjects.com/diffusion/CURA\r
2 \r
3 \r
4 = Cura =\r
5 \r
6 This is the development version of Cura for LulzBot 3D Printers by Aleph Objects, Inc. It is available here: https://code.alephobjects.com/diffusion/CURA\r
7 \r
8 This branch is based on the upstream version maintained by daid and Ultimaker: https://github.com/daid/Cura\r
9 \r
10 = Development =\r
11 \r
12 Cura is developed in Python with a C++ engine. The part you are looking at right now is the Python GUI. The C++ engine is responsible for generating the actual toolpath. For development of the engine check out https://code.alephobjects.com/diffusion/CE/\r
13 \r
14 Both MacOS and Linux require some extra instructions for development, as you need to prepare an environment. Look below at the proper section to see what is needed.\r
15 \r
16 There are two options to run cura on your system. Package (Build/install/run) or run directly from the source code.\r
17 \r
18 == Running from Source ==\r
19 Recommended for alpha testers and software developers contributing patches or pull requests.\r
20 \r
21 ## Get the source code\r
22   git clone https://code.alephobjects.com/diffusion/CURA/cura.git\r
23 \r
24 ##Install dependencies for your platform\r
25 Run the `sudo apt-get install ...` or `sudo yum install ...` line from the below platform dependant sections.\r
26 \r
27 ##Build CuraEngine\r
28 Easily done by running package.sh once\r
29 ```\r
30 cd cura\r
31 package.sh <platform name here>\r
32 ```\r
33 \r
34 ##Link CuraEngine\r
35 For *nix OSes you can create a symbolic link. This can be placed in the directory above where you cloned cura.\r
36 ```\r
37 cd ..\r
38 ln -s ./cura/CuraEngine/build/CuraEngine CuraEngine\r
39 ```\r
40 \r
41 ##Run\r
42 ``` ./dev-cura ```\r
43 \r
44 == Packaging ==\r
45 Recommended for organizations that are building their own version of Cura.\r
46 \r
47 Cura development comes with a script "package.sh", this script has been designed to run under *nix OSes (Linux, MacOS, FreeBSD). For Windows the package.sh script can be run from bash using git. The "package.sh" script generates a final release package. You should not need it during development, unless you are changing the release process. If you want to distribute your own version of Cura, then the package.sh script will allow you to do that.\r
48 \r
49 \r
50 == Fedora ==\r
51 \r
52 Fedora builds Cura by using `mock`, thereby enabling it to build RPMs for every distribution that `mock` has a configuration file for. In pratice this means that Fedora can build RPMs for several versions of Fedora, CentOS and RHEL. Cura can be built under a regular user account, there is no need to have root privileges. In fact, having root privileges is very much discouraged. However, the user account under which the build is performed needs to be a member of the 'mock' group. This is accomplished as follows:\r
53 ```bash\r
54 sudo usermod -a -G mock "$(whoami)"\r
55 ```\r
56 \r
57 To install the software that is required to build Cura, run the following commands:\r
58 ```bash\r
59 sudo yum install -y git rpmdevtools rpm-build mock arduino\r
60 \r
61 # Ensure that the Arduino tools can be found by the build\r
62 sudo mkdir -p /usr/share/arduino/hardware/tools/avr\r
63 sudo ln -sf /usr/bin /usr/share/arduino/hardware/tools/avr/bin\r
64 \r
65 ```\r
66 \r
67 To build and install Cura, run the following commands:\r
68 \r
69 ```bash\r
70 # Get the Cura software, only required once\r
71 git clone https://code.alephobjects.com/diffusion/CURA/cura.git\r
72 \r
73 # Build for the current system\r
74 cd cura\r
75 ./package.sh fedora\r
76 \r
77 # Install on the current system\r
78 sudo yum localinstall -y scripts/linux/fedora/RPMS/Cura-*.rpm\r
79 ```\r
80 \r
81 Examples of building other configurations:\r
82 \r
83 ```bash\r
84 # Build for Fedora rawhide x86-64 and i386\r
85 ./package.sh fedora fedora-rawhide-x86_64.cfg fedora-rawhide-i386.cfg\r
86 \r
87 # Since only the basename of the mock configurations is used, this also works:\r
88 ./package.sh fedora /etc/mock/fedora-21-x86_64.cfg /etc/mock/fedora-rawhide-i386.cfg\r
89 ```\r
90 \r
91 == Debian and Ubuntu Linux ==\r
92 \r
93 To build and install Cura, run the following commands:\r
94 \r
95 ```bash\r
96 git clone https://code.alephobjects.com/diffusion/CURA/cura.git\r
97 \r
98 sudo apt-get install python-opengl python-numpy python-serial python-setuptools python-wxgtk3.0 curl python-power\r
99 # Run this also if you're building for 32bit Debian\r
100 sudo apt-get install gcc-multilib g++-multilib\r
101 \r
102 cd cura\r
103 \r
104 ./package.sh debian_amd64          # or debian_i386 for 32bit\r
105 # this will prompt for your root password to run dpkg-deb\r
106 \r
107 sudo dpkg -i ./scripts/linux/cura*.deb\r
108 ```\r
109 \r
110 == FreeBSD ==\r
111 \r
112 On FreeBSD simply use the Port Tree (`cd /usr/ports/cad/cura`) to create (`make package`) and install (`make install`) the package as root. Port will check for all necessary dependencies. You can also use the provided binary package with `pkg install Cura`. If you want to create an archive for local use the `package.sh freebsd` script (as an ordinary user) will give you a tarball with the program.\r
113 \r
114 == Mac OS X ==\r
115 \r
116 The following section describes how to prepare working environment for developing and packaing for Mac OS X. The working environment consist of build of Python, build of wxPython and all required Python packages.\r
117 \r
118 We assume you already have Apple hardware with [64bit processor](http://support.apple.com/kb/HT3696) and you are familiar with tools like [virtualenv](http://pypi.python.org/pypi/virtualenv), [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) and [pip](http://www.pip-installer.org/en/latest/). Also ensure you have modern compiler installed.\r
119 \r
120 \r
121 ##Install Python\r
122 You'll need **non-system**, **framework-based**, **universal** with **deployment target set to 10.6** build of Python 2.7\r
123 \r
124 **non-system**: Output of\r
125 ```python -c "import sys; print sys.prefix"```\r
126 should *not* start with *"/System/Library/Frameworks/Python.framework/"*.\r
127 \r
128 **framework-based**: Output of\r
129 ```python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"```\r
130 should be non-empty string. E.g. *Python*.\r
131 \r
132 **universal**: Output of\r
133 ```lipo -info `which python` ```\r
134 should include both i386 and x86_64. E.g *"Architectures in the fat file: /usr/local/bin/python are: i386 x86_64"*.\r
135 \r
136 **deployment target set to 10.6**: Output of\r
137 ```otool -l `which python` ```\r
138 should contain *"cmd LC_VERSION_MIN_MACOSX ... version 10.6"*.\r
139 \r
140 The easiest way to install it is via [Homebrew](http://mxcl.github.com/homebrew/) using the formula from Cura's repo:\r
141 `brew install --build-bottle --fresh cura/scripts/darwin/python.rb --universal`\r
142 Note if you already have Python installed via Homebrew, you have to uninstall it first.\r
143 \r
144 You can also install [official build](http://www.python.org/ftp/python/2.7.3/python-2.7.3-macosx10.6.dmg).\r
145 \r
146 ##Configure Virtualenv\r
147 Create new virtualenv. If you have [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) installed:\r
148 `mkvirtualenv Cura`\r
149 \r
150 wxPython cannot be installed via pip, we have to build it from source by specifing prefix to our virtualenv.\r
151 \r
152 Assuming you have virtualenv at *~/.virtualenvs/Cura/* and [wxPython sources](http://sourceforge.net/projects/wxpython/files/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.bz2) at *~/Downloads/wxPython-src-2.9.4.0/*:\r
153 \r
154 1. ```cd``` into *~/Downloads/wxPython-src-2.9.4.0/* and configure the sources:\r
155 \r
156         ./configure \\r
157         CFLAGS='-msse2 -mno-sse3 -mno-sse4' \\r
158         CXXFLAGS='-msse2 -mno-sse3 -mno-sse4' \\r
159         --disable-debug \\r
160         --enable-clipboard \\r
161         --enable-display \\r
162         --enable-dnd \\r
163         --enable-monolithic \\r
164         --enable-optimise \\r
165         --enable-std_string \\r
166         --enable-svg \\r
167         --enable-unicode \\r
168         --enable-universal_binary=i386,x86_64 \\r
169         --enable-webkit \\r
170         --prefix=$HOME/.virtualenvs/Cura/ \\r
171         --with-expat \\r
172         --with-libjpeg=builtin \\r
173         --with-libpng=builtin \\r
174         --with-libtiff=builtin \\r
175         --with-macosx-version-min=10.6 \\r
176         --with-opengl \\r
177         --with-osx_cocoa \\r
178         --with-zlib=builtin\r
179 \r
180 2. ```make install```\r
181     Note to speedup the process I recommend you to enable multicore build by adding the -j*cores* flag:\r
182     ```make -j4 install```\r
183 3. ```cd``` into *~/Downloads/wxPython-src-2.9.4.0/wxPython/*\r
184 4. Build wxPython (Note `python` is the python of your virtualenv):\r
185 \r
186         python setup.py build_ext \\r
187         BUILD_GIZMOS=1 \\r
188         BUILD_GLCANVAS=1 \\r
189         BUILD_STC=1 \\r
190         INSTALL_MULTIVERSION=0 \\r
191         UNICODE=1 \\r
192         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \\r
193         WXPORT=osx_cocoa\r
194 \r
195 5. Install wxPython (Note ```python``` is the python of your virtualenv):\r
196 \r
197         python setup.py install \\r
198         --prefix=$HOME/.virtualenvs/Cura \\r
199         BUILD_GIZMOS=1 \\r
200         BUILD_GLCANVAS=1 \\r
201         BUILD_STC=1 \\r
202         INSTALL_MULTIVERSION=0 \\r
203         UNICODE=1 \\r
204         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \\r
205         WXPORT=osx_cocoa\r
206 \r
207 6. Create file *~/.virtualenvs/Cura/bin/pythonw* with the following content:\r
208 \r
209         #!/bin/bash\r
210         ENV=`python -c "import sys; print sys.prefix"`\r
211         PYTHON=`python -c "import sys; print sys.real_prefix"`/bin/python\r
212         export PYTHONHOME=$ENV\r
213         exec $PYTHON "$@"\r
214 \r
215 At this point virtualenv is configured for wxPython development.\r
216 Remember to use `python` for pacakging and `pythonw` to run app for debugging.\r
217 \r
218 \r
219 ##Install Python Packages\r
220 Required python packages are specified in *requirements.txt* and *requirements_darwin.txt*\r
221 If you use virtualenv, installing requirements as easy as ```pip install -r requirements_darwin.txt```\r
222 \r
223 \r
224 ##Package Cura into application\r
225 Ensure that virtualenv is activated, so ```python``` points to the python of your virtualenv (e.g. ~/.virtualenvs/Cura/bin/python).Use package.sh to build Cura:\r
226 ```./package.sh darwin```\r
227 \r
228 Note that application is only guaranteed to work on Mac OS X version used to build and higher, but may not support lower versions.\r
229 E.g. Cura built on 10.8 will work on 10.8 and 10.7, but not on 10.6. In other hand, Cura built on 10.6 will work on 10.6, 10.7 and 10.8.\r
230 \r