Difference between revisions of "Setup the build environment"

From RobotinoWiki
(Building with Visual Studio 2010 for Windows 32 Bit)
Line 20: Line 20:
  
 
===Building with Visual Studio 2010 for Windows 32 Bit===
 
===Building with Visual Studio 2010 for Windows 32 Bit===
First of all Visual Studio 2010 is not supported. There is no guarantee that this instruction will works. Furthermore there is no guarantee for a successful compilation with the built API nor no problems by running programs compiled with it.
+
First of all Visual Studio 2010 is not supported. There is no guarantee that this instruction will work. Furthermore there is no guarantee for a successful compilation with the built API nor no problems by running programs compiled with it.
  
 
====english instruction====
 
====english instruction====

Revision as of 20:01, 1 January 2011

Building from source

The recommended way

Download the external depencies package. (REC internal \\fileserver\openrobotino_external*)

Unpack the 7z archive to a local harddisk. On Linux

sudo apt-get install p7zip
7zr x openrobotino_external_20101230.7z
find external -wholename "*/bin/*" -exec chmod +x {} \;

Set the environment variable OPENROBOTINO_EXTERNAL_DIR to the full path of the just unpacked external folder.

Get the sources via SVN from http://svn.openrobotino.org/trunk

Use cmake to configure the openrobotino1 folder.


Building with Visual Studio 2010 for Windows 32 Bit

First of all Visual Studio 2010 is not supported. There is no guarantee that this instruction will work. Furthermore there is no guarantee for a successful compilation with the built API nor no problems by running programs compiled with it.

english instruction

After downloading trunk and extracting external into it there are some modification needed. At first boost an qt libraries have to build with Visual Studio 2010. Then the support for those files have to add to some cmake files. At least six of the generated project files must be changed.

boost 1.41

Most of the needed things are named in HOW_TO_BUILD.txt under the boost directory of the external:
Download and extract boost 1.41.0 and download the binaries for boost jam and extract the exe file in the boost source folder. Now open a Visual Studio Command Prompt and move to the boost source. Now compile boost with the following command. The command is longer than in the text file:

bjam release debug link=static threading=multi --with-thread --with-date_time --with-filesystem \
     --with-regex --with-system --with-wave --with-math --with-serialization --with-test \
     --with-signals --with-graph --with-iostreams --with-program_options stage

After succeed there should be 84 files in the subfolder "stage/lib". You need the files with "1_41" in the name. Copy these 42 libraries into "external\boost\1_41\lib\win32" of the OpenrobotinoAPI.

qt 4.7.1

Download qt source from http://get.qt.nokia.com/qt/source/ and extract it. The file qt-everywhere-opensource-src-4.7.1.zip is needed. Open a Visual Studio Command Prompt and change into the qt source directory. Now qt can be compiled for debug and release. It will compile for hours:

configure -debug-and-release -static -opensource -platform win32-msvc2010 -no-qt3support \
          -qtnamespace openrobotinoqt -no-gif -no-libmng -no-libtiff -no-libjpeg -no-dsp -no-vcproj \
          -no-phonon -no-webkit -no-scripttools
nmake

After finishing the needed files are in the bin and lib subfolder. They have to be copied to "external\qt\4_7_1_static_openrobotinoqt\bin\win32\vc100" or "external\qt\4_7_1_static_openrobotinoqt\lib\win32\vc100". The directories "vc100" have to be created. You need "moc.exe" and "rcc.exe" from bin and the following files of the lib-folder:

QtCore.lib
QtGui.lib
qtmain.lib
QtNetwork.lib
QtSvg.lib
QtXml.lib

QtCored.lib
QtGuid.lib
qtmaind.lib
QtNetworkd.lib
QtSvgd.lib
QtXmld.lib

cmake configuration file

There are four files to change to enable Visual Studio 2010 support. They resists in the subfolder "tools\cmake" of the API. In the following parts of the files "+" means to add the Line an nothing that the file is not changed.

