CMakeLists.txt 4.17 KB
Newer Older
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
1
cmake_minimum_required(VERSION 3.0)
2
enable_language(C)
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
3

4
5
6
7
if (UNIX)
  add_definitions(-D_POSIX_C_SOURCE=200809L)
endif()

8
9
10
include(CheckSymbolExists)
check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)

11
12
13
##
# Determine the software version from VCS
# Fallback to descriptive version if VCS unavailable
David Flynn's avatar
David Flynn committed
14
15
#  NB: the "unconfirmed-" part refers to this being a fallback option
#      and the reported version may or may not be accurate.
David Flynn's avatar
David Flynn committed
16
set(VERSION_FALLBACK "unconfirmed-release-7.1")
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
set(VERSION_FILE ${CMAKE_CURRENT_BINARY_DIR}/version.cpp)
set(VERSION_FILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in)
set(VERSION_CACHE_FILE ${CMAKE_CURRENT_BINARY_DIR}/version.cache)
find_package(Git)
add_custom_target(
  genversion
  COMMAND ${CMAKE_COMMAND} -D OUTPUT=${VERSION_FILE}
                           -D TEMPLATE=${VERSION_FILE_IN}
                           -D VERSION_FALLBACK=${VERSION_FALLBACK}
                           -D VERSION_EXTRA=${VERSION_EXTRA}
                           -D VERSION_CACHE_FILE=${VERSION_CACHE_FILE}
                           -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
                           -P ${CMAKE_SOURCE_DIR}/scripts/genversion.cmake
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

add_custom_command(
  OUTPUT ${VERSION_FILE}
  DEPENDS genversion
)
37

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
38
39
40
41
42
configure_file (
  "${CMAKE_CURRENT_SOURCE_DIR}/TMC3Config.h.in"
  "${PROJECT_BINARY_DIR}/tmc3/TMC3Config.h"
)

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
# NB: avoid the use of wild cards for source files in this directory,
# since cmake is unable to detect additions or removals in such cases
# resulting in obscure broken builds when switching branches or
# otherwise adding/removing files.
#
# Dependencies are permitted to use the wild card since they are
# not expected to change without modifying this CMakeLists.txt.
#

file(GLOB PROJECT_IN_FILES
  "TMC3Config.h.in"
  "version.cpp.in"
)

58
file(GLOB PROJECT_INC_FILES
59
  "AttributeDecoder.h"
60
  "AttributeEncoder.h"
61
62
  "BitReader.h"
  "BitWriter.h"
63
  "DualLutCoder.h"
64
  "FixedPoint.h"
65
  "OctreeNeighMap.h"
66
67
68
69
70
71
72
73
  "PCCKdTree.h"
  "PCCMath.h"
  "PCCMisc.h"
  "PCCPointSet.h"
  "PCCPointSetProcessing.h"
  "PCCTMC3Common.h"
  "PCCTMC3Decoder.h"
  "PCCTMC3Encoder.h"
74
  "RAHT.h"
75
  "TMC3.h"
76
  "constants.h"
77
  "entropy.h"
78
  "entropydirac.h"
79
80
  "entropyo3dgc.h"
  "entropyutils.h"
81
  "geometry.h"
82
  "geometry_intra_pred.h"
83
  "geometry_octree.h"
84
  "geometry_trisoup.h"
85
86
87
  "hls.h"
  "io_hls.h"
  "io_tlv.h"
88
  "osspecific.h"
89
  "partitioning.h"
90
  "pcc_chrono.h"
91
  "ply.h"
92
  "quantization.h"
93
94
95
  "ringbuf.h"
  "tables.h"
  "version.h"
96
97
98
99
  "../dependencies/nanoflann/*.hpp"
  "../dependencies/nanoflann/*.h"
  "../dependencies/arithmetic-coding/inc/*.h"
  "../dependencies/program-options-lite/*.h"
100
  "../dependencies/schroedinger/schroarith.h"
101
)
102

103
file(GLOB PROJECT_CPP_FILES
104
  "AttributeDecoder.cpp"
105
  "AttributeEncoder.cpp"
106
  "DualLutCoder.cpp"
107
  "FixedPoint.cpp"
108
  "OctreeNeighMap.cpp"
109
  "RAHT.cpp"
110
  "TMC3.cpp"
111
  "decoder.cpp"
112
  "encoder.cpp"
113
  "entropydirac.cpp"
114
  "geometry_intra_pred.cpp"
115
116
117
  "geometry_octree.cpp"
  "geometry_octree_decoder.cpp"
  "geometry_octree_encoder.cpp"
118
119
  "geometry_trisoup_decoder.cpp"
  "geometry_trisoup_encoder.cpp"
120
121
  "io_hls.cpp"
  "io_tlv.cpp"
122
  "misc.cpp"
123
  "osspecific.cpp"
124
  "partitioning.cpp"
125
  "pcc_chrono.cpp"
126
  "ply.cpp"
127
  "quantization.cpp"
128
  "tables.cpp"
129
130
  "../dependencies/arithmetic-coding/src/*.cpp"
  "../dependencies/program-options-lite/*.cpp"
131
  "../dependencies/schroedinger/schroarith.c"
132
)
133

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
134
135
136
137
source_group (inc FILES ${PROJECT_INC_FILES})
source_group (input FILES ${PROJECT_IN_FILES})
source_group (cpp FILES ${PROJECT_CPP_FILES})

138
139
include_directories(
  "${PROJECT_BINARY_DIR}/tmc3"
140
  "${PROJECT_SOURCE_DIR}"
141
  "${CMAKE_CURRENT_SOURCE_DIR}"
142
143
144
145
  "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/nanoflann"
  "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/arithmetic-coding/inc"
  "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/program-options-lite"
)
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
146

147
148
149
150
151
152
153
add_executable (tmc3
  ${PROJECT_CPP_FILES}
  ${PROJECT_INC_FILES}
  ${PROJECT_IN_FILES}
  ${VERSION_FILE}
)
add_dependencies(tmc3 genversion)
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
154

155
156
157
add_executable (ply-merge EXCLUDE_FROM_ALL
  "../tools/ply-merge.cpp"
  "misc.cpp"
158
  "ply.cpp"
159
160
161
162
163
  "../dependencies/program-options-lite/program_options_lite.cpp"
  ${VERSION_FILE}
)
add_dependencies(ply-merge genversion)

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
164
install (TARGETS tmc3 DESTINATION bin)