User Tools

Site Tools


installation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
installation [2013/04/06 11:36]
smilauer
installation [2017/06/21 17:25] (current)
edita [Windows installation under MinGW environment]
Line 26: Line 26:
 The oofem.git directory has been created with OOFEM source tree.  The oofem.git directory has been created with OOFEM source tree. 
  
-  cd oofem.git+  cd oofem.git ​
   ​   ​
 Once you've checked out a copy of the source tree, you can update your source tree at any time so it is in sync with the latest and greatest by entering your oofem directory and running the command: Once you've checked out a copy of the source tree, you can update your source tree at any time so it is in sync with the latest and greatest by entering your oofem directory and running the command:
Line 71: Line 71:
   * The oofem executable will be created in ~/​build/​debug directory   * The oofem executable will be created in ~/​build/​debug directory
  
 +  * **Important notice:** Use the debug build while you get everything to work, but make sure to compile an optimized version for running serious simulations (CMAKE_BUILD_TYPE=Release). The optimized version will be orders of magnitudes faster than the Debug build.
 +
 +    mkdir -p ~/​build/​release/​
 +    cd ~/​build/​release/​
 +    cmake -DCMAKE_BUILD_TYPE=Release ~/​oofem.git/​
 +    make
 +    ​
 ==== Build options ==== ==== Build options ====
  
Line 79: Line 86:
 Some common build options Some common build options
  
 +  * **CMAKE_BUILD_TYPE** specifies between Debug, Release
   * **%%CMAKE_CXX_FLAGS="​flags"​%%** allows to specify compiler flags   * **%%CMAKE_CXX_FLAGS="​flags"​%%** allows to specify compiler flags
   * **%%USE_DSS="​ON"​%%** will include sparse direct solver. ​   * **%%USE_DSS="​ON"​%%** will include sparse direct solver. ​
Line 123: Line 131:
   * [[http://​www.bloodshed.net/​dev/​devcpp.html|Dev-C++]] is is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as its compiler. It creates native Win32 executables. Dev-C++ is Free Software. ​   * [[http://​www.bloodshed.net/​dev/​devcpp.html|Dev-C++]] is is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as its compiler. It creates native Win32 executables. Dev-C++ is Free Software. ​
   * [[http://​www.cmake.org|CMake]] is the cross-platform build tool OOFEM uses, and is able to generate build files for Visual Studio. See further instructions on the [[CMake|CMake]] wiki page.   * [[http://​www.cmake.org|CMake]] is the cross-platform build tool OOFEM uses, and is able to generate build files for Visual Studio. See further instructions on the [[CMake|CMake]] wiki page.
 +  * [[https://​code.google.com/​p/​tortoisegit/​wiki/​Download?​tm=2|TortoiseGit]] is the most intuitive Git client for Windows.
 +  * [[http://​www.paraview.org/​|ParaView]] is a good and free replacement for oofeg under Windows.
 +
 ===== Windows installation under MinGW environment ===== ===== Windows installation under MinGW environment =====
   * MinGW uses standard GNU g++ compiler. In a standard MinGW instalation,​ a few libraries included in oofem are missing (sys/​resource.h,​ execinfo.h). These are not included during cmakeing and compilation for MinGW compilation.   * MinGW uses standard GNU g++ compiler. In a standard MinGW instalation,​ a few libraries included in oofem are missing (sys/​resource.h,​ execinfo.h). These are not included during cmakeing and compilation for MinGW compilation.
-  * Under Windows, install ​mingw, C, C++ and MSys as a terminal. Download these from [[http://​sourceforge.net/​projects/​mingw/​files/​Installer/​mingw-get-inst/mingw-get-inst-20120426/​mingw-get-inst-20120426.exe/​download|installator]].+  * Under Windows, install [[http://​sourceforge.net/​projects/​mingw-w64/|mingw]] ​including C, C++ and MSys as a terminal
   * You may want installing windows version of [[http://​git-scm.com/​download/​win|Git]]. Getting the development version of oofem is through a command <​code>​$git.exe clone http://​www.oofem.org/​git/​oofem.git oofem.git</​code>​   * You may want installing windows version of [[http://​git-scm.com/​download/​win|Git]]. Getting the development version of oofem is through a command <​code>​$git.exe clone http://​www.oofem.org/​git/​oofem.git oofem.git</​code>​
-  * Under oofem.git directory, create a new directory, e.g. //target//. Under //target// run <​code>​$cmake.exe -G"​MinGW Makefiles" ​..</​code> ​ It is needed sometimes ​to run this command twiceThis ensures creating makefiles for MinGW+  * Install the latest version of [[http://cmake.org/download/|cmake]]. 
-  * Run $mingw32-make.exe to compile. ​oofem.exe is created+  * Run a batch at C:\Program Files\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw-w64.bat,​ it sets up a PATH to mingw32-make.exe and opens a new terminal. Do not close it
-  * [[https://​github.com/​leethomason/​tinyxml2|TinyXML2]] is required to read input files for CEMHYD3D module. TinyXML2 can be installed. For windows it needs to be compiled into a shared library libtinyxml2.dll. Proceed in a standard way for cmake files. Create a new subdirectory , e.g. //target//. Under //target// run <​code>​$cmake.exe -G "MinGW Makefiles"​ ..</​code>​ a few times. Cmake starts to complain about a missing RC compiler. Edit CMakeCache.txt and edit line specifying RC compiler, to make e.g. CMAKE_RC_COMPILER:​FILEPATH=c:/​MinGW/​bin/​windres.exe. Run ''​$mingw32-make.exe''​. A shared library is created. To compile oofem with CEMHYD and TinyXML2 support, run <​code>​$cmake.exe -G"​MinGW Makefiles"​ -DUSE_CEMHYD="​ON"​ -DTINYXML2_DIR="/​c/​oofem/​tinyxml/"​ ..</​code>​ and than  <​code>​$mingw32-make.exe</​code>​ +  * In that terminal run graphical CMake: "​C:​\Program Files\CMake\bin\cmake-gui" 
-  * If oofem.exe complains about missing libtinyxml2.dll,​ add the location to the system path or copy libtinyxml2.dll in the same directory as oofem.exe. +    * In CMake set up a path to your oofem.git folder (Browse Source button).  
-  oofem.exe with static librariesiml support and optimized version is build via <​code>​$cmake.exe -G"​MinGW Makefiles" ​-DCMAKE_CXX_FLAGS="-O2" ​-DUSE_IML="ON" -DUSE_STATIC_LIB="​ON" .. +    * Create a new project folder (e.g. build) and set up a path to it (Browse Build button). Put a tick in "​Advanced"​ checkbox and then click Configure. A new window appears. Specify the generator "MinGW Makefiles"​ and "Use default native compilers",​ click Finish.  
-$mingw32-make.exe +    * Select packages and modules you want to use (or just keep the default settings). Write string "​RELASE"​ (with capitals) or "​DEBUG"​ in CMAKE_BUILD_TYPE. Uncheck "​USE_SHARED_LIB"​. Hit Configure again and then click Generate. 
-</​code>​If you want smoothless transfer ​of oofem.exe to another windows computer, you need to put all *.dll from c:\MinGW\bin in the same directory as oofem.exe.+    ​* [[https://​github.com/​leethomason/​tinyxml2|TinyXML2]] is required to read input files for CEMHYD3D module. TinyXML2 can be installed. For windows it needs to be compiled into a shared library libtinyxml2.dll. Proceed in a standard way for cmake files. Create a new subdirectory , e.g. //target//. Under //target// run <​code>​$cmake.exe -G "MinGW Makefiles"​ ..</​code>​ a few times. Cmake starts to complain about a missing RC compiler. Edit CMakeCache.txt and edit line specifying RC compiler, to make e.g. CMAKE_RC_COMPILER:​FILEPATH=c:/​MinGW/​bin/​windres.exe. Run ''​$mingw32-make.exe''​. A shared library is created. To compile oofem with CEMHYD and TinyXML2 support, run <​code>​$cmake.exe -G"​MinGW Makefiles"​ -DUSE_CEMHYD="​ON"​ -DTINYXML2_DIR="/​c/​oofem/​tinyxml/"​ ..</​code>​ and than  <​code>​$mingw32-make.exe</​code>​ 
 +    * If oofem.exe complains about missing libtinyxml2.dll,​ add the location to the system path or copy libtinyxml2.dll in the same directory as oofem.exe. 
 +    Close CMake, but do not close the terminalOpen your project foldere.g. cd C:​\OOFEM\build 
 +  * Type mingw32-make -j3 to compile oofem using 3 cores. (Building release took approx. 15 minutes.) 
 +  * In case of error caused by multiple definition of '​vsnprintf'​ add -D__USE_MINGW_ANSI_STDIO=0 in CMAKE_CXX_FLAGS and regenerate makefiles. 
 +  * Run oofem tests: ​"mingw32-make tests -j3" ​and benchmarks ​"mingw32-make benchmarks -j3" 
 +  * The size of oofem with debug options is approx 740 MB, release 10.2 MB 
 +  * In order to use oofem on a different computer it is essential to transfer all *.dll'​s from MinGW/bin alonside oofem. Copy them in the same folder as oofem.exe (8 files, 3.5 MB) 
 + 
 + 
 +===== Windows installation with Visual Studio ===== 
 +  * Visual Studio 2013 is advised, since it fully supports C++11 specifications,​ see [[http://​msdn.microsoft.com/​en-us/​library/​hh567368.aspx|here]]. You can use the Express for Windows Desktop edition, freely available [[http://​www.visualstudio.com/​en-us/​products/​visual-studio-express-vs.aspx|here]]
 +  * Get oofem code from Git repository as explained previously or, if you're using [[https://​code.google.com/​p/​tortoisegit/​wiki/​Download?​tm=2|TortoiseGit]],​ simply create a new folder (e.g. ''​C:​\oofem''​),​ right-click on it and select ''​Git clone...''​ from the contextual menu. In the window that appears, use the address:<​code>​http://​www.oofem.org/​git/​oofem.git</​code>​ 
 +  * Install [[https://​cmake.org/​download/​|cmake]]. 
 +  * Start the VS2013 command prompt (choose x86 if you want a 32-bit compilation),​ and type ''​cmake-gui''​ and press enter to load the graphic interface for CMake. The bin folder in CMake installation directory must in system path; if the command does not work, add it and restart the prompt. 
 +  * In the CMake window, insert the path the previously downloaded oofem.git copy (e.g. ''​C:​\oofem''​) in the fieds ''​Where is the source code:''​ and ''​Where to build the binaries:''​ and click ''​Configure''​ twice. Select in the data line now displayed in the main panel all the packages you want to include in your built (''​USE_...''​ flags). You can also leave the default checks. Finally press ''​Generate''​ and choose in the window that would appear ''​Visual Studio 12 2013''​ and ''​Use native compiler''​. 
 +  * Now in the oofem folder (e.g. ''​C:​\oofem''​) double-click on ''​oofem.sln''​ to start VS; right-click on the ''​oofem''​ project and click on ''​Set as StartUp Project''​. Compile the solution. You can find the resulting ''​oofem.exe''​ inside the ''​Debug'',​ ''​Release'',​ ''​MinSizeRel''​ or ''​RelWithDebInfo''​ folder. 
 +  * If you want to smoothless transfer oofem.exe to another windows computer, you may have to install [[http://​www.microsoft.com/​en-us/​download/​details.aspx?​id=40784|VC++ 2013 redistributable package]].  
 +  ​For the best debugging experience in VS, please deselect ''​USE_SHARED_LIB''​ in CMake to generate a monolithic executable. 
 +  * There are different configurations for Debug and Release versions under VS->​Configuration manager->​Active solution configuration. Debug version is generally slower and contains debugging symbols. Users usually choose Release version which is optimized for speed.  
 + 
 +If you plan to redistribute the OOFEM executable to Windows XP machines, you must set the property ''​Visual Studio 2013 - Windows XP (v120_xp)''​ in ''​Configuration Properties\General\Platform Toolset''​ from the ''​oofem''​ project settings.
  
 +If you're interested in **parallel version for Windows**, go [[installing_optional#​[Parallel version for Windows]|here]].
installation.1365240966.txt.gz · Last modified: 2013/04/06 11:36 by smilauer