{"id":120,"date":"2014-06-16T11:59:34","date_gmt":"2014-06-16T11:59:34","guid":{"rendered":"http:\/\/openwam.webs.upv.es\/docs\/?p=120"},"modified":"2016-01-14T22:07:46","modified_gmt":"2016-01-14T22:07:46","slug":"how-to-compile-openwam","status":"publish","type":"post","link":"https:\/\/openwam.webs.upv.es\/docs\/?p=120","title":{"rendered":"How to compile OpenWAM"},"content":{"rendered":"<p><!--more--><\/p>\n<h1>Introduction.<\/h1>\n<p style=\"text-align: justify;\">OpenWAM is written in C++ using the standars of c++11. The project is based on\u00a0CMake files. CMake is a tool needed to modify the settings of the project and to transform the project to be open by different compilers. CMake can be download from <a title=\"CMake - Cross Plataform Make\" href=\"http:\/\/www.cmake.org\/\" target=\"_blank\">www.cmake.org<\/a> or from the linux repository.<\/p>\n<h1>Windows platform.<\/h1>\n<h2>Installation of GCC for Windows.<\/h2>\n<h3>MinGW installation.<\/h3>\n<p>MinGW is a\u00a0native Windows port of the GNU Compiler Collection (GCC), with freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality.\u00a0To install MinGW you must follow these steps:<\/p>\n<ol>\n<li>Download the installer of the last version of <a title=\"MinGW download\" href=\"http:\/\/sourceforge.net\/projects\/mingw\/files\/latest\/download?source=directory\" target=\"_blank\">MinGW<\/a>.<\/li>\n<li>Run the installation manager. Select a simple path, for example c:\\mingw.<\/li>\n<li>Fortran and Ada compilers are not needed. You can skip.<\/li>\n<\/ol>\n<h3>MinGW64 installation.<\/h3>\n<p>MinGW64 is based on MinGW but is able to compile 64 bits applications. To install MinGW64 follow these steps:<\/p>\n<ol>\n<li>Download the <a title=\"MinGW-builds project\" href=\"http:\/\/mingw-w64.sourceforge.net\/download.php#mingw-builds\">Mingw-builds project<\/a> from its web page.<\/li>\n<li>Run the installer and select the specify set up settings.\n<ul>\n<li>Version: The last one.<\/li>\n<li>Architecture: Depend on your computer.<\/li>\n<li>Threads: Win32<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>TDM-GCC intallation.<\/h3>\n<p>Another tool based on MinGW which is able to compile applications for 32 and 64 bits. To install it, follow these steps:<\/p>\n<ol>\n<li>Donwload <a title=\"TDM-GCC\" href=\"http:\/\/sourceforge.net\/projects\/tdm-gcc\/files\/TDM-GCC%20Installer\/tdm-gcc-webdl.exe\/download\" target=\"_blank\">TDM-GCC<\/a> from its web page.<\/li>\n<li>Run the installer and follow the instructions.<\/li>\n<\/ol>\n<h2>Using Eclipse and\u00a0GCC for Windows<\/h2>\n<p>In order to compile OpenWAM using Eclipse and GCC for Windows\u00a0you need the following tools.<\/p>\n<ul>\n<li><a title=\"Eclipse Standard\" href=\"http:\/\/www.eclipse.org\/downloads\/\" target=\"_blank\">Eclipse Installer<\/a><\/li>\n<li><a title=\"MinGW\" href=\"http:\/\/www.mingw.org\" target=\"_blank\">MinGW<\/a>,\u00a0<a title=\"MinGW64\" href=\"http:\/\/mingw-w64.sourceforge.net\/\" target=\"_blank\">MinGW64<\/a>\u00a0or <a title=\"TDM GCC\" href=\"http:\/\/tdm-gcc.tdragon.net\/\" target=\"_blank\">TDM-gcc<\/a><\/li>\n<\/ul>\n<h3>Eclipse Installation.<\/h3>\n<p>To install eclipse you must follow these steps:<\/p>\n<ol>\n<li>Donwload Eclipse Intaller. You can chose a different package for 32 and for 64 bits architecture.<\/li>\n<li>Select Eclipse IDE for C\/C++ Developers.<\/li>\n<li>Run Eclipse doing double click on eclipse.exe.<\/li>\n<\/ol>\n<h3>Generate and compile the Eclipse project.<\/h3>\n<p>In order to compile OpewWAM using Eclipse and MinGW you must follow these steps:<\/p>\n<ol>\n<li>Run CMake (cmake-gui).<\/li>\n<li>Where is the source code: Select the folder where is place de source code and the CMakeList.txt (${PROJECT_SOURCE_DIR}).<\/li>\n<li>Where to build the binaries: Select the folder where the Eclipse project will be created and where the OpenWAM binary will be built (${PROJECT_BINARY_DIR}).<\/li>\n<li>Press the Configure button.<\/li>\n<li>Specify the generator for this project: Eclipse CDT4 &#8211; MinGW Makefiles.<\/li>\n<li>I you have only one installation of MinGW or MinGW64 and the path correctly configure probably CMake will find the binaries of the compiler. Then select &#8220;Use default native compilers&#8221;.<\/li>\n<li>In other case, or if problems appear using the previous option select &#8220;Specify native compilers&#8221;.<\/li>\n<li>If you use step 7 select the compilers. gcc.exe for C and g++ for C++. Both files must be placed in the bin folder of the GCC for Windows\u00a0installation.<\/li>\n<li>If the following error appear: &#8220;Error in configuration process, project files may be invalid&#8221; and CMAKE_MAKE_PROGRAM is set to CMAKE_MAKE_PROGRAM-<br \/>\nNOTFOUND, set it to the mingw32-make.exe file that is found in the bin folder<br \/>\nof the MinGW installation. Check Advanced option to correct this error.<\/li>\n<li>Press configure button again.<\/li>\n<li>If you want to add to OpenWAM the capability to run in parallel, select BUILD_PARALLEL.<\/li>\n<li>If\u00a0CMAKE_ECLIPSE_EXECUTABLE-NOTFOUND select the eclipse.exe.<\/li>\n<li>CMAKE_CXX_FLAGS and\u00a0CMAKE_C_FLAGS\n<ul>\n<li>-static: The openwam.exe is compiled statically. Not additional DLL are needed to run it.<\/li>\n<li>-m: -m32 to generate\u00a0a 32 bits application and -m64 to generate a 64 bits application.<\/li>\n<li>-march=xxx: Architecture of the computer:<\/li>\n<li>Recommended flags for 32 bits application:\u00a0<strong>-m32 -fomit-frame-pointer -march=pentiumpro -pipe -static<\/strong>.<\/li>\n<li>Recommended flags for 64 bits application:<strong>\u00a0-march=x86-64 -mtune=generic -m64 -pipe -static<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>CMAKE_RC_FLAGS: For 32 bits compilations in Windows use -F pe-i386.<\/li>\n<li>CMAKE_BUILD_TYPE: Select between Release, Debug, MinSizeRel\u00a0or\u00a0RelWithDebInfo<\/li>\n<li>Press configure button until all parameter are\u00a0not in red.<\/li>\n<li>Press generate button.<\/li>\n<li>Close CMake.<\/li>\n<li>Run eclipse.<\/li>\n<li>Select the default workspace.<\/li>\n<li>File-&gt; Import -&gt; Existing project into workspace and press next.<\/li>\n<li>Select root directory: Browse the folder where CMake created the eclipse project and press finish.<\/li>\n<li>The project is now open in Eclipse. In order to build it, go to Make Target window and do double-click on the target &#8220;all&#8221;.<\/li>\n<\/ol>\n<h2>Using Microsoft Visual Studio.<\/h2>\n<p><span style=\"color: #333333;\">In order to compile OpenWAM using Microsoft Visual Studio\u00a0you need the following tools.<\/span><\/p>\n<ul>\n<li><a title=\"Microsoft Visual Studio\" href=\"http:\/\/www.visualstudio.com\/\" target=\"_blank\">Microsoft Visual Studio<\/a>. During the installation the c++ capability must be selected.<\/li>\n<li><a title=\"Visual C++ Redistributable Packages\" href=\"http:\/\/www.microsoft.com\/en-us\/search\/DownloadResults.aspx?q=redistributable%20packages\" target=\"_blank\">Visual C++ Redistributable Packages for Visual Studio<\/a>. If you compile OpenWAM with Visual Studio you must install this tool in the computer where openwam will run if Visual Studio is not installed. You need the version of the Redistributable Packages depending on the version of the Visal Studio used to compile.<\/li>\n<\/ul>\n<h3>Generate and compile the Visual Studio project.<\/h3>\n<ol>\n<li>Run CMake (cmake-gui).<\/li>\n<li>Where is the source code: Select the folder where is place de source code and the CMakeList.txt (${PROJECT_SOURCE_DIR}).<\/li>\n<li>Where to build the binaries: Select the folder where the Visual Studio\u00a0project will be created and where the OpenWAM binary will be built (${PROJECT_BINARY_DIR}).<\/li>\n<li>Press the Configure button.<\/li>\n<li>Specify the generator for this project:\u00a0Visual Studio XX 20XX. Select sufix Win64 for a 64 bits application.<\/li>\n<li>Select &#8220;Use default native compilers&#8221;.<\/li>\n<li>Press configure button again.<\/li>\n<li>If you want to add to OpenWAM the capability to run in parallel, select BUILD_PARALLEL.<\/li>\n<li>Press configure button until all parameter are\u00a0not in red.<\/li>\n<li>Press generate button.<\/li>\n<li>Close CMake.<\/li>\n<li>Run Visual Studio.<\/li>\n<li>Open the solution generated in the folder\u00a0${PROJECT_BINARY_DIR}<\/li>\n<li>The project is now open in Visual Studio. In order to build it, go to Compile -&gt; Compile Solution (F7).<\/li>\n<\/ol>\n<h1>Linux platform.<\/h1>\n<h2>Using Eclipse and GCC.<\/h2>\n<p>In order to compile OpenWAM using Eclipse and GCC\u00a0you need to install the following packages form your linux distribution repository.<\/p>\n<ul>\n<li>Eclipse.<\/li>\n<li>Eclipse-cdt<\/li>\n<li>CMake<\/li>\n<\/ul>\n<h3>Generate and compile the\u00a0Eclipse project.<\/h3>\n<ol>\n<li>Run CMake (cmake-gui).<\/li>\n<li>Where is the source code: Select the folder where is place de source code and the CMakeList.txt (${PROJECT_SOURCE_DIR}).<\/li>\n<li>Where to build the binaries: Select the folder where the Eclipse project will be created and where the OpenWAM binary will be built (${PROJECT_BINARY_DIR}).<\/li>\n<li>Press the Configure button.<\/li>\n<li>Specify the generator for this project: Eclipse CDT4 &#8211; Unix\u00a0Makefiles.<\/li>\n<li>Select &#8220;Use default native compilers&#8221;.<\/li>\n<li>Press configure button again.<\/li>\n<li>If you want to add to OpenWAM the capability to run in parallel, select BUILD_PARALLEL.<\/li>\n<li>CMAKE_CXX_FLAGS and\u00a0CMAKE_C_FLAGS\n<ul>\n<li>-static: The openwam.exe is compiled statically. Not additional DLL are needed to run it.<\/li>\n<li>-m: -m32 to generate\u00a0a 32 bits application and -m64 to generate a 64 bits application.<\/li>\n<li>-march=xxx: Architecture of the computer:<\/li>\n<li>Recommended flags for 32 bits application:\u00a0<strong>-m32 -fomit-frame-pointer -march=pentiumpro -pipe -static.<\/strong><\/li>\n<li>Recommended flags for 64 bits application:\u00a0<strong>-march=x86-64 -mtune=generic -m64 -pipe -static<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>CMAKE_BUILD_TYPE: Select between Release, Debug, MinSizeRel\u00a0or\u00a0RelWithDebInfo<\/li>\n<li>Press configure button until all parameter are\u00a0not in red.<\/li>\n<li>Press generate button.<\/li>\n<li>Close CMake.<\/li>\n<li>Run eclipse.<\/li>\n<li>Select the default workspace.<\/li>\n<li>File-&gt; Import -&gt; Existing project into workspace and press next.<\/li>\n<li>Select root directory: Browse the folder where CMake created the eclipse project and press finish.<\/li>\n<li>The project is now open in Eclipse. In order to build it, go to Make Target window and do double-click on the target &#8220;all&#8221;.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-120","post","type-post","status-publish","format-standard","hentry","category-code-development"],"_links":{"self":[{"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=\/wp\/v2\/posts\/120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=120"}],"version-history":[{"count":29,"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=\/wp\/v2\/posts\/120\/revisions"}],"predecessor-version":[{"id":695,"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=\/wp\/v2\/posts\/120\/revisions\/695"}],"wp:attachment":[{"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openwam.webs.upv.es\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}