| 1 |
#Copyright (c) Microsoft. All rights reserved. |
| 2 |
#Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| 3 |
|
| 4 |
function(target_link_libraries_with_arg_prefix arg_prefix whatIsBuilding lib) |
| 5 |
if(${arg_prefix} STREQUAL "debug") |
| 6 |
target_link_libraries(${whatIsBuilding} debug ${lib}) |
| 7 |
elseif(${arg_prefix} STREQUAL "optimized") |
| 8 |
target_link_libraries(${whatIsBuilding} optimized ${lib}) |
| 9 |
elseif(${arg_prefix} STREQUAL "general") |
| 10 |
target_link_libraries(${whatIsBuilding} general ${lib}) |
| 11 |
else() |
| 12 |
target_link_libraries(${whatIsBuilding} ${lib}) |
| 13 |
endif() |
| 14 |
endfunction() |
| 15 |
|
| 16 |
function(set_test_target_folder whatIsBuilding ext) |
| 17 |
if("${whatIsBuilding}" MATCHES ".*e2e.*") |
| 18 |
set_target_properties(${whatIsBuilding}_${ext} |
| 19 |
PROPERTIES |
| 20 |
FOLDER "tests/E2ETests") |
| 21 |
else() |
| 22 |
set_target_properties(${whatIsBuilding}_${ext} |
| 23 |
PROPERTIES |
| 24 |
FOLDER "tests/UnitTests") |
| 25 |
endif() |
| 26 |
endfunction() |
| 27 |
|
| 28 |
function(windows_unittests_add_dll whatIsBuilding) |
| 29 |
link_directories(${whatIsBuilding}_dll $ENV{VCInstallDir}UnitTest/lib) |
| 30 |
|
| 31 |
add_library(${whatIsBuilding}_dll SHARED |
| 32 |
${${whatIsBuilding}_cpp_files} |
| 33 |
${${whatIsBuilding}_h_files} |
| 34 |
${${whatIsBuilding}_c_files} |
| 35 |
${logging_files} |
| 36 |
) |
| 37 |
|
| 38 |
set_test_target_folder(${whatIsBuilding} "dll") |
| 39 |
|
| 40 |
set(PARSING_ADDITIONAL_LIBS OFF) |
| 41 |
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 42 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER) |
| 43 |
set(ARG_PREFIX "none") |
| 44 |
foreach(f ${ARGN}) |
| 45 |
set(skip_to_next FALSE) |
| 46 |
if(${f} STREQUAL "ADDITIONAL_LIBS") |
| 47 |
SET(PARSING_ADDITIONAL_LIBS ON) |
| 48 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 49 |
set(ARG_PREFIX "none") |
| 50 |
#also unset all the other states |
| 51 |
set(skip_to_next TRUE) |
| 52 |
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE") |
| 53 |
SET(PARSING_ADDITIONAL_LIBS OFF) |
| 54 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON) |
| 55 |
set(skip_to_next TRUE) |
| 56 |
endif() |
| 57 |
|
| 58 |
if(NOT skip_to_next) |
| 59 |
if(PARSING_ADDITIONAL_LIBS) |
| 60 |
if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general")) |
| 61 |
SET(ARG_PREFIX ${f}) |
| 62 |
else() |
| 63 |
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_dll ${f}) |
| 64 |
set(ARG_PREFIX "none") |
| 65 |
endif() |
| 66 |
endif() |
| 67 |
endif() |
| 68 |
|
| 69 |
endforeach() |
| 70 |
|
| 71 |
target_include_directories(${whatIsBuilding}_dll PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include) |
| 72 |
target_compile_definitions(${whatIsBuilding}_dll PUBLIC -DCPP_UNITTEST) |
| 73 |
target_link_libraries(${whatIsBuilding}_dll micromock_cpp_unittest umock_c ctest testrunnerswitcher) |
| 74 |
endfunction() |
| 75 |
|
| 76 |
function(windows_unittests_add_exe whatIsBuilding) |
| 77 |
add_executable(${whatIsBuilding}_exe |
| 78 |
${${whatIsBuilding}_cpp_files} |
| 79 |
${${whatIsBuilding}_h_files} |
| 80 |
${${whatIsBuilding}_c_files} |
| 81 |
${CMAKE_CURRENT_LIST_DIR}/main.c |
| 82 |
${logging_files} |
| 83 |
) |
| 84 |
|
| 85 |
set_test_target_folder(${whatIsBuilding} "exe") |
| 86 |
|
| 87 |
set(PARSING_ADDITIONAL_LIBS OFF) |
| 88 |
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 89 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER) |
| 90 |
set(ARG_PREFIX "none") |
| 91 |
foreach(f ${ARGN}) |
| 92 |
set(skip_to_next FALSE) |
| 93 |
if(${f} STREQUAL "ADDITIONAL_LIBS") |
| 94 |
SET(PARSING_ADDITIONAL_LIBS ON) |
| 95 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 96 |
set(ARG_PREFIX "none") |
| 97 |
#also unset all the other states |
| 98 |
set(skip_to_next TRUE) |
| 99 |
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE") |
| 100 |
SET(PARSING_ADDITIONAL_LIBS OFF) |
| 101 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON) |
| 102 |
set(skip_to_next TRUE) |
| 103 |
endif() |
| 104 |
|
| 105 |
if(NOT skip_to_next) |
| 106 |
if(PARSING_ADDITIONAL_LIBS) |
| 107 |
if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general")) |
| 108 |
SET(ARG_PREFIX ${f}) |
| 109 |
else() |
| 110 |
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f}) |
| 111 |
set(ARG_PREFIX "none") |
| 112 |
endif() |
| 113 |
endif() |
| 114 |
endif() |
| 115 |
|
| 116 |
endforeach() |
| 117 |
|
| 118 |
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST) |
| 119 |
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories}) |
| 120 |
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest testrunnerswitcher) |
| 121 |
add_test(NAME ${whatIsBuilding} COMMAND ${whatIsBuilding}_exe) |
| 122 |
endfunction() |
| 123 |
|
| 124 |
#this function takes more than the 1 mandatory argument (whatIsBuilding) |
| 125 |
#the parameters are separated by "known" separators |
| 126 |
#for example, ADDITIONAL_LIBS starts a list of needed libraries |
| 127 |
function(linux_unittests_add_exe whatIsBuilding) |
| 128 |
add_executable(${whatIsBuilding}_exe |
| 129 |
${${whatIsBuilding}_cpp_files} |
| 130 |
${${whatIsBuilding}_h_files} |
| 131 |
${${whatIsBuilding}_c_files} |
| 132 |
${CMAKE_CURRENT_LIST_DIR}/main.c |
| 133 |
${logging_files} |
| 134 |
) |
| 135 |
|
| 136 |
set_test_target_folder(${whatIsBuilding} "exe") |
| 137 |
|
| 138 |
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST) |
| 139 |
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories}) |
| 140 |
|
| 141 |
#this part detects |
| 142 |
# - the additional libraries that might be needed. |
| 143 |
# additional libraries are started by ADDITIONAL_LIBS parameter and ended by any other known parameter (or end of variable arguments) |
| 144 |
# - a valgrind suppression file (VALGRIND_SUPPRESSIONS_FILE) for memcheck |
| 145 |
# the file name follows immediately after |
| 146 |
|
| 147 |
set(PARSING_ADDITIONAL_LIBS OFF) |
| 148 |
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 149 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER) |
| 150 |
set(ARG_PREFIX "none") |
| 151 |
foreach(f ${ARGN}) |
| 152 |
set(skip_to_next FALSE) |
| 153 |
if(${f} STREQUAL "ADDITIONAL_LIBS") |
| 154 |
SET(PARSING_ADDITIONAL_LIBS ON) |
| 155 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 156 |
set(ARG_PREFIX "none") |
| 157 |
set(skip_to_next TRUE) |
| 158 |
#also unset all the other states |
| 159 |
|
| 160 |
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE") |
| 161 |
SET(PARSING_ADDITIONAL_LIBS OFF) |
| 162 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON) |
| 163 |
set(skip_to_next TRUE) |
| 164 |
endif() |
| 165 |
|
| 166 |
if(NOT skip_to_next) |
| 167 |
if(PARSING_ADDITIONAL_LIBS) |
| 168 |
if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general")) |
| 169 |
SET(ARG_PREFIX ${f}) |
| 170 |
else() |
| 171 |
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f}) |
| 172 |
set(ARG_PREFIX "none") |
| 173 |
endif() |
| 174 |
elseif(PARSING_VALGRIND_SUPPRESSIONS_FILE) |
| 175 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER "--suppressions=${f}") |
| 176 |
endif() |
| 177 |
endif() |
| 178 |
|
| 179 |
endforeach() |
| 180 |
|
| 181 |
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest) |
| 182 |
|
| 183 |
add_test(NAME ${whatIsBuilding} COMMAND $<TARGET_FILE:${whatIsBuilding}_exe>) |
| 184 |
|
| 185 |
if(${run_valgrind}) |
| 186 |
find_program(VALGRIND_FOUND NAMES valgrind) |
| 187 |
if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND) |
| 188 |
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind") |
| 189 |
else() |
| 190 |
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --num-callers=100 --error-exitcode=1 --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>) |
| 191 |
add_test(NAME ${whatIsBuilding}_helgrind COMMAND valgrind --tool=helgrind --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>) |
| 192 |
add_test(NAME ${whatIsBuilding}_drd COMMAND valgrind --tool=drd --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>) |
| 193 |
endif() |
| 194 |
endif() |
| 195 |
endfunction() |
| 196 |
|
| 197 |
function(build_test_artifacts whatIsBuilding use_gballoc) |
| 198 |
|
| 199 |
#the first argument is what is building |
| 200 |
#the second argument is whether the tests should be build with gballoc #defines or not |
| 201 |
#the following arguments are a list of libraries to link with |
| 202 |
|
| 203 |
if(${use_gballoc}) |
| 204 |
add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) |
| 205 |
else() |
| 206 |
endif() |
| 207 |
|
| 208 |
#setting #defines |
| 209 |
if(WIN32) |
| 210 |
add_definitions(-D_CRT_SECURE_NO_WARNINGS) |
| 211 |
else() |
| 212 |
endif() |
| 213 |
|
| 214 |
#setting includes |
| 215 |
set(sharedutil_include_directories ${sharedutil_include_directories} ${TESTRUNNERSWITCHER_INCLUDES} ${CTEST_INCLUDES} ${UMOCK_C_INCLUDES} ${AZURE_C_SHARED_UTILITY_INCLUDES}) |
| 216 |
set(sharedutil_include_directories ${sharedutil_include_directories} ${MICROMOCK_INC_FOLDER} ${TESTRUNNERSWITCHER_INC_FOLDER} ${CTEST_INC_FOLDER} ${SAL_INC_FOLDER} ${SHARED_UTIL_INC_FOLDER} ${SHARED_UTIL_SRC_FOLDER}) |
| 217 |
if(WIN32) |
| 218 |
else() |
| 219 |
include_directories(${sharedutil_include_directories}) |
| 220 |
endif() |
| 221 |
|
| 222 |
#setting logging_files |
| 223 |
add_definitions(-DLOGGER_DISABLE_PAL) |
| 224 |
if(DEFINED SHARED_UTIL_SRC_FOLDER) |
| 225 |
set(logging_files ${XLOGGING_C_FILE} ${LOGGING_C_FILE}) |
| 226 |
elseif(DEFINED SHARED_UTIL_FOLDER) |
| 227 |
set(logging_files ${XLOGGING_C_FILE} ${LOGGING_C_FILE}) |
| 228 |
else() |
| 229 |
message(FATAL_ERROR "No Shared Utility folder defined for src.") |
| 230 |
endif() |
| 231 |
|
| 232 |
#setting output type |
| 233 |
if(WIN32) |
| 234 |
if( |
| 235 |
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${run_unittests}) OR |
| 236 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${run_e2e_tests}) OR |
| 237 |
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests}) |
| 238 |
) |
| 239 |
windows_unittests_add_exe(${whatIsBuilding} ${ARGN}) |
| 240 |
if (${use_cppunittest}) |
| 241 |
windows_unittests_add_dll(${whatIsBuilding} ${ARGN}) |
| 242 |
endif() |
| 243 |
else() |
| 244 |
if( |
| 245 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${nuget_e2e_tests}) |
| 246 |
) |
| 247 |
windows_unittests_add_exe(${whatIsBuilding}_nuget ${ARGN}) |
| 248 |
else() |
| 249 |
#do nothing |
| 250 |
endif() |
| 251 |
endif() |
| 252 |
else() |
| 253 |
if( |
| 254 |
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${run_unittests}) OR |
| 255 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${run_e2e_tests}) OR |
| 256 |
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests}) |
| 257 |
) |
| 258 |
linux_unittests_add_exe(${whatIsBuilding} ${ARGN}) |
| 259 |
endif() |
| 260 |
endif() |
| 261 |
endfunction(build_test_artifacts) |
| 262 |
|
| 263 |
|
| 264 |
function(c_windows_unittests_add_dll whatIsBuilding folder) |
| 265 |
link_directories(${whatIsBuilding}_dll $ENV{VCInstallDir}UnitTest/lib) |
| 266 |
|
| 267 |
add_library(${whatIsBuilding}_testsonly_lib STATIC |
| 268 |
${${whatIsBuilding}_test_files} |
| 269 |
) |
| 270 |
SET(VAR 1) |
| 271 |
foreach(file ${${whatIsBuilding}_test_files}) |
| 272 |
set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS -DCPPUNITTEST_SYMBOL=some_symbol_for_cppunittest_${VAR}) |
| 273 |
MATH(EXPR VAR "${VAR}+1") |
| 274 |
endforeach() |
| 275 |
|
| 276 |
set_target_properties(${whatIsBuilding}_testsonly_lib |
| 277 |
PROPERTIES |
| 278 |
FOLDER ${folder} ) |
| 279 |
|
| 280 |
target_include_directories(${whatIsBuilding}_testsonly_lib PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include) |
| 281 |
target_compile_definitions(${whatIsBuilding}_testsonly_lib PUBLIC -DCPP_UNITTEST) |
| 282 |
target_compile_options(${whatIsBuilding}_testsonly_lib PUBLIC /TP /EHsc) |
| 283 |
|
| 284 |
add_library(${whatIsBuilding}_dll SHARED |
| 285 |
${${whatIsBuilding}_cpp_files} |
| 286 |
${${whatIsBuilding}_h_files} |
| 287 |
${${whatIsBuilding}_c_files} |
| 288 |
${logging_files} |
| 289 |
) |
| 290 |
|
| 291 |
set_target_properties(${whatIsBuilding}_dll |
| 292 |
PROPERTIES |
| 293 |
FOLDER ${folder}) |
| 294 |
|
| 295 |
set_source_files_properties(${${whatIsBuilding}_c_files} ${logging_files} |
| 296 |
PROPERTIES |
| 297 |
COMPILE_FLAGS /TC) |
| 298 |
|
| 299 |
set_source_files_properties(${${whatIsBuilding}_cpp_files} |
| 300 |
PROPERTIES |
| 301 |
COMPILE_FLAGS /TP) |
| 302 |
|
| 303 |
target_link_libraries(${whatIsBuilding}_dll umock_c ctest testrunnerswitcher ${whatIsBuilding}_testsonly_lib ) |
| 304 |
|
| 305 |
set(PARSING_ADDITIONAL_LIBS OFF) |
| 306 |
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 307 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER) |
| 308 |
set(ARG_PREFIX "none") |
| 309 |
foreach(f ${ARGN}) |
| 310 |
set(skip_to_next FALSE) |
| 311 |
if(${f} STREQUAL "ADDITIONAL_LIBS") |
| 312 |
SET(PARSING_ADDITIONAL_LIBS ON) |
| 313 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 314 |
set(ARG_PREFIX "none") |
| 315 |
#also unset all the other states |
| 316 |
set(skip_to_next TRUE) |
| 317 |
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE") |
| 318 |
SET(PARSING_ADDITIONAL_LIBS OFF) |
| 319 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON) |
| 320 |
set(skip_to_next TRUE) |
| 321 |
endif() |
| 322 |
|
| 323 |
if(NOT skip_to_next) |
| 324 |
if(PARSING_ADDITIONAL_LIBS) |
| 325 |
if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general")) |
| 326 |
SET(ARG_PREFIX ${f}) |
| 327 |
else() |
| 328 |
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_dll ${f}) |
| 329 |
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_testsonly_lib ${f}) |
| 330 |
set(ARG_PREFIX "none") |
| 331 |
endif() |
| 332 |
endif() |
| 333 |
endif() |
| 334 |
|
| 335 |
endforeach() |
| 336 |
|
| 337 |
SET(SPACES " ") |
| 338 |
SET(VAR 1) |
| 339 |
foreach(file ${${whatIsBuilding}_test_files}) |
| 340 |
# for x64 the underscore is not needed |
| 341 |
if (ARCHITECTURE STREQUAL "x86_64" OR ARCHITECTURE STREQUAL "ARM") |
| 342 |
set_property(TARGET ${whatIsBuilding}_dll APPEND_STRING PROPERTY LINK_FLAGS ${SPACES}/INCLUDE:"some_symbol_for_cppunittest_${VAR}") |
| 343 |
else() |
| 344 |
set_property(TARGET ${whatIsBuilding}_dll APPEND_STRING PROPERTY LINK_FLAGS ${SPACES}/INCLUDE:"_some_symbol_for_cppunittest_${VAR}") |
| 345 |
endif() |
| 346 |
MATH(EXPR VAR "${VAR}+1") |
| 347 |
endforeach() |
| 348 |
endfunction() |
| 349 |
|
| 350 |
function(c_windows_unittests_add_exe whatIsBuilding folder) |
| 351 |
add_executable(${whatIsBuilding}_exe |
| 352 |
${${whatIsBuilding}_test_files} |
| 353 |
${${whatIsBuilding}_cpp_files} |
| 354 |
${${whatIsBuilding}_h_files} |
| 355 |
${${whatIsBuilding}_c_files} |
| 356 |
${CMAKE_CURRENT_LIST_DIR}/main.c |
| 357 |
${logging_files} |
| 358 |
) |
| 359 |
set_target_properties(${whatIsBuilding}_exe |
| 360 |
PROPERTIES |
| 361 |
FOLDER ${folder}) |
| 362 |
|
| 363 |
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST) |
| 364 |
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories}) |
| 365 |
target_link_libraries(${whatIsBuilding}_exe umock_c ctest testrunnerswitcher) |
| 366 |
|
| 367 |
set(PARSING_ADDITIONAL_LIBS OFF) |
| 368 |
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 369 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER) |
| 370 |
set(ARG_PREFIX "none") |
| 371 |
foreach(f ${ARGN}) |
| 372 |
set(skip_to_next FALSE) |
| 373 |
if(${f} STREQUAL "ADDITIONAL_LIBS") |
| 374 |
SET(PARSING_ADDITIONAL_LIBS ON) |
| 375 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 376 |
set(ARG_PREFIX "none") |
| 377 |
#also unset all the other states |
| 378 |
set(skip_to_next TRUE) |
| 379 |
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE") |
| 380 |
SET(PARSING_ADDITIONAL_LIBS OFF) |
| 381 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON) |
| 382 |
set(skip_to_next TRUE) |
| 383 |
endif() |
| 384 |
|
| 385 |
if(NOT skip_to_next) |
| 386 |
if(PARSING_ADDITIONAL_LIBS) |
| 387 |
if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general")) |
| 388 |
SET(ARG_PREFIX ${f}) |
| 389 |
else() |
| 390 |
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f}) |
| 391 |
set(ARG_PREFIX "none") |
| 392 |
endif() |
| 393 |
endif() |
| 394 |
endif() |
| 395 |
|
| 396 |
endforeach() |
| 397 |
|
| 398 |
add_test(NAME ${whatIsBuilding} COMMAND ${whatIsBuilding}_exe) |
| 399 |
endfunction() |
| 400 |
|
| 401 |
#this function takes more than the 1 mandatory argument (whatIsBuilding) |
| 402 |
#the parameters are separated by "known" separators |
| 403 |
#for example, ADDITIONAL_LIBS starts a list of needed libraries |
| 404 |
function(c_linux_unittests_add_exe whatIsBuilding folder) |
| 405 |
|
| 406 |
add_executable(${whatIsBuilding}_exe |
| 407 |
${${whatIsBuilding}_test_files} |
| 408 |
${${whatIsBuilding}_cpp_files} |
| 409 |
${${whatIsBuilding}_h_files} |
| 410 |
${${whatIsBuilding}_c_files} |
| 411 |
${CMAKE_CURRENT_LIST_DIR}/main.c |
| 412 |
${logging_files} |
| 413 |
) |
| 414 |
set_target_properties(${whatIsBuilding}_exe |
| 415 |
PROPERTIES |
| 416 |
FOLDER ${folder}) |
| 417 |
|
| 418 |
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST) |
| 419 |
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories}) |
| 420 |
|
| 421 |
#this part detects |
| 422 |
# - the additional libraries that might be needed. |
| 423 |
# additional libraries are started by ADDITIONAL_LIBS parameter and ended by any other known parameter (or end of variable arguments) |
| 424 |
# - a valgrind suppression file (VALGRIND_SUPPRESSIONS_FILE) for memcheck |
| 425 |
# the file name follows immediately after |
| 426 |
|
| 427 |
set(PARSING_ADDITIONAL_LIBS OFF) |
| 428 |
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 429 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER) |
| 430 |
set(ARG_PREFIX "none") |
| 431 |
foreach(f ${ARGN}) |
| 432 |
set(skip_to_next FALSE) |
| 433 |
if(${f} STREQUAL "ADDITIONAL_LIBS") |
| 434 |
SET(PARSING_ADDITIONAL_LIBS ON) |
| 435 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 436 |
set(ARG_PREFIX "none") |
| 437 |
#also unset all the other states |
| 438 |
set(skip_to_next TRUE) |
| 439 |
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE") |
| 440 |
SET(PARSING_ADDITIONAL_LIBS OFF) |
| 441 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON) |
| 442 |
set(skip_to_next TRUE) |
| 443 |
endif() |
| 444 |
|
| 445 |
if(NOT skip_to_next) |
| 446 |
if(PARSING_ADDITIONAL_LIBS) |
| 447 |
if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general")) |
| 448 |
SET(ARG_PREFIX ${f}) |
| 449 |
else() |
| 450 |
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f}) |
| 451 |
set(ARG_PREFIX "none") |
| 452 |
endif() |
| 453 |
elseif(PARSING_VALGRIND_SUPPRESSIONS_FILE) |
| 454 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER "--suppressions=${f}") |
| 455 |
endif() |
| 456 |
endif() |
| 457 |
|
| 458 |
endforeach() |
| 459 |
|
| 460 |
target_link_libraries(${whatIsBuilding}_exe umock_c ctest m) |
| 461 |
|
| 462 |
add_test(NAME ${whatIsBuilding} COMMAND $<TARGET_FILE:${whatIsBuilding}_exe>) |
| 463 |
|
| 464 |
if(${run_valgrind}) |
| 465 |
find_program(VALGRIND_FOUND NAMES valgrind) |
| 466 |
if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND) |
| 467 |
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind") |
| 468 |
else() |
| 469 |
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --gen-suppressions=all --num-callers=100 --error-exitcode=1 --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>) |
| 470 |
add_test(NAME ${whatIsBuilding}_helgrind COMMAND valgrind --tool=helgrind --gen-suppressions=all --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>) |
| 471 |
add_test(NAME ${whatIsBuilding}_drd COMMAND valgrind --tool=drd --gen-suppressions=all --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>) |
| 472 |
endif() |
| 473 |
endif() |
| 474 |
endfunction() |
| 475 |
|
| 476 |
function(build_c_test_artifacts whatIsBuilding use_gballoc folder) |
| 477 |
|
| 478 |
#the first argument is what is building |
| 479 |
#the second argument is whether the tests should be build with gballoc #defines or not |
| 480 |
#the following arguments are a list of libraries to link with |
| 481 |
|
| 482 |
if(${use_gballoc}) |
| 483 |
add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) |
| 484 |
else() |
| 485 |
endif() |
| 486 |
|
| 487 |
#setting #defines |
| 488 |
if(WIN32) |
| 489 |
add_definitions(-D_CRT_SECURE_NO_WARNINGS) |
| 490 |
else() |
| 491 |
endif() |
| 492 |
|
| 493 |
#setting includes |
| 494 |
set(sharedutil_include_directories ${sharedutil_include_directories} ${TESTRUNNERSWITCHER_INCLUDES} ${CTEST_INCLUDES} ${UMOCK_C_INCLUDES} ${AZURE_C_SHARED_UTILITY_INCLUDES}) |
| 495 |
set(sharedutil_include_directories ${sharedutil_include_directories} ${MICROMOCK_INC_FOLDER} ${UMOCK_C_INC_FOLDER} ${TESTRUNNERSWITCHER_INC_FOLDER} ${CTEST_INC_FOLDER} ${SAL_INC_FOLDER} ${SHARED_UTIL_INC_FOLDER} ${SHARED_UTIL_SRC_FOLDER}) |
| 496 |
if(WIN32) |
| 497 |
else() |
| 498 |
include_directories(${sharedutil_include_directories}) |
| 499 |
endif() |
| 500 |
|
| 501 |
add_definitions(-DLOGGER_DISABLE_PAL) |
| 502 |
|
| 503 |
#setting logging_files |
| 504 |
if(DEFINED SHARED_UTIL_SRC_FOLDER) |
| 505 |
set(logging_files ${XLOGGING_C_FILE} ${LOGGING_C_FILE}) |
| 506 |
elseif(DEFINED SHARED_UTIL_FOLDER) |
| 507 |
set(logging_files ${XLOGGING_C_FILE} ${LOGGING_C_FILE}) |
| 508 |
else() |
| 509 |
message(FATAL_ERROR "No Shared Utility folder defined for includes/src.") |
| 510 |
endif() |
| 511 |
|
| 512 |
#setting output type |
| 513 |
if(WIN32) |
| 514 |
if( |
| 515 |
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${run_unittests}) OR |
| 516 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${run_e2e_tests}) OR |
| 517 |
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests}) |
| 518 |
) |
| 519 |
if (${use_cppunittest}) |
| 520 |
c_windows_unittests_add_dll(${whatIsBuilding} ${folder} ${ARGN}) |
| 521 |
endif() |
| 522 |
c_windows_unittests_add_exe(${whatIsBuilding} ${folder} ${ARGN}) |
| 523 |
else() |
| 524 |
if( |
| 525 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${nuget_e2e_tests}) |
| 526 |
) |
| 527 |
c_windows_unittests_add_exe(${whatIsBuilding}_nuget ${folder} ${ARGN}) |
| 528 |
else() |
| 529 |
#do nothing |
| 530 |
endif() |
| 531 |
endif() |
| 532 |
else() |
| 533 |
if( |
| 534 |
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${run_unittests}) OR |
| 535 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${run_e2e_tests}) OR |
| 536 |
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests}) |
| 537 |
) |
| 538 |
c_linux_unittests_add_exe(${whatIsBuilding} ${folder} ${ARGN}) |
| 539 |
endif() |
| 540 |
endif() |
| 541 |
endfunction() |
| 542 |
|
| 543 |
function(compile_c_test_artifacts_as whatIsBuilding compileAsWhat) |
| 544 |
|
| 545 |
if(WIN32) |
| 546 |
if( |
| 547 |
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${run_unittests}) OR |
| 548 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${run_e2e_tests}) OR |
| 549 |
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests}) |
| 550 |
) |
| 551 |
if (${use_cppunittest}) |
| 552 |
if(${compileAsWhat} STREQUAL "C99") |
| 553 |
compileTargetAsC99(${whatIsBuilding}_dll) |
| 554 |
compileTargetAsC99(${whatIsBuilding}_testsonly_lib) |
| 555 |
endif() |
| 556 |
if(${compileAsWhat} STREQUAL "C11") |
| 557 |
compileTargetAsC11(${whatIsBuilding}_dll) |
| 558 |
compileTargetAsC11(${whatIsBuilding}_testsonly_lib) |
| 559 |
endif() |
| 560 |
endif() |
| 561 |
if(${compileAsWhat} STREQUAL "C99") |
| 562 |
compileTargetAsC99(${whatIsBuilding}_exe) |
| 563 |
endif() |
| 564 |
if(${compileAsWhat} STREQUAL "C11") |
| 565 |
compileTargetAsC11(${whatIsBuilding}_exe) |
| 566 |
endif() |
| 567 |
else() |
| 568 |
if( |
| 569 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${nuget_e2e_tests}) |
| 570 |
) |
| 571 |
if(${compileAsWhat} STREQUAL "C99") |
| 572 |
compileTargetAsC99(${whatIsBuilding}_exe) |
| 573 |
endif() |
| 574 |
if(${compileAsWhat} STREQUAL "C11") |
| 575 |
compileTargetAsC11(${whatIsBuilding}_exe) |
| 576 |
endif() |
| 577 |
else() |
| 578 |
#do nothing |
| 579 |
endif() |
| 580 |
endif() |
| 581 |
else() |
| 582 |
if( |
| 583 |
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${run_unittests}) OR |
| 584 |
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${run_e2e_tests}) OR |
| 585 |
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests}) |
| 586 |
) |
| 587 |
if(${compileAsWhat} STREQUAL "C99") |
| 588 |
compileTargetAsC99(${whatIsBuilding}_exe) |
| 589 |
endif() |
| 590 |
if(${compileAsWhat} STREQUAL "C11") |
| 591 |
compileTargetAsC11(${whatIsBuilding}_exe) |
| 592 |
endif() |
| 593 |
endif() |
| 594 |
endif() |
| 595 |
endfunction() |
| 596 |
|
| 597 |
function(build_c_test_longhaul_test test_name test_c_files test_h_files) |
| 598 |
set(test_c_files |
| 599 |
${CMAKE_CURRENT_LIST_DIR}/../common_longhaul/iothub_client_statistics.c |
| 600 |
${CMAKE_CURRENT_LIST_DIR}/../common_longhaul/iothub_client_common_longhaul.c |
| 601 |
${test_c_files} |
| 602 |
) |
| 603 |
|
| 604 |
set(test_h_files |
| 605 |
${CMAKE_CURRENT_LIST_DIR}/../common_longhaul/iothub_client_statistics.h |
| 606 |
${CMAKE_CURRENT_LIST_DIR}/../common_longhaul/iothub_client_common_longhaul.h |
| 607 |
${test_h_files} |
| 608 |
) |
| 609 |
|
| 610 |
IF(WIN32) |
| 611 |
#windows needs this define |
| 612 |
add_definitions(-D_CRT_SECURE_NO_WARNINGS) |
| 613 |
add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) |
| 614 |
ENDIF(WIN32) |
| 615 |
|
| 616 |
#Conditionally use the SDK trusted certs in the samples |
| 617 |
if(${set_trusted_cert_in_samples}) |
| 618 |
add_definitions(-DSET_TRUSTED_CERT_IN_SAMPLES) |
| 619 |
include_directories(${PROJECT_SOURCE_DIR}/certs) |
| 620 |
set(samples_cert_file ${PROJECT_SOURCE_DIR}/certs/certs.c) |
| 621 |
endif() |
| 622 |
|
| 623 |
include_directories(${IOTHUB_TEST_INC_FOLDER}) |
| 624 |
include_directories(${IOTHUB_SERVICE_CLIENT_INC_FOLDER}) |
| 625 |
include_directories(.) |
| 626 |
|
| 627 |
add_executable(${test_name} ${test_c_files} ${test_h_files} ${samples_cert_file}) |
| 628 |
|
| 629 |
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF) |
| 630 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER) |
| 631 |
foreach(f ${ARGN}) |
| 632 |
set(skip_to_next FALSE) |
| 633 |
if(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE") |
| 634 |
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON) |
| 635 |
set(skip_to_next TRUE) |
| 636 |
endif() |
| 637 |
|
| 638 |
if(NOT skip_to_next) |
| 639 |
if(PARSING_VALGRIND_SUPPRESSIONS_FILE) |
| 640 |
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER "--suppressions=${f}") |
| 641 |
endif() |
| 642 |
endif() |
| 643 |
endforeach() |
| 644 |
|
| 645 |
if(${run_valgrind}) |
| 646 |
find_program(VALGRIND_FOUND NAMES valgrind) |
| 647 |
if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND) |
| 648 |
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind") |
| 649 |
else() |
| 650 |
# below are the longhaul tests running under valgrind |
| 651 |
# These are currently disabled because the longhaul containers are still Ubuntu 16 andd need s to upgraded to Ubuntu 18 |
| 652 |
|
| 653 |
#add_test(NAME ${test_name}_valgrind COMMAND valgrind --gen-suppressions=all --num-callers=100 --error-exitcode=1 --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${test_name}>) |
| 654 |
#add_test(NAME ${test_name}_helgrind COMMAND valgrind --tool=helgrind --gen-suppressions=all --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${test_name}>) |
| 655 |
#add_test(NAME ${test_name}_drd COMMAND valgrind --tool=drd --gen-suppressions=all --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${test_name}>) |
| 656 |
#set_tests_properties(${test_name}_valgrind PROPERTIES TIMEOUT 1296000) |
| 657 |
#set_tests_properties(${test_name}_helgrind PROPERTIES TIMEOUT 1296000) |
| 658 |
#set_tests_properties(${test_name}_drd PROPERTIES TIMEOUT 1296000) |
| 659 |
|
| 660 |
# run the lonhaul without using valgrind |
| 661 |
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) |
| 662 |
set_tests_properties(${test_name} PROPERTIES TIMEOUT 1296000) |
| 663 |
endif() |
| 664 |
else() |
| 665 |
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) |
| 666 |
set_tests_properties(${test_name} PROPERTIES TIMEOUT 1296000) |
| 667 |
endif() |
| 668 |
|
| 669 |
target_link_libraries(${test_name} |
| 670 |
iothub_test |
| 671 |
iothub_client) |
| 672 |
|
| 673 |
set_target_properties(${test_name} PROPERTIES FOLDER "tests/LongHaul") |
| 674 |
endfunction() |
| 675 |
|
| 676 |
# This function focuses on setting files which are unique to a given hardware platform. |
| 677 |
# The choice of tlsio is not unique per-platform, and is set in the main CMakeLists.txt |
| 678 |
function(set_platform_files c_shared_dir) |
| 679 |
if(WIN32) |
| 680 |
if(${use_condition}) |
| 681 |
set(CONDITION_C_FILE ${c_shared_dir}/adapters/condition_win32.c PARENT_SCOPE) |
| 682 |
endif() |
| 683 |
|
| 684 |
if(${use_etw} STREQUAL "OFF") |
| 685 |
set(XLOGGING_C_FILE ${c_shared_dir}/src/xlogging.c PARENT_SCOPE) |
| 686 |
set(LOGGING_C_FILE ${c_shared_dir}/src/consolelogger.c PARENT_SCOPE) |
| 687 |
set(LOGGING_H_FILE ${c_shared_dir}/inc/azure_c_shared_utility/consolelogger.h PARENT_SCOPE) |
| 688 |
elseif(${use_etw} STREQUAL "TRACELOGGING") |
| 689 |
set(XLOGGING_C_FILE ${c_shared_dir}/src/etwxlogging.c PARENT_SCOPE) |
| 690 |
set(LOGGING_C_FILE ${c_shared_dir}/src/etwlogger_driver.c PARENT_SCOPE) |
| 691 |
set(LOGGING_H_FILE ${c_shared_dir}/inc/azure_c_shared_utility/etwlogger_driver.h PARENT_SCOPE) |
| 692 |
elseif(${use_etw} STREQUAL "TRACELOGGING_WITH_CONSOLE") |
| 693 |
set(XLOGGING_C_FILE ${c_shared_dir}/src/etwxlogging.c PARENT_SCOPE) |
| 694 |
set(LOGGING_C_FILE ${c_shared_dir}/src/etwlogger_driver.c ${c_shared_dir}/src/consolelogger.c PARENT_SCOPE) |
| 695 |
set(LOGGING_H_FILE ${c_shared_dir}/inc/azure_c_shared_utility/etwlogger_driver.h ${c_shared_dir}/inc/azure_c_shared_utility/consolelogger.h PARENT_SCOPE) |
| 696 |
endif() |
| 697 |
|
| 698 |
set(THREAD_C_FILE ${c_shared_dir}/adapters/threadapi_win32.c PARENT_SCOPE) |
| 699 |
set(LOCK_C_FILE ${c_shared_dir}/adapters/lock_win32.c PARENT_SCOPE) |
| 700 |
set(SRW_LOCK_C_FILE ${c_shared_dir}/adapters/srw_lock.c PARENT_SCOPE) |
| 701 |
set(TIMER_C_FILE ${c_shared_dir}/adapters/timer.c PARENT_SCOPE) |
| 702 |
set(STRING_UTILS_C_FILE ${c_shared_dir}/adapters/string_utils.c PARENT_SCOPE) |
| 703 |
set(RANDOM_C_FILE ${c_shared_dir}/adapters/random_stub.c PARENT_SCOPE) |
| 704 |
|
| 705 |
if (${use_builtin_httpapi}) |
| 706 |
set(HTTP_C_FILE ${c_shared_dir}/adapters/httpapi_compact.c PARENT_SCOPE) |
| 707 |
else() |
| 708 |
set(HTTP_C_FILE ${c_shared_dir}/adapters/httpapi_winhttp.c PARENT_SCOPE) |
| 709 |
endif() |
| 710 |
set(PLATFORM_C_FILE ${c_shared_dir}/adapters/platform_win32.c PARENT_SCOPE) |
| 711 |
if (${use_socketio}) |
| 712 |
set(SOCKETIO_C_FILE ${c_shared_dir}/adapters/socketio_win32.c PARENT_SCOPE) |
| 713 |
endif() |
| 714 |
set(TICKCOUTER_C_FILE ${c_shared_dir}/adapters/tickcounter_win32.c PARENT_SCOPE) |
| 715 |
if (${use_default_uuid}) |
| 716 |
set(UNIQUEID_C_FILE ${c_shared_dir}/adapters/uniqueid_stub.c PARENT_SCOPE) |
| 717 |
else() |
| 718 |
set(UNIQUEID_C_FILE ${c_shared_dir}/adapters/uniqueid_win32.c PARENT_SCOPE) |
| 719 |
endif() |
| 720 |
set(DNS_C_FILE ${c_shared_dir}/src/dns_resolver_sync.c PARENT_SCOPE) |
| 721 |
else() |
| 722 |
set(XLOGGING_C_FILE ${c_shared_dir}/src/xlogging.c PARENT_SCOPE) |
| 723 |
set(LOGGING_C_FILE ${c_shared_dir}/src/consolelogger.c PARENT_SCOPE) |
| 724 |
set(LOGGING_H_FILE ${c_shared_dir}/inc/azure_c_shared_utility/consolelogger.h PARENT_SCOPE) |
| 725 |
|
| 726 |
if(${use_condition}) |
| 727 |
set(CONDITION_C_FILE ${c_shared_dir}/adapters/condition_pthreads.c PARENT_SCOPE) |
| 728 |
endif() |
| 729 |
|
| 730 |
if (${use_builtin_httpapi}) |
| 731 |
set(HTTP_C_FILE ${c_shared_dir}/adapters/httpapi_compact.c PARENT_SCOPE) |
| 732 |
else() |
| 733 |
set(HTTP_C_FILE ${c_shared_dir}/adapters/httpapi_curl.c PARENT_SCOPE) |
| 734 |
endif() |
| 735 |
set(LOCK_C_FILE ${c_shared_dir}/adapters/lock_pthreads.c PARENT_SCOPE) |
| 736 |
if (use_applessl) |
| 737 |
set(PLATFORM_C_FILE ${c_shared_dir}/pal/ios-osx/platform_appleios.c PARENT_SCOPE) |
| 738 |
else() |
| 739 |
set(PLATFORM_C_FILE ${c_shared_dir}/adapters/platform_linux.c PARENT_SCOPE) |
| 740 |
endif() |
| 741 |
if (${use_socketio}) |
| 742 |
set(SOCKETIO_C_FILE ${c_shared_dir}/adapters/socketio_berkeley.c PARENT_SCOPE) |
| 743 |
endif() |
| 744 |
set(THREAD_C_FILE ${c_shared_dir}/adapters/threadapi_pthreads.c PARENT_SCOPE) |
| 745 |
set(TICKCOUTER_C_FILE ${c_shared_dir}/adapters/tickcounter_linux.c PARENT_SCOPE) |
| 746 |
if (${use_default_uuid}) |
| 747 |
set(UNIQUEID_C_FILE ${c_shared_dir}/adapters/uniqueid_stub.c PARENT_SCOPE) |
| 748 |
elseif(AZSPHERE) |
| 749 |
set(UNIQUEID_C_FILE ${c_shared_dir}/adapters/uniqueid_azsphere.c PARENT_SCOPE) |
| 750 |
else() |
| 751 |
set(UNIQUEID_C_FILE ${c_shared_dir}/adapters/uniqueid_linux.c PARENT_SCOPE) |
| 752 |
endif() |
| 753 |
if(${use_c_ares}) |
| 754 |
set(DNS_C_FILE ${c_shared_dir}/src/dns_resolver_ares.c PARENT_SCOPE) |
| 755 |
else() |
| 756 |
set(DNS_C_FILE ${c_shared_dir}/src/dns_resolver_sync.c PARENT_SCOPE) |
| 757 |
endif() |
| 758 |
|
| 759 |
if(UNIX AND NOT MACOSX) |
| 760 |
set(RANDOM_C_FILE ${c_shared_dir}/adapters/random_posix.c PARENT_SCOPE) |
| 761 |
else() |
| 762 |
set(RANDOM_C_FILE ${c_shared_dir}/adapters/random_stub.c PARENT_SCOPE) |
| 763 |
endif() |
| 764 |
endif() |
| 765 |
|
| 766 |
if(WIN32 OR MACOSX OR LINUX) |
| 767 |
set (ENVIRONMENT_VARIABLE_C_FILE ${c_shared_dir}/adapters/envvariable.c PARENT_SCOPE) |
| 768 |
endif() |
| 769 |
endfunction(set_platform_files) |