architecture.cmake:

 	#check for Visual Studio 2008
 	ELSEIF( MSVC90 )
 		SET( COMPILER_NAME vc90 )
 	
+	#check for Visual Studio 2010
+	ELSEIF( MSVC10 )
+		SET( COMPILER_NAME vc100 )
+	
 	ELSE( MSVC71 )

FindMyBoost.cmake:

 	IF( MSVC90 )
 		SET( BOOST_COMPILER_NAME vc90 )
+	#check for Visual Studio 2010
+	ELSEIF( MSVC10 )
+		SET( BOOST_COMPILER_NAME vc100 )
 	#check for Visual Studio 2005

FindMyQt4.cmake:

 	#check for Visual Studio 2008
 	ELSEIF( MSVC90 )
 		SET( QT_COMPILER_NAME vc90 )
 		SET( QT_MKSPECS_DIR ${QT_PATH}/mkspecs/win32-msvc2008 )
+		
+	#check for Visual Studio 2010, 
+	#attention: QT 4.5.1 has no mkspecs/win32-msvc2010, but 4.7.1, so copy it
+	ELSEIF( MSVC10 )
+		SET( QT_COMPILER_NAME vc100 )
+		SET( QT_MKSPECS_DIR ${QT_PATH}/mkspecs/win32-msvc2010 )
 		
 	ELSE( MSVC71 )

FindMyQt4_static_openrobotinoqt.cmake:

 	#check for Visual Studio 2008
 	ELSEIF( MSVC90 )
 		SET( QT_COMPILER_NAME vc90 )
 		SET( QT_MKSPECS_DIR ${QT_PATH}/mkspecs/win32-msvc2008 )
+		
+	#check for Visual Studio 2010
+	ELSEIF( MSVC10 )
+		SET( QT_COMPILER_NAME vc100 )
+		SET( QT_MKSPECS_DIR ${QT_PATH}/mkspecs/win32-msvc2010 )
 		
 	ELSE( MSVC71 )

Warning: I have problems with the current Version of the API (date 01.01.2011) with some cmake files. OPENROBOTINO_EXTERNAL_DIR is not set. So I used the following workaround which goes a step back to a previous version: tools/find_library.cmake:

 	
 	SET(
 		LIB_SEARCH_PATH
-		$ENV{OPENROBOTINO_EXTERNAL_DIR}/${CURRENT_LIB}
+		${REC_MAIN_DIR}/external/${CURRENT_LIB}
 	)
 

openrobotino1/tools/iomon/CMakeLists.txt:


-SET( EXTERNAL_DIR $ENV{OPENROBOTINO_EXTERNAL_DIR} )
+SET(  EXTERNAL_DIR ${REC_MAIN_DIR}/external )
STRING( REPLACE "\\" "/" EXTERNAL_DIR "${EXTERNAL_DIR}" )

Jetzt hat cmake bei mir keine Fehler mehr gemeldet.


building OpenrobotinoAPI

Now cmake can be used. After downloading and installing or extracting the newest version from http://www.cmake.org/cmake/resources/software.html. "cmake-gui.exe" has to be called from the bin directory of cmake. Fill in the path to "openrobotino1" of the API source into "Where is the source code" and your favorite folder in "Where to build the binaries". Now "configure", "configure" and "generate". Use "Visual Studio 10" as compiler. Then open a project file of your favorite folder. The properties of the six projects "armd", "arm_debugger", "iomon", "example_qtclient", "rec_robotino_server" and "rec_robotino_comd" have to be changed. You need in the debug version of the solution the debug versions of the qt libraries. So add the "d" to the end of the qt file names under "Configuration Properties", "Linker", "Input", "Additional Dependencies" in the project properties.
To build the API set "INSTALL" as start project and build it in debug or release mode. The result, the builded API, resists in the subfolder "install".


german instruction

