chiark / gitweb /
Update README
[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.\r
53 \r
54 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.\r
55 \r
56 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
57 \r
58 ```bash\r
59 sudo usermod -a -G mock "$(whoami)"\r
60 ```\r
61 \r
62 To install the software that is required to build Cura, run the following\r
63 commands:\r
64 \r
65 ```bash\r
66 sudo yum install -y git rpmdevtools rpm-build mock arduino\r
67 \r
68 # Ensure that the Arduino tools can be found by the build\r
69 sudo mkdir -p /usr/share/arduino/hardware/tools/avr\r
70 sudo ln -sf /usr/bin /usr/share/arduino/hardware/tools/avr/bin\r
71 \r
72 ```\r
73 \r
74 To build and install Cura, run the following commands:\r
75 \r
76 ```bash\r
77 # Get the Cura software, only required once\r
78 git clone https://code.alephobjects.com/diffusion/CURA/cura.git\r
79 \r
80 # Build for the current system\r
81 cd cura\r
82 ./package.sh fedora\r
83 \r
84 # Install on the current system\r
85 sudo yum localinstall -y scripts/linux/fedora/RPMS/Cura-*.rpm\r
86 ```\r
87 \r
88 Examples of building other configurations:\r
89 \r
90 ```bash\r
91 # Build for Fedora rawhide x86-64 and i386\r
92 ./package.sh fedora fedora-rawhide-x86_64.cfg fedora-rawhide-i386.cfg\r
93 \r
94 # Since only the basename of the mock configurations is used, this also works:\r
95 ./package.sh fedora /etc/mock/fedora-21-x86_64.cfg /etc/mock/fedora-rawhide-i386.cfg\r
96 ```\r
97 \r
98 == Debian and Ubuntu Linux ==\r
99 \r
100 To build and install Cura, run the following commands:\r
101 \r
102 ```bash\r
103 git clone https://code.alephobjects.com/diffusion/CURA/cura.git\r
104 \r
105 sudo apt-get install python-opengl python-numpy python-serial python-setuptools python-wxgtk2.8 curl python-power\r
106 # Run this also if you're building for 32bit Debian\r
107 sudo apt-get install gcc-multilib g++-multilib\r
108 \r
109 cd cura\r
110 \r
111 ./package.sh debian_amd64          # or debian_i386 for 32bit\r
112 # this will prompt for your root password to run dpkg-deb\r
113 \r
114 sudo dpkg -i ./scripts/linux/cura*.deb\r
115 ```\r
116 \r
117 == FreeBSD ==\r
118 \r
119 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`.\r
120 \r
121 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
122 \r
123 == Mac OS X ==\r
124 \r
125 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
126 \r
127 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
128 \r
129 \r
130 ###Install Python\r
131 You'll need **non-system**, **framework-based**, **universal** with **deployment target set to 10.6** build of Python 2.7\r
132 \r
133 **non-system**: Output of\r
134 ```python -c "import sys; print sys.prefix"```\r
135 should *not* start with *"/System/Library/Frameworks/Python.framework/"*.\r
136 \r
137 **framework-based**: Output of\r
138 ```python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"```\r
139 should be non-empty string. E.g. *Python*.\r
140 \r
141 **universal**: Output of\r
142 ```lipo -info `which python` ```\r
143 should include both i386 and x86_64. E.g *"Architectures in the fat file: /usr/local/bin/python are: i386 x86_64"*.\r
144 \r
145 **deployment target set to 10.6**: Output of\r
146 ```otool -l `which python` ```\r
147 should contain *"cmd LC_VERSION_MIN_MACOSX ... version 10.6"*.\r
148 \r
149 The easiest way to install it is via [Homebrew](http://mxcl.github.com/homebrew/) using the formula from Cura's repo:\r
150 `brew install --build-bottle --fresh cura/scripts/darwin/python.rb --universal`\r
151 Note if you already have Python installed via Homebrew, you have to uninstall it first.\r
152 \r
153 You can also install [official build](http://www.python.org/ftp/python/2.7.3/python-2.7.3-macosx10.6.dmg).\r
154 \r
155 ##Configure Virtualenv\r
156 Create new virtualenv. If you have [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) installed:\r
157 `mkvirtualenv Cura`\r
158 \r
159 wxPython cannot be installed via pip, we have to build it from source by specifing prefix to our virtualenv.\r
160 \r
161 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
162 \r
163 1. ```cd``` into *~/Downloads/wxPython-src-2.9.4.0/* and configure the sources:\r
164 \r
165         ./configure \\r
166         CFLAGS='-msse2 -mno-sse3 -mno-sse4' \\r
167         CXXFLAGS='-msse2 -mno-sse3 -mno-sse4' \\r
168         --disable-debug \\r
169         --enable-clipboard \\r
170         --enable-display \\r
171         --enable-dnd \\r
172         --enable-monolithic \\r
173         --enable-optimise \\r
174         --enable-std_string \\r
175         --enable-svg \\r
176         --enable-unicode \\r
177         --enable-universal_binary=i386,x86_64 \\r
178         --enable-webkit \\r
179         --prefix=$HOME/.virtualenvs/Cura/ \\r
180         --with-expat \\r
181         --with-libjpeg=builtin \\r
182         --with-libpng=builtin \\r
183         --with-libtiff=builtin \\r
184         --with-macosx-version-min=10.6 \\r
185         --with-opengl \\r
186         --with-osx_cocoa \\r
187         --with-zlib=builtin\r
188 \r
189 2. ```make install```\r
190     Note to speedup the process I recommend you to enable multicore build by adding the -j*cores* flag:\r
191     ```make -j4 install```\r
192 3. ```cd``` into *~/Downloads/wxPython-src-2.9.4.0/wxPython/*\r
193 4. Build wxPython (Note `python` is the python of your virtualenv):\r
194 \r
195         python setup.py build_ext \\r
196         BUILD_GIZMOS=1 \\r
197         BUILD_GLCANVAS=1 \\r
198         BUILD_STC=1 \\r
199         INSTALL_MULTIVERSION=0 \\r
200         UNICODE=1 \\r
201         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \\r
202         WXPORT=osx_cocoa\r
203 \r
204 5. Install wxPython (Note ```python``` is the python of your virtualenv):\r
205 \r
206         python setup.py install \\r
207         --prefix=$HOME/.virtualenvs/Cura \\r
208         BUILD_GIZMOS=1 \\r
209         BUILD_GLCANVAS=1 \\r
210         BUILD_STC=1 \\r
211         INSTALL_MULTIVERSION=0 \\r
212         UNICODE=1 \\r
213         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \\r
214         WXPORT=osx_cocoa\r
215 \r
216 6. Create file *~/.virtualenvs/Cura/bin/pythonw* with the following content:\r
217 \r
218         #!/bin/bash\r
219         ENV=`python -c "import sys; print sys.prefix"`\r
220         PYTHON=`python -c "import sys; print sys.real_prefix"`/bin/python\r
221         export PYTHONHOME=$ENV\r
222         exec $PYTHON "$@"\r
223 \r
224 At this point virtualenv is configured for wxPython development.\r
225 Remember to use `python` for pacakging and `pythonw` to run app for debugging.\r
226 \r
227 \r
228 ##Install Python Packages\r
229 Required python packages are specified in *requirements.txt* and *requirements_darwin.txt*\r
230 If you use virtualenv, installing requirements as easy as ```pip install -r requirements_darwin.txt```\r
231 \r
232 \r
233 ##Package Cura into application\r
234 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
235 ```./package.sh darwin```\r
236 \r
237 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
238 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
239 \r