Skip to content

everycastlabs/ntv2-tally

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AJA NTV2 SDK (MIT license)

Building the ajantv2 library with CMake and ninja build on Windows/macOS/Linux

  1. Download and install CMake 3.10 or higher and place it in your PATH on the filesystem. CMake is available on all three major platforms supported by ajantv2 (Windows, macOS, Linux).

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

    Then, run: brew install cmake

    • Ubuntu Linux 20.04 - Install CMake via the apt package manager:
    sudo apt update
    sudo apt install cmake
    
  2. Download ninja build, unzip and place it somewhere within the PATH on your filesystem.

  3. Clone the ntv2 git repository.

    git clone [email protected]:aja-video/ntv2.git
    
  4. cd into the ntv2 git repo directory.

  5. Create a temporary build directory where CMake will produce the build artifacts. For example: mkdir cmake-build

  6. cd into the new build directory: cd cmake-build

  7. Windows/MSVC-only: Run the vcvarsall.bat script within the VS2017 or 2019 installation to initialize the MSVC environment for x86 64-bit.

    "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
    
  8. Run cmake to generate the input files for build system to consume.

    CMake is a "meta-build" tool and as such it does not build the ajantv2 library itself. Rather, it generates input files that another build system consumes to build ajantv2. This tutorial uses the aformentioned "ninja build" system but other CMake build system "generators" are available on Windows, macOS and Linux. See https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html for more information about CMake generators.

    • Generating build files for the ajantv2 library:
    cmake -DCMAKE_BUILD_TYPE=Debug -GNinja ..    
    

    NOTE: Specify -DCMAKE_BUILD_TYPE=Release to build the ajantv2 library in release mode with optimizations.

  9. Run ninja to build the ntv2 software:

    ninja -f build.ninja
    

Binaries of the ajantv2 library can be found within your temporary build directory, under ajalibraries/ajantv2.

Part 2: Building with CMake + Visual Studio Solution files

These instructions assume that you have:

  • Installed CMake 3.10 or higher.
  • Installed either Visual Studio 2017 or 2019 and any Visual C++ dependencies required to build ntv2.
  • Checked out the ntv2 git repository.
  1. Create temporary build directory:
    mkdir cmake-build
    
  2. cd into the temporary build directory.
  3. Run CMake to generate a Visual Studio Solution:
    • VS 2017 (x64)
    cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 15 2017 Win64" ..
    
    • VS 2019 (x64)
    cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 16 2019" -A Win64 ..
    
  4. Build the generated VS solution with MSBuild:
    msbuild /p:Platform=x64 /p:Configuration=Debug /t:Clean,Build ntv2.sln
    
    NOTE: The solution (ntv2.sln) file may also be opened in Visual Studio for building.

Part 3: Building with CMake + Unix Makefiles on macOS or Linux

These instructions assume that you have:

  • Installed CMake 3.10 or higher.
  • Installed GCC or Clang on your macOS/Linux system.
  • Checked out the ntv2 git repository.
  1. Create temporary build directory:
    mkdir cmake-build
    
  2. cd into the temporary build directory.
  3. Run CMake to generate Makefiles for ntv2:
    cmake -DCMAKE_BUILD_TYPE=Debug -G Makefile ..
    
  4. Build the generated Makefiles:
    make -j$(nproc)
    

Deploying NTV2 sources and build artifacts with CMake Install

The cmake --install command can be used to deploy NTV2 sources and build artifacts to a destination path

specified with the CMAKE_INSTALL_PREFIX variable. If this variable is not overridden at CMake build time,

the default system install paths will be used (/usr/local on UNIX and c:/Program Files/${PROJECT_NAME} on Windows).

See https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html for more information.

Linux example

Run from the root of the ntv2 repo. CMake Install deploys output files to a sub-directory called ntv2-install.

#!/bin/sh
NTV2_DIR=$PWD
BUILD_DIR=ntv2-build
INSTALL_DIR=ntv2-install

rm -rf ${INSTALL_DIR}
rm -rf ${BUILD_DIR}

cmake -S . -B${BUILD_DIR} \
-DCMAKE_BUILD_TYPE=Debug \
-DAJA_INSTALL_HEADERS=ON \
-DAJA_INSTALL_SOURCES=ON \
-DCMAKE_INSTALL_PREFIX="${NTV2_DIR}/${INSTALL_DIR}" \
-DAJA_DEPLOY_LIBS=ON \
-DAJA_BUILD_OPENSOURCE=ON

cmake --build ${BUILD_DIR} -- -j$(nproc>&1)
cmake --install ${BUILD_DIR}

About

Experimental place for tally PR

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 56.4%
  • C++ 42.9%
  • CMake 0.6%
  • Makefile 0.1%
  • Objective-C++ 0.0%
  • Objective-C 0.0%