Installation Instructions For SACAMOS SW1 (GUI for the CL Tools
---------------------------------------------------------------

This file is part of SACAMOS, cable models for EMI simulations in SPICE.
It was developed by the University of Nottingham and the Netherlands Aerospace
Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.

Copyright (C) 2015-2017 University of Nottingham

SACAMOS is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

SACAMOS is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

A copy of the GNU General Public License version 3 can be found in the
file GNU_GPL_v3 in the root or at <http:www.gnu.org/licenses/>.

The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk

Contents
========
1. Introduction
2. Requirements
3. Installation:
    i)    wxWidgets on Linux
    ii)   wxWidgets on MS Windows
	iii)  wxWidgets on OSX
    iv)   SW1 GUI on Linux/OSX
    v)    SW1 GUI on Windows
    vi)   installation note SW1 for OSX
    
1. Introduction
===============

SW1 is the graphical user interface to the command line tool set for:

    i)    Designing cable models
    ii)   Designing cable bundle models
    iii)  Generate the Spice based models of these bundles for a given cable length
    iv)   Exporting the Spice Library and Symbol files for Ngspice and LTspice
    

2. Requirements
===============
SW1 is reliant on the following:

i.   compilation : wxWidgets library (essential to compile gSpiceUI vSACAMOS)
ii.  compilation of the SACAMOS command line tools that are located within the folder
     [SACAMOS_INSTALLATION_DIRECTROY]/bin

Note: in the following the [SACAMOS_INSTALLATION_DIRECTROY] will be referred to as 
simply [SACAMOS]

Note 1: SACAMOS is reliant upon a specific folder structure the SACAMOS root folder 
should contain a /bin folder for all the executables and also folders for each of 
the 'MOD' library(s) of cable models e.g.:

    ----> SACAMOS |_____> bin
	              |_____> MOD
	              |_____> MOD1
	              |_____> MOD2
	              |_____ ... and so on
				  
Note 2: MOD is the generic term for the libray of cable models, it can be created 
with any user define name.

Within each 'MOD' there is also a specific folder structure that should not be broken:

    ----> MOD |_____> CABLE
	          |_____> BUNDLE
	          |_____> SPICE |_____> SYMBOL
			  

3. Installation
===============
The software can be compiled on Linux, MS Windows and OSX platforms and is dependant upon the 
prior installation of the the wxWidgets library. 


			  
i. Installation of wxWidgets on Linux
-------------------------------------

Download and extract the wxWidgets library from:

    http://www.wxWidgets.org/
    
Version 3.0.2 had been used throughout the development of SACAMOS. For full 
information refer to the installation guide(s) on the website or with the 'docs'
folder of the download. The simplest approach is to enter the root folder of the
extracted download and do:

    mkdir buildgtk
    cd buildgtk
    ../configure --with-gtk
    make
    su <type root password>
    make install
    ldconfig
    [if you get "ldconfig: command not found", try using "/sbin/ldconfig"]
 


ii. Installation of wxWidgets on MS Windows
-------------------------------------------
The following has been tested on MS Windows 7 & 10. The installation of 
wxWidgets on MS Windows make use of MinGW ("Minimalist GNU for Windows") and 
MSYS ("Minimal SYStem") to build native windows applications via a command line 
environment. To install wxWidgets you therefore need to install MinGW/MSYS.

i. Install MinGW and MSYS:
 
Download the installer (mingw-get-setup.exe) from: http://www.mingw.org/. Run 
the installer and select as a minimum the components C & C++ and MSYS. Install 
these components by selecting 'Apply Changes' from the Installation menu.
 
Note: Installation in the root of your hard drive is recommended.
 
Once installed Ensure that the file C:\MinGW\msys\1.0\etc\fstab and contains at 
least the following line itself followed by an empty line (this is generally 
already the case):
    
    C:\MinGW   /mingw
 
Navigate to C:\mingw\msys\1.0 and run msys.bat. to create your 'home' directory 
at C:\mingw\msys\1.0\home\[your user name] Once run create a shortcut to 
msys.bat and copy it to your desktop. Double clicking this will now open a 
terminal/shell and out you within your home directory.

ii. Install wxWidgets

Download and extract the wxWidgets library from:

    http://www.wxWidgets.org/
    
For example download 'xWidgets-3.0.2.zip' and extract this to a folder in the 
root of your hard drive e.g.

C:\wxWidgets-3.0.2

Open a MSYS shell and navigate to the wxWidgets folder, e.g:

    cd c:\wxWidgets\wxWidgets-3.0.2
    
Create a build folder and change directory into it, e.g.
    mkdir build-msw
    cd build-msw

Run the wxWidgets configure script (for full options refer to the installation 
instructions bu the following is known to work):

    ../configure --build=x86-winnt-mingw32 --disable-shared --disable-threads

Build wxWidgets:

    make MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release DEBUG_FLAG=0

Install wxWidgets:

    make install
	

iii. Installation of wxWidgets on OSX
-----------------------------------
At the time of writing the easiest route is to install wxWidgets through MacPorts.
Follow the instrictions here to install MacPorts:

	https://www.macports.org/install.php
	
then from a 'terminal' issue the commands:

    sudo port install wxWidgets-3.0 +universal
    sudo port select --set wxWidgets wxWidgets-3.0
	
and that should be it.

    
iv. Installation of SW1 on Linux / OSX
--------------------------------------
Download the SACAMOS source code from the Git repository via:
    
    http://www.sacamos.org/downloads.html
    
Extract the archive into a folder within your home directory e.g.

    /home/[your user name]/SACAMOS.git
    
Open a terminal and navigate to the SACAMOS.git folder, e.g:

    cd SACAMOS.git
	
and then navigate to the SW1 source directory:

    cd GUI/SW1/SRC
    
Build SW1

    make -f makefile.quick
	
Copy the resulting SW1_GUI binary executable to the folder [SACAMOS]/bin e.g.:

    cp SW1_GUI [SACAMOS]/bin
	
this will copy the SW1 executable to the SACAMOS/bin folder (the location of the 
of the command line tools).

Finally copy the 'resources' folder and its contents in the SRC directory, to 
the folder [SACAMOS]/bin e.g:

    cp -R resources [SACAMOS]/bin	    

    
v. Installation of SW1 on MS Windows
------------------------------------
Download the SW1 source (for Windows) from:
    
    http://www.sacamos.org/downloads
    
The following assumes that the command line tools have previously been built using MinGW. 
Extract the archive into a folder within your MSYS home directory e.g.

    C:\MinGW\msys\1.0\home\user\SACAMOS_SRC
    
Open a MSYS shell and navigate to the SACAMOS_SRC folder, e.g:

    cd SACAMOS_SRC
    
Build SW1

    make -f makefile.simple 
    
Copy the SW1 binary executable to the folder [SACAMOS]/BIN e.g.:

    cp SW1 [SACAMOS]/bin
	
The SW1 GUI can then be run directly from the folder or a shortcut to it.
	

vi. Installation note for SACAMOS GUI SW1 on OSX
-----------------------------------------------

Compilation under OSX relies upon having a suitable gcc compiler installed. This may be 
accomplished by installing Xcode. See the following link for details:

https://itunes.apple.com/us/app/xcode/id497799835?mt=12
---------------------------------------------
