Ticket #1445: CMakeLists.txt

File CMakeLists.txt, 6.7 KB (added by jsauer, 7 years ago)

cmake configuration file

Line 
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
15cmake_minimum_required(VERSION 3.3)
16project( HM )
17
18include_directories ("${PROJECT_SOURCE_DIR}/../../source/Lib"  )
19
20
21if(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)
27else()
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)
30endif()
31
32
33# set debug and release config as in makefiles which are provided
34set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wuninitialized")
35set(CMAKE_CXX_FLAGS_DEBUG "-g  -D_DEBUG")
36
37# collect the files belonging to the different libraries
38file(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
45file(GLOB TAppCommon_SRC
46    "${PROJECT_SOURCE_DIR}/../../source/Lib/TAppCommon/*.h"
47    "${PROJECT_SOURCE_DIR}/../../source/Lib/TAppCommon/*.cpp"
48)
49file(GLOB TLibEncoder_SRC
50    "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibEncoder/*.h"
51    "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibEncoder/*.cpp"
52)
53file(GLOB TLibDecoder_SRC
54    "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibDecoder/*.h"
55    "${PROJECT_SOURCE_DIR}/../../source/Lib/TLibDecoder/*.cpp"
56)
57file(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
63file(GLOB TAppDecoder_SRC
64    "${PROJECT_SOURCE_DIR}/../../source/App/TAppDecoder/*.h"
65    "${PROJECT_SOURCE_DIR}/../../source/App/TAppDecoder/*.cpp"
66)
67file(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
74add_library(TLibVideoIO STATIC ${TLibVideoIO_SRC})
75add_library(TLibCommon STATIC ${TLibCommon_SRC})
76add_library(TLibDecoder STATIC ${TLibDecoder_SRC})
77add_library(TLibDecoderAnalyser STATIC ${TLibDecoder_SRC})
78target_compile_definitions(TLibDecoderAnalyser  PUBLIC  RExt__DECODER_DEBUG_BIT_STATISTICS=1)
79add_library(TLibEncoder STATIC ${TLibEncoder_SRC})
80add_library(TAppCommon STATIC ${TAppCommon_SRC})
81
82
83# state which binaries to build, you can add additional libraries to link with
84add_executable( TAppDecoder ${TAppDecoder_SRC})
85target_link_libraries(TAppDecoder TLibDecoder TLibCommon  TLibVideoIO TAppCommon dl pthread )
86add_executable( TAppEncoder ${TAppEncoder_SRC})
87target_link_libraries( TAppEncoder TLibEncoder TLibCommon TLibVideoIO TAppCommon dl pthread )
88add_executable( TAppDecoderAnalyser ${TAppDecoder_SRC})
89target_link_libraries(TAppDecoderAnalyser TLibDecoderAnalyser TLibCommon  TLibVideoIO TAppCommon dl pthread )
90target_compile_definitions(TAppDecoderAnalyser PUBLIC  RExt__DECODER_DEBUG_BIT_STATISTICS=1)
91
92if(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 )
97endif()
98
99
100
101# set properties for compiling as in makefiles which are provided
102set(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")
105set(OtherOptions "-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE")
106
107set_target_properties(TLibVideoIO         PROPERTIES COMPILE_FLAGS "${CommonOptions} ${OtherOptions}")
108set_target_properties(TLibCommon          PROPERTIES COMPILE_FLAGS "${CommonOptions}")
109set_target_properties(TLibDecoder         PROPERTIES COMPILE_FLAGS "${CommonOptions}")
110set_target_properties(TLibDecoderAnalyser PROPERTIES COMPILE_FLAGS "${CommonOptions}")
111set_target_properties(TLibEncoder         PROPERTIES COMPILE_FLAGS "${CommonOptions}")
112set_target_properties(TAppCommon          PROPERTIES COMPILE_FLAGS "${CommonOptions}")
113set_target_properties(TAppDecoder         PROPERTIES COMPILE_FLAGS "${CommonOptions} ${OtherOptions}")
114set_target_properties(TAppDecoderAnalyser PROPERTIES COMPILE_FLAGS "${CommonOptions} ${OtherOptions}")
115set_target_properties(TAppEncoder         PROPERTIES COMPILE_FLAGS "${CommonOptions} ${OtherOptions}")
116
117
118
119# add postfixes for executables too
120if(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})
123else()
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})
126endif()
127
128
129# specify where to put the produced binaries and libraries
130if(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   )
147else()
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   )
166endif()
167