Nachdem das aktuelle "trunk" heruntergeladen wurde und "external" dort extrahiert wurde fehlen noch einige Änderungen. Boost und QT müssen mit Visual Studio 2010 kompiliert werden. Ferner sind einige cmake-Dateien anzupassen.

boost 1.41

Es reicht die Anleitung von HOW_TO_BUILD.txt des boost-Ordners zu befolgen. Dies umfasst:
Nach dem Herunterladen von boost 1.41.0 wird auch boost jam als binary heruntergeladen und in den boost-Ordner entpackt. Nun kann es gebaut werden. Dabei werden allerdings mehr Parameter angegeben, als in der txt-Datei stehen.

bjam release debug link=static threading=multi --with-thread --with-date_time --with-filesystem \
     --with-regex --with-system --with-wave --with-math --with-serialization --with-test \
     --with-signals --with-graph --with-iostreams --with-program_options stage

Danach müsste es in dem Unterordner "stage" ein lib-Ordner existiert. Dort müssten nun 84 Dateien liegen. Alle Dateien die ein "1_41" im Namen tragen - 42 an der Zahl - sind nun in den Ordner "external\boost\1_41\lib\win32" der OpenrobotinoAPI zu kopieren.

qt 4.7.1

Zuerst gilt es den Quelltext von qt auf der Webseite herunter (Datei qt-everywhere-opensource-src-4.7.1.zip) zu laden und zu entpacken. Im Anschluss wird die Eingabeaufforderung von Visual Studio 2010 gestartet und in das Verzeichnis von qt gewechselt. Nun muss qt vor dem bauen konfiguriert werden. Das Bauen selber wird je nach Rechenleistung Stunden dauern. Es muss in release und debug gebaut werden.

configure -debug-and-release -static -opensource -platform win32-msvc2010 -no-qt3support \
          -qtnamespace openrobotinoqt -no-gif -no-libmng -no-libtiff -no-libjpeg -no-dsp -no-vcproj \
          -no-phonon -no-webkit -no-scripttools
nmake

Nachdem nun alles erstellt wurde, finden sich die benötigten Dateien in den Ordnern bin und lib. Diese sind nach "external\qt\4_7_1_static_openrobotinoqt\bin\win32\vc100" bzw. "external\qt\4_7_1_static_openrobotinoqt\lib\win32\vc100" kopiert werden. "vc100" muss dabei jeweils extra angelegt werden. Aus dem bin-Ordner werden die Dateien "moc.exe" und "rcc.exe" benötigt. Vom lib-Ordner sind folgende Dateien zu kopieren:

QtCore.lib
QtGui.lib
qtmain.lib
QtNetwork.lib
QtSvg.lib
QtXml.lib

QtCored.lib
QtGuid.lib
qtmaind.lib
QtNetworkd.lib
QtSvgd.lib
QtXmld.lib

CMake-Konfigurationsdateien

Zwar sind nun alle Daten vorhanden, jedoch wird CMake vermutlich noch einige Probleme haben, da die vorhandenen Dateien kein Visual Studio 2010 vorsehen. Deshalb gilt es diese zu verändern. Diese sind unter "tools\cmake" zu finden. "+" bedeutet dabei "Zeile muss hinzu gefügt werden", "-" "Zeile muss entfernt werden" und " " bedeutet "Zeile bleibt so".

architecture.cmake:

 	#check for Visual Studio 2008
 	ELSEIF( MSVC90 )
 		SET( COMPILER_NAME vc90 )
 	
+	#check for Visual Studio 2010
+	ELSEIF( MSVC10 )
+		SET( COMPILER_NAME vc100 )
+	
 	ELSE( MSVC71 )

FindMyBoost.cmake:

 	IF( MSVC90 )
 		SET( BOOST_COMPILER_NAME vc90 )
+	#check for Visual Studio 2010
+	ELSEIF( MSVC10 )
+		SET( BOOST_COMPILER_NAME vc100 )
 	#check for Visual Studio 2005

