Skip to content

Latest commit

 

History

History
114 lines (77 loc) · 5.1 KB

README.md

File metadata and controls

114 lines (77 loc) · 5.1 KB

Building Warzone for macOS

Prerequisites:

For convenience, you will probably want either Homebrew or Macports installed for setting up certain prerequisites. If you don't have either yet, Homebrew is recommended.

  1. macOS 10.12+

    • While building may work on prior versions of macOS, it is only tested on macOS 10.12+.
  2. Xcode 8 / 9

  3. CMake 3.11.3+ (required to generate the Xcode project)

  4. Gettext (required to compile the translations and language files)

    • If you have Homebrew installed, you can use the following command in Terminal:
      brew install gettext

      The build scripts work perfectly with the default (keg-only) Homebrew install of gettext.

    • If you have Macports installed, you can use the following command in Terminal:
      sudo port install gettext
  5. Asciidoctor (required to build the documentation / help files)

    • If you have Homebrew installed, you can use the following command in Terminal:
      brew install asciidoctor
    • If you have Macports installed, you can use the following command in Terminal:
      sudo port install asciidoctor
    • Or, via gem install:
      gem install asciidoctor --no-rdoc --no-ri --no-document

      Depending on system configuration, sudo gem install may be required.

    Alternatively, you can install + use AsciiDoc via brew install asciidoc docbook-xsl.

Setup & Configuration:

Generating the macOS port's build environment & configuration requires the following steps in Terminal:

1. Set the minimum deployment target

To set the minimum deployment target used for vcpkg and the CMake-generated Xcode project, execute the following command in the same Terminal session used for later commands:

  1. Export minimum deployment target (example: macOS 10.10):
    export MACOSX_DEPLOYMENT_TARGET=10.10

2. Use vcpkg to fetch & build dependencies

  1. cd into the root folder of the Git repo / source code. This should be the folder containing get-dependencies_mac.sh

  2. Run the following command:

    ./get-dependencies_mac.sh

The get-dependencies_mac.sh script will automatically:

  • Download + build vcpkg
  • Build required dependencies

vcpkg may require a newer compiler to build itself. Follow the instructions output by the get-dependencies_mac.sh.

3. Use CMake to configure & generate the Xcode project

Again, from the root of the Git repo / source code:

  1. Run the following command:
    cmake '-H.' -Bbuild -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake -G"Xcode"

This will run CMake to generate the Xcode project. The Xcode project (and other build files) will be generated in a build subdirectory.

To change the build folder path, modify the -Bbuild portion of the command above. For example, -B../wzbuild will generate the build files in a wzbuild directory in the parent directory of the source code.

Building:

The macOS port is built using the Xcode project generated by CMake. If following the instructions above, this will be located in a build subdirectory: $(SOURCE_DIR)/build/warzone2100.xcodeproj

To build the game from the command-line:

  1. Run the following command:
    xcodebuild -project build/warzone2100.xcodeproj -target warzone2100 -configuration Release -destination "platform=macOS"

You can also simply open the project in Xcode, and build the warzone2100 scheme. (You may want to tweak it to build in a Release configuration - the default for that scheme in "Run" mode is Debug, for easier development.)

Deployment:

The macOS port produces a 64-bit self-contained application bundle that requires macOS 10.10+* to run.

* See Setup & Configuration for how to set the minimum deployment target.

Additional Information:

The macOS port supports sandboxing, but this requires code-signing to be configured in the Xcode project. (By default, code-signing is disabled in the Xcode project.)