PyCXX README

# PyCXX -- README

## Installation using distutils

### Windows Installation and Demo

1. Fetch http://prdownloads.sourceforge.net/cxx/pycxx-6.1.1.tar.gz
2. Expand the archive into a directory of your choosing C:\ for example. Note: WinZip can expand .tar.gz files.
3. Install the PyCXX files:

   1.     C:> cd \pycxx-6.1.1

   2.     C:\pycxx-6.1.1> python setup.py install

4. Install the PyCXX Demo:

   1.     C:> cd \pycxx-6.1.1\Demo

   2.     C:\pycxx-6.1.1\Demo> python setup.py install

5. Run the demo:

   1.     C:> python

   2.     >>> import CXX.example

   3.     >>> CXX.example.test()

   4.     >>> r = CXX.example.range( 11, 100, 13 )

   5.     >>> for i in r: print i

   6.     ...

### Unix Installation and Demo

Note: distutils is not available for Python 1.5.2

1. Fetch http://prdownloads.sourceforge.net/cxx/pycxx-6.1.1.tar.gz
2. Login as root. root access is typically needed on Unix systems to install the PyCXX files into the Python directories.
3. Expand the archive into a directory of your choosing ~\ for example.
4. Install the PyCXX files:

   1.     # cd ~\pycxx-6.1.1

   2.     # python setup.py install

5. Install the PyCXX Demo for Python2:

   1.     # cd ~\pycxx-6.1.1\Demo\Python2

   2.     # python setup.py install

6. Install the PyCXX Demo for Python3:

   1.     # cd ~\pycxx-6.1.1\Demo\Python3

   2.     # python setup.py install

7. Run the demos:

   1.     $ python

   2.     >>> import CXX.example

   3.     >>> CXX.example.test()

   4.     >>> r = CXX.example.range( 11, 100, 13 )

   5.     >>> for i in r: print i

   6.     ...

## Installation using Project and Makefile

If you cannot or do not wish to use the distutils methods to work with PyCXX a set of Makefiles and Project files are provided.

### Windows Installation and Demo

1. Fetch http://prdownloads.sourceforge.net/cxx/pycxx-6.1.1.tar.gz
2. Expand the archive into a directory of your choosing C:\ for example. WinZip can expand .tar.gz files.
3. Build the example. Using Microsoft Visual C++ 2008 for python version 3.0 or later load the workspace corresponsing to the version of Python you wish the work with.
   - example_py30.sln - Python 3.0 and its maintanence release
4. Run the example. (I'll assume you are testing Python 3.0)
   - cd c:\pycxx-6.1.1\pyds30
   - c:\python30\python -c "import example;example.test()"

### Unix and Mac OS X Installation and Demo

1. Fetch http://prdownloads.sourceforge.net/cxx/pycxx-6.1.1.tar.gz
2. Expand the archive into a directory of your choosing ~/ for example.
3. Select to makefile for your system and python version.
   - example_linux_py30.mak - Linux Python 3.0
   - example_mac_py30.mak - Mac OS X Python 2.5
4. Build the example. Use GNU make
   $ make -f example-makefile example.so
5. Run the examples.
   $ make -f example-makefile test

To create a makefile for another vendors Unix follow these steps:

1. copy one of the example make files above.
2. edit the variables to match your Python installation and C++ compile needs
3. Proceed to build and test as above.

Note: most of the makefile rules to build PyCXX and its example are contained in example_python3_common.mak.

## Revision History

### Version 6.1.1 (26-Sep-2009)

Supports Python 3 starting at Python 3.1 and Python 2

Code clean up to fix compiler warnings reported by gcc 4.2.1 on Mac OS X when building for Python 3.

### Version 6.1.0 (19-Jul-2009)

Support Python 3 and Python 2