Difference between revisions of "CompileWindows"

From Wiki for iCub and Friends
Jump to: navigation, search
(Create the YARP Makefiles)
(Delete updated page)
 
Line 1: Line 1:
'''Important''': we assume here that you have completed the previous steps in the manual (see Section 6.1 "Prepare Your System" in the manual's main page).
 
  
These instructions work on XP, Vista and Windows 6, Visual Studio 8 and Visual Studio 9.
 
 
For other compilers, e.g. Visual Studio express, additional steps might be required. Visual Studio express requires the installation of the Windows Platform SDK. Visual Studio 8/9 come pre-packed with the Platform SDK.
 
 
= Compiling YARP =
 
 
== Create the YARP Makefiles ==
 
 
* Run cmake.
 
* Point the source code to %YARP_ROOT% (this goes into the "Where is the source code" entry in the gui).
 
* Point the binary directory to %YARP_DIR%, this can be a directory of your choice, for example %YARP_ROOT%/build (this goes into the "Where to build the binaries" entry in the gui).
 
* Project files generation is an iterative process, click on the button "Configure" until the button "Generate" becomes available. Then hit "Generate" and quit.
 
 
Choose the following options:
 
* CMAKE_BUILD_TYPE, set to "Release" in case you'd like to optimize
 
* CREATE_GUIS, set to ON
 
* CREATE_LIB_MATH, set to ON
 
* CREATE_DEVICE_LIBRARY_MODULES, set to ON
 
Make a configure in order to see the different modules available and
 
* ENABLE_yarpmod_portaudio, set to ON
 
 
Important: CREATE_GUIS and CREATE_LIB_MATH require you have installed the libraries gtk and gsl (see [[PrepareWindows]])
 
 
Installation:
 
CMake automatically creates an install rule for target/project. In the documentation we assume you install binaries in %YARP_BIN%/bin and %YARP_BIN%/lib. The compiler will build executables and libraries there, so you don't need to perform the installation. You can instruct CMake so that it generates make/project files that install to other places:
 
 
* CMAKE_INSTALL_PREFIX
 
 
When you do make install all binaries will be copied to CMAKE_INSTALL_PREFIX/bin and CMAKE_INSTALL_PREFIX/lib.
 
 
In this case for other packages to use YARP you have to set the variable YARP_DIR so that it points to CMAKE_INSTALL_PREFIX.
 
 
Of course you can customize the installation directory as you wish, however the remainder of the documentation assumes the above configuration.
 
 
* Depending on the hardware on your system you might want to compile additional device drivers. This is done for example on the pc104. Instruction for doing this are reported elsewhere.
 
 
== Compile ==
 
 
Now we are ready to compile. Open the YARP visual studio project file in %YARP_DIR% and compile it.
 
 
=== Example ===
 
Now we're ready to run a simple Yarp code to test the installation so far. You might want to prepare a yarp.conf file in the conf directory similar to this one:
 
 
127.0.0.1 10000
 
 
// start network description, don't forget to separate "Node="
 
// and names with space
 
[NETWORK_DESCRIPTION]
 
[END]
 
 
which tells Yarp (the server) to start on the localhost and respond to port 10000. This allows Yarp applications to find the name server (see next chapter).
 
 
You can then try running the server. On a terminal window, type:
 
 
yarpserver
 
 
and you should see:
 
 
yarp: Port /root active at tcp://127.0.0.1:10000
 
Name server can be browsed at http://127.0.0.1:10000/
 
yarp: Bootstrap server listening at mcast://224.2.1.1:10001
 
 
if you type on a web browser http://127.0.0.1:10000 you get information about the name server (registered ports, info, etc.).
 
 
For the time being we can just check functionality by running a simple example. On another terminal type:
 
 
yarp read /portread
 
 
on a third terminal:
 
 
yarp write /portwrite
 
 
and on yet another terminal:
 
 
yarp connect /portwrite /portread
 
 
you'll see the effect on the name server:
 
 
yarp: registration name /portwrite ip 127.0.0.1 port 10012 type tcp
 
yarp: registration name /portread ip 127.0.0.1 port 10002 type tcp
 
 
Now, anything typed on the yarp write will be sent and printed on the read side.
 
 
= Options =
 
 
If you need to compile devices that provide interface to the hardware you can follow this link [[Compilation on the pc104]]
 
 
= Compile the iCub software =
 
 
'''Important''': since July 2010 we have a new build system, and organization of the repository has changed. This page contains the instructions for compiling the old repository: [[CompileWindows(Old)]].
 
 
== Generate Project Files ==
 
 
First you need to generate make files.
 
 
* Run cmake.
 
* Point the source code to %ICUB_ROOT%/main (this goes into the "Where is the source code" entry in the gui).
 
* Point the binary directory to %ICUB_DIR%, this can be a directory of your choice, for example %ICUB_ROOT%/main/build (this goes into the "Where to build the binaries" entry in the gui).
 
* Project files generation is an iterative process, click on the button "Configure" until the button "Generate" becomes available. Then hit "Generate" and quit.
 
 
All project files will be placed in %ICUB_DIR%. At any time you can remove the content of %ICUB_DIR% to generate new files.
 
 
=== Options ===
 
 
* ICUB_APPLICATIONS_PREFIX
 
 
This determines where the compiler will install the applications, by default this is initialized to %ICUB_ROOT%.
 
 
CMake will check all dependencies, for each <package> it creates a variable called ICUB_HAS_<package>. This is true or false if the library has been found or not.
 
 
In addition for each <package> there is a variable called ICUB_USE_<package>; this tells cmake if you want to ignore a particular package. CMake will compile only modules that meet the enabled dependencies.
 
 
See [[PrepareWindows]] for instructions about how to prepare your system so that all dependencies are satisfied.
 
 
* Similarly to YARP, by default make will build executables and libraries in %ICUB_ROOT%/bin and %ICUB_ROOT%/lib. You can customize where "make install" will copy these files by setting: CMAKE_INSTALL_PREFIX to something you like. 
 
 
If you need to compile optional devices (for example devices that provide interface to the hardware) you can follow this link: [[Compilation on the pc104]].
 
 
== Compile ==
 
 
Open the project files in %ICUB_DIR%.
 
 
* Compile ALL_BUILD
 
 
== Installing applications ==
 
 
Don't forget to install applications: build the "install_applications" target.
 
 
this will copy a set of config and xml template files to ICUB_APPLICATIONS_PREFIX/app.
 
 
== Install binaries==
 
 
Optionally you can install the binaries in a directory of your choice, build the "INSTALL" target.
 

Latest revision as of 13:01, 27 April 2020