Sunday, June 3, 2012

Athens and Native Boost at work

Igor Stasenko recorded an introduction to Athens: a vector-based graphics framework for Pharo. Athens uses Native Boost which enables running machine code, generated dynamically by language side.

See instructions below to install and configure Pharo for Athens.


 In order to reproduce the demo, you must:
  • use the Pharo 1.4 image 
  • run it with a NativeBoost enabled VM - get it for GNU/Linux, MacOSX or MS-Windows.
  • have cairo library installed
    • GNU/Linux: should be already present in your distribution or use your package manager (Debian: apt-get install libcairo2). If you use a 64bit system, also install package ia32-libs. In this case cairo library is located in /usr/lib32/, so update TCairoLibrary class>>#nbLibraryNameOrHandle
    • MacOSX: install it using MacPorts - port install cairo +universal (don't forget +universal!) -  be sure to have only one version installed (you can check with port list cairo )
    • MS-Windows: get the GTK all-in-one bundle from the Windows32 GTK download page. Extract the archive (for example in C:\) and add the gtk+-bundle_2.24.10-20120208_win32\bin\ directory to your PATH environment variable. Then update TCairoLibrary class>>#nbLibraryNameOrHandle to declare libcairo-2.dll path:
        (NativeBoost platformId = NativeBoostConstants win32PlatformId)
        ifTrue: [
          ^ 'C:\gtk+-bundle_2.24.10-20120208_win32\bin\libcairo-2.dll'
        self error: 'define your own path'

Load Athens (note: use version 1.1 and not 1.0 as shown on video)
Gofer new
    squeaksource: 'Athens';
    package: 'ConfigurationOfAthens';
((Smalltalk at:#ConfigurationOfAthens) project version: '1.1') load.
Open the demo
m := AthensDemoMorph new openInWorld.
Navigate through figures
m nextFigure.
m prevFigure
Close the demo
m delete.