Re: [hatari-devel] From a short trip to Windows land

[ Thread Index | Date Index | More Archives ]

Heh, funny.
I found it easier to setup a cross compiler on Linux and a small, custom build system to compile hatari for Windows. The only thing I miss is capsimage, which I couldn't get to (cross) compile.

On May 15, 2016 1:23 PM, "Thomas Huth" <th.huth@xxxxxx> wrote:

 Hi all,

in case anybody is interested: During the past days, I've done some
experiments with compiling Hatari on Windows, using the Visual Studio
Community compiler. Why, you might ask? Well, mainly because I was
curious, how much effort this would be, and how well our CMake setup
works for non-make based IDEs. I was also a little bit annoyed by the
obstrusive "Visual.Studio" folder in the main directory of the Hatari
sources and I wondered whether this could be done in a smoother way.

So here's a quick "how to compile Hatari with Visual Studio":

- Get Visual Studio (I used the free Community edition)

- Download from
  and extract it somewhere on your HD

- Get the latest Hatari sources from the hg repository, e.g. using

- You need two additional header files for compiling Hatari which are
  unfortunately not part of Visual Studio by default.
  * dirent.h from:
  * unistd.h from:
    (disable the getopt line in there)
  Put the headers somewhere where the compiler can find them, e.g. in
  the same directory where the header files from SDL2 are.

- Get CMake for Windows from and run it. Select the
  sources of Hatari, and a build directory, make sure you've
  selected the right Generator for Visual Studio (e.g. whether you
  want a 64-bit build or 32-bit; I used 64-bit, since this matched the
  version of the SDL2 library that I've downloaded) then hit configure.
  You've then got to manually fill in three variables for locating the
  SDL2 files, one for the SDL2 include directory, one for SDL2main.lib
  and one for SDL2.lib. Hit the "configure" button again, and if
  everything worked fine, click the "generate" button.

- You should have a proper Visual Studio project now that you can use
  to compile Hatari.

The CMake-generated Visual Studio project worked pretty well for me,
even the intermediate steps to compile the CPU emulator files worked
out of the box. So the conversion from autoconf to CMake a couple of
years ago was IMHO really the right choice.
I had to work around some GCC-isms and some minor header file
problems that we had in the recent Hatari sources, but then I was
finally able to compile a Hatari.exe binary and to see the little green
desktop here, too. I've committed my fixes, and mostly thanks to the
external unistd.h and dirent.h files that I've mentioned above, most
stuff from the old Visual.Studio folder was not required anymore today,
so I finally removed that folder from the Hatari repository.

Anyway, that's also already the end of my trip to Windows land (I'm
really not compatible with that OS, it decided to crash two times while
I'm was using it and I had a hard and annoying time to get it running
again). My evaluation period of the Visual Studio Community edition is
also over in a couple of days, and I certainly don't want to register
myself at for being able to use it again ... so I won't
continue to support that VS build in the future anymore. If somebody
feels like compiling Hatari with VS, feel free to have a try, but
otherwise the VS support can IMHO now happily bit-rot in that vs-fix.h
header file that I've introduced instead of that obstrusive
"Visual.Studio" folder in the main directory.


Mail converted by MHonArc 2.6.19+