FindMyQt4.cmake:

 	#check for Visual Studio 2008
 	ELSEIF( MSVC90 )
 		SET( QT_COMPILER_NAME vc90 )
 		SET( QT_MKSPECS_DIR ${QT_PATH}/mkspecs/win32-msvc2008 )
+		
+	#check for Visual Studio 2010, 
+	#attention: QT 4.5.1 has no mkspecs/win32-msvc2010, but 4.7.1, so copy it
+	ELSEIF( MSVC10 )
+		SET( QT_COMPILER_NAME vc100 )
+		SET( QT_MKSPECS_DIR ${QT_PATH}/mkspecs/win32-msvc2010 )
 		
 	ELSE( MSVC71 )

FindMyQt4_static_openrobotinoqt.cmake:

 	#check for Visual Studio 2008
 	ELSEIF( MSVC90 )
 		SET( QT_COMPILER_NAME vc90 )
 		SET( QT_MKSPECS_DIR ${QT_PATH}/mkspecs/win32-msvc2008 )
+		
+	#check for Visual Studio 2010
+	ELSEIF( MSVC10 )
+		SET( QT_COMPILER_NAME vc100 )
+		SET( QT_MKSPECS_DIR ${QT_PATH}/mkspecs/win32-msvc2010 )
 		
 	ELSE( MSVC71 )

Anmerkung: Bei meiner aktuellen Version (Stand 01.01.2011) gibt es einen Fehler in den cmake-Dateien. OPENROBOTINO_EXTERNAL_DIR ist nicht gesetzt. Deshalb habe ich als "workaround" folgende Änderung vorgenommen. Dabei handelt es sich teilweise um eine frühere Version: tools/find_library.cmake:

 	
 	SET(
 		LIB_SEARCH_PATH
-		$ENV{OPENROBOTINO_EXTERNAL_DIR}/${CURRENT_LIB}
+		${REC_MAIN_DIR}/external/${CURRENT_LIB}
 	)
 

openrobotino1/tools/iomon/CMakeLists.txt:


-SET( EXTERNAL_DIR $ENV{OPENROBOTINO_EXTERNAL_DIR} )
+SET(  EXTERNAL_DIR ${REC_MAIN_DIR}/external )
STRING( REPLACE "\\" "/" EXTERNAL_DIR "${EXTERNAL_DIR}" )

Jetzt hat cmake bei mir keine Fehler mehr gemeldet.


OpenrobotinoAPI bauen

Als erstes wird die aktuelle CMake-Version benötigt. Diese kann unter http://www.cmake.org/cmake/resources/software.html herunter geladen werden. Nach dem Entpacken oder installieren wird "cmake-gui.exe" ausgeführt. Als "Where is the source code" wird der Pfad zu "openrobotino1" incl. gewählt. Als Zielort ("Where to build the binaries") wird der Wunschordner gewählt. Es folgt "configure", "configure" und "generate". Bei Nachfrage wird "Visual Studio 10" gewählt. Die direkte Arbeit mit CMake ist damit beendet.
Nun wird ein Visual Studio Projekt in dem Zielordner geöffnet, wodurch die komplette Solution-Datei geöffnet wird. Sechs Projekte gilt es an zu passen. Diese sind "armd", "arm_debugger", "iomon", "example_qtclient", "rec_robotino_server" und "rec_robotino_comd". Bei ihnen müssen in der Debug-Version auch die Debug-QT-Bibliotheken verwendet werden. Es gilt also in den Projekteigenschaften unter "Konfigurationseigenschaften", "Linker", "Eingabe", "Zusätzliche Abhängigkeiten" ein "d" am Ende des Dateinamens vor der Endung ein zu tragen. Nun kann "INSTALL" als Startprojekt gewählt und je nach Wunsch in Release oder Debug gebaut werden. Die gebaute API findet sich dann im Ordner "install" unter dem Projektordner.