Update Note: to build GoldenCheetah v3.6 we are using Microsoft Visual C++ 2019,
included in Microsoft Visual Studio 2019 AppVeyor image, with Qt5.15.2 and GSL 2.7
installed with vcpkg, on AppVeyor continuous integration platform.
You can check the appveyor.yml for the complete and updated build script,
the minimum Qt version known to work is 5.13 with Qt WebEngine and Qt Charts.
GSL - GNU Scientific Library is a mandatory dependency starting with v3.6

Ale Martinez - Jul, 2022
                                 +++++++++++++++++++++++
                                 WIN32 BUILD WALKTHROUGH
                                 +++++++++++++++++++++++

                                     Joern Rischmueller

                                       February 2017


This instruction will guide  you through a standard build of GoldenCheetah (without external
dependencies or API based services included).

Prerequisites:

To build on Windows you need the necessary toolchain to be installed. Since 2017
GoldenCheetah is enabled to be build with the Microsoft Visual C++ 2015 toolchain,
which is also the recommended toolchain to be used. Building with the "mingw" toolchain
might still be possible, but may conflict with features needed from the Qt library
which are no longer supported by the "mingw" version of Qt.

Disclaimer:

For any of the downloads and tools the document refers to, please check if you comply
with the license agreements. I cannot any responsibility for any of the downloads you
are doing.

You need:

- Microsoft Visual C++ 2015 - which is part of Visual Studio 2015
  -- Download from Microsoft - they offer a "Community Edition" which is sufficient 
     to build GoldenCheetah
	 
- Microsoft Windows SDK - which needs to be installed separately
  -- Download from here: https://developer.microsoft.com/de-de/windows/downloads/windows-10-sdk
  -- I am using the Windows 10 SDK - version 10.0.14393.795(since I build on Windows 10) - 
     Note: building on other Windows Version(s) may require other SDK Version to be installed
		   but was not tested 
  -- When installing the SDK you have several options - for GoldenCheetah you need the "SDK" itself and
     in case you want to Debug also the "Debugging Tools" to be installed. All other parts (to my experience)
	 are not required.
	 
- Flex and Bison (below the version working for me)
  -- Download from here: https://sourceforge.net/projects/winflexbison/
  -- Use the "win_flex_bison-latest.zip" version
  -- Unzip wherever you like and make sure that the location "win_bison.exe" and "win_flex.exe
     are added to your "Path" environment variable
	 
- Qt C++ Framework
  -- As of today, please use Qt 5.8.0 (which is the most recent official release) for Microsoft VC2015
  -- Download is available here: https://www.qt.io/download/ - the OpenSource version is sufficient
     to build GoldenCheetah
	 You need to decide if you go for the 32Bit or the 64Bit version, all further descriptions will refer
	 to the 64Bit version of Qt and the 64Bit Version of the Visual C++ Toolchain. 
	 32 Bit follows the same concepts, you just need to download and/or configure the tools for 32 bit.
	 The 
  -- Install Qt and make sure that the \bin directory of Qt is added to your "Path" environment variable
     (default path of Qt is C:\Qt\Qt5.8.0\5.8\msvc2015_64\bin)
  -- To build GoldenCheetah we recommend to use "jom.exe" which is an "nmake" clone - see https://wiki.qt.io/Jom
     With your Qt installation you also get QtCreator installed which is the free IDE for Qt. Jom is 
	 part of the QtCreator installation. For the later build process, make sure that the path to "jom.exe"
	 is added to your "Path" environment variable.
	 (default path of QtCreator/Jom is C:\Qt\Qt5.8.0\Tools\QtCreator\bin)
	 
Note: Building a 32bit version / Building for Windows XP
	-- 32bit follows the same concepts, you just need to download and/or configure the tools for 32 bit.
	-- The Visual Studio standard toolchain as well as the SDK do not support Windows XP any more.
	

	 
Building from command line without additional dependencies:

For this build, I am installing all source code,... into the directory: c:\coding

- Download GoldenCheetah source (either using Git or downloading the ZIP file)
  -- Download from here: https://github.com/GoldenCheetah/GoldenCheetah
  -- Install in c:\coding\GoldenCheetah
  
