1 | ### THIS CMAKE FILE COULD BE USED FOR COMPILING HEVC REFERENCE SOFTWARE |
---|
2 | ### distribution is only allowed with the copyright message below |
---|
3 | |
---|
4 | #************************************************************************** |
---|
5 | # Copyright (C) 2017 |
---|
6 | # Institut fuer Nachrichtentechnik |
---|
7 | # RWTH Aachen University |
---|
8 | # Johannes Sauer |
---|
9 | # sauer@ient.rwth-aachen.de |
---|
10 | # Jens Schneider |
---|
11 | # schneider@ient.rwth-aachen.de |
---|
12 | # |
---|
13 | #************************************************************************** |
---|
14 | |
---|
15 | cmake_minimum_required(VERSION 3.3) |
---|
16 | project( HM ) |
---|
17 | |
---|
18 | include_directories ("${PROJECT_SOURCE_DIR}/../../source/Lib" ) |
---|
19 | |
---|
20 | |
---|
21 | if(HIGH_BIT_DEPTH) |
---|
22 | message(STATUS "This is a high bit depth build") |
---|
23 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb") |
---|
24 | add_definitions("-DRExt__HIGH_BIT_DEPTH_SUPPORT=1") |
---|
25 | set(CMAKE_DEBUG_POSTFIX "HighBitDepthStaticd" CACHE STRING "Set Debug library postfix" FORCE) |
---|
26 | set(CMAKE_RELEASE_POSTFIX "HighBitDepthStatic" CACHE STRING "Set Release library postfix" FORCE) |
---|
27 | else() |
---|
28 | set(CMAKE_DEBUG_POSTFIX "Staticd" CACHE STRING "Set Debug library postfix" FORCE) |
---|
29 | set(CMAKE_RELEASE_POSTFIX "Static" CACHE STRING "Set Release library postfix" FORCE) |
---|
30 | endif() |
---|
31 | |
---|
32 | |
---|
33 | # set debug and release config as in makefiles which are provided |
---|
34 | set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wuninitialized") |
---|
35 | set(CMAKE_CXX_FLAGS_DEBUG "-g -D_DEBUG") |
---|
36 | |
---|
37 | # collect the files belonging to the different libraries |
---|
38 | file(GLOB TLibCommon_SRC |
---|
39 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibCommon/*.h" |
---|
40 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibCommon/*.cpp" |
---|
41 | "${PROJECT_SOURCE_DIR}/../../source/Lib/libmd5/*.h" |
---|
42 | "${PROJECT_SOURCE_DIR}/../../source/Lib/libmd5/*.c" |
---|
43 | ) |
---|
44 | |
---|
45 | file(GLOB TAppCommon_SRC |
---|
46 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TAppCommon/*.h" |
---|
47 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TAppCommon/*.cpp" |
---|
48 | ) |
---|
49 | file(GLOB TLibEncoder_SRC |
---|
50 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibEncoder/*.h" |
---|
51 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibEncoder/*.cpp" |
---|
52 | ) |
---|
53 | file(GLOB TLibDecoder_SRC |
---|
54 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibDecoder/*.h" |
---|
55 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibDecoder/*.cpp" |
---|
56 | ) |
---|
57 | file(GLOB TLibVideoIO_SRC |
---|
58 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibVideoIO/*.h" |
---|
59 | "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibVideoIO/*.cpp" |
---|
60 | ) |
---|
61 | |
---|
62 | # collect the files belonging to the different executables |
---|
63 | file(GLOB TAppDecoder_SRC |
---|
64 | "${PROJECT_SOURCE_DIR}/../../source/App/TAppDecoder/*.h" |
---|
65 | "${PROJECT_SOURCE_DIR}/../../source/App/TAppDecoder/*.cpp" |
---|
66 | ) |
---|
67 | file(GLOB TAppEncoder_SRC |
---|
68 | "${PROJECT_SOURCE_DIR}/../../source/App/TAppEncoder/*.h" |
---|
69 | "${PROJECT_SOURCE_DIR}/../../source/App/TAppEncoder/*.cpp" |
---|
70 | ) |
---|
71 | |
---|
72 | |
---|
73 | # stating which libaries to build |
---|
74 | add_library(TLibVideoIO STATIC ${TLibVideoIO_SRC}) |
---|
75 | add_library(TLibCommon STATIC ${TLibCommon_SRC}) |
---|
76 | add_library(TLibDecoder STATIC ${TLibDecoder_SRC}) |
---|
77 | add_library(TLibDecoderAnalyser STATIC ${TLibDecoder_SRC}) |
---|
78 | target_compile_definitions(TLibDecoderAnalyser PUBLIC RExt__DECODER_DEBUG_BIT_STATISTICS=1) |
---|
79 | add_library(TLibEncoder STATIC ${TLibEncoder_SRC}) |
---|
80 | add_library(TAppCommon STATIC ${TAppCommon_SRC}) |
---|
81 | |
---|
82 | |
---|
83 | # state which binaries to build, you can add additional libraries to link with |
---|
84 | add_executable( TAppDecoder ${TAppDecoder_SRC}) |
---|
85 | target_link_libraries(TAppDecoder TLibDecoder TLibCommon TLibVideoIO TAppCommon dl pthread ) |
---|
86 | add_executable( TAppEncoder ${TAppEncoder_SRC}) |
---|
87 | target_link_libraries( TAppEncoder TLibEncoder TLibCommon TLibVideoIO TAppCommon dl pthread ) |
---|
88 | add_executable( TAppDecoderAnalyser ${TAppDecoder_SRC}) |
---|
89 | target_link_libraries(TAppDecoderAnalyser TLibDecoderAnalyser TLibCommon TLibVideoIO TAppCommon dl pthread ) |
---|
90 | target_compile_definitions(TAppDecoderAnalyser PUBLIC RExt__DECODER_DEBUG_BIT_STATISTICS=1) |
---|
91 | |
---|
92 | if(NOT HIGH_BIT_DEPTH) |
---|
93 | add_executable( annexBbytecount "${PROJECT_SOURCE_DIR}/../../source/App/utils/annexBbytecount.cpp" ) |
---|
94 | target_link_libraries( annexBbytecount TLibDecoder TLibCommon TLibVideoIO TAppCommon dl pthread ) |
---|
95 | add_executable( convert_NtoMbit_YCbCr "${PROJECT_SOURCE_DIR}/../../source/App/utils/convert_NtoMbit_YCbCr.cpp" ) |
---|
96 | target_link_libraries( convert_NtoMbit_YCbCr TLibDecoder TLibCommon TLibVideoIO TAppCommon dl pthread ) |
---|
97 | endif() |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | # set properties for compiling as in makefiles which are provided |
---|
102 | set(CommonOptions "-fPIC -DMSYS_LINUX -Wall -Wshadow -Wno-sign-compare") |
---|
103 | # warnings as errors |
---|
104 | #set(CommonOptions "-fPIC -DMSYS_LINUX -Wall -Wshadow -Wno-sign-compare -Werror") |
---|
105 | set(OtherOptions "-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE") |
---|
106 | |
---|
107 | set_target_properties(TLibVideoIO PROPERTIES COMPILE_FLAGS "${CommonOptions} ${OtherOptions}") |
---|
108 | set_target_properties(TLibCommon PROPERTIES COMPILE_FLAGS "${CommonOptions}") |
---|
109 | set_target_properties(TLibDecoder PROPERTIES COMPILE_FLAGS "${CommonOptions}") |
---|
110 | set_target_properties(TLibDecoderAnalyser PROPERTIES COMPILE_FLAGS "${CommonOptions}") |
---|
111 | set_target_properties(TLibEncoder PROPERTIES COMPILE_FLAGS "${CommonOptions}") |
---|
112 | set_target_properties(TAppCommon PROPERTIES COMPILE_FLAGS "${CommonOptions}") |
---|
113 | set_target_properties(TAppDecoder PROPERTIES COMPILE_FLAGS "${CommonOptions} ${OtherOptions}") |
---|
114 | set_target_properties(TAppDecoderAnalyser PROPERTIES COMPILE_FLAGS "${CommonOptions} ${OtherOptions}") |
---|
115 | set_target_properties(TAppEncoder PROPERTIES COMPILE_FLAGS "${CommonOptions} ${OtherOptions}") |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | # add postfixes for executables too |
---|
120 | if(HIGH_BIT_DEPTH) |
---|
121 | set_target_properties( TAppDecoder TAppDecoderAnalyser TAppEncoder PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) |
---|
122 | set_target_properties( TAppDecoder TAppDecoderAnalyser TAppEncoder PROPERTIES RELEASE_POSTFIX ${CMAKE_RELEASE_POSTFIX}) |
---|
123 | else() |
---|
124 | set_target_properties( TAppDecoder TAppDecoderAnalyser TAppEncoder annexBbytecount convert_NtoMbit_YCbCr PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) |
---|
125 | set_target_properties( TAppDecoder TAppDecoderAnalyser TAppEncoder annexBbytecount convert_NtoMbit_YCbCr PROPERTIES RELEASE_POSTFIX ${CMAKE_RELEASE_POSTFIX}) |
---|
126 | endif() |
---|
127 | |
---|
128 | |
---|
129 | # specify where to put the produced binaries and libraries |
---|
130 | if(HIGH_BIT_DEPTH) |
---|
131 | INSTALL(TARGETS |
---|
132 | #libaries |
---|
133 | TLibCommon |
---|
134 | TAppCommon |
---|
135 | TLibEncoder |
---|
136 | TLibDecoder |
---|
137 | TLibDecoderAnalyser |
---|
138 | TLibVideoIO |
---|
139 | #binaries |
---|
140 | TAppDecoder |
---|
141 | TAppDecoderAnalyser |
---|
142 | TAppEncoder |
---|
143 | RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/../../bin" |
---|
144 | LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/../../lib" |
---|
145 | ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/../../lib" |
---|
146 | ) |
---|
147 | else() |
---|
148 | INSTALL(TARGETS |
---|
149 | #libaries |
---|
150 | TLibCommon |
---|
151 | TAppCommon |
---|
152 | TLibEncoder |
---|
153 | TLibDecoder |
---|
154 | TLibDecoderAnalyser |
---|
155 | TLibVideoIO |
---|
156 | #binaries |
---|
157 | TAppDecoder |
---|
158 | TAppDecoderAnalyser |
---|
159 | TAppEncoder |
---|
160 | annexBbytecount |
---|
161 | convert_NtoMbit_YCbCr |
---|
162 | RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/../../bin" |
---|
163 | LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/../../lib" |
---|
164 | ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/../../lib" |
---|
165 | ) |
---|
166 | endif() |
---|
167 | |
---|