Instructions for building on Windows.

Fuller instructions that include
   * Installing CMake 
   * Portable Settings
   * Building an Installer
can be found on our wiki at 
http://wiki.audacityteam.org/wiki/Building_On_Windows


1. MSVC 2019: Download and install Microsoft Visual Studio 2019

  https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16
  be sure to include the Desktop Development with C++ Workflow
  this build was testing using VS 16.8.5

2. Git: Download and install Git, for example by installing:

  Git for Windows: https://git-scm.com/download/win
  and optionally GitExtensions: http://gitextensions.github.io/

  download and run the .msi installer.  GitExtensions has a GUI interface, 
  includes Git for Windows and has a Git bash command line in the bottom panel 
  of the screen.

3. Python

  We no longer use Python 2.7.18 during the build. Instead we must use Python 3.
  You can download Python 3.9.1 from https://www.python.org/downloads/windows/
  Select the Python 3.9.1 Windows Installer (32-bit)

4. wxWidgets:

 a) Clone wxWidgets and checkout 3.1.3 from the Audacity fork of the 
    wxWidgets project: 
       https://github.com/audacity/wxWidgets/

    for example, in the git-bash command line:
      mkdir wxWidgets
      git clone --recurse-submodules https://github.com/audacity/wxWidgets/
      
    IF you forgot the --recurse-submodules, you can correct that later by:
      git submodule update --init

    It is instructive to review but do NOT follow the instructions for 
    building at 
    https://github.com/audacity/wxWidgets/blob/audacity-fixes-3.1.3/README-GIT.md
    https://github.com/audacity/wxWidgets/blob/audacity-fixes-3.1.3/docs/msw/install.md
 
 b) We (currently) build the 32 bit DLL version, 
    and Audacity is built 32 bit too.

    Set WXWIN environment variable to the appropriate directory where you 
    installed wxWidgets. This will tell CMake where to find wxWidgets later.

      To set WXWIN, click on Settings (the cogwheel icon from the start menu)
      Then in the 'find a setting' search box type 'env'.
      Choose 'Edit the system environment variables'
      Then the 'Environment Variables' button 
      Then in system variables, for variable and value,  add (for example)     

      WXWIN         C:\aud300\wxWidgets

    You will be building a dll version with MSVC2019 IDE, so...

	    In Windows File Manager, right-click on ../wxWidgets/build/msw/wx_vc16.sln,
	    Select Visual Studio 2019.
	    In the solutions configurations drop-down list, change "Debug" to 
      "DLL Release",
     	Then select Build > Build Solution.
	
	  When the build completes, you will get a message such as:
	  ========= Build: 24 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

	    Close Visual Studio.

    You can check this worked also by looking in C:\aud300\wxWidgets\lib\vc_dll
    There should be dll files there with _'ud' in their name.    
    The ud stands for 'unicode debug'.  If you only have files with 'u' then 
    you only have release.


5. Audacity

  a) Clone Audacity from the Audacity GitHub project.
       https://github.com/audacity/audacity/

    for example, in the git-bash command line
      mkdir audacity
      git clone https://github.com/audacity/audacity/

  b) Open the CMake GUI

     Open VS 2019 > "continue without code" > File > Open > CMake
     Open CMakeLists.txt in root of audacity source folder you cloned

     Wait for the CMake Overview Pages tab to appear (be patient)
	   Click "Open the CMake Settings Editor" in this new tab
	   Scroll up to the top of the window and settings
	   In the Configurations window, click the green "+", then select x86-Release
	   Set Configuration type: Release

	   Verify Toolset: msvc_86
	   Keep Build Root: ${projectDir}\out\build\${name} (default, you can 
     change it) (this corresponds to CMAKE_BINARY_DIR)

     Click on "Show advanced settings" (scroll down).
	   Change CMake generator: VS 16 2019 (was Ninja)
	   Click "Save and Generate CMake cache to load variables" once, then
	   Click "Save and Generate CMake cache to load variables" a second time
	     or select Project > Generate CMake Cache
	 
  c) Switch to the Ouput tab

     Wait for "CMake generation finished".
	   Check the Error List window:
	     you should have 0 Errors and 0 Warnings.
		 
  d) Return to the CMakeSettings.json window
       Review CMake variables and cache
	   Note that:

	   wxWidgets_LIB_DIR > 'C:/aud300/wxWidgets/lib/vc_dll' (your path 
       may be slightly different)
     wxWidgets_ROOT_DIR > 'C:/aud300/wxWidgets' (your path 
       may be slightly different)
       

  e) Build

       Select Build > Build All
       Click on the Output tab and wait for the message "Build All succeeded" 
	     Check the Error List tab.  There should be 0 Errors and 17 Warnings.
       Check the output directory indicated in step 6 to find 
         `../bin/Release/Audacity.exe`
    
