********* README file for cppsimdata module for Python *********

(for ngspicedata module for Python, follow directions below but change cppsimdata to ngspicedata)

The cppsimdata provides the class CppSimData to load CppSim results into Python.

It was developed by Michael H. Perrott as part of the CppSim package
and is available at www.cppsim.com.

It is distributed under the terms of the MIT license.  Please see the Copying file for details.

It requires use of the shared library cppsimdata_lib.so (or
cppsimdata_lib.dll for Windows) included in this distribution, which
must be compiled using a C compiler.

For Windows, you can run either a 32-bit or 64-bit version of Python.

For Mac, it is assumed that you are running a 64-bit version
of Python.   If you desire to run the 32-bit version of Python
on the Mac, you should follow the compile instructions below
and place the newly created shared library file in the win32
subdirectory.


*** How to compile cppsimdata_lib.c: *****

Windows:
1) First install the Microsoft Visual Studio Express C++ compiler
   (available for free from Microsoft website)
    - Note:  if you want to compile to 64-bit (default for CppSim), then you need to
      configure the Microsoft Visual C compiler for 64-bit compilation as described in
      https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx
      Essentially, you need to go to the Visual Studio installation directory within
      the Visual Studio Command Prompt and then run:   vcvarsall amd64
      Note:  if the above fails, consider installing Windows SDK 7.1 to get access to 64-bit compilation:
      http://stackoverflow.com/questions/1865069/how-to-compile-a-64-bit-application-using-visual-c-2010-express
2) Open the Visual Studio Command Prompt
3) Within the Command Prompt, cd to the directory containing the cppsimdata_lib.c file
4) Within the Command Promp, run the commmand:   
   cl -LD cppsimdata_lib.c -Fecppsimdata_lib.dll
5) Move the resulting cppsimdata_lib.dll into the win32 subdirectory

Mac:
1) Be sure to install the Xcode package along with the command line tools
2) Open a Terminal
3) Within the Terminal, cd to the directory containing the cppsimdata_lib.c file
4) Within the Terminal, run the command:
    for 32-bit Python:
      gcc -shared -m32 -lc -Wl,-install_name,cppsimdata_lib.so -o cppsimdata_lib.so -fPIC cppsimdata_lib.c
    for 64-bit Python (on a 64-bit machine):
      gcc -shared -lc -Wl,-install_name,cppsimdata_lib.so -o cppsimdata_lib.so -fPIC cppsimdata_lib.c

5) Move the resulting cppsimdata_lib.so into the macosx or macosx64 subdirectory as appropriate

Linux:
1) Be sure to have installed the gcc compiler
2) Open a Terminal
3) Within the Terminal, cd to the directory containing the cppsimdata_lib.c file
4) Within the Terminal, run the command:
    gcc -shared -Wl,-soname,cppsimdata_lib -o cppsimdata_lib.so -fPIC cppsimdata_lib.c
5) Move the resulting cppsimdata_lib.so into the glnx86 or glnxa64 subdirectory as appropriate

*** Example of running within Python ***

# First, cd to the path containing this file
# Example:
cd /Users/perrott/CppSim/CppSimShared/Python

# To run python scripts using the CppSimData class from other directories:
import sys
sys.path.append(full_path_to_this_directory)
# example:  sys.path.append('/Users/perrott/CppSim/CppSimShared/Python')

# Now run the test example
%run test_cppsimdata

# Please see test_cppsimdata.py file for further details on using the CppSimData class

