How to compile OpenWAM

Contents

Introduction.

OpenWAM is written in C++ using the standars of c++11. The project is based on CMake 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 www.cmake.org or from the linux repository.

Windows platform.

Installation of GCC for Windows.

MinGW installation.

MinGW is a native 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. To install MinGW you must follow these steps:

  1. Download the installer of the last version of MinGW.
  2. Run the installation manager. Select a simple path, for example c:\mingw.
  3. Fortran and Ada compilers are not needed. You can skip.

MinGW64 installation.

MinGW64 is based on MinGW but is able to compile 64 bits applications. To install MinGW64 follow these steps:

  1. Download the Mingw-builds project from its web page.
  2. Run the installer and select the specify set up settings.
    • Version: The last one.
    • Architecture: Depend on your computer.
    • Threads: Win32

TDM-GCC intallation.

Another tool based on MinGW which is able to compile applications for 32 and 64 bits. To install it, follow these steps:

  1. Donwload TDM-GCC from its web page.
  2. Run the installer and follow the instructions.

Using Eclipse and GCC for Windows

In order to compile OpenWAM using Eclipse and GCC for Windows you need the following tools.

Eclipse Installation.

To install eclipse you must follow these steps:

  1. Donwload Eclipse Intaller. You can chose a different package for 32 and for 64 bits architecture.
  2. Select Eclipse IDE for C/C++ Developers.
  3. Run Eclipse doing double click on eclipse.exe.

Generate and compile the Eclipse project.

In order to compile OpewWAM using Eclipse and MinGW you must follow these steps:

  1. Run CMake (cmake-gui).
  2. Where is the source code: Select the folder where is place de source code and the CMakeList.txt (${PROJECT_SOURCE_DIR}).
  3. 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}).
  4. Press the Configure button.
  5. Specify the generator for this project: Eclipse CDT4 – MinGW Makefiles.
  6. 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 “Use default native compilers”.
  7. In other case, or if problems appear using the previous option select “Specify native compilers”.
  8. 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 installation.
  9. If the following error appear: “Error in configuration process, project files may be invalid” and CMAKE_MAKE_PROGRAM is set to CMAKE_MAKE_PROGRAM-
    NOTFOUND, set it to the mingw32-make.exe file that is found in the bin folder
    of the MinGW installation. Check Advanced option to correct this error.
  10. Press configure button again.
  11. If you want to add to OpenWAM the capability to run in parallel, select BUILD_PARALLEL.
  12. If CMAKE_ECLIPSE_EXECUTABLE-NOTFOUND select the eclipse.exe.
  13. CMAKE_CXX_FLAGS and CMAKE_C_FLAGS
    • -static: The openwam.exe is compiled statically. Not additional DLL are needed to run it.
    • -m: -m32 to generate a 32 bits application and -m64 to generate a 64 bits application.
    • -march=xxx: Architecture of the computer:
    • Recommended flags for 32 bits application: -m32 -fomit-frame-pointer -march=pentiumpro -pipe -static.
    • Recommended flags for 64 bits application: -march=x86-64 -mtune=generic -m64 -pipe -static
  14. CMAKE_RC_FLAGS: For 32 bits compilations in Windows use -F pe-i386.
  15. CMAKE_BUILD_TYPE: Select between Release, Debug, MinSizeRel or RelWithDebInfo
  16. Press configure button until all parameter are not in red.
  17. Press generate button.
  18. Close CMake.
  19. Run eclipse.
  20. Select the default workspace.
  21. File-> Import -> Existing project into workspace and press next.
  22. Select root directory: Browse the folder where CMake created the eclipse project and press finish.
  23. The project is now open in Eclipse. In order to build it, go to Make Target window and do double-click on the target “all”.

Using Microsoft Visual Studio.

In order to compile OpenWAM using Microsoft Visual Studio you need the following tools.

  • Microsoft Visual Studio. During the installation the c++ capability must be selected.
  • Visual C++ Redistributable Packages for Visual Studio. 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.

Generate and compile the Visual Studio project.

  1. Run CMake (cmake-gui).
  2. Where is the source code: Select the folder where is place de source code and the CMakeList.txt (${PROJECT_SOURCE_DIR}).
  3. Where to build the binaries: Select the folder where the Visual Studio project will be created and where the OpenWAM binary will be built (${PROJECT_BINARY_DIR}).
  4. Press the Configure button.
  5. Specify the generator for this project: Visual Studio XX 20XX. Select sufix Win64 for a 64 bits application.
  6. Select “Use default native compilers”.
  7. Press configure button again.
  8. If you want to add to OpenWAM the capability to run in parallel, select BUILD_PARALLEL.
  9. Press configure button until all parameter are not in red.
  10. Press generate button.
  11. Close CMake.
  12. Run Visual Studio.
  13. Open the solution generated in the folder ${PROJECT_BINARY_DIR}
  14. The project is now open in Visual Studio. In order to build it, go to Compile -> Compile Solution (F7).

Linux platform.

Using Eclipse and GCC.

In order to compile OpenWAM using Eclipse and GCC you need to install the following packages form your linux distribution repository.

  • Eclipse.
  • Eclipse-cdt
  • CMake

Generate and compile the Eclipse project.

  1. Run CMake (cmake-gui).
  2. Where is the source code: Select the folder where is place de source code and the CMakeList.txt (${PROJECT_SOURCE_DIR}).
  3. 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}).
  4. Press the Configure button.
  5. Specify the generator for this project: Eclipse CDT4 – Unix Makefiles.
  6. Select “Use default native compilers”.
  7. Press configure button again.
  8. If you want to add to OpenWAM the capability to run in parallel, select BUILD_PARALLEL.
  9. CMAKE_CXX_FLAGS and CMAKE_C_FLAGS
    • -static: The openwam.exe is compiled statically. Not additional DLL are needed to run it.
    • -m: -m32 to generate a 32 bits application and -m64 to generate a 64 bits application.
    • -march=xxx: Architecture of the computer:
    • Recommended flags for 32 bits application: -m32 -fomit-frame-pointer -march=pentiumpro -pipe -static.
    • Recommended flags for 64 bits application: -march=x86-64 -mtune=generic -m64 -pipe -static
  10. CMAKE_BUILD_TYPE: Select between Release, Debug, MinSizeRel or RelWithDebInfo
  11. Press configure button until all parameter are not in red.
  12. Press generate button.
  13. Close CMake.
  14. Run eclipse.
  15. Select the default workspace.
  16. File-> Import -> Existing project into workspace and press next.
  17. Select root directory: Browse the folder where CMake created the eclipse project and press finish.
  18. The project is now open in Eclipse. In order to build it, go to Make Target window and do double-click on the target “all”.

 

Bookmark the permalink.

Comments are closed.