Difference between revisions of "HowTo compile with cmake"

From AMule Project FAQ
Jump to: navigation, search
(Preparing the libraries needed)
(Requirements for compiling aMule for Windows using cmake)
Line 11: Line 11:
 
*libGeoIP [https://github.com/maxmind/geoip-api-c Download or git clone]
 
*libGeoIP [https://github.com/maxmind/geoip-api-c Download or git clone]
 
*[http://www.libpng.org/pub/png/libpng.html libpng] -> [http://prdownloads.sourceforge.net/libpng/lpng1626.zip?download Download 1.6.26]
 
*[http://www.libpng.org/pub/png/libpng.html libpng] -> [http://prdownloads.sourceforge.net/libpng/lpng1626.zip?download Download 1.6.26]
*[[wxWidgets]] library -> [https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.2/wxWidgets-3.0.2.zip Download (3.0.2)]
+
*[[wxWidgets]] library -> [https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.2/wxWidgets-3.0.2.zip Download (3.0.2)] (Starting with VS14 you need [https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.0/wxWidgets-3.1.0.zip Version 3.1.0])
 
*[http://www.zlib.org zlib] compression library [http://zlib.net/zlib128-dll.zip Download (1.2.8)]
 
*[http://www.zlib.org zlib] compression library [http://zlib.net/zlib128-dll.zip Download (1.2.8)]
  

Revision as of 09:50, 7 December 2016

Requirements for compiling aMule for Windows using cmake

You will need the following packages:

Unpacking the sources

  • Create a root folder. You can name it whatever you want. In this example it is called "aMule".
  • Unpack wx, cryptopp flex/bison and zlib into that folder. (Just to find them again. In fact it doesn't matter where put them.

Preparing the libraries needed

boost

  • Open a Visual Studio Command Prompt from your startmenu
  • cd into the dir, where you extracted the source
  • run bootstrap
  • run .\b2 install

cryptopp

  • If you use VisualStudio, open one of the projects you find in the source-dir. For others instructions will go here, when tested.
  • Select Release or Debug build.

This is important, as cryptlib.h will be generated and compile will only work with the same config. This also means, if you've built cryptopp with Debug option, you can build aMule only with Debug enabled

  • Right click on cryptlib goto Properties C/C++ -> Code Generation and set the Runtime-Library to /MD (/MDd for Debug)
  • Build the cryptlib project in the solution

flex/bison

  • Just extract the archive

libGeoIP

  • Open a Visual Studio Command Prompt from your startmenu
  • cd into the dir, where you extracted the source
  • run nmake /f Makefile.vc

zlib

  • Just extract the archive

libpng

  • Open die vstudio project
  • Rightclick on libpng and open the properties
  • Open C/C++ -> General
  • Change "$(ZLibSrcDir)" to "$(ZLibSrcDir)/include" in "Additional Include Directories"
  • Open Linker -> General
  • Change "$(ZLibSrcDir)" to "$(ZLibSrcDir)/lib" in "Additional Library Directories"
  • Open Linker -> Input
  • Change "zlib.lib" to "zdll.lib" in "Additional Dependencies"
  • Build the libpng project of the solution and nevermind the failing zlib project.

wxWidgets

  • Just open the project that suits your IDE and build the whole solution.

aMule

  • Start GIT-GUI (or git-bash or anything you like) from your start-menu (or whatever your current installation has.
  • Point the repo to https://github.com/amule-project/amule.git and clone it to whereever you want.
  • Checkout branch cmake.

Creating the solution

  • Open cmake-gui
  • Point the source-code directory to where you cloned the repo
  • Point the build directory to wherever you want
  • Hit configure and select the generator for the IDE you want to use and click finish.
  • Now you can select all the options you want, and hit configure again.
  • Hit generate

Setting the paths needed

If (and it will be the case if you didn't move anything you downloaded or compiled into system directories) not everything needed is found.

  • For the libraries: Open a Texteditor, open <your-amule-folder>\cmake/searchdirs.cmake and uncomment the needed lines, and point it to where the stuff was created.
  • For the binaries (flex/bison) you can select the files directly in cmake (i.e BISON_EXECUTABLE for bison) after enabling advanced opton.
  • Hit configure again
  • Hit generate

Compiling

  • Open the created project files in the build directory you've set.
  • Choose Debug/Release etc. like you selected for cryptopp before.
  • Start compilation.

Tested with

  • Microsoft Visual C++ 2010 (VC10) Download
  • Microsoft Visual Studio 2012 (VC11) Update 5 Download
  • Microsoft Visual Studio 2013 (VC12) Update 4 Download