Download the source package either from the SDCC Subversion repository
or from the snapshot builds http://sdcc.sourceforge.net/snap.php,
it will be named something like sdcc-src-yyyymmdd-rrrr.tar.bz2. SDCC
is distributed with all the project, solution and other files you
need to build it using Visual C++ 2010 (except for ucSim). The solution
name is 'sdcc.sln'. Please note that as it is now, all the executables
are created in a folder called sdcc\bin_vc. Once built
you need to copy the executables from sdcc\bin_vc
to sdcc\bin before running SDCC.
Apart from the SDCC sources you also need to have the BOOST libraries
installed for MSVC. Get it here http://www.boost.org/
In order to build SDCC with MSVC you need win32 executables of bison.exe,
flex.exe, and gawk.exe. One good place to get them is here http://unxutils.sourceforge.net
If UnxUtils didn't work well, msys (http://www.mingw.org/wiki/msys)
or msys2(https://msys2.github.io) can be an alternative.
Download the file UnxUtils.zip. Now you have to install
the utilities and setup MSVC so it can locate the required programs.
Here there are two alternatives (choose one!):
- The easy way:
a) Extract UnxUtils.zip to your C:\ hard disk PRESERVING
the original paths, otherwise bison won't work. (If you are using
WinZip make certain that 'Use folder names' is selected)
b) Add 'C:\user\local\wbin'
to VC++ Directories / Executable Directories.
(As a side effect, you get a bunch of Unix utilities that could be
useful, such as diff and patch.)
- A more compact way:
This one avoids extracting a bunch of files you may not use, but requires
some extra work:
a) Create a directory were to put the tools needed, or use a directory
already present. Say for example 'C:\util'.
b) Extract 'bison.exe', 'bison.hairy', 'bison.simple', 'flex.exe',
and gawk.exe to such directory WITHOUT preserving the original paths.
(If you are using WinZip make certain that 'Use folder names' is not
selected)
c) Rename bison.exe to '_bison.exe'.
d) Create a batch file 'bison.bat' in 'C:\util\'
and add these lines:
set BISON_SIMPLE=C:\util\bison.simple
set BISON_HAIRY=C:\util\bison.hairy
_bison %1 %2 %3 %4 %5 %6 %7 %8 %9
Steps 'c' and 'd' are needed because bison requires by default that
the files 'bison.simple' and 'bison.hairy' reside in some weird Unix
directory, '/usr/local/share/' I think. So it is necessary to tell
bison where those files are located if they are not in such directory.
That is the function of the environment variables BISON_SIMPLE and
BISON_HAIRY.
e) Add 'C:\util' to VC++ Directories / Executable Directories.
Note that you can use any other path instead of 'C:\util',
even the path where the Visual C++ tools are, probably: 'C:\Program
Files\Microsoft Visual Studio\Common\Tools'.
So you don't have to execute step 'e' :)
That is it. Open 'sdcc.sln' in Visual Studio, click 'build all', when
it finishes copy the executables from sdcc\bin_vc
to sdcc\bin, and you can compile using SDCC.