Difference between revisions of "CMake"

From AMule Project FAQ
Jump to: navigation, search
m (Clarify that all build-projects are replaced.)
(Install cmake for your system)
 
(4 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
= Preparation =
 
= Preparation =
 
== Install cmake for your system ==
 
== Install cmake for your system ==
On Win or Mac, get your copy from [[http://www.cmake.org/cmake/resources/software.html#latest|cmake download page]].
+
On Win or Mac, get your copy from [[http://www.cmake.org/cmake/resources/software.html#latest cmake download page]].
 
Most linux distros have it already in their package management, so get it from there.
 
Most linux distros have it already in their package management, so get it from there.
  
 
== Get cmake enabled source ==
 
== Get cmake enabled source ==
Go to [[http://vollstreckernet.de/cmake/]], here can get either complete tarballs (named amule-cmake-<svn-rev>), or
+
Go to [[https://github.com/amule-project/amule/tree/cmake github]], here can get either complete tarballs, or just clone the source using git as usual.
patches for the source (named cmake-<date>).
+
  
 
If you got the tarball, extract it and enter the created dir.
 
If you got the tarball, extract it and enter the created dir.
 
If you decided for the patch, go into an already existing source-dir (almost every version that compiles should be fine),
 
in there run:
 
 
patch -p1 < <downloaded-patch-file>
 
 
As development takes place in a git repo, svn-revision can't be detected properly, so you got to create a usable information
 
by hand in the top-level dir of your amule source by running.
 
 
echo "<svn-rev> > .svn-revision
 
  
 
= Usage =
 
= Usage =

Latest revision as of 16:25, 18 July 2019

Overview

In late development phase of 2.3.1, Vollstrecker has again been pissed by our autotools-based build-system. After some time of tryouts, he decided to give cmake a chance. For more information about this system look [[1]].

As 2.3.1 has been already in rc-phase, this has been delayed to a later time, which has come now.

Purpose

The intentional idea behind this is to replace to autotools build-system and the additional project-files for other plattforms.

Preparation

Install cmake for your system

On Win or Mac, get your copy from [cmake download page]. Most linux distros have it already in their package management, so get it from there.

Get cmake enabled source

Go to [github], here can get either complete tarballs, or just clone the source using git as usual.

If you got the tarball, extract it and enter the created dir.

Usage

It's recommended to do an out of source-build (in-source works, too), so for the shortest test you just got to:

mkdir build cd build cmake ../ make (make install, DESTDIR= works)

Types of configuration

GUI-Mode

This is variant with which you can see the most informations. Just start the gui from your menu, or run cmake-gui from the dir you want to build in.

Enter the path to source and/or build dir into the text-fields in the upper area of the dialog-window and then press configure. Here you can choose if you want cmake to create projects for your preferred IDE, or just makefiles. After the first run, you can en-/disable options like you want, if done press configure again, and it will present you what has changed based on your decisions, so you can adjust a bit more, like you want. If finally done, press generate.

Interview mode

Go to the dir you want to build in, and run:

cmake -i <path-to-source>

cmake will now configure the source, and will ask you the options it knows of.

Commandline Arguments

This one is most like the old configure-scripts. Just go to the dir you want to build in, and run:

cmake <path-to-source>

Building

After configuration, you can build the binaries, the way you always do, depending on the type of output you have chosen. So if you decided to create a project file for an IDE, open that one in there and start build-process.

If you've chosen "Makefile" go to the dir you want to build in (actually you should already be there) and run:

make

Installing

Again, this depends on the output you've chosen. For "Makefile" you can do like usual:

make install

If you don't have superuser-priv's, or just don't want to install to a alternative location, you can use:

make install DESTDIR=<location>

This will install everything into <location> as top-level dir.

Options

Options are passed to the script with -D<option=value>. Options are meant to be named as near to the old options as possible, so -DPREFIX= sets prefix, but for the separate apps, It has been found more meaningful to call them BUILD, so -DBUILD_ALC=on (ON, on, TRUE, true, YES, yes and many more are good) is used to build alc, -DBUILD_MONOLITHIC=off excludes amule.

Options for "What is built"

Here is a short summary of options you can choose from, to select what you want to build (defaults in brackets)

  • BUILD_ALC (OFF)

compile aMuleLinkCreator GUI version

  • BUILD_ALCC (OFF)

compile aMuleLinkCreator for console

  • BUILD_AMULECMD (OFF)

compile aMule command line client

  • BUILD_EVERYTHING (OFF)

compile all parts of aMule

  • BUILD_CAS (OFF)

compile C aMule Statistics

  • BUILD_DAEMON (OFF)

compile aMule daemon version

  • BUILD_ED2K (ON)

compile aMule ed2k links handler

  • BUILD_FILEVIEW (OFF)

compile aMule file viewer for console

  • BUILD_MONOLITHIC (ON)

enable building of the monolithic aMule app

  • BUILD_PLASMAMULE (OFF)

compile aMule plasma applet and engine

  • BUILD_REMOTEGUI (OFF)

compile aMule remote GUI

  • BUILD_WEBSERVER (OFF)

compile aMule WebServer

  • BUILD_WXCAS (OFF)

compile aMule GUI Statistics

  • BUILD_XAS (OFF)

install xas XChat2 plugin

Options for "How is it built"

  • ENABLE_DEBUG (ON)

build debugging symbols into binaries Turning this off hasn't been tested, so most-likely it won't change anything.

  • ENABLE_IP2COUNTRY (OFF)

compile with GeoIP IP2Country library

  • ENABLE_MMAP (OFF)

enable using mapped memory if supported

  • ENABLE_NLS (ON)

enable national language support

  • ENABLE_UPNP (ON)

compile UPnP code

Advantages of cmake

  • Not only denoised build (disable with make VERBOSE=1), it has colored

build with progress in %.

  • Can create not just Makefiles, there are generators for real many IDEs

out there, so you can create projects for xCode, Visual Studio, kdevelop or what you like to use.

  • Automatic caching, so reconfiguring with other options is much faster

by default (k, it's needed to tweak some stuff, but it works)

  • One build-system for all platforms. (theoretically spkeaking)
  • No need of generating the build-system (so no autogen needed anymore, just checkout (for users that use the svn or an alternative repo out there) and start.

Temporary Disadvantages of cmake

By now, a change to config.h means, that almost everything is rebuilt. Many (almost all) compiler-defines have been moved from compiler-cmd to config.h. Next step would be, to split it to separate headers, but for now they are kept in one to let it still be buildable with autotools, so we can keep both systems in a transition to the new one (if accepted).


Testing status

By now it's tested on following systems:

  • Debian (all flavors worked)
  • Ubuntu (all flavors worked)
  • Windows (short test by Stu, needs some modifications to detect everything)