This guide will help you with the setup of your host machine in order to properly build and run the the NVIDIA GameWorks Graphics sample applications for Vulkan and OpenGL.

Please ensure your system meets the Graphics Samples Prerequisites before proceeding further.

Installing and Building on Windows Host

This section will walk you through the setup of the Vulkan and OpenGL samples on a Windows development PC, for Android and Windows build targets.

Targeting Windows PC

  1. Unzip the samples pack to a directory on the Windows Host PC. We will call this directory SAMPLES_ROOT.
  2. If you haven't already done so, download and install the LunarG Vulkan SDK. Ensure that the installer has set VK_SDK_PATH to the path to the SDK, and restart any Visual Studio instances. See the Prerequisites guide for recommended min SDK version.
  3. Launch Visual Studio 2013 or 2015.
  4. Open the all-samples project file: {SAMPLES_ROOT}/samples/build/vs201[3,5]All/AllSamples.sln.
  5. Build the solution as release or debug.
  6. The resulting apps will be placed in {SAMPLES_ROOT}/samples/bin/vs201[3,5][x86,x64]/.

Targeting Android Device

  1. Unzip the samples pack to a directory on the Windows Host PC. We will call this directory SAMPLES_ROOT.
  2. If you haven't already done so, download and install the CodeWorks for Android installer for Windows. Be sure to include NVIDIA Nsight Tegra, Visual Studio Edition as an installed component.
  3. Launch Visual Studio 2013 or 2015.
  4. Open the all-samples project file: {SAMPLES_ROOT}/samples/build/vs201[3,5]All/AllSamples.sln.
  5. Build the solution as release or debug.
  6. The resulting app APKs will be placed in {SAMPLES_ROOT}/samples/bin/Tegra-Android/.
Common Android Build Errors
  • An error similar to:

    BUILD FAILED
    C:\NVPACK\android-sdk-windows\tools\ant\build.xml:542: Unable to resolve project target 'android-14'

    Can be solved as follows:

    1. Run {NVPACK}/android-sdk-windows/SDKManager.exe
    2. Click deselect all.
    3. Find Android 4.0 (API14).
    4. Check SDK Platform.
    5. Click Install packages.
    6. Follow the steps to accept the license and install the package
  • The error:

    [dx] Could not create the Java virtual machine.
    [dx] Error occurred during initialization of VM
    [dx] Could not reserve enough space for object heap

    Can be fixed as follows:

    1. Edit {NVPACK}\android-sdk-windows\build-tools\{each version}\dx.bat.
    2. Find the line:
      set defaultMx=-Xmx1024M
      And change the 1024 to 512, like:
      set defaultMx=-Xmx512M.
    3. Save and exit.
    4. Restart Visual Studio.
    5. Rebuild.

Installing and Building on/for Linux x86_64 Host/Target

This section will walk you through the setup of the OpenGL and Vulkan samples on a Linux development PC.

  1. Install the Linux build/target pre-requisites by running:
    sudo apt-get install g++ xorg-dev libglu1-mesa-dev make
  2. If using Ubuntu 12.04 LTS, building the Vulkan samples requires g++ 4.8:
    sudo apt-get install python-software-properties
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-4.8
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
    sudo apt-get install g++-4.8
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
  3. Ensure that the environment variable VK_SDK_PATH is exported and points to the LunarG SDK root. See the Prerequisites guide for recommended min SDK version.
  4. Ensure that the LD_LIBRARY_PATH variable includes the LunarG SDK's loader path: $VK_SDK_PATH/x86_64/lib.
  5. Pull the samples pack to a directory on the Linux Host PC. We will call this directory SAMPLES_ROOT.
  6. Open a terminal window to {SAMPLES_ROOT}/samples/build/linux64.
  7. Run make.
  8. The resulting apps will be placed in {SAMPLES_ROOT}/samples/bin/linux64/. Note that as per the Prerequisites guide, the system must have working OpenGL drivers for the samples to run.
  9. Individual samples may be built via make build_[sample]_[debug, release]

Installing and Building on Linux x86_64 Host for Android Target

This section will walk you through the setup of the OpenGL and Vulkan samples on a Linux development PC to run on an Android device.

  1. Install the Linux build/target pre-requisites by running:
    sudo apt-get install g++ xorg-dev libglu1-mesa-dev make
    Full CodeWorks for Android 1r4 for Linux x64 tools install. Note that means that NDK r11/r12 are not yet supported. CodeWorks 1r4 supports r10e.
  2. If using Ubuntu 12.04 LTS, building the Vulkan samples requires g++ 4.8:
    sudo apt-get install python-software-properties
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-4.8
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
    sudo apt-get install g++-4.8
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
  3. Pull the samples pack to a directory on the Linux Host PC. We will call this directory SAMPLES_ROOT.
  4. Open a terminal window to {SAMPLES_ROOT}/samples/build/makeandroid.
  5. Run make.
  6. The resulting apps will be placed in each sample's {SAMPLES_ROOT}/samples/[sampletype]/[samplename]/bin/.
  7. Individual samples may be built via make build_[sample]_[debug, release]

Installing and Building for Tegra Ubuntu (Jetson TX1)

The samples can be compiled locally on the device, or cross-compiled from an x86_64 Ubuntu desktop.

  1. Pull the samples pack to a directory on the Ubuntu desktop or Jetson TX1. We will call this directory SAMPLES_ROOT.
  2. Install the Linux target pre-requisites onto the build host:
    sudo apt-get update(this is critical, or else the next line will do nothing)
    sudo apt-get install g++ xorg-dev libglu1-mesa-dev make
  3. If cross-compiling from an x86_64 Ubuntu desktop, install the cross-compiler onto the build host:
    sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
  4. On the build host, open a terminal window to {SAMPLES_ROOT}/samples/build/linux-aarch64, depending on the host PC.
  5. Run make.
  6. The resulting apps will be placed in {SAMPLES_ROOT}/samples/bin/linux-aarch64/
  7. Individual samples may be built via make build_[sample]_[debug, release]
  8. If the vulkan loader is not pre-installed on the target platform (Jetson TX1), it can be downloaded from the NVIDIA Embedded Developer Site. Also, the samples pack contains a pre-built loader. It can be installed by adding the path: {SAMPLES_ROOT}/extensions/externals/lib/linux-aarch64 ti LD_LIBRARY_PATH variable.