Instructions for building on macOS using CMake.

Building on macOS has been made much simpler with the Audacity 2.4.0
release. Still, read this document throughly before starting.

1) Get and install the latest Xcode version available your macOS version:

      MacOS                   Xcode Version (as of Mar 2020)
      Catalina - 10.15        11.3
      Mojave - 10.14          10.3
      High Sierra - 10.13     9.4.1
      Sierra - 10.12          9.2
      El Capitan - 10.11      8.2.1
      Yosemite - 10.10        7.2.1

2) Clone the Audacity repository:

      git clone https://github.com/audacity/audacity

3) Clone wxWidgets 3.1.3:

      git clone --recurse-submodules https://github.com/audacity/wxWidgets.git

   Ensure that you clone with the "--recurse-submodules" option, and do not
   just download the Zip package, otherwise there will be required components
   missing.

   Don't be tempted to use wxWidgets already installed by a package manager
   such as Homebrew because this will cause problems.

   We have applied some Audacity specific patches to wxWidgets to better 
   support VoiceOver, so please use the audacity-fixes-3.1.3 branch. It's
   the default branch on our GitHub copy:

      https://github.com/audacity/wxWidgets/tree/audacity-fixes-3.1.3

   You can be certain the correct branch is active with:

      git checkout audacity-fixes-3.1.3

4) Change directory to the folder where wxWidgets was cloned and build it using:

      sudo <path to Audacity source>/mac/scripts/build_wxwidgets

5) The config command should return "3.1.3" if the install was successful:

      /usr/local/x86_64/bin/wx-config --version

6) Now that you have wxWidgets installed, edit your .bash_profile and add:

      export WX_CONFIG=/usr/local/x86_64/bin/wx-config

7) Download the CMake 3.16.4 DMG from:

      https://cmake.org/download

8) Double click the DMG, follow the prompts and drag the CMake app to the
   Applications folder.

   If you will be building from the command line, open the CMake application
   and click the "Tools -> How to Install For Command Line Use" menu. It will
   give you additional instructions on making CMake available to the command
   line.

   You are now ready to start building Audacity.

BUILDING USING THE CMAKE GUI

   NOTE: Building with the GUI interface will result in the downloading of
         another copy of wxWidgets from Audacity.

1) Open the app.

2) Click the "Browse Source..." button and locate the top of your Audacity
   source tree, then click the "Open" button.

3) Click the "Browse Build..." button and find the location where you want to
   put the build (use the "New Folder" button at the bottom left to create a
   new folder).

   This folder does not have to be in or even near the source tree, but it
   must not be the same as the source tree. However, it is common to make it
   a subdirectory of the Audacity source tree.

4) Click the "Configure" button and when the dialog pops up, select "Xcode" for
   the generator, then click the "Done" button.

5) Click the "Generate" button to create the Xcode project.

6) Now you can either click the "Open Project" button or go to your "Build" folder in
   Finder and open the Xcode project as normal.

BUILDING FROM THE COMMAND LINE

1) Change directory to your Audacity source tree.

      cd audacity

2) Create the "build" folder (name it anything you like):

      mkdir bld

3) Change to the "build" folder:

      cd bld

4) Configure and generate the Xcode project:

      cmake -G Xcode ..

5) Build Audacity using the CMake command or xcodebuild:

      cmake --build . --config Release

      xcodebuild --configuration Release

   The "Audacity.app" bundle will be in the "bin/Release" subdirectory of your
   "build" folder, so you can start it via Finder or:

      open bin/Release/Audacity.app

Notes:

   - If you'd like to get a completely clean build, just delete "build" folder
     and return to step 2 above.

   - Once the Xcode project is generated, you shouldn't have to "configure" or
     "generate" again as it will be done for you automatically after pulling
     updates and building.

     For example:

        cd <audacity> directory
        git pull
        cd bld
        cmake --build . --config Release

   - Instructions on optional signing of DMGs, showing languages other than English,
     and other useful information can be found on our wiki at: 
     http://wiki.audacityteam.org/wiki/Building_On_Mac

