1------------------------------------------------------------------------ 2 How to build the sources from CVS 3------------------------------------------------------------------------ 4 5Please use the install.txt files in docs/gtk, docs/msw, docs/motif, docs/mac 6etc. alongside these instructions. 7 8I) Windows using plain makefiles 9---------------------------------------- 10 11a) If using Microsoft Visual C++ 5.0 or 6.0 12 13Ensure that the command-line compiler and tools (including 14nmake) are installed and ready to run. Depending on your 15installation there may be a batch file (commonly named VCVARS32.BAT) 16that needs to be run to set correct environment variables and PATH entries. 17 18Continue with item c) below. 19 20 21b) If using the MinGW or Cygwin compilers 22 23You can get MinGW from http://www.mingw.org/ 24 25Cygwin is available at http://www.cygwin.com/ 26 27If you are using Cygwin or MinGW together with the MSYS environment, you 28can build the library using configure (see "Unix ports" and 29"Windows using configure" below). You can also 30build wxWidgets without configure using native makefile, but only with 31MinGW. Using Cygwin together with Windows makefile is no longer supported. 32 33If building with MinGW without configure: 34 35-> Set your path so that it includes the directory 36 where your compiler and tools reside 37 38-> Make sure you have GNU Make installed. It must be Windows native version. 39 Download it from http://www.mingw.org, the executable will be called 40 mingw32-make.exe. 41 42-> Modern version of MinGW is required; preferably MinGW 2.0 (with gcc3), 43 but MinGW with gcc-2.95.3 will suffice. If you are using 2.95, you will 44 have to change variable GCC_VERSION in config.gcc (see msw/install.txt 45 for details). 46 47If using configure, Unix instructions apply. 48 49 50c) Build instructions 51 52Assumming that you installed the wxWidgets sources 53into c:\wxWidgets: 54 55-> Copy c:\wxWidgets\include\wx\msw\setup0.h 56 to c:\wxWidgets\include\wx\msw\setup.h 57-> Edit c:\wxWidgets\include\wx\msw\setup.h to choose 58 the features you would like to compile wxWidgets with[out]. 59 60 and std iostreams are disabled with 61 #define wxUSE_STD_IOSTREAM 0 62 63-> type: cd c:\wxWidgets\build\msw 64-> type: make -f makefile.gcc (if using GNU tools) 65or type: nmake -f makefile.vc (if using MS VC++) 66etc. 67 68 See also docs/msw/install.txt for additional compilation options. 69 70d) Borland (including free command line tools) 71 Download tools from http://www.borland.com/downloads/ 72 73 See docs/msw/install.txt for details; in brief: 74 75-> type cd c:\wxWidgets\build\msw 76-> type make -f makefile.bcc 77 78You can customize many things in the build process, detailed description is 79in docs/msw/install.txt. 80 81 82II) Unix ports 83-------------- 84 85Building wxGTK or wxMotif completely without configure 86won't ever work, but there is now a new makefile system 87that works without libtool and automake, using only 88configure to create what is needed. 89 90In order to create configure, you need to have the 91GNU autoconf package (version > 2.54) installed 92on your system and type run "autoconf" in the base 93directory (or run the autogen.sh script in the same 94directory, which just calls autoconf). Note that you usually don't 95need to do this because configure is included in CVS. 96 97Set WXWIN environment variable to the base directory such 98as ~/wxWidgets (this is actually not really needed). 99 100-> type: export WXWIN=~/wxWidgets 101-> type: md mybuild 102-> type: cd mybuild 103-> type: ../configure --with-motif 104or type: ../configure --with-gtk 105-> type: make 106-> type: su <type root password> 107-> type: make install 108-> type: ldconfig 109-> type: exit 110 111Call configure with --disable-shared to create a static 112library. Calling "make uninstall" will remove the installed 113library and "make dist" will create a distribution (not 114yet complete). 115 116III) Windows using configure 117---------------------------------------- 118 119wxWidgets can be built on Windows using MSYS (see 120http://www.mingw.org/), which is a POSIX build environment 121for Windows. With MSYS you can just ./configure && make (see also VII, 122Unix->Windows cross-compiling using configure). 123 124Of course, you can also build the library using plain makefiles (see 125section I). 126 127IV) Classic MacOS using CodeWarrior (eg MacOS 8.x/9.x) 128---------------------------------------- 129 130Refer to the readme.txt and install.txt files in docs/mac to build 131wxWidgets under Classic Mac OS using CodeWarrior. 132 133If you are checking out the CVS sources using cvs under Mac OS X and 134compiling under Classic Mac OS: 135 136- make sure that all text files have a Mac OS type of 'TEXT' otherwise 137 CodeWarrior may ignore them. Checking out the CVS sources using cvs 138 under Mac OS X creates untyped files which can lead to compilation 139 errors under CodeWarrior which are hard to track down. 140 141- convert the xml files to CodeWarrior binary projects using the supplied 142 AppleScript in docs/mac (M5xml2mcp.applescript for CodeWarrior 5.3) 143 144V) MacOS X using configure and the Developer Tools 145---------------------------------------- 146 147You need to have the Developer Tools installed. If this is not the case, 148you will need to register at the Apple Developer web site (this is a free 149registration) in order to download the Developer Tools installer. 150 151In order to create configure, you need to have the 152GNU autoconf package (version >= 2.54) installed 153on your system and type run "autoconf" in the base 154directory (or run the autogen.sh script in the same 155directory, which just calls autoconf). 156 157-> type: mkdir macbuild 158-> type: cd macbuild 159-> type: ../configure --with-mac 160or type: ../configure 161-> type: make 162 163VI) OS/2 164---------------------------------------- 165No notes. 166 167VII) Unix->Windows cross-compiling using configure 168-------------------------------------------------- 169 170First you'll need a cross-compiler; linux glibc binaries of MinGW and 171Cygwin (both based on egcs) can be found at 172ftp://ftp.objsw.com/pub/crossgcc/linux-x-win32. Alternative binaries, 173based on the latest MinGW release can be found at 174http://members.telering.at/jessich/mingw/mingwcross/mingw_cross.html 175Otherwise you can compile one yourself. 176 177[ A Note about Cygwin and MinGW: the main difference is that Cygwin 178binaries are always linked against cygwin.dll. This dll encapsulates most 179standard Unix C extensions, which is very handy if you're porting unix 180software to windows. However, wxMSW doesn't need this, so MinGW is 181preferable if you write portable C(++). ] 182 183You might want to build both Unix and Windows binaries in the same source 184tree; to do this make subdirs for each e.g. unix and win32. If you've 185already build wxWidgets in the main dir, do a 'make distclean' there, 186otherwise configure will get confused. (In any case, read the section 'Unix 187using configure' and make sure you're able to build a native wxWidgets 188library; cross-compiling errors can be pretty obscure and you'll want to be 189sure that your configure setup is basically sound.) 190 191To cross compile the windows library, do 192-> cd win32 193(or whatever you called it) 194Now run configure. There are two ways to do this 195-> ../configure --host=i586-mingw32 --build=i586-linux --with-mingw 196where --build= should read whatever platform you're building on. Configure 197will notice that build and host platforms differ, and automatically prepend 198i586-mingw32- to gcc, ar, ld, etc (make sure they're in the PATH!). 199The other way to run configure is by specifying the names of the binaries 200yourself: 201-> CC=i586-mingw32-gcc CXX=i586-mingw32-g++ RANLIB=i586-mingw32-ranlib \ 202 DLLTOOL=i586-mingw32-dlltool LD=i586-mingw32-ld NM=i586-mingw32-nm \ 203 ../configure --host=i586-mingw32 --with-mingw 204 205(all assuming you're using MinGW) 206By default this will compile a DLL, if you want a static library, 207specify --disable-shared. 208 209Type 210-> make 211and wait, wait, wait. Don't leave the room, because the minute you do there 212will be a compile error :-) 213 214NB: if you are using a very old compiler you risk to get quite a few warnings 215 about "ANSI C++ forbids implicit conversion from 'void *'" in all places 216 where va_arg macro is used. This is due to a bug in (some versions of) 217 MinGW headers which may be corrected by upgrading your compier, 218 otherwise you might edit the file 219 220 ${install_prefix}/lib/gcc-lib/i586-mingw32/egcs-2.91.57/include/stdarg.h 221 222 (instead of egcs-2.91.57 you may have something different), searching for 223 the lines 224 225/* Define __gnuc_va_list. */ 226 227#ifndef __GNUC_VA_LIST 228#define __GNUC_VA_LIST 229#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) 230typedef char *__gnuc_va_list; 231#else 232typedef void *__gnuc_va_list; 233#endif 234#endif 235 236 and adding "|| defined(_WIN32)" to the list of platforms on which 237 __gnuc_va_list is char *. 238 239If this is successful, you end up with a wx23_2.dll/libwx23_2.a in win32/lib 240(or just libwx_msw.a if you opted for a static build). 241Now try building the minimal sample: 242 243-> cd samples/minimal 244-> make 245 246and run it with wine, for example (or copy to a Windows box) 247-> wine minimal.exe 248 249If all is well, do an install; from win32 250-> make install 251 252Native and cross-compiled installations can co-exist peacefully 253(as long as their widget sets differ), except for wx-config. You might 254want to rename the cross-compiled one to i586-mingw32-wx-config, or something. 255 256Cross-compiling TODO: 257--------------------- 258- resource compiling must be done manually for now (should/can we link the 259default wx resources into libwx_msw.a?) [ No we can't; the linker won't 260link it in... you have to supply an object file ] 261- static executables are HUGE -- there must be room for improvement. 262 263