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

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

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

10
11
12
##
# Determine the software version from VCS
# Fallback to descriptive version if VCS unavailable
David Flynn's avatar
David Flynn committed
13
14
#  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
15
set(VERSION_FALLBACK "unconfirmed-release-3.0")
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
)
36

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

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#
# 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"
)

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

93
file(GLOB PROJECT_CPP_FILES
94
  "AttributeDecoder.cpp"
95
  "AttributeEncoder.cpp"
96
  "DualLutCoder.cpp"
97
  "OctreeNeighMap.cpp"
98
  "RAHT.cpp"
99
  "TMC3.cpp"
100
  "decoder.cpp"
101
  "encoder.cpp"
102
  "geometry_intra_pred.cpp"
103
104
105
  "geometry_octree.cpp"
  "geometry_octree_decoder.cpp"
  "geometry_octree_encoder.cpp"
106
107
  "geometry_trisoup_decoder.cpp"
  "geometry_trisoup_encoder.cpp"
108
109
  "io_hls.cpp"
  "io_tlv.cpp"
110
  "osspecific.cpp"
111
112
  "pcc_chrono.cpp"
  "tables.cpp"
113
114
115
  "../dependencies/arithmetic-coding/src/*.cpp"
  "../dependencies/program-options-lite/*.cpp"
)
116

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
117
118
119
120
source_group (inc FILES ${PROJECT_INC_FILES})
source_group (input FILES ${PROJECT_IN_FILES})
source_group (cpp FILES ${PROJECT_CPP_FILES})

121
122
include_directories(
  "${PROJECT_BINARY_DIR}/tmc3"
123
  "${CMAKE_CURRENT_SOURCE_DIR}"
124
125
126
127
  "${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
128

129
130
131
132
133
134
135
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
136
137

install (TARGETS tmc3 DESTINATION bin)