-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
53 lines (39 loc) · 1.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Create a build folder and build from there:
# mkdir build
# cd build
# cmake ..
cmake_minimum_required( VERSION 3.14 )
# Apple stuff to avoid a warning about rpaths
cmake_policy( SET CMP0042 NEW )
# Filename extensions must be explicit
if ( ${CMAKE_VERSION} VERSION_GREATER "3.20" )
cmake_policy( SET CMP0115 NEW )
endif()
# Target the 64-bit compiler on Windows. We assume 64-bit for everything
# and no effort has been made to support 32-bit.
if ( WIN32 )
set( CMAKE_GENERATOR_PLATFORM x64 CACHE INTERNAL "Force 64-bit compilation" )
endif()
# Hardcode CUDA paths since auto detection failed for me
SET( CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc )
include_directories( /usr/local/cuda/include )
# Main project
project( nvenc_h265_transparency LANGUAGES CXX CUDA )
# Always look in /usr/local/include because this isn't default - sometimes.
# Also check our code's root directory.
# If this doesn't make sense for your platorm/configuration then it will be safely ignored.
SET( CMAKE_REQUIRED_INCLUDES /usr/local/include ${PROJECT_SOURCE_DIR} )
include_directories( ${CMAKE_REQUIRED_INCLUDES} )
# C++ settings
set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG" )
# CUDA settings
set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_50,code=\"sm_50,compute_50\" )
include( CheckIncludeFile )
# Use CLI11 for argument parsing
find_package( CLI11 REQUIRED )
# NVidia Video Encode libs, installed with the graphics driver
find_library( CUVID_LIB nvcuvid )
find_library( NVENCODEAPI_LIB nvidia-encode )
add_executable( nvenc_h265_transparency main.cpp utility.hpp nvEncodeAPI.h )
target_link_libraries( nvenc_h265_transparency ${CUDA_CUDA_LIBRARY} ${NVENCODEAPI_LIB} ${CUVID_LIB} )