-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
90 lines (70 loc) · 2.06 KB
/
Copy pathCMakeLists.txt
File metadata and controls
90 lines (70 loc) · 2.06 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
cmake_minimum_required(VERSION 3.16)
project(dec_hevc_file)
set (target dec_hevc_file)
add_executable(${target})
# Operating System
string(TOLOWER ${CMAKE_SYSTEM_NAME} OS)
# output
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../../../bin/${PLATFORM})
if (CMAKE_GENERATOR MATCHES "Visual Studio.*20.*")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../../../bin)
endif()
# debug definitions
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(${target} PUBLIC _DEBUG)
endif()
# release definitions
if (CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_definitions(${target} PUBLIC NDEBUG)
endif()
# Windows
if(OS STREQUAL "windows")
# add /MTd or /MT compiler option
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# enable C++ 17 standard features
target_compile_features(${target} PRIVATE cxx_std_17)
# assume extern "C" functions do not throw
target_compile_options(${target} PRIVATE /EHsc)
# common definitions
target_compile_definitions(${target} PRIVATE UNICODE _UNICODE)
# x64 compile options
if (PLATFORM STREQUAL "x64")
target_compile_definitions(${target} PRIVATE WIN64)
endif()
# x86 compile options
if (PLATFORM STREQUAL "x86")
target_compile_definitions(${target} PRIVATE WIN32)
endif()
# debug compile options
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${target} PRIVATE /Zi /Od)
endif()
# release compile options
if (CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(${target} PRIVATE /O2)
endif()
endif()
# include dirs
target_include_directories(${target}
PUBLIC
../../../sdk/include
)
# sources
file(GLOB source "./*.cpp")
target_sources(${target}
PRIVATE
${source}
)
# lib dirs
target_link_directories(${target}
PRIVATE
${PROJECT_SOURCE_DIR}/../../../sdk/lib/${PLATFORM}
)
# libs
if(OS STREQUAL "windows")
target_link_libraries(
${target}
AVBlocks64.dll
Shlwapi
)
endif()