forked from eProsima/Fast-DDS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (87 loc) · 3.98 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
find_package(Threads REQUIRED)
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<BOOL:${WIN32}>,$<STREQUAL:"${CMAKE_SYSTEM_NAME}","WindowsStore">>:_WIN32_WINNT=0x0603>
$<$<AND:$<BOOL:${WIN32}>,$<NOT:$<STREQUAL:"${CMAKE_SYSTEM_NAME}","WindowsStore">>>:_WIN32_WINNT=0x0601>
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
else()
target_compile_definitions(${PROJECT_NAME} PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
endif()
###############################################################################
# Binaries
###############################################################################
set(MEMORYTEST_SOURCE MemoryTestPublisher.cpp
MemoryTestSubscriber.cpp
MemoryTestTypes.cpp
main_MemoryTest.cpp
)
add_executable(MemoryTest ${MEMORYTEST_SOURCE})
target_include_directories(MemoryTest PRIVATE ${Asio_INCLUDE_DIR})
target_link_libraries(MemoryTest fastrtps foonathan_memory fastdds::optionparser ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
configure_file("cycles_tests.py" "cycles_tests.py")
configure_file("memory_tests.py" "memory_tests.py")
configure_file("memory_analysis.py" "memory_analysis.py")
find_package(PythonInterp 3 REQUIRED)
if(PYTHONINTERP_FOUND)
###############################################################################
# MemoryTest
###############################################################################
add_test(NAME MemoryTest
COMMAND ${PYTHON_EXECUTABLE} memory_tests.py)
# Set test with label NoMemoryCheck
set_property(TEST MemoryTest PROPERTY LABELS "NoMemoryCheck")
if(WIN32)
set_property(TEST MemoryTest PROPERTY ENVIRONMENT
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$ENV{PATH}")
endif()
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"PROFILING_BINS=$<TARGET_FILE:MemoryTest>")
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"VALGRIND_BIN=${CTEST_MEMORYCHECK_COMMAND}")
if(SECURITY)
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs")
endif()
###############################################################################
# CyclesTest
###############################################################################
add_test(NAME CyclesTest
COMMAND ${PYTHON_EXECUTABLE} cycles_tests.py)
# Set test with label NoMemoryCheck
set_property(TEST CyclesTest PROPERTY LABELS "NoMemoryCheck")
if(WIN32)
set_property(TEST CyclesTest PROPERTY ENVIRONMENT
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$ENV{PATH}")
endif()
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"PROFILING_BINS=$<TARGET_FILE:MemoryTest>")
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"VALGRIND_BIN=valgrind")
if(SECURITY)
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs")
endif()
endif()
add_subdirectory(allocations)