Difference between revisions of "WxHaskell/Windows"

From HaskellWiki
Jump to: navigation, search
(get rid of crufty old information)
Line 1: Line 1:
=== Building wxWidgets and wxc with Microsoft Visual C++ ===
To be fleshed out (now that wxHaskell 0.12 is out, the build instructions have changed). See [[../]]
The advantage of using Visual C++ is that the resulting libraries are smaller and faster than the gnu compiled ones. Furthermore, the debug version provides for automatic detection of memory leaks in the wxWidgets libraries and you get a warning when forgetting to deallocate wxWidgets objects. The drawback is that the configure scripts are not used and you will need to set some options manually.
If you want to use [http://www.microsoft.com/express/download/ Visual C++ Express Edition], you must use Visual C++ 2008 Express Editions or higher. Because previous version requires [http://msdn2.microsoft.com/express/aa700755.aspx installing Microsoft Platform SDK] before building wxWidgets or wxHaskell.
We use the wxWidgets provided workspace directly:
* '''wxWidgets 2.8''': Open the <tt>$wxwin/build/msw/wx.dsw</tt> workspace. Select menu &quot;<tt>Build/Batch build</tt>&quot; and select all configurations by using the mouse and the <tt>shift</tt> key, when you click a marker, all configurations are deselected. Next you manually select the &quot;Unicode Release&quot; and &quot;Unicode Debug&quot; versions of all projects and press &quot;Build&quot;. Afterwards, press &quot;Save All&quot; to save all your mouse clicking work :-)
If you want to use [http://wxhaskell.sourceforge.net/doc/Graphics-UI-WXCore-Db.html database access], [http://wxhaskell.sourceforge.net/doc/Graphics-UI-WXCore-OpenGL.html openGL canvas] and Graphics Context, you must edit <tt>$wxwin/include/msw/setup.h</tt>'s <tt>#define wxUSE_*</tt>(* is target feature name) from 0 to 1.
After building wxWidgets, you need to run <tt>configure</tt> for the wxHaskell library.
<pre>&gt; cd $wxhaskell
&gt; ./configure --with-msc</pre>
If you want to use the debug version of the library, use the <tt>--wxc-libname</tt> option too.
<pre>&gt; ./configure --with-msc --wxc-libname=wxcd</pre>
After configuration, first run <tt>make</tt> command to generate stc_gen.* files.
<pre>&gt; make</pre>
Make will stop by following error.
<pre>&gt; make: *** No rule to make target `out/wxc/wxc-msw2.8.9-0.11.0.dll', needed by `wxc'.  Stop.</pre>
Then go <tt>$wxhaskell/wxc</tt> directory. Here, you need to adapt the <tt>wxc-&lt;em&gt;version&lt;/em&gt;.dsp</tt> project to reference the correct wxWidgets directory. Open the <tt>.dsp</tt> file in an editor and replace all occurrences of &quot;<tt>..\..\wxWindows-2.8.9</tt>&quot; or by the installed wxWidgets directory, i.e. <tt>$wxwin</tt>.
After adapting the project file, you can open the workspace <tt>wxc/wxc-&lt;em&gt;version&lt;/em&gt;.dsw</tt> and build the &quot;Unicode Release&quot; and &quot;Unicode Debug&quot; versions of the C wrapper library.
And finally! – you can run <tt>make</tt> in the <tt>$wxhaskell</tt> directory to build the Haskell libraries.
<pre>&gt; cd $wxhaskell
&gt; make
&gt; make install
&gt; make wx
&gt; make wx-install</pre>
== User experiences ==
==== GHC 6.10.1, wxWidgets 2.8.9, wxHaskell 0.11.0 (binary) ====
# Download the wxhaskell binary from [http://sourceforge.net/project/showfiles.php?group_id=73133&package_id=73173&release_id=649115 sourceforge]
# Unpack wxhaskell-*.zip. And double-click wxhaskell-*\bin\wxhaskell-register.bat.
# wxhaskell-register.bat install wxHaskell to your system.
==== Assumptions (a.k.a. what I have tested) ====
* GHC 6.4.2 (Jason Dagit reports success with GHC 6.5 as well).
* Cygwin installation. See [[WxHaskell/Cygwin]] for detail, but broadly, you need Cygwin bash and install binaries.
* wxWidgets built/installed in a path with no spaces in it. Actually you can use a path with spaces but there are a few rules. For example, I had ghc installed to this location:<br/><tt>C:\Program Files\Visual Haskell</tt><br/>So this required me to use the following configure command:<br/><tt>./configure --libdir=C:/Progra~1/Visual~1</tt><br/>
The two important things here are: 1) You must use the forward slash
and 2) you cannot use spaces.
Next I found that I needed to add <tt>C:\Program Files\Visual Haskell</tt> to
my path so that the wxHaskell dlls could be located by windows.
* Environment variables:
** PATH should include MinGW and Cygwin binary directories. MinGW must come before Cygwin in PATH.
** WXHASKELL environment var points to wxHaskell install directory.
** WXWIN environment directory points to wxWidgets install directory.
For more detailed information, see [http://biolpc22.york.ac.uk/pub/2.8.9/install-msw-2.8.9.txt Installing wxWidgets 2.8.9 on Microsoft Windows 9x/ME, Windows NT, Windows 2000, Windows XP, and Windows CE].
== See also ==
== See also ==

Revision as of 12:33, 24 November 2009

To be fleshed out (now that wxHaskell 0.12 is out, the build instructions have changed). See WxHaskell

See also