CMakeLists.txt 3.25 KB
Newer Older
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
1
2
3
4
5
6
7
cmake_minimum_required(VERSION 3.0)

if (MSVC)
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:tbb_debug.lib")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:tbb.lib")
endif()

8
9
10
11
if (UNIX)
  add_definitions(-D_POSIX_C_SOURCE=200809L)
endif()

12
13
14
include(CheckSymbolExists)
check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)

15
16
17
##
# Determine the software version from VCS
# Fallback to descriptive version if VCS unavailable
18
set(VERSION_FALLBACK "unconfirmed-release-2.0-rc1")
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
)
39

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

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#
# 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"
)

60
file(GLOB PROJECT_INC_FILES
61
  "AttributeDecoder.h"
62
  "AttributeEncoder.h"
63
64
65
66
67
68
69
70
  "PCCKdTree.h"
  "PCCMath.h"
  "PCCMisc.h"
  "PCCPointSet.h"
  "PCCPointSetProcessing.h"
  "PCCTMC3Common.h"
  "PCCTMC3Decoder.h"
  "PCCTMC3Encoder.h"
71
  "RAHT.h"
72
  "TMC3.h"
73
  "osspecific.h"
74
75
76
77
  "pcc_chrono.h"
  "ringbuf.h"
  "tables.h"
  "version.h"
78
79
80
81
82
  "../dependencies/nanoflann/*.hpp"
  "../dependencies/nanoflann/*.h"
  "../dependencies/arithmetic-coding/inc/*.h"
  "../dependencies/program-options-lite/*.h"
)
83

84
file(GLOB PROJECT_CPP_FILES
85
  "AttributeDecoder.cpp"
86
  "AttributeEncoder.cpp"
87
  "RAHT.cpp"
88
  "TMC3.cpp"
89
  "osspecific.cpp"
90
91
  "pcc_chrono.cpp"
  "tables.cpp"
92
93
94
  "../dependencies/arithmetic-coding/src/*.cpp"
  "../dependencies/program-options-lite/*.cpp"
)
95

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
96
97
98
99
source_group (inc FILES ${PROJECT_INC_FILES})
source_group (input FILES ${PROJECT_IN_FILES})
source_group (cpp FILES ${PROJECT_CPP_FILES})

100
101
include_directories(
  "${PROJECT_BINARY_DIR}/tmc3"
102
  "${CMAKE_CURRENT_SOURCE_DIR}"
103
104
105
106
107
  "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/nanoflann"
  "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/tbb/include"
  "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/arithmetic-coding/inc"
  "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/program-options-lite"
)
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
108

109
110
111
112
113
114
115
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
116
117
118
target_link_libraries (tmc3 tbb_static)

install (TARGETS tmc3 DESTINATION bin)