Changes between Version 12 and Version 13 of DevEnvironment


Ignore:
Timestamp:
01/27/12 01:52:41 (2 years ago)
Author:
matija
Comment:

Migration to Mercurial.

Legend:

Unmodified
Added
Removed
Modified
  • DevEnvironment

    v12 v13  
    77== Ubuntu & Eclipse == 
    88 
    9 This procedure has been written for and tested on Ubuntu 11.04, but should also work for newer and older (down to 10.04) releases. 
     9This procedure has been written for and tested on Ubuntu 11.10, but should also work for newer and older (down to 10.04) releases. 
    1010 
    1111=== Package Installation === 
    1212 
    1313You need to install the following packages: 
    14 * `eclipse` will be your IDE, and one of its plugins we will install needs `libsvn-java` to work, 
     14* `eclipse` will be your IDE (Integrated Development Environment), 
     15* `mercurial` will be your VCS (Version Control System), 
    1516* `make`, `g++`, `python-dev`, `python-numpy`, `python-matplotlib`, `python-imaging` and `python-rpy2` are needed to build and use the Orange scripting environment, and 
    1617* `python-qwt5-qt4` is needed in order for the Orange Canvas (GUI) to work, 
    1718* `cmake`, `python-qt4-dev` and `python-qt4-gl` are needed in order to build and use the new Qt and 3D visualization widgets, 
    1819* `python-sphinx`, `texlive-latex-base`, `texlive-latex-recommended`, `texlive-latex-extra` and `dvipng` are needed to build the HTML documentation, 
    19 * `python-setuptools` provides `easy_install`, which we need for `numpydoc`. 
     20* `python-pip` provides `pip`, which we need for `numpydoc`. 
    2021 
    2122Beware that Sphinx has to be at least of version 1.0; Ubuntu 10.10 and older contain older versions of Sphinx, so you should '''not''' install the `python-sphinx` from apt repository, but find another way, such as `easy_install sphinx`. 
     
    2324This is the command to install all those packages in one shot: 
    2425{{{ 
    25 sudo apt-get install eclipse libsvn-java make g++ python-dev python-numpy python-matplotlib python-imaging python-rpy2 python-qwt5-qt4 cmake python-qt4-dev python-qt4-gl python-sphinx texlive-latex-base texlive-latex-recommended texlive-latex-extra dvipng python-setuptools 
     26sudo apt-get install eclipse mercurial make g++ python-dev python-numpy python-matplotlib python-imaging python-rpy2 python-qwt5-qt4 cmake python-qt4-dev python-qt4-gl python-sphinx texlive-latex-base texlive-latex-recommended texlive-latex-extra dvipng python-pip 
    2627}}} 
    2728 
    2829To build the documentation, `numpydoc` is also needed: 
    2930{{{ 
    30 sudo easy_install numpydoc 
     31sudo pip install numpydoc 
    3132}}} 
    3233 
    3334If you wish to use Orange for network analysis, you also need a recent version of networkx; you can install it with: 
    3435{{{ 
    35 sudo easy_install networkx 
     36sudo pip install networkx 
    3637}}} 
    37  
    38 Next, you need to run Eclipse and install the needed plugins: CDT (C/C++ Development Tooling), PyDev (Python IDE for Eclipse) and Subclipse (for Subversion repository support). Choose Help->Install New Software... and add the following Update Sites: 
    39  * CDT Site: http://download.eclipse.org/tools/cdt/releases/galileo 
    40  * PyDev Site: http://pydev.org/updates/ 
    41  * Subclipse Site: http://subclipse.tigris.org/update_1.6.x 
    42  
    43 Choose --All Available Sites-- for the "Work with" option and install the following choices: Subclipse, PyDev and CDT Main Features. 
    4438 
    4539=== Obtaining the Code === 
    4640 
    47 Switch to the SVN Repository Exploring perspective and add the following repository location: http://orange.biolab.si/svn/orange. Then browse into the `trunk` directory (or elsewhere, if you know what you're doing) and checkout `source`, `orange` and, optionally, `testing` (in this order). Use the "Check out as a project configured using the New Project Wizard" option for all projects and configure projects as follows. 
     41Open a terminal, get to the directory where you want the code to reside and clone our repository: 
     42{{{ 
     43hg clone https://bitbucket.org/biolab/orange . 
     44}}} 
    4845 
    49 For `source`, select C/C++->C++ Project. Select Makefile project->Empty Project->Linux GCC for Project type and Toolchain. Later in this guide it will be assumed you used the directory name (ie. `source`) for project name. 
     46After a little while you'll notice you now have subdirectory `orange` containing, among other things, the following directories: 
     47 * `orange` with Orange's Python source code, 
     48 * `source` with Orange's C++ source code, 
     49 * `docs` with Orange documentation. 
    5050 
    51 Under project properties, C/C++ Build->Environment, add the following environmental variables: 
    52  * `ORANGE_LIBDIR=${ProjDirPath}` 
    53  * `CXXFLAGS=-ggdb` 
    54  * `LDFLAGS=-ggdb` 
    55  
    56 (If you intend to invoke `make` on the commandline, you can add those properties into the `Makefile` and `makefile.defs`.) 
    57  
    58 To accelerate the compilation process on a multi-processor or multi-core machine, you may instruct Eclipse to use parallel build (`-j` switch to the `make`): go to project properties for `source` project and under C/C++ Build->Behaviour check "Use parallel build". Manually enter a desired parallel jobs count; do NOT use "optimal jobs number": Eclipse likes to run all possible compilations at once and you'll probably run out of RAM. 
    59  
    60 For both `orange` and `testing`, select Pydev->Pydev Project. Later in this guide it will be assumed you used the directory name for project name (ie. `orange` and `testing`). Uncheck the "Create default 'src' folder" checkbox. Configure the interpreter if Eclipse requests so; you may use the Auto Config button with default settings. Select `source` as a referenced project of `orange`, and `orange` of `testing`. 
     51There's also a `setup.py` file you can use to build and install Orange, although for development purposes we suggest you use `make` (within the `source` directory). We'll get to that later. 
    6152 
    6253=== Path Settings === 
     
    6455To be able to run Orange, you need to add some directories to the `PYTHONPATH`. Here, we will assume you only have one version of Orange on your system and you want to use it from within Eclipse and also outside it. If you have more than one version of Orange, we'll assume you also know the best way to deal with your paths. 
    6556 
    66 Open a terminal and go to your workspace directory (which contains at least `orange` and `source` directories). Now invoke the following: 
     57Open a terminal and go to the directory where your clone of Orange repository resides (i.e. the directory that contains the `orange` and `source` subdirectories). Now invoke the following: 
    6758{{{ 
    68 ( echo -e "$PWD/source\n$PWD/orange\n$PWD/orange/OrangeCanvas\n$PWD/orange/OrangeWidgets" && find $PWD/orange/OrangeWidgets -maxdepth 1 -type d -regex '[^\.].*' ) | sudo tee `python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`/orange.pth 
     59( echo -e "$PWD/orange\n$PWD/orange/OrangeCanvas\n$PWD/orange/OrangeWidgets" && find $PWD/orange/OrangeWidgets -maxdepth 1 -type d -regex '[^\.].*' ) | sudo tee `python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`/orange.pth 
    6960}}} 
    7061 
    71 You will need to provide your password, because sudo is used to write to a system directory. You may dissect the command to figure out what it does; it basically puts some paths in your workspace to a file `orange.pth` in python's `dist-packages` directory. 
     62You will need to provide your password, because `sudo` is used to write to a system directory. You may dissect the command to figure out what it does; it basically puts some paths in your repository clone to a file `orange.pth` in python's `dist-packages` directory. 
     63 
     64=== Setting Up The Eclipse IDE === 
     65 
     66Next, you need to run Eclipse. As the workspace, choose the directory you used to clone our repository. (There are other possibilities; do it your own way if you know your way around.) Within Eclipse, install the needed plugins: CDT (C/C++ Development Tooling), PyDev (Python IDE for Eclipse) and MercurialEclipse (for Mercurial repository support). That is, choose Help->Install New Software... and add the following Update Sites: 
     67 * CDT Site: http://download.eclipse.org/tools/cdt/releases/helios 
     68 * PyDev Site: http://pydev.org/updates/ 
     69 * MercurialEclipse Site: http://cbes.javaforge.com/update 
     70 
     71Choose --All Available Sites-- for the "Work with" option and install the following choices: MercurialEclipse->MercurialEclipse, PyDev and CDT Main Features. 
     72 
     73Now let's set up the projects in Eclipse. We'll set up two projects: `orange` for Python code and `source` for C++ code. 
     74 
     75Open the New Project dialog, select C/C++->C++ Project. Select Makefile project->Empty Project->Linux GCC for Project type and Toolchain. Use `source` as project name, disregarding the warning about project already existing. 
     76 
     77Under project properties ("Advanced settings..." button), C/C++ Build->Environment, add the following environmental variables: 
     78 * `CXXFLAGS=-ggdb` 
     79 * `LDFLAGS=-ggdb` 
     80 
     81(If you intend to invoke `make` on the commandline, you can add those properties into your `~/.pam_environment` file or elsewhere you see fit.) 
     82 
     83To accelerate the compilation process on a multi-processor or multi-core machine, you may instruct Eclipse to use parallel build (`-j` switch to the `make`): go to project properties for `source` project and under C/C++ Build->Behaviour check "Use parallel build". Manually enter a desired parallel jobs count, for example the number of processor cores in your computer; do NOT use "optimal jobs number": Eclipse likes to run all possible compilations at once and you'll probably run out of RAM. 
     84 
     85Fire up the New Project dialog once more, select Pydev->Pydev Project and name the project `orange`. Use the "Add project directory to PYTHONPATH" option, and in no case the "Create 'src' folder and add it to PYTHONPATH". Configure the interpreter if Eclipse requests so; you may use the Auto Config button with default settings. Select `source` as a referenced project. 
    7286 
    7387=== Enabling Running and Debugging === 
     
    7589For debugging, it's best to set up three debug configurations: one for Python code, one for C++ code with Orange Canvas being invoked and one without Canvas to debug in python scripting environment. Choose Run->Debug Configurations and set up the following configurations. 
    7690 
    77 Add a new "Python Run" configuration, name it `orange-canvas-python`, select `orange` as the project and `OrangeCanvas/orngCanvas.pyw` as the main module. Click apply. 
     91Add a new "Python Run" configuration, name it `orange-canvas-python` (or otherwise, if you will), select `orange` as the project and select `OrangeCanvas/orngCanvas.pyw` as the main module. Click apply. 
    7892 
    79 Now add a new "C/C++ Application" configuration, name it `orange-Cpp`, select `source` as the project and `/usr/bin/python` as the C/C++ Application. Debugger (in the Debugger tab) should be set to "gdb Debugger" and "Stop on startup" '''not''' checked. You may now apply the configuration. 
     93Now add a new "C/C++ Application" configuration, name it `orange-cpp`, select `source` as the project and `/usr/bin/python` as the C/C++ Application. In the Debugger tab, uncheck the "Stop on startup at `main`". You may now apply the configuration. 
    8094 
    81 Now clone the last configuration, name it `orange-canvas-Cpp` and add, in the Arguments tab, type `${workspace_loc}/orange/OrangeCanvas/orngCanvas.pyw` as program arguments. 
     95Now clone the last configuration, name it `orange-canvas-cpp` and add, in the Arguments tab, enter `${workspace_loc}/orange/OrangeCanvas/orngCanvas.pyw` as program arguments. 
     96 
     97You can now test those three configurations. Beware that without setting `-ggdb` flags (as described higher up in this document) you will not be able to debug C++ code. Note also that on the first run (and after heavy modifications of C++ code) it will take some time for your computer to build the C++ code of Orange. 
    8298 
    8399=== Building the Documentation === 
    84100 
    85 To build the documentation, open a terminal and go to `orange/doc/Orange` directory. Invoke `make html` (preceded by `make clean` if you want to force a rebuild of all documentation). You should now have a `html/index.html` file with documentation index. 
     101To build the documentation, open a terminal and go to `docs/reference` directory under your workspace. Invoke `make html` (preceded by `make clean` if you want to force a rebuild of all documentation). You should now have a `html/index.html` file with documentation index.