Difference between revisions of "HowTo compile with Visual Studio"
(removed zlib, added fixes for settings) |
|||
(21 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
== Requirements for compiling [[aMule]] for Windows using Visual Studio == | == Requirements for compiling [[aMule]] for Windows using Visual Studio == | ||
You will need the following packages: | You will need the following packages: | ||
− | *Microsoft [http://msdn.microsoft.com/en-us/vstudio/default.aspx Visual Studio] | + | *Microsoft [http://msdn.microsoft.com/en-us/vstudio/default.aspx Visual Studio] 2008 or 2010 (called "VS") - either the free Express Edition or the commercial edition |
− | *Windows port of [[wxWidgets]] library ( | + | *Windows port of [[wxWidgets]] library (known as wxMSW) -> [http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.12.zip Download (2.8.12)] |
− | * [http://www.cryptopp.com/ Crypto++] library -> [http://prdownloads.sourceforge.net/cryptopp/ | + | * [http://www.cryptopp.com/ Crypto++] library -> [http://prdownloads.sourceforge.net/cryptopp/cryptopp561.zip Download (5.6.1)] |
*[http://www.zlib.org zlib] compression library is already included in wxMSW | *[http://www.zlib.org zlib] compression library is already included in wxMSW | ||
− | *aMule | + | *[http://www.amule.org/files/ aMule 2.2.6 source] or latest [[aMule SVN|SVN source tarball]] -> [http://amule.sourceforge.net/tarballs/ Download aMule] |
− | Also, 1100MB free space on your hard disk (around 40MB to download the above packages and the rest for temporary compilation files and installations | + | Also, 1100MB free space on your hard disk (around 40MB to download the above packages and the rest for temporary compilation files and installations. |
As a reference, the whole compilation process will take around 20 min on a medium-high resourced computer. | As a reference, the whole compilation process will take around 20 min on a medium-high resourced computer. | ||
Line 20: | Line 18: | ||
*Unpack wxMSW to "aMule\wxWidgets" (no intermediate subfolder). | *Unpack wxMSW to "aMule\wxWidgets" (no intermediate subfolder). | ||
*Unpack cryptopp to "aMule\cryptopp" (no intermediate subfolder). | *Unpack cryptopp to "aMule\cryptopp" (no intermediate subfolder). | ||
− | *Unpack aMule to "aMule\trunk" (no intermediate subfolder). This folder can be named as you like, the | + | *Unpack aMule to "aMule\trunk" (no intermediate subfolder). This folder can be named as you like, the 2 library folders must have exact the names from above, or the project won't load. |
== Preparing the library projects == | == Preparing the library projects == | ||
+ | VS2008: | ||
*Open "aMule\wxWidgets\build\msw\wx.dsw" in VS. It asks, if it should convert the project. Answer "Yes to all". | *Open "aMule\wxWidgets\build\msw\wx.dsw" in VS. It asks, if it should convert the project. Answer "Yes to all". | ||
*Close VS, saving the changes. | *Close VS, saving the changes. | ||
− | + | VS2010 can't open the ancient dsw projects anymore. Download [http://amule.googlecode.com/files/wx2.8.12_VS2010_proj.zip project files] and put them in aMule\wxWidgets\build\msw . | |
− | + | If you build with wx 2.9 (which is highly experimental!) it comes with projects for VS2008 ("aMule\wxWidgets\build\msw\wx_vc9.sln") which you can use in VS2008 or open in VS2010 for conversion. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | == | + | == Selecting the solution == |
+ | #"aMule-MSVCE-ExtLibs.sln" builds wxWidgets and cryptopp into a single big lib "libext.lib". | ||
+ | #"aMule-MSVCE.sln" builds aMule (including aMule's internal libs) and aMule's tools. That way the (now flat) aMule solution is not cluttered with all the wxWidgets libs, and a ''Clean Solution'' won't clean the wxWidgets build (which usually is not the intention). These solutions can be used both with the express edition and with the commercial VS edition. | ||
+ | #"aMule-MSVC.sln" works only with the commercial edition of VS2008. This solution includes everything - aMule, tools, external libs, organized in folders (which the express edition does not allow). Usage of this solution is ''not recommended'' for newer versions of aMule. | ||
− | + | == Compiling the external libraries == | |
− | + | ||
− | + | *Open the aMule solution "aMule\trunk\MSVC Solution\aMule-MSVCE-ExtLibs.sln" in VS. | |
+ | *In the toolbar set the Solution Configuration to ''Debug'' or ''Release'' (whatever you prefer) and the Solution Platform to ''Win32''. | ||
+ | *Debug build: | ||
+ | *In the solution explorer open properties of ''cryptlib''. | ||
+ | *In ''Configuration Properties/C-C++/Code Generation'' change ''Runtime Library'' to ''Multithreaded Debug DLL (/MDd)''. | ||
+ | *Release build: | ||
+ | *In the solution explorer open properties of all projects except ''buildlibext''. | ||
+ | *In ''Configuration Properties/C-C++/Code Generation'' change ''Runtime Library'' to ''Multithreaded (/MT)''. | ||
+ | *Hit ''F7''. | ||
+ | *If everything was fine, load "aMule\trunk\MSVC Solution\aMule-MSVCE.sln" to continue. | ||
== Compiling aMule == | == Compiling aMule == | ||
− | + | Select ''Build/Build Solution'' or just hit ''F7'' and lean back. | |
− | + | ||
− | + | ||
− | + | ||
If you get errors: | If you get errors: | ||
Line 57: | Line 60: | ||
'''//''' b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | '''//''' b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | ||
− | === | + | === error accessing something.pdb === |
− | + | Sometimes VS stumbles over it's own feet. Just delete the offending pdb and try again. | |
− | + | ||
− | + | ||
− | + | ||
== Running == | == Running == | ||
− | To run aMule from VS, right-click on '' | + | To run aMule from VS, right-click on ''aMule'' and ''Set as StartUp project''. |
Then hit F5. | Then hit F5. | ||
− | |||
− | |||
aMule's configuration will be stored in your document folder in "AppData\Roaming\aMule" (under Vista). | aMule's configuration will be stored in your document folder in "AppData\Roaming\aMule" (under Vista). | ||
− | == | + | == Building aMule with GeoIP support == |
− | + | ||
+ | The [http://www.maxmind.com MaxMind] GeoIP library can detect the country an IP adress comes from. aMule uses this information | ||
+ | to display a little country flag for each source or ed2k server. | ||
+ | Since this is an external library it is disabled by default. This is how to enable it (only available in the SVN version): | ||
+ | |||
+ | Download the free [http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz GeoIP C library 1.4.6] (older versions don't work!). | ||
+ | From the folder libGeoIP take "GeoIP.h" and "GeoIP.c" and put them into "MSVC Solution\libs\libGeoIP" (replacing the dummy files that may be there). | ||
+ | |||
+ | Rebuild aMule. That's it. :-) | ||
+ | |||
+ | The free [http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz GeoIP country database] will be downloaded automatically on startup. |
Latest revision as of 12:46, 3 April 2011
Contents
Requirements for compiling aMule for Windows using Visual Studio
You will need the following packages:
- Microsoft Visual Studio 2008 or 2010 (called "VS") - either the free Express Edition or the commercial edition
- Windows port of wxWidgets library (known as wxMSW) -> Download (2.8.12)
- Crypto++ library -> Download (5.6.1)
- zlib compression library is already included in wxMSW
- aMule 2.2.6 source or latest SVN source tarball -> Download aMule
Also, 1100MB free space on your hard disk (around 40MB to download the above packages and the rest for temporary compilation files and installations.
As a reference, the whole compilation process will take around 20 min on a medium-high resourced computer.
Unpacking the sources
- Create a root folder. You can name it whatever you want. In this example it is called "aMule".
- Unpack wxMSW to "aMule\wxWidgets" (no intermediate subfolder).
- Unpack cryptopp to "aMule\cryptopp" (no intermediate subfolder).
- Unpack aMule to "aMule\trunk" (no intermediate subfolder). This folder can be named as you like, the 2 library folders must have exact the names from above, or the project won't load.
Preparing the library projects
VS2008:
- Open "aMule\wxWidgets\build\msw\wx.dsw" in VS. It asks, if it should convert the project. Answer "Yes to all".
- Close VS, saving the changes.
VS2010 can't open the ancient dsw projects anymore. Download project files and put them in aMule\wxWidgets\build\msw .
If you build with wx 2.9 (which is highly experimental!) it comes with projects for VS2008 ("aMule\wxWidgets\build\msw\wx_vc9.sln") which you can use in VS2008 or open in VS2010 for conversion.
Selecting the solution
- "aMule-MSVCE-ExtLibs.sln" builds wxWidgets and cryptopp into a single big lib "libext.lib".
- "aMule-MSVCE.sln" builds aMule (including aMule's internal libs) and aMule's tools. That way the (now flat) aMule solution is not cluttered with all the wxWidgets libs, and a Clean Solution won't clean the wxWidgets build (which usually is not the intention). These solutions can be used both with the express edition and with the commercial VS edition.
- "aMule-MSVC.sln" works only with the commercial edition of VS2008. This solution includes everything - aMule, tools, external libs, organized in folders (which the express edition does not allow). Usage of this solution is not recommended for newer versions of aMule.
Compiling the external libraries
- Open the aMule solution "aMule\trunk\MSVC Solution\aMule-MSVCE-ExtLibs.sln" in VS.
- In the toolbar set the Solution Configuration to Debug or Release (whatever you prefer) and the Solution Platform to Win32.
- Debug build:
- In the solution explorer open properties of cryptlib.
- In Configuration Properties/C-C++/Code Generation change Runtime Library to Multithreaded Debug DLL (/MDd).
- Release build:
- In the solution explorer open properties of all projects except buildlibext.
- In Configuration Properties/C-C++/Code Generation change Runtime Library to Multithreaded (/MT).
- Hit F7.
- If everything was fine, load "aMule\trunk\MSVC Solution\aMule-MSVCE.sln" to continue.
Compiling aMule
Select Build/Build Solution or just hit F7 and lean back.
If you get errors:
error in Scanner.cpp
change
b->yy_is_interactive = 0; // b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
error accessing something.pdb
Sometimes VS stumbles over it's own feet. Just delete the offending pdb and try again.
Running
To run aMule from VS, right-click on aMule and Set as StartUp project. Then hit F5.
aMule's configuration will be stored in your document folder in "AppData\Roaming\aMule" (under Vista).
Building aMule with GeoIP support
The MaxMind GeoIP library can detect the country an IP adress comes from. aMule uses this information to display a little country flag for each source or ed2k server. Since this is an external library it is disabled by default. This is how to enable it (only available in the SVN version):
Download the free GeoIP C library 1.4.6 (older versions don't work!). From the folder libGeoIP take "GeoIP.h" and "GeoIP.c" and put them into "MSVC Solution\libs\libGeoIP" (replacing the dummy files that may be there).
Rebuild aMule. That's it. :-)
The free GeoIP country database will be downloaded automatically on startup.