ngspice/visualc/how-to-ngspice-vstudio.txt

78 lines
2.6 KiB
Plaintext

ngspice may be compiled by MS Visual Studio Community 2019.
For compilation you need the GNU bison parser generator.
A ready for windows compiled variant can be downloaded as
win_flex_bison-latest.zip
from
http://sourceforge.net/projects/winflexbison/files/
Create the directory
..\..\flex-bison
relative to the current directory ngspice/visualc, and
unzip win_flex_bison-latest.zip there. So for example
if you have D:\myspice\ngspice, you will then have
directory D:\myspice\flex-bison which contains
win_bison.exe and others.
We will invoke the win_bison.exe file
in this directory during the visual studio compilation.
Visual Studio is started by double click on vngspice.sln.
Select 'Build' 'Configuration Manager' and then choose one
of the build options, e.g. 'Active solution configuration'
with its Debug, Release or ReleaseOMP GUI versions or the
equivalent console version (no GUI, no graphical interface),
and 'Active solution platform', generating either 32 bit code
by choosing 'x86', or 64 bit code by 'x64'.
Selection of 'Build' and then 'Rebuild solution' will build
complete ngspice, starting with XSPICE, where cmpp.exe is made
first, then all code models are compiled as dlls named *.cm,
and and afterwards ngspice.exe is generated. Finally
make-install-vngspice.bat is called to copy ngspice.exe, code
models and spinit into a directory tree, that resembles the one
generated by mingw 'make install'. An example tree for
ReleaseOMP 32 bit is given below.
C:\Spice\
bin\
ngspice.exe
vcomp140.dll
lib\
spice\
analog.cm
digital.cm
spice2poly.cm
extradev.cm
extravt.cm
table.cm
share\
ngspice
scripts\
spinit
If spinit is not found in the directory cited above,
ngspice.exe also searches for spinit in its own directory. If you
give a relative path for the codemodel directories in spinit, you
may define your own directory tree.
The dll version of ngspice, ngspice.dll, is made as a standalone
dll (no codemodels, no installation) by double click on
sharedspice.sln. However ngspice.dll may use the directory
tree and code models as created above.
If you want to add fftw support for the fft commands, download
the Windows variant of fftw from
http://www.fftw.org/install/windows.html.
Create the directories
../../fftw-3.3.4-dll32
../../fftw-3.3.4-dll64
relative from this directory right here, and unzip there the
32 bit and 64 bit downloads.
Visual Studio is stated by double click on vngspice-fftw.sln.
The following procedure is the same as cited above.