/**

  @page install_win Building %OpenMS on Windows

  @section install_win_read Introduction


  This document addresses %OpenMS users and explains the
  installation procedure for building %OpenMS from its sources. If you only want to use the %OpenMS Proteomics Pipeline (TOPP), you are strongly
  encouraged to <b>download the windows binary installer</b>
  (see <a href="http://www.OpenMS.de/download/" target="_blank">here</a>),
  instead of building %OpenMS from sources.
  For more information read the install instructions for the TOPP binaries.

  This document especially considers the installation of several libraries which are required by %OpenMS.
  Most of these libraries are made available in our "contrib-package" (see below).
  <br>
  If you encounter errors during configuring/compiling our software, have a look at our "Known Issues" section \ref known_dev_bugs "here",
  maybe the error is already known. If not, please write to the <a href="open-ms-general@lists.sourceforge.net" target="_new">mailing list</a>.
  <br>
  <br>


  <b>Notation of this tutorial</b>
     <ul>
        <li>A string in &lt;&gt; is something the user needs to choose e.g. &lt;path_to_contrib&gt; means that this string should be replaced by the path where the user put the %OpenMS contrib package. Usually all commands where this is necessary come with examples, so don't worry.
        <li>Whenever you added a path to your Windows PATH Environment variable, every Command Prompt which is already open will not be refreshed. You will need a to open a new one.
     </ul>


  @section install_win_setup Setup of environment

    <b>Pre-Requisites (Software)</b>
    <ul>
      <li><b>Visual Studio</b>: VS2015 and above are supported, but we thoroughly recommend <b>VS2019</b> (faster compilation, faster executables and it fixes a bug in OpenMP multithreading - see <a href="https://github.com/OpenMS/OpenMS/issues/4389" target="_new">issue #4389</a>).
             The C++ Express editions should work as well, we tested VSE2015 Update 3.
        <br><b>Not supported are MinGW (g++ based compiler) and VS2013 (and earlier, due to missing C11 support). Do not use a MinGW-enabled shell since CMake will get confused! Please use the Command Prompt of the Visual Studio version you want to build with.</b>
            Other compilers which are close to the VS toolchain might work, but are not tested.
      <li><b>CMake</b>: Have at least CMake 3.1 or greater installed (see http://www.cmake.org). For building with our contrib package please use 3.14+. <br>
	      CMake's Generator (-G flag) also must support your version of Visual Studio. If it doesn't, please upgrade CMake.<br>
      <li><b>7-Zip</b>: To extract archives within submodules of the contrib you will need <tt>7-Zip</tt> (see http://www.7-zip.org/)
        <br>7z.exe is searched in "C:/Program Files/7-Zip/" and "C:/Programme/7-Zip/". Make sure it is in either of these locations or add
        the installation directory to your PATH.
    </ul>


  @section install_win_required Installing required dependency libraries

    %OpenMS depends on several other libraries. On a Windows system, these are usually not present.

  @subsection install_win_contrib Contrib installation
        In order to make the
        installation of the remaining required libraries easier, we composed a
        "contrib-package" containing the libraries Boost, Eigen, sqlite3, CoinMP, WildMagic, libSVM, libHDF5, SeqAn, glpk, zlib, libbz2 and Xerces-C.
        This contrib package has several advantages over manual installation
        <ul>
            <li>You get all the libraries in versions tested with %OpenMS.</li>
            <li>It contains a batch script that builds all the libraries in one step.</li>
            <li>You don't have to spend hours reading installation instructions of all the libraries.</li>
            <li>We applied some patches to the libraries to fix some bugs. <BR><b>These bugs may be fatal if you do not use the contrib package.</b></li>
        </ul>

    @b Download:

    If you plan to use the development version of %OpenMS, clone %OpenMS and checkout the optional contrib submodule with
    \code
    git clone https://github.com/OpenMS/OpenMS
    git submodule update --init contrib
    \endcode
    to obtain the latest potentially unstable version.
    If you want to use a release version of %OpenMS, use the corresponding Release-tagged version
    on GitHub (https://github.com/OpenMS/contrib/releases) or download the contrib source from a .tar.gz
    for older releases.

    @b Installation:

    After you got the source code for the contrib package follow these steps:

    <ol>
      <li>Open a <b>VisualStudio Developer Command prompt</b> (by default you will get a 32-bit environment which you most likely do not want; use a x64 environment if you want 64 bit apps!)<br>
					@note VS2015 does not provide a commandline shortcut for a 64bit command prompt. Call <tt>"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64</tt> to get one!
					@note VS2017 has a (well hidden) batch-file which correctly configures your environment for 64bit builds. It should be located at
					<tt>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"</tt>. (Same goes for VS2019)
      <li>Create a build directory for the %OpenMS contrib<br>
          e.g. <tt>mkdir contrib_win64_build</tt>
      <li>Call CMake to build the contrib<br>
        Be aware that you can build 64bit apps even if your operating system is only 32bit (cross-compiling), but you will not be
        able to run 64bit apps in this case.

        \code
        cd <path_to_contrib_build>
        cmake -DBUILD_TYPE=ALL -DNUMBER_OF_JOBS=4 -G "<generator>" -A x64 "<path_to_contrib>"
        \endcode

        The <tt>&lt;generator&gt;</tt> you use must be one of the Visual Studio Generators. This is because some contrib libs require Visual Studio to build.
        Use the <tt>-A x64</tt> flag to build 64-bit libraries for the contrib (32-bit does not really make any sense for LC-MS data processing)!
        Type <tt>cmake -help</tt> to see a list of available generators.<br>

        Example:
        \code
        cd c:\dev\contrib_win64_build
        cmake -DBUILD_TYPE=ALL -DNUMBER_OF_JOBS=4 -G "Visual Studio 16 2019" -A x64 "c:\dev\OpenMS\contrib"
        \endcode

      <li>Add the &lt;path_to_contrib_build&gt;/lib directory to your PATH Environment Variable (this is so Windows can find the DLL's when running our executables).
    </ol>

	@subsection install_qt QT installation

    Qt comes in two flavors: commercial or non-commercial - choose whatever is applicable to you: read more on the Qt website
    For several recent QT5 versions, there are binary development versions available for the most recent compilers. Go to https://www.qt.io/download
    and click on "Go open source" at the end of the right column to download the installer. Follow steps, download, save and run the installer.
    Create a Qt account. Choose a folder like "c:\dev\QT". From the components choose a matching version, e.g. QT 5.10.0 and the MSVC component that fits
    your Visual Studio version and architecture (most likely only 64bit is supported anymore). You can deselect QTCreator under Tools.
    Accept the license, choose startmenu entries if wanted and install. Resulting files appear under "c:\dev\QT\$VERSION".

    To build Qt from sources, download Qt5 from their git repository ad follow the steps below:

    Follow this procedure if you want to compile Qt yourself:
    <ol>
      <li>non-commercial:
        <ol>
          <li>install perl (e.g. Strawberry Perl), Python and git
          <li>download <b>Qt5 source</b> via git or as a source package from the website:
            \code
            git clone git://github.com/qt/qt5 --branch 5.9 qt-5.9
            \endcode
          <li>activate the needed modules via:
            \code
             perl init-repository --module-subset="essential,qtsvg" --branch
            \endcode
          <li>open a Visual Studio Command Line (use x64 version if you want 64bit apps!)
          <li>
            \code
            cd qt-5.9
            \endcode
          <li>if you have multiple versions of VS installed you might need to provide the <tt>-platform</tt> param for the next configure command (e.g., <tt>-platform win32-msvc2012</tt>)
          <li>To save disk space, we use the <tt>-prefix</tt> switch to install only the required parts of Qt to a new directory of your choice (called <tt>&lt;path-to-qt&gt;</tt>, e.g. <tt>c:/dev/Qt/5.9/</tt>).
              Check more options and supported compilers here: http://doc.qt.io/qt-5/configure-options.html (especially for developers). Note that part of Qt requires Python to compile, so its a good idea to add the Python executable to your path
            \code
            PATH=%PATH%;C:\Python27\
            configure -opensource -skip speech -skip location -nomake tests -nomake examples -confirm-license -opengl dynamic -prefix <path-to-qt> -platform win32-msvc 
            \endcode
          <li>
            \code
            nmake
            \endcode
          <li>
	    \code
	    nmake install
	    \endcode
          <li>all Qt files (libs, includes etc) are now in <tt><path-to-qt></tt> and sub-directories.
          <li>alternatively to nmake, you can download JOM (http://qt-project.org/wiki/jom) and type "jom" and subsequently "jom install" in your Qt build directory to use multiple cores (builds a lot faster usually)
        </ol>
      <li>commercial:
        <ol>
          <li>we have no experience here, but it should be possible to get the DLL's and Link-Libraries here as well.
        </ol>
      <li>add the <tt>&lt;path-to-qt&gt;/bin</tt> (!) directory to your PATH Environment Variable, so the dlls are found during runtime.
      <li>set the environment variable QT_QPA_PLATFORM_PLUGIN_PATH to <tt>&lt;path-to-qt&gt;/plugins/platforms</tt>,
          otherwise you might get an error "This application failed to start because it could not find or load the Qt platform plugin "windows".
          Alternatively, you can copy the entire platforms-folder into the folder where your %OpenMS executables will be created (but they will depend on the build-type, i.e. release|debug|...).
    </ol>



@section create_doc Building the documentation (optional)

  This section is optional. If you can live with the online documentation, you do not need to build your own.

  In order to build the class documentation (<tt>doc</tt> & <tt>doc_internal</tt> targets), TOPP tutorials (<tt>doc_tutorials</tt> target) and more,
  you will need to install three programs:

  <ol>
    <li> Doxygen (1.8.16 is tested, others might work as well; older versions might produce errors or incomplete documentation due to lack of support for certain commands or bugs)
      <ul>
        <li> Download the installer for Windows (http://www.doxygen.org)
        <li> Execute the installer. It should automatically add doxygen.exe to the Windows PATH Environment (please recheck)
      </ul>
    <li> MikTeX (version 2.7 and 2.9 are tested, others might work as well, texlive is an option, too) - basic version (for DVIPS, LATEX etc).
      <ul>
         <li> Download binaries for Windows (http://miktex.org/)
         <li> During installation tick "install missing packages on the fly = yes"
         <li> The installer SHOULD add the bin directory of MikTeX automatically to the Windows PATH Environment (please recheck)
      </ul>
    <li> GPL Ghostscript (e.g. 8.60, 9.19) for Windows
      <ul>
         <li> Download binaries for Windows (http://www.ghostscript.com/) and install
         <li> Add the <i>&lt;path_to_GHOSTSCRIPT&gt;/bin</i> directory (e.g. c:/programs/gs/gs8.60/bin) to the Windows PATH Environment
      </ul>
    <li>
      Optional:<br>
        You can create dependency graphs using a doxygen plug-in called <tt>dot</tt>.
        <ul>
            <li> Download binaries for windows from http://www.graphviz.org (we tested: graphviz-2.18.exe)
            <li> The installer should have added dot.exe to the Windows PATH Environment (please recheck)
        </ul>
  </ol>

  You should install the above apps prior to installing %OpenMS (see below), because otherwise during the configuration step the documentation targets will be
  disabled.
  If you already have a working installation of %OpenMS (without documentation), you can simply install the above programs and reconfigure %OpenMS by calling <tt>cmake .</tt> in your build tree. No need to recompile the library!

  @section install_win_openms Installing OpenMS

    For development and cutting edge functionalities we recommend using the Git version from GitHub
    \code
    git clone https://github.com/OpenMS/OpenMS
    \endcode
    Certain stable releases can found on the GitHub release page https://github.com/OpenMS/OpenMS/releases.

    If you have not installed the libraries which %OpenMS requires,
    please refer to the section @ref install_win_contrib above (and skip the clone step).
    <br>

    Now, we create the build system:
    <ol>
      <li>Open a Visual Studio Command Line (use x64 version if you want 64bit apps -- and yes, you want that!)
      <li>Create a build directory for %OpenMS, e.g. <tt>mkdir OpenMS_Win64</tt>
      @note Due to Windows restrictions concerning the maximum length of a file path (of 260 characters) and the rather deep folder hierarchies created by CMake and Visual Studio, we advise to restrict the length of the base path to your build directory. We suggest less than 40 characters if possible.
      <li>Call CMake to create the build system
        \code
        cd <path_to_OpenMS_build>
        cmake -D OPENMS_CONTRIB_LIBS="<path_to_contrib_build>" -D CMAKE_PREFIX_PATH=<path_to_QT5_prefix> -G "<generator>" -A x64 -T host=x64 "<path_to_OpenMS>"
        \endcode

        The CMAKE_PREFIX_PATH should hold the path to your Qt5 build directory (see example below). Note that it is NOT the main Qt5 directory, but the subfolder which is named after the toolchain it was build with (e.g. "5.6/msvc2015_64").
        @note If you build Qt5 from source, the build directories will be located at <tt>&lt;path_to_qt&gt;/mkspecs</tt>. Here you will need to choose the matching directory for your architecture and Visual Studio version.
        @note Example CMAKE_PREFIX_PATH: <tt>C:\dev\qt-5.9\mkspecs\winrt-x64-msvc2017</tt>
        
        The choice of <tt>&lt;generator&gt;</tt> depends on your system. Type <tt>cmake --help</tt> to see a list of available generators.
        
        @note We strongly recommend the Visual Studio Generator and it should be identical to the one used for building the contrib. Other generators (such as nmake) are not supported! If you need compiling on the command line, you can use <tt>MSBuild</tt> also on VS solution files!
        Use the <tt>-A x64</tt> flag to build a 64-bit %OpenMS library and TOPP executables (32-bit does not really make any sense for LC-MS data processing)!
        The <tt>-T host=x64</tt> flag instructs Visual Studio to use a 64bit compiler and linker toolchain to avoid linker errors (<tt>LNK1210: exceeded internal ILK size limit; link with /INCREMNTAL:NO</tt>) during development (if the flag is omitted the 32bit toolchain is used to generate 64bit binaries).
        Example:
        \code
        cd c:\dev\OpenMS_Win64
        cmake -D OPENMS_CONTRIB_LIBS="C:\dev\contrib_win64_build" -D CMAKE_PREFIX_PATH=c:\dev\Qt5.6.2\5.6\msvc2015_64\ -G "Visual Studio 16 2019" -A x64 -T host=x64 ..\OpenMS
        \endcode
       
    </ol>

    \includedoc "../doxygen/install/common-cmake-parameters.doxygen"


    Now there should be a <tt>OpenMS_host.sln</tt> file in your build directory, which you can open using Visual Studio.
    If you want to work on only a subset of %OpenMS (e.g., OpenMS_GUI) you can open the specific solution that you will find in the src/ folder of your
    build folder and below (e.g., src/openms_gui/OpenMS_GUI.sln).

    In Visual Studio execute the 'targets' project, which will show you the most prominent targets.

    Try to build the %OpenMS library - the target is called '%OpenMS'. This will create the %OpenMS.dll library. If you used the debug configuration it will be called
    OpenMSd.dll, in release mode its called OpenMS.dll.<br>
    As a last step you should add the location of the %OpenMS.dll to your PATH environment. This makes calling TOPPView and TOPP tools more convenient if you are working the command line. Also, external projects (see @subpage external_code) require the %OpenMS dll (OpenMS.dll or OpenMSd.dll) to be in the PATH. Depending on the generator and
    configuration used you will find the dll in [OpenMS_build]/bin/Release or [OpenMS_build]/bin/Debug (for VS) or just [OpenMS_build]/bin (nmake). In the same folder the
    TOPP tools will reside once build (see next section).
    Be aware that the order of directories in the PATH variable determines which dll or executable is used, if no absolute path was given when the executable was called.
    So the PATH might need to be updated (add/delete/reorder entries) if you are working with multiple installations or configurations of %OpenMS.

    @section install_win_topp Building the TOPP tools

    TOPP is a toolset for the analysis of HPLC-MS data. It consists of several small applications that can be chained to create analysis pipelines tailored for a specific problem.
    <br>
    <br>
    After you have built %OpenMS, you can build the TOPP tools
    by building the "TOPP" project in the IDE.
    <br>

  @section install_win_testing_openms Testing your OpenMS/TOPP installation

  Each class in %OpenMS and each TOPP tool has a unit test. The tests will be build with the complete solution. To specifically build and execute the tests,
  go to your %OpenMS build_tree and further into ./src/tests/class_tests. There you'll find an OpenMS_class_tests.sln file, which you can open.
  For other generators an equivalent file with another suffix will be present. Now, build the 'ALL_BUILD' target and the 'RUN_TESTS' target.
  You can also run the tests in a command prompt in &lt;OpenMS_build_tree&gt; using <tt>ctest</tt>.
  Single tests can be run with <tt>ctest -R <testnameregex></tt>, e.g. <tt>ctest -R Base64_test</tt>.
  For more syntax on CTest look at the online documentation at http://cmake.org/.

  @section install_win_cmdline_openms Building OpenMS on the commandline

  The Visual Studio solution files can contain many targets, which makes the IDE a bit sluggish especially when starting up the first time.
  The %OpenMS class tests are by far the largest.

  If you just want to compile the library or executables, it's usually faster to use the commandline. Visual Studio solution files can be used here as well,
  as arguments to <tt>MSBuild.exe</tt>, e.g.
  \code
  MSBuild.exe <solution.sln> /maxcpucount /target:<target> /p:Configuration=<Config>
  \endcode

  @note Since the call can be a bit lengthy, there is a batch file in
  <tt>OpenMS/tools/build.bat</tt> and in the root of your build tree (copied
  there by cmake for convenience), which allows to build the most important
  targets (TOPP, UTILS, Gui, Tests, Doc) in Release or Debug using very short
  notation. Call it without arguments to see its usage help text. For example
  to build only the %OpenMS library in release mode, call

  \code
  build OpenMS r
  \endcode


*/
