chiark / gitweb /
Merge pull request #681 from hg42/faster-virtualprinter
[cura.git] / README.md
1 Cura
2 ====
3
4 Read this, it's important!
5 ===========================
6
7 If you are reading this, then you are looking at the *development* version of Cura. If you just want to use Cura, take a look at the following location: https://daid.github.com/Cura
8
9 Development
10 ===========
11
12 Cura is developed in Python with a C++ engine. The part you are looking at right now is the Python GUI.
13 The C++ engine is responsible for generating the actual toolpath. For development of the engine check out https://github.com/Ultimaker/CuraEngine
14
15 Packaging
16 ---------
17
18 Cura development comes with a script "package.sh", this script has been designed to run under *nix OSes (Linux, MacOS). For Windows the package.sh script can be run from bash using git.
19 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.
20
21 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.
22
23 Debian and Ubuntu Linux
24 --------
25
26 To build and install Cura, run the following commands:
27
28 ```bash
29 git clone https://github.com/daid/Cura.git
30
31 sudo apt-get install python-opengl
32 sudo apt-get install python-numpy
33 sudo apt-get install python-serial
34 sudo apt-get install python-setuptools
35
36 cd Cura
37
38 sudo ./package.sh debian
39
40 sudo dpkg -i ./scripts/linux/Cura*.deb
41 ```
42
43 Mac OS X
44 --------
45 The following section describes how to prepare working environment for developing and packaing for Mac OS X.
46 The working environment consist of build of Python, build of wxPython and all required Python packages.
47
48 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.
49
50
51 ###Install Python
52 You'll need **non-system**, **framework-based**, **universal** with **deployment target set to 10.6** build of Python 2.7
53
54 **non-system**: Output of  
55 `python -c "import sys; print sys.prefix"`  
56 should *not* start with *"/System/Library/Frameworks/Python.framework/"*.
57
58 **framework-based**: Output of  
59 `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`  
60 should be non-empty string. E.g. *Python*.
61
62 **universal**: Output of  
63 ``lipo -info `which python` ``  
64 should include both i386 and x86_64. E.g *"Architectures in the fat file: /usr/local/bin/python are: i386 x86_64"*.
65
66 **deployment target set to 10.6**: Output of  
67 ``otool -l `which python` ``  
68 should contain *"cmd LC_VERSION_MIN_MACOSX ... version 10.6"*.
69
70 The easiest way to install it is via [Homebrew](http://mxcl.github.com/homebrew/) using the formula from Cura's repo:  
71 `brew install --build-bottle --fresh Cura/scripts/darwin/python.rb --universal`  
72 Note if you already have Python installed via Homebrew, you have to uninstall it first.
73
74 You can also install [official build](http://www.python.org/ftp/python/2.7.3/python-2.7.3-macosx10.6.dmg).
75
76
77 ###Configure Virtualenv
78 Create new virtualenv. If you have [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) installed:  
79 `mkvirtualenv Cura`
80
81 wxPython cannot be installed via pip, we have to build it from source by specifing prefix to our virtualenv.
82
83 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/*:
84
85 1. `cd` into *~/Downloads/wxPython-src-2.9.4.0/* and configure the sources:
86
87         ./configure \
88         CFLAGS='-msse2 -mno-sse3 -mno-sse4' \
89         CXXFLAGS='-msse2 -mno-sse3 -mno-sse4' \
90         --disable-debug \
91         --enable-clipboard \
92         --enable-display \
93         --enable-dnd \
94         --enable-monolithic \
95         --enable-optimise \
96         --enable-std_string \
97         --enable-svg \
98         --enable-unicode \
99         --enable-universal_binary=i386,x86_64 \
100         --enable-webkit \
101         --prefix=$HOME/.virtualenvs/Cura/ \
102         --with-expat \
103         --with-libjpeg=builtin \
104         --with-libpng=builtin \
105         --with-libtiff=builtin \
106         --with-macosx-version-min=10.6 \
107         --with-opengl \
108         --with-osx_cocoa \
109         --with-zlib=builtin
110
111 2. `make install`  
112     Note to speedup the process I recommend you to enable multicore build by adding the -j*cores* flag:  
113     `make -j4 install`
114 3. `cd` into *~/Downloads/wxPython-src-2.9.4.0/wxPython/*
115 4. Build wxPython (Note `python` is the python of your virtualenv):
116
117         python setup.py build_ext \
118         BUILD_GIZMOS=1 \
119         BUILD_GLCANVAS=1 \
120         BUILD_STC=1 \
121         INSTALL_MULTIVERSION=0 \
122         UNICODE=1 \
123         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \
124         WXPORT=osx_cocoa
125
126 5. Install wxPython (Note `python` is the python of your virtualenv):
127
128         python setup.py install \
129         --prefix=$HOME/.virtualenvs/Cura \
130         BUILD_GIZMOS=1 \
131         BUILD_GLCANVAS=1 \
132         BUILD_STC=1 \
133         INSTALL_MULTIVERSION=0 \
134         UNICODE=1 \
135         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \
136         WXPORT=osx_cocoa
137
138 6. Create file *~/.virtualenvs/Cura/bin/pythonw* with the following content:
139
140         #!/bin/bash
141         ENV=`python -c "import sys; print sys.prefix"`
142         PYTHON=`python -c "import sys; print sys.real_prefix"`/bin/python
143         export PYTHONHOME=$ENV
144         exec $PYTHON "$@"
145
146 At this point virtualenv is configured for wxPython development.  
147 Remember to use `python` for pacakging and `pythonw` to run app for debugging.
148
149
150 ###Install Python Packages
151 Required python packages are specified in *requirements.txt* and *requirements_darwin.txt*  
152 If you use virtualenv, installing requirements as easy as `pip install -r requirements_darwin.txt`
153
154
155 ###Package Cura into application
156 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:  
157 `./package.sh darwin`
158
159 Note that application is only guaranteed to work on Mac OS X version used to build and higher, but may not support lower versions.
160 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.
161