Makes azure-c-shared-utility installable and a find module in CMake. Adds a flag for using installed packages instead of adding submodules.
Links with crypt32 ws_32 and secur32 when using openssl.
This commit is contained in:
Родитель
f98926f576
Коммит
b2ac4ad476
|
@ -2,6 +2,7 @@
|
|||
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
|
||||
################################################################################
|
||||
|
||||
/build
|
||||
/build_all/windows/nuget.exe
|
||||
/cmake
|
||||
/devdoc/~$o_requirements.docm
|
||||
|
|
544
CMakeLists.txt
544
CMakeLists.txt
|
@ -36,6 +36,7 @@ option(use_http "set use_http to ON if http is to be used, set to OFF to not use
|
|||
option(use_condition "set use_condition to ON if the condition module and its adapters should be enabled" ON)
|
||||
option(use_wsio "set use_wsio to ON to use libwebsockets for WebSocket support (default is OFF)" OFF)
|
||||
option(nuget_e2e_tests "set nuget_e2e_tests to ON to generate e2e tests to run with nuget packages (default is OFF)" OFF)
|
||||
option(use_installed_dependencies "set use_installed_dependencies to ON to use installed packages instead of building dependencies from submodules" OFF)
|
||||
|
||||
if(WIN32)
|
||||
option(use_schannel "set use_schannel to ON if schannel is to be used, set to OFF to not use schannel" ON)
|
||||
|
@ -145,17 +146,16 @@ if(MSVC)
|
|||
|
||||
endif()
|
||||
elseif(LINUX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Werror")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Werror")
|
||||
if(NOT IN_OPENWRT)
|
||||
set (CMAKE_C_FLAGS "-D_POSIX_C_SOURCE=200112L ${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${use_wsio})
|
||||
include("dependencies.cmake")
|
||||
include_directories($ENV{OpenSSLDir}/include)
|
||||
include_directories(deps/libwebsockets/lib)
|
||||
include_directories(${PROJECT_BINARY_DIR}/deps/libwebsockets)
|
||||
|
||||
if(WIN32)
|
||||
string(REPLACE "/W4" "/W0" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
|
@ -172,7 +172,6 @@ if(${use_wsio})
|
|||
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4006 /IGNORE:4221")
|
||||
|
||||
remove_definitions(/WX)
|
||||
add_subdirectory(deps/libwebsockets)
|
||||
add_definitions(/WX)
|
||||
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS_PREV})
|
||||
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_PREV})
|
||||
|
@ -189,7 +188,6 @@ if(${use_wsio})
|
|||
if(NOT IN_OPENWRT)
|
||||
string(REPLACE "-D_POSIX_C_SOURCE=200112L" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
endif()
|
||||
add_subdirectory(deps/libwebsockets)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
if(NOT IN_OPENWRT)
|
||||
|
@ -275,483 +273,10 @@ function(add_files_to_install filesToBeInstalled)
|
|||
set(INSTALL_H_FILES ${INSTALL_H_FILES} ${filesToBeInstalled} CACHE INTERNAL "Files that will be installed on the system")
|
||||
endfunction()
|
||||
|
||||
function(set_test_target_folder whatIsBuilding ext)
|
||||
if("${whatIsBuilding}" MATCHES ".*e2e.*")
|
||||
set_target_properties(${whatIsBuilding}_${ext}
|
||||
PROPERTIES
|
||||
FOLDER "tests/E2ETests")
|
||||
else()
|
||||
set_target_properties(${whatIsBuilding}_${ext}
|
||||
PROPERTIES
|
||||
FOLDER "tests/UnitTests")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(windows_unittests_add_dll whatIsBuilding)
|
||||
link_directories(${whatIsBuilding}_dll $ENV{VCInstallDir}UnitTest/lib)
|
||||
|
||||
add_library(${whatIsBuilding}_dll SHARED
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${sharedutil_include_directories}../../src/xlogging.c
|
||||
${sharedutil_include_directories}../../src/consolelogger.c
|
||||
)
|
||||
|
||||
set_test_target_folder(${whatIsBuilding} "dll")
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_dll ${f})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
target_include_directories(${whatIsBuilding}_dll PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include)
|
||||
target_compile_definitions(${whatIsBuilding}_dll PUBLIC -DCPP_UNITTEST)
|
||||
target_link_libraries(${whatIsBuilding}_dll micromock_cpp_unittest umock_c ctest testrunnerswitcher)
|
||||
endfunction()
|
||||
|
||||
function(windows_unittests_add_exe whatIsBuilding)
|
||||
add_executable(${whatIsBuilding}_exe
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.c
|
||||
${sharedutil_include_directories}../../src/xlogging.c
|
||||
${sharedutil_include_directories}../../src/consolelogger.c
|
||||
)
|
||||
|
||||
set_test_target_folder(${whatIsBuilding} "exe")
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_exe ${f})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
|
||||
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
|
||||
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest testrunnerswitcher)
|
||||
add_test(NAME ${whatIsBuilding} COMMAND ${whatIsBuilding}_exe)
|
||||
endfunction()
|
||||
|
||||
#this function takes more than the 1 mandatory argument (whatIsBuilding)
|
||||
#the parameters are separated by "known" separators
|
||||
#for example, ADDITIONAL_LIBS starts a list of needed libraries
|
||||
function(linux_unittests_add_exe whatIsBuilding)
|
||||
add_executable(${whatIsBuilding}_exe
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.c
|
||||
${sharedutil_include_directories}../../src/xlogging.c
|
||||
${sharedutil_include_directories}../../src/consolelogger.c
|
||||
)
|
||||
|
||||
set_test_target_folder(${whatIsBuilding} "exe")
|
||||
|
||||
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
|
||||
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
|
||||
|
||||
#this part detects
|
||||
# - the additional libraries that might be needed.
|
||||
# additional libraries are started by ADDITIONAL_LIBS parameter and ended by any other known parameter (or end of variable arguments)
|
||||
# - a valgrind suppression file (VALGRIND_SUPPRESSIONS_FILE) for memcheck
|
||||
# the file name follows immediately after
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
|
||||
else()
|
||||
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_exe ${f})
|
||||
elseif(PARSING_VALGRIND_SUPPRESSIONS_FILE)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER "--suppressions=${f}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest)
|
||||
|
||||
add_test(NAME ${whatIsBuilding} COMMAND $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
|
||||
if(${run_valgrind})
|
||||
find_program(VALGRIND_FOUND NAMES valgrind)
|
||||
if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
|
||||
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
|
||||
else()
|
||||
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --num-callers=100 --error-exitcode=1 --trace-children=yes --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
add_test(NAME ${whatIsBuilding}_helgrind COMMAND valgrind --tool=helgrind --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
add_test(NAME ${whatIsBuilding}_drd COMMAND valgrind --tool=drd --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(build_test_artifacts whatIsBuilding use_gballoc)
|
||||
|
||||
#the first argument is what is building
|
||||
#the second argument is whether the tests should be build with gballoc #defines or not
|
||||
#the following arguments are a list of libraries to link with
|
||||
|
||||
if(${use_gballoc})
|
||||
add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC)
|
||||
else()
|
||||
endif()
|
||||
|
||||
#setting #defines
|
||||
if(WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
else()
|
||||
endif()
|
||||
|
||||
#setting includes
|
||||
set(sharedutil_include_directories ${MICROMOCK_INC_FOLDER} ${TESTRUNNERSWITCHER_INC_FOLDER} ${CTEST_INC_FOLDER} ${SAL_INC_FOLDER} ${SHARED_UTIL_INC_FOLDER} ${SHARED_UTIL_SRC_FOLDER})
|
||||
if(WIN32)
|
||||
else()
|
||||
include_directories(${sharedutil_include_directories})
|
||||
endif()
|
||||
|
||||
#setting output type
|
||||
if(WIN32)
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${skip_unittests})
|
||||
)
|
||||
else()
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${nuget_e2e_tests})
|
||||
)
|
||||
windows_unittests_add_exe(${whatIsBuilding}_nuget ${ARGN})
|
||||
else()
|
||||
windows_unittests_add_exe(${whatIsBuilding} ${ARGN})
|
||||
windows_unittests_add_dll(${whatIsBuilding} ${ARGN})
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${skip_unittests})
|
||||
)
|
||||
else()
|
||||
linux_unittests_add_exe(${whatIsBuilding} ${ARGN})
|
||||
endif()
|
||||
endif()
|
||||
endfunction(build_test_artifacts)
|
||||
|
||||
|
||||
function(c_windows_unittests_add_dll whatIsBuilding folder)
|
||||
link_directories(${whatIsBuilding}_dll $ENV{VCInstallDir}UnitTest/lib)
|
||||
|
||||
add_library(${whatIsBuilding}_testsonly_lib STATIC
|
||||
${${whatIsBuilding}_test_files}
|
||||
)
|
||||
SET(VAR 1)
|
||||
foreach(file ${${whatIsBuilding}_test_files})
|
||||
set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS -DCPPUNITTEST_SYMBOL=some_symbol_for_cppunittest_${VAR})
|
||||
MATH(EXPR VAR "${VAR}+1")
|
||||
endforeach()
|
||||
|
||||
set_target_properties(${whatIsBuilding}_testsonly_lib
|
||||
PROPERTIES
|
||||
FOLDER ${folder} )
|
||||
|
||||
target_include_directories(${whatIsBuilding}_testsonly_lib PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include)
|
||||
target_compile_definitions(${whatIsBuilding}_testsonly_lib PUBLIC -DCPP_UNITTEST)
|
||||
target_compile_options(${whatIsBuilding}_testsonly_lib PUBLIC /TP /EHsc)
|
||||
|
||||
add_library(${whatIsBuilding}_dll SHARED
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${sharedutil_include_directories}../../src/xlogging.c
|
||||
${sharedutil_include_directories}../../src/consolelogger.c
|
||||
)
|
||||
|
||||
set_target_properties(${whatIsBuilding}_dll
|
||||
PROPERTIES
|
||||
FOLDER ${folder} )
|
||||
|
||||
target_include_directories(${whatIsBuilding}_dll PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include)
|
||||
target_compile_definitions(${whatIsBuilding}_dll PUBLIC -DCPP_UNITTEST)
|
||||
target_link_libraries(${whatIsBuilding}_dll micromock_cpp_unittest umock_c ctest testrunnerswitcher ${whatIsBuilding}_testsonly_lib )
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_dll ${f})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
SET(SPACES " ")
|
||||
SET(VAR 1)
|
||||
foreach(file ${${whatIsBuilding}_test_files})
|
||||
|
||||
# for x64 the underscore is not needed
|
||||
if (ARCHITECTURE STREQUAL "x86_64")
|
||||
set_property(TARGET ${whatIsBuilding}_dll APPEND_STRING PROPERTY LINK_FLAGS ${SPACES}/INCLUDE:"some_symbol_for_cppunittest_${VAR}")
|
||||
else()
|
||||
set_property(TARGET ${whatIsBuilding}_dll APPEND_STRING PROPERTY LINK_FLAGS ${SPACES}/INCLUDE:"_some_symbol_for_cppunittest_${VAR}")
|
||||
endif()
|
||||
MATH(EXPR VAR "${VAR}+1")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(c_windows_unittests_add_exe whatIsBuilding folder)
|
||||
add_executable(${whatIsBuilding}_exe
|
||||
${${whatIsBuilding}_test_files}
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.c
|
||||
${sharedutil_include_directories}../../src/xlogging.c
|
||||
${sharedutil_include_directories}../../src/consolelogger.c
|
||||
)
|
||||
set_target_properties(${whatIsBuilding}_exe
|
||||
PROPERTIES
|
||||
FOLDER ${folder})
|
||||
|
||||
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
|
||||
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
|
||||
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest testrunnerswitcher)
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_exe ${f})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
add_test(NAME ${whatIsBuilding} COMMAND ${whatIsBuilding}_exe)
|
||||
endfunction()
|
||||
|
||||
#this function takes more than the 1 mandatory argument (whatIsBuilding)
|
||||
#the parameters are separated by "known" separators
|
||||
#for example, ADDITIONAL_LIBS starts a list of needed libraries
|
||||
function(c_linux_unittests_add_exe whatIsBuilding folder)
|
||||
|
||||
add_executable(${whatIsBuilding}_exe
|
||||
${${whatIsBuilding}_test_files}
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.c
|
||||
${sharedutil_include_directories}../../src/xlogging.c
|
||||
${sharedutil_include_directories}../../src/consolelogger.c
|
||||
)
|
||||
set_target_properties(${whatIsBuilding}_exe
|
||||
PROPERTIES
|
||||
FOLDER ${folder})
|
||||
|
||||
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
|
||||
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
|
||||
|
||||
#this part detects
|
||||
# - the additional libraries that might be needed.
|
||||
# additional libraries are started by ADDITIONAL_LIBS parameter and ended by any other known parameter (or end of variable arguments)
|
||||
# - a valgrind suppression file (VALGRIND_SUPPRESSIONS_FILE) for memcheck
|
||||
# the file name follows immediately after
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_exe ${f})
|
||||
elseif(PARSING_VALGRIND_SUPPRESSIONS_FILE)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER "--suppressions=${f}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest)
|
||||
|
||||
add_test(NAME ${whatIsBuilding} COMMAND $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
|
||||
if(${run_valgrind})
|
||||
find_program(VALGRIND_FOUND NAMES valgrind)
|
||||
if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
|
||||
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
|
||||
else()
|
||||
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --num-callers=100 --error-exitcode=1 --trace-children=yes --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
add_test(NAME ${whatIsBuilding}_helgrind COMMAND valgrind --tool=helgrind --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
add_test(NAME ${whatIsBuilding}_drd COMMAND valgrind --tool=drd --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(build_c_test_artifacts whatIsBuilding use_gballoc folder)
|
||||
|
||||
#the first argument is what is building
|
||||
#the second argument is whether the tests should be build with gballoc #defines or not
|
||||
#the following arguments are a list of libraries to link with
|
||||
|
||||
if(${use_gballoc})
|
||||
add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC)
|
||||
else()
|
||||
endif()
|
||||
|
||||
#setting #defines
|
||||
if(WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
else()
|
||||
endif()
|
||||
|
||||
#setting includes
|
||||
set(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})
|
||||
if(WIN32)
|
||||
else()
|
||||
include_directories(${sharedutil_include_directories})
|
||||
endif()
|
||||
|
||||
#setting output type
|
||||
if(WIN32)
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${skip_unittests})
|
||||
)
|
||||
else()
|
||||
c_windows_unittests_add_dll(${whatIsBuilding} ${folder} ${ARGN})
|
||||
c_windows_unittests_add_exe(${whatIsBuilding} ${folder} ${ARGN})
|
||||
endif()
|
||||
else()
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${skip_unittests})
|
||||
)
|
||||
else()
|
||||
c_linux_unittests_add_exe(${whatIsBuilding} ${folder} ${ARGN})
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(set_platform_files)
|
||||
if(WIN32)
|
||||
if(${use_condition})
|
||||
set(CONDITION_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/condition_win32.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(THREAD_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/threadapi_win32.c PARENT_SCOPE)
|
||||
set(LOCK_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/lock_win32.c PARENT_SCOPE)
|
||||
if (WINCE)
|
||||
set(HTTP_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/httpapi_wince.c PARENT_SCOPE)
|
||||
else()
|
||||
set(HTTP_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/httpapi_winhttp.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(PLATFORM_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/platform_win32.c PARENT_SCOPE)
|
||||
if (${use_socketio})
|
||||
set(SOCKETIO_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/socketio_win32.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(TICKCOUTER_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/tickcounter_win32.c PARENT_SCOPE)
|
||||
set(UNIQUEID_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/uniqueid_win32.c PARENT_SCOPE)
|
||||
else()
|
||||
if(${use_condition})
|
||||
set(CONDITION_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/condition_pthreads.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(HTTP_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/httpapi_curl.c PARENT_SCOPE)
|
||||
set(LOCK_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/lock_pthreads.c PARENT_SCOPE)
|
||||
set(PLATFORM_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/platform_linux.c PARENT_SCOPE)
|
||||
if (${use_socketio})
|
||||
set(SOCKETIO_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/socketio_berkeley.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(THREAD_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/threadapi_pthreads.c PARENT_SCOPE)
|
||||
set(TICKCOUTER_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/tickcounter_linux.c PARENT_SCOPE)
|
||||
set(UNIQUEID_C_FILE ${CMAKE_CURRENT_LIST_DIR}/adapters/uniqueid_linux.c PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(set_platform_files)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/configs/azure_c_shared_utilityFunctions.cmake")
|
||||
|
||||
#Setup the platform files
|
||||
set_platform_files()
|
||||
set_platform_files(${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include_directories(${UMOCK_C_INC_FOLDER})
|
||||
|
||||
|
@ -918,11 +443,6 @@ if(${use_cyclonessl} AND WIN32)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
else()
|
||||
add_files_to_install("${source_h_files}")
|
||||
endif()
|
||||
|
||||
IF(WIN32)
|
||||
#windows needs this define
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
|
@ -966,7 +486,9 @@ endif()
|
|||
if(${use_openssl})
|
||||
if (WIN32)
|
||||
target_link_libraries(aziotsharedutil
|
||||
$ENV{OpenSSLDir}/lib/ssleay32.lib $ENV{OpenSSLDir}/lib/libeay32.lib)
|
||||
$ENV{OpenSSLDir}/lib/ssleay32.lib
|
||||
$ENV{OpenSSLDir}/lib/libeay32.lib
|
||||
crypt32 ws2_32 secur32)
|
||||
else()
|
||||
target_link_libraries(aziotsharedutil ssl crypto)
|
||||
endif()
|
||||
|
@ -989,6 +511,7 @@ if(LINUX)
|
|||
endif()
|
||||
|
||||
if (NOT ${skip_unittests})
|
||||
include("dependencies-test.cmake")
|
||||
add_subdirectory(testtools)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
@ -997,10 +520,47 @@ if (NOT ${skip_samples})
|
|||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
target_link_libraries(aziotsharedutil micromock_ctest)
|
||||
|
||||
# Set CMAKE_INSTALL_* if not defined
|
||||
include(GNUInstallDirs)
|
||||
if(${use_installed_dependencies})
|
||||
# Set CMAKE_INSTALL_* if not defined
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Install Azure C Shared Utility
|
||||
install (TARGETS aziotsharedutil DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install (FILES ${source_h_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot/azure_c_shared_utility)
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
endif()
|
||||
|
||||
# Install Azure C Shared Utility
|
||||
set(package_location "cmake")
|
||||
|
||||
install (TARGETS aziotsharedutil EXPORT aziotsharedutilTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/../bin
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot
|
||||
)
|
||||
install (FILES ${source_h_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot/azure_c_shared_utility)
|
||||
install (FILES ${micromock_h_files_full_path} ${INSTALL_H_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
configure_file("configs/${PROJECT_NAME}Config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
install(EXPORT aziotsharedutilTargets
|
||||
FILE
|
||||
"${PROJECT_NAME}Targets.cmake"
|
||||
DESTINATION
|
||||
${package_location}
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"configs/${PROJECT_NAME}Config.cmake"
|
||||
"configs/${PROJECT_NAME}Functions.cmake"
|
||||
DESTINATION
|
||||
${package_location}
|
||||
)
|
||||
|
||||
endif()
|
32
README.md
32
README.md
|
@ -26,6 +26,37 @@ azure-c-shared-utility uses cmake for configuring build files.
|
|||
cmake ..
|
||||
```
|
||||
|
||||
### Installation and Use
|
||||
Optionally, you may choose to install azure-c-shared-utility on your machine:
|
||||
|
||||
1. Switch to the *cmake* folder and run
|
||||
```
|
||||
cmake -Duse_installed_dependencies=ON ../
|
||||
```
|
||||
```
|
||||
cmake --build . --target install
|
||||
```
|
||||
|
||||
or install using the follow commands for each platform:
|
||||
|
||||
On Linux:
|
||||
```
|
||||
sudo make install
|
||||
```
|
||||
|
||||
On Windows:
|
||||
```
|
||||
msbuild /m INSTALL.vcxproj
|
||||
```
|
||||
|
||||
2. Use it in your project (if installed)
|
||||
```
|
||||
find_package(azure_c_shared_utility REQUIRED CONFIG)
|
||||
target_link_library(yourlib aziotsharedutil)
|
||||
```
|
||||
|
||||
_If running tests, this requires that umock-c, azure-ctest, and azure-c-testrunnerswitcher are installed (through CMake) on your machine._
|
||||
|
||||
## Configuration options
|
||||
|
||||
In order to turn on/off the tlsio implementations use the following CMAKE options:
|
||||
|
@ -34,3 +65,4 @@ In order to turn on/off the tlsio implementations use the following CMAKE option
|
|||
* `-Duse_openssl:bool={ON/OFF}` - turns on/off the OpenSSL support. If this option is use an environment variable name OpenSSLDir should be set to point to the OpenSSL folder.
|
||||
* `-Duse_wolfssl:bool={ON/OFF}` - turns on/off the WolfSSL support. If this option is use an environment variable name WolfSSLDir should be set to point to the WolfSSL folder.
|
||||
* `-Duse_http:bool={ON/OFF}` - turns on/off the HTTP API support.
|
||||
* `-Duse_installed_dependencies:bool={ON/OFF}` - turns on/off building azure-c-shared-utility using installed dependencies. This package may only be installed if this flag is ON.
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#Copyright (c) Microsoft. All rights reserved.
|
||||
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/azure_c_shared_utilityTargets.cmake")
|
||||
|
||||
get_target_property(AZURE_C_SHARED_UTILITY_INCLUDES aziotsharedutil INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
set(AZURE_C_SHARED_UTILITY_INCLUDES ${AZURE_C_SHARED_UTILITY_INCLUDES} CACHE INTERNAL "")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/azure_c_shared_utilityFunctions.cmake")
|
|
@ -0,0 +1,490 @@
|
|||
#Copyright (c) Microsoft. All rights reserved.
|
||||
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
function(set_test_target_folder whatIsBuilding ext)
|
||||
if("${whatIsBuilding}" MATCHES ".*e2e.*")
|
||||
set_target_properties(${whatIsBuilding}_${ext}
|
||||
PROPERTIES
|
||||
FOLDER "tests/E2ETests")
|
||||
else()
|
||||
set_target_properties(${whatIsBuilding}_${ext}
|
||||
PROPERTIES
|
||||
FOLDER "tests/UnitTests")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(windows_unittests_add_dll whatIsBuilding)
|
||||
link_directories(${whatIsBuilding}_dll $ENV{VCInstallDir}UnitTest/lib)
|
||||
|
||||
add_library(${whatIsBuilding}_dll SHARED
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${logging_files}
|
||||
)
|
||||
|
||||
set_test_target_folder(${whatIsBuilding} "dll")
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_dll ${f})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
target_include_directories(${whatIsBuilding}_dll PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include)
|
||||
target_compile_definitions(${whatIsBuilding}_dll PUBLIC -DCPP_UNITTEST)
|
||||
target_link_libraries(${whatIsBuilding}_dll micromock_cpp_unittest umock_c ctest testrunnerswitcher)
|
||||
endfunction()
|
||||
|
||||
function(windows_unittests_add_exe whatIsBuilding)
|
||||
add_executable(${whatIsBuilding}_exe
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.c
|
||||
${logging_files}
|
||||
)
|
||||
|
||||
set_test_target_folder(${whatIsBuilding} "exe")
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_exe ${f})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
|
||||
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
|
||||
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest testrunnerswitcher)
|
||||
add_test(NAME ${whatIsBuilding} COMMAND ${whatIsBuilding}_exe)
|
||||
endfunction()
|
||||
|
||||
#this function takes more than the 1 mandatory argument (whatIsBuilding)
|
||||
#the parameters are separated by "known" separators
|
||||
#for example, ADDITIONAL_LIBS starts a list of needed libraries
|
||||
function(linux_unittests_add_exe whatIsBuilding)
|
||||
add_executable(${whatIsBuilding}_exe
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.c
|
||||
${logging_files}
|
||||
)
|
||||
|
||||
set_test_target_folder(${whatIsBuilding} "exe")
|
||||
|
||||
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
|
||||
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
|
||||
|
||||
#this part detects
|
||||
# - the additional libraries that might be needed.
|
||||
# additional libraries are started by ADDITIONAL_LIBS parameter and ended by any other known parameter (or end of variable arguments)
|
||||
# - a valgrind suppression file (VALGRIND_SUPPRESSIONS_FILE) for memcheck
|
||||
# the file name follows immediately after
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
|
||||
else()
|
||||
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_exe ${f})
|
||||
elseif(PARSING_VALGRIND_SUPPRESSIONS_FILE)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER "--suppressions=${f}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest)
|
||||
|
||||
add_test(NAME ${whatIsBuilding} COMMAND $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
|
||||
if(${run_valgrind})
|
||||
find_program(VALGRIND_FOUND NAMES valgrind)
|
||||
if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
|
||||
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
|
||||
else()
|
||||
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --num-callers=100 --error-exitcode=1 --trace-children=yes --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
add_test(NAME ${whatIsBuilding}_helgrind COMMAND valgrind --tool=helgrind --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
add_test(NAME ${whatIsBuilding}_drd COMMAND valgrind --tool=drd --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(build_test_artifacts whatIsBuilding use_gballoc)
|
||||
|
||||
#the first argument is what is building
|
||||
#the second argument is whether the tests should be build with gballoc #defines or not
|
||||
#the following arguments are a list of libraries to link with
|
||||
|
||||
if(${use_gballoc})
|
||||
add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC)
|
||||
else()
|
||||
endif()
|
||||
|
||||
#setting #defines
|
||||
if(WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
else()
|
||||
endif()
|
||||
|
||||
#setting includes
|
||||
set(sharedutil_include_directories ${sharedutil_include_directories} ${TESTRUNNERSWITCHER_INCLUDES} ${CTEST_INCLUDES} ${UMOCK_C_INCLUDES} ${AZURE_C_SHARED_UTILITY_INCLUDES})
|
||||
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})
|
||||
if(WIN32)
|
||||
else()
|
||||
include_directories(${sharedutil_include_directories})
|
||||
endif()
|
||||
|
||||
#setting logging_files
|
||||
if(DEFINED SHARED_UTIL_SRC_FOLDER)
|
||||
set(logging_files ${SHARED_UTIL_SRC_FOLDER}../../src/xlogging.c ${SHARED_UTIL_SRC_FOLDER}../../src/consolelogger.c)
|
||||
elseif(DEFINED SHARED_UTIL_FOLDER)
|
||||
set(logging_files ${SHARED_UTIL_FOLDER}/src/xlogging.c ${SHARED_UTIL_FOLDER}/src/consolelogger.c)
|
||||
else()
|
||||
message(FATAL_ERROR "No Shared Utility folder defined for src.")
|
||||
endif()
|
||||
|
||||
#setting output type
|
||||
if(WIN32)
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${skip_unittests})
|
||||
)
|
||||
else()
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND $<BOOL:${nuget_e2e_tests}>)
|
||||
)
|
||||
windows_unittests_add_exe(${whatIsBuilding}_nuget ${ARGN})
|
||||
else()
|
||||
windows_unittests_add_exe(${whatIsBuilding} ${ARGN})
|
||||
windows_unittests_add_dll(${whatIsBuilding} ${ARGN})
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${skip_unittests})
|
||||
)
|
||||
else()
|
||||
linux_unittests_add_exe(${whatIsBuilding} ${ARGN})
|
||||
endif()
|
||||
endif()
|
||||
endfunction(build_test_artifacts)
|
||||
|
||||
|
||||
function(c_windows_unittests_add_dll whatIsBuilding folder)
|
||||
link_directories(${whatIsBuilding}_dll $ENV{VCInstallDir}UnitTest/lib)
|
||||
|
||||
SET(VAR 1)
|
||||
foreach(file ${${whatIsBuilding}_test_files})
|
||||
add_library(${whatIsBuilding}_testsonly_lib STATIC
|
||||
${file}
|
||||
)
|
||||
set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS -DCPPUNITTEST_SYMBOL=some_symbol_for_cppunittest_${VAR})
|
||||
MATH(EXPR VAR "${VAR}+1")
|
||||
endforeach()
|
||||
|
||||
set_target_properties(${whatIsBuilding}_testsonly_lib
|
||||
PROPERTIES
|
||||
FOLDER ${folder} )
|
||||
|
||||
target_include_directories(${whatIsBuilding}_testsonly_lib PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include)
|
||||
target_compile_definitions(${whatIsBuilding}_testsonly_lib PUBLIC -DCPP_UNITTEST)
|
||||
target_compile_options(${whatIsBuilding}_testsonly_lib PUBLIC /TP /EHsc)
|
||||
|
||||
add_library(${whatIsBuilding}_dll SHARED
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${logging_files}
|
||||
)
|
||||
|
||||
set_target_properties(${whatIsBuilding}_dll
|
||||
PROPERTIES
|
||||
FOLDER ${folder} )
|
||||
|
||||
target_include_directories(${whatIsBuilding}_dll PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include)
|
||||
target_compile_definitions(${whatIsBuilding}_dll PUBLIC -DCPP_UNITTEST)
|
||||
target_link_libraries(${whatIsBuilding}_dll micromock_cpp_unittest umock_c ctest testrunnerswitcher ${whatIsBuilding}_testsonly_lib )
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_dll ${f})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
SET(VAR 1)
|
||||
foreach(file ${${whatIsBuilding}_test_files})
|
||||
|
||||
# for x64 the underscore is not needed
|
||||
if (ARCHITECTURE STREQUAL "x86_64")
|
||||
set_property(TARGET ${whatIsBuilding}_dll APPEND PROPERTY LINK_FLAGS /INCLUDE:"some_symbol_for_cppunittest_${VAR}")
|
||||
else()
|
||||
set_property(TARGET ${whatIsBuilding}_dll APPEND PROPERTY LINK_FLAGS /INCLUDE:"_some_symbol_for_cppunittest_${VAR}")
|
||||
endif()
|
||||
MATH(EXPR VAR "${VAR}+1")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(c_windows_unittests_add_exe whatIsBuilding folder)
|
||||
add_executable(${whatIsBuilding}_exe
|
||||
${${whatIsBuilding}_test_files}
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.c
|
||||
${logging_files}
|
||||
)
|
||||
set_target_properties(${whatIsBuilding}_exe
|
||||
PROPERTIES
|
||||
FOLDER ${folder})
|
||||
|
||||
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
|
||||
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
|
||||
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest testrunnerswitcher)
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_exe ${f})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
add_test(NAME ${whatIsBuilding} COMMAND ${whatIsBuilding}_exe)
|
||||
endfunction()
|
||||
|
||||
#this function takes more than the 1 mandatory argument (whatIsBuilding)
|
||||
#the parameters are separated by "known" separators
|
||||
#for example, ADDITIONAL_LIBS starts a list of needed libraries
|
||||
function(c_linux_unittests_add_exe whatIsBuilding folder)
|
||||
|
||||
add_executable(${whatIsBuilding}_exe
|
||||
${${whatIsBuilding}_test_files}
|
||||
${${whatIsBuilding}_cpp_files}
|
||||
${${whatIsBuilding}_h_files}
|
||||
${${whatIsBuilding}_c_files}
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.c
|
||||
${logging_files}
|
||||
)
|
||||
set_target_properties(${whatIsBuilding}_exe
|
||||
PROPERTIES
|
||||
FOLDER ${folder})
|
||||
|
||||
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
|
||||
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
|
||||
|
||||
#this part detects
|
||||
# - the additional libraries that might be needed.
|
||||
# additional libraries are started by ADDITIONAL_LIBS parameter and ended by any other known parameter (or end of variable arguments)
|
||||
# - a valgrind suppression file (VALGRIND_SUPPRESSIONS_FILE) for memcheck
|
||||
# the file name follows immediately after
|
||||
|
||||
set(PARSING_ADDITIONAL_LIBS OFF)
|
||||
set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
|
||||
foreach(f ${ARGN})
|
||||
set(skip_to_next FALSE)
|
||||
if(${f} STREQUAL "ADDITIONAL_LIBS")
|
||||
SET(PARSING_ADDITIONAL_LIBS ON)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
|
||||
#also unset all the other states
|
||||
set(skip_to_next TRUE)
|
||||
elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
|
||||
SET(PARSING_ADDITIONAL_LIBS OFF)
|
||||
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
|
||||
set(skip_to_next TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT skip_to_next)
|
||||
if(PARSING_ADDITIONAL_LIBS)
|
||||
target_link_libraries(${whatIsBuilding}_exe ${f})
|
||||
elseif(PARSING_VALGRIND_SUPPRESSIONS_FILE)
|
||||
set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER "--suppressions=${f}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
target_link_libraries(${whatIsBuilding}_exe micromock_ctest umock_c ctest)
|
||||
|
||||
add_test(NAME ${whatIsBuilding} COMMAND $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
|
||||
if(${run_valgrind})
|
||||
find_program(VALGRIND_FOUND NAMES valgrind)
|
||||
if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
|
||||
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
|
||||
else()
|
||||
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --num-callers=100 --error-exitcode=1 --trace-children=yes --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
add_test(NAME ${whatIsBuilding}_helgrind COMMAND valgrind --tool=helgrind --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
add_test(NAME ${whatIsBuilding}_drd COMMAND valgrind --tool=drd --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(build_c_test_artifacts whatIsBuilding use_gballoc folder)
|
||||
|
||||
#the first argument is what is building
|
||||
#the second argument is whether the tests should be build with gballoc #defines or not
|
||||
#the following arguments are a list of libraries to link with
|
||||
|
||||
if(${use_gballoc})
|
||||
add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC)
|
||||
else()
|
||||
endif()
|
||||
|
||||
#setting #defines
|
||||
if(WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
else()
|
||||
endif()
|
||||
|
||||
#setting includes
|
||||
set(sharedutil_include_directories ${sharedutil_include_directories} ${TESTRUNNERSWITCHER_INCLUDES} ${CTEST_INCLUDES} ${UMOCK_C_INCLUDES} ${AZURE_C_SHARED_UTILITY_INCLUDES})
|
||||
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})
|
||||
if(WIN32)
|
||||
else()
|
||||
include_directories(${sharedutil_include_directories})
|
||||
endif()
|
||||
|
||||
#setting logging_files
|
||||
if(DEFINED SHARED_UTIL_SRC_FOLDER)
|
||||
set(logging_files ${SHARED_UTIL_SRC_FOLDER}../../src/xlogging.c ${SHARED_UTIL_SRC_FOLDER}../../src/consolelogger.c)
|
||||
elseif(DEFINED SHARED_UTIL_FOLDER)
|
||||
set(logging_files ${SHARED_UTIL_FOLDER}/src/xlogging.c ${SHARED_UTIL_FOLDER}/src/consolelogger.c)
|
||||
else()
|
||||
message(FATAL_ERROR "No Shared Utility folder defined for includes/src.")
|
||||
endif()
|
||||
|
||||
#setting output type
|
||||
if(WIN32)
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${skip_unittests})
|
||||
)
|
||||
else()
|
||||
c_windows_unittests_add_dll(${whatIsBuilding} ${folder} ${ARGN})
|
||||
c_windows_unittests_add_exe(${whatIsBuilding} ${folder} ${ARGN})
|
||||
endif()
|
||||
else()
|
||||
if(
|
||||
(("${whatIsBuilding}" MATCHES ".*ut.*") AND ${skip_unittests})
|
||||
)
|
||||
else()
|
||||
c_linux_unittests_add_exe(${whatIsBuilding} ${folder} ${ARGN})
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(set_platform_files c_shared_dir)
|
||||
if(WIN32)
|
||||
if(${use_condition})
|
||||
set(CONDITION_C_FILE ${c_shared_dir}/adapters/condition_win32.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(THREAD_C_FILE ${c_shared_dir}/adapters/threadapi_win32.c PARENT_SCOPE)
|
||||
set(LOCK_C_FILE ${c_shared_dir}/adapters/lock_win32.c PARENT_SCOPE)
|
||||
if (WINCE)
|
||||
set(HTTP_C_FILE ${c_shared_dir}/adapters/httpapi_wince.c PARENT_SCOPE)
|
||||
else()
|
||||
set(HTTP_C_FILE ${c_shared_dir}/adapters/httpapi_winhttp.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(PLATFORM_C_FILE ${c_shared_dir}/adapters/platform_win32.c PARENT_SCOPE)
|
||||
if (${use_socketio})
|
||||
set(SOCKETIO_C_FILE ${c_shared_dir}/adapters/socketio_win32.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(TICKCOUTER_C_FILE ${c_shared_dir}/adapters/tickcounter_win32.c PARENT_SCOPE)
|
||||
set(UNIQUEID_C_FILE ${c_shared_dir}/adapters/uniqueid_win32.c PARENT_SCOPE)
|
||||
else()
|
||||
if(${use_condition})
|
||||
set(CONDITION_C_FILE ${c_shared_dir}/adapters/condition_pthreads.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(HTTP_C_FILE ${c_shared_dir}/adapters/httpapi_curl.c PARENT_SCOPE)
|
||||
set(LOCK_C_FILE ${c_shared_dir}/adapters/lock_pthreads.c PARENT_SCOPE)
|
||||
set(PLATFORM_C_FILE ${c_shared_dir}/adapters/platform_linux.c PARENT_SCOPE)
|
||||
if (${use_socketio})
|
||||
set(SOCKETIO_C_FILE ${c_shared_dir}/adapters/socketio_berkeley.c PARENT_SCOPE)
|
||||
endif()
|
||||
set(THREAD_C_FILE ${c_shared_dir}/adapters/threadapi_pthreads.c PARENT_SCOPE)
|
||||
set(TICKCOUTER_C_FILE ${c_shared_dir}/adapters/tickcounter_linux.c PARENT_SCOPE)
|
||||
set(UNIQUEID_C_FILE ${c_shared_dir}/adapters/uniqueid_linux.c PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(set_platform_files)
|
|
@ -0,0 +1,6 @@
|
|||
#Copyright (c) Microsoft. All rights reserved.
|
||||
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
if(${use_installed_dependencies})
|
||||
find_package(umock_c REQUIRED CONFIG)
|
||||
endif()
|
|
@ -0,0 +1,11 @@
|
|||
#Copyright (c) Microsoft. All rights reserved.
|
||||
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
if(${use_installed_dependencies})
|
||||
find_package(libwebsockets REQUIRED CONFIG)
|
||||
include_directories(${LIBWEBSOCKETS_INCLUDE_DIRS})
|
||||
else()
|
||||
include_directories(deps/libwebsockets/lib)
|
||||
include_directories(${PROJECT_BINARY_DIR}/deps/libwebsockets)
|
||||
add_subdirectory(deps/libwebsockets)
|
||||
endif()
|
|
@ -2,8 +2,14 @@
|
|||
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#this is CMakeLists for testtools. It does nothing, except loads other folders
|
||||
add_subdirectory(ctest)
|
||||
|
||||
include("../configs/azure_c_shared_utilityFunctions.cmake")
|
||||
|
||||
if(NOT ${use_installed_dependencies})
|
||||
add_subdirectory(ctest)
|
||||
add_subdirectory(testrunner)
|
||||
add_subdirectory(umock-c)
|
||||
endif()
|
||||
|
||||
add_subdirectory(sal)
|
||||
add_subdirectory(testrunner)
|
||||
add_subdirectory(micromock)
|
||||
add_subdirectory(umock-c)
|
||||
add_subdirectory(micromock)
|
|
@ -46,6 +46,7 @@ set(micromock_h_files
|
|||
)
|
||||
|
||||
string(REPLACE "./inc/" ";./testtools/micromock/inc/" FILES_TO_INSTALL ${micromock_h_files})
|
||||
set(micromock_h_files_full_path "${FILES_TO_INSTALL}" CACHE INTERNAL "")
|
||||
add_files_to_install("${FILES_TO_INSTALL}")
|
||||
|
||||
IF(WIN32)
|
||||
|
@ -55,7 +56,9 @@ IF(WIN32)
|
|||
#windows needs to be build 2 flavor of micromock, one for CTEST reporting, one for CPP_UNITTEST
|
||||
add_library(micromock_cpp_unittest ${micromock_cpp_files} ${micromock_h_files})
|
||||
target_compile_definitions(micromock_cpp_unittest PUBLIC CPP_UNITTEST)
|
||||
target_include_directories(micromock_cpp_unittest PUBLIC $ENV{VCInstallDir}UnitTest/include)
|
||||
#flip VCInstallDir path
|
||||
file(TO_CMAKE_PATH $ENV{VCInstallDir} VCInstallDir)
|
||||
target_include_directories(micromock_cpp_unittest PUBLIC ${VCInstallDir}/UnitTest/include)
|
||||
|
||||
set_target_properties(micromock_cpp_unittest
|
||||
PROPERTIES
|
||||
|
@ -77,15 +80,18 @@ set_target_properties(micromock_ctest
|
|||
set(MICROMOCK_INC_FOLDER ${CMAKE_CURRENT_LIST_DIR}/inc CACHE INTERNAL "this is what needs to be included if using micromock lib" FORCE)
|
||||
|
||||
include_directories(${TESTRUNNERSWITCHER_INC_FOLDER} ${CTEST_INC_FOLDER} ${SAL_INC_FOLDER} ${MICROMOCK_INC_FOLDER} )
|
||||
include_directories(${TESTRUNNERSWITCHER_INCLUDES} ${CTEST_INCLUDES} ${UMOCK_C_INCLUDES})
|
||||
|
||||
if (NOT ${skip_unittests})
|
||||
add_subdirectory(unittests)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
else()
|
||||
install (TARGETS micromock_ctest DESTINATION lib)
|
||||
endif (WIN32)
|
||||
if(${use_installed_dependencies})
|
||||
if(WIN32)
|
||||
install (TARGETS micromock_cpp_unittest EXPORT aziotsharedutilTargets DESTINATION lib)
|
||||
endif()
|
||||
install (TARGETS micromock_ctest EXPORT aziotsharedutilTargets DESTINATION lib)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_executable(micromock_generator ./tools/micromockgenerator/micromockgenerator.cpp)
|
||||
|
|
|
@ -15,4 +15,6 @@ elseif(UNIX)
|
|||
set(SAL_INC_FOLDER ${CMAKE_CURRENT_LIST_DIR}/inc CACHE INTERNAL "this is what needs to be included if using sal header" FORCE)
|
||||
endif()
|
||||
|
||||
add_files_to_install("./testtools/sal/inc/sal.h;./testtools/sal/inc/no_sal2.h")
|
||||
if(LINUX)
|
||||
add_files_to_install("./testtools/sal/inc/sal.h;./testtools/sal/inc/no_sal2.h")
|
||||
endif()
|
Загрузка…
Ссылка в новой задаче