- Setup the configuration of GoldenCheetah for the Qt windows build
  -- Copy C:\coding\GoldenCheetah\qwt\qwtconfig.pri.in to C:\coding\GoldenCheetah\qwt\qwtconfig.pri     
  -- Copy C:\coding\GoldenCheetah\src\gccconfig.pri.in to C:\coding\GoldenCheetah\src\gccconfig.pri 
  -- Edit the "gcconfig.pri" file (see also instructions in the file itself)
     Lines to be changed (from Default to New - or Add(ed):
 	 Default										New
     #CONFIG += release					 		    CONFIG += release	
     #DEFINES += NOWEBKIT                		    DEFINES += NOWEBKIT
	 #QMAKE_LRELEASE = /usr/bin/lrelease			QMAKE_LRELEASE = lrelease
	 
	 Default
	 #WINKIT_INSTALL= "C:/Program Files (x86)/Windows Kits/8.1/Lib/winv6.3/um/x64"
	 New
	 WINKIT_INSTALL= "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.14393.0/um/x64"
	 Note: This is the default path for the SDK - depending on how you installed the 
	       SDK the path my deviate from the example.
		   
	 Add Lines
	 CONFIG += lex
	 CONFIG += yacc
	 
	 Default										New
	 #QMAKE_LEX = win_flex							QMAKE_LEX  = win_flex --wincompat
	 #QMAKE_YACC = win_bison						QMAKE_YACC = win_bison --file-prefix=y -t
	 
	 Add Lines
	 # Make sure that LEX/YACC is executed first (to allow multi-core compilation via Jom)
	 lex.CONFIG += target_predeps
	 yacc_impl.CONFIG += target_predeps
	 yacc_decl.CONFIG += target_predeps
	 

- Open the console tool of your choice in folder c:\coding\GoldenCheetah to run the build process
  (I assume cmd.com with prompt ">")
  -- Initialize the Visual C++ compile for 64 Bit Builds
	 >CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
  -- Run "qmake" to prepare the build for Qt
     >qmake build.pro -spec win32-msvc2015
  -- Run "jom" to prepare and run the GoldenCheetah build
     >jom qmake_all && jom
     Note: When build first time you get number of error messages on .qm files missing.
	       "RCC: Error in 'Resources\application.qrc': Cannot find file 'translations/gc_fr.qm'"
           You can ignore these messages for your build. The .qm files will be created during
		   the build at a later point in time via the "lrelease.exe" command you configured in 
		   gcconfig.pri)
	 Hint: In some (still inpredictable cases) the build stops during compilation of the "qwt"
	       library. Just re-start it by running "jom" again, without any other action. Your
		   build will continue without problems.
		   
- Wait - the compile with "jom" just uses 1 core. If you want to use more of your machine,
  you may use "jom" with option "-j <no_of_cores>" e.g. "jom -j 4".
  
  
- Since your are doing an "in-source" build you will find a release version of "GoldenCheetah.exe" 
  in folder: "C:\coding\GoldenCheetah\src\release". You can run the .exe from that location as long
  as the Qt libraries are on your "Path".
  
- To run GoldenCheetah.exe on a different machine (withoug Qt being installed), you need to collect
  the Qt libraries. Easiest way is the "windeployqt" tool provided with Qt. 
  Details can be found here: http://doc.qt.io/qt-5/windows-deployment.html


Building with additional dependencies:
 
We use a number of libraries for specific functions of GoldenCheetah. You find the list of dependencies
and their sources documented in "gccconfig.pri.in". Here just a short summary which of those libraries
are available in the official GoldenCheetah builds and some hints how to build them to be usable.

Info: I plan to provide a pre-compiled set of the dependencies for the Windows version of GoldenCheetah,
      so that not everybody has to invest the efforts to build the .dll's for the different tools.
	  
	  
- SRM download support via SRMIO
  -- Is NOT part of the official Windows builds since I was not able to create a .DLL which works
     with an MSVC2015 based build of GoldenCheetah. If anybody finds a solution to add this dependency
	 again - highly welcome.
	 
- D2XX device download support
  -- Is part of the official Windows builds - we use the libs and do static linking.
     The version currently used is: "CDM v2.10.00 WHQL Certified" - while there are more recent
	 version available for download.
	 
- iCal Calendar support (prerequisite for the "Diary" view)
  -- Is part of the official build as a static lib - the build uses Release 1.0.1
  
- USB1 support via USBExpress
  -- Is part of the official build as .dll - the build uses Release 3.5.1
  
- USB2 support via libusb
  -- Is part of the official build - the build uses the pre-compiled release 1.2.6.0
  
- Video Playback via VLC
  -- Is part of the official build as .dll - the build uses the pre-compiled release 2.2.1
  
- Resampling via libsamplerate
  -- Is part of the official build as .dll - the build uses 
  

Building with integration to external services (via APIs)

As of today a number of integrations with external services like Strava, Cyclinganalytics,
Google Calendar, Dropbox, Today's Plan, Google Drive, CloudDB) exist in the official GoldenCheetah
builds. The permission to use API's of such services requires a dedicated registration (in this case
for "GoldenCheetah" as the consumer of the services) where in return the GoldenCheetah team gets 
specific credentials to access the services.

All of the services request that the access credentials are kept private and are under responsibility
of the team/company/individual who has registered for the API use with the company providing the services.

You can always start your personal registration process with the services to get your own credentials
to build GoldenCheetah version which can use the service APIs. But you are doing that on your own full
responsibility.

*****************************************************************************************************

Have fun to build your own version. Feedback/Contributions to this guide are welcome. The easiest way
to contribute is to provide a pull-request.

Cheers.
Joern
