use -fsanitize=address in all code rather than just the top-level links

This commit is contained in:
Seth Alves 2015-08-20 10:14:16 -07:00
parent 2056f588e3
commit c25082d86f
46 changed files with 143 additions and 50 deletions

View file

@ -213,3 +213,9 @@ endif ()
if (ANDROID OR DESKTOP_GVR)
add_subdirectory(gvr-interface)
endif ()
if (DEFINED ENV{HIFI_MEMORY_DEBUGGING})
if (UNIX)
MESSAGE("-- Memory debugging is enabled")
endif (UNIX)
endif ()

View file

@ -18,12 +18,7 @@ if (UNIX)
endif (UNIX)
include_application_version()
copy_dlls_beside_windows_executable()
if (DEFINED ENV{HIFI_MEMORY_DEBUGGING})
if (UNIX)
MESSAGE("-- assignment-client memory debugging is enabled.")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
endif (UNIX)
endif ()
setup_memory_debugger()
copy_dlls_beside_windows_executable()

View file

@ -0,0 +1,21 @@
#
# MemoryDebugger.cmake
#
# Copyright 2015 High Fidelity, Inc.
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(SETUP_MEMORY_DEBUGGER)
if (DEFINED ENV{HIFI_MEMORY_DEBUGGING})
SET( HIFI_MEMORY_DEBUGGING true )
endif ()
if (HIFI_MEMORY_DEBUGGING)
if (UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libasan -static-libstdc++ -fsanitize=address")
endif (UNIX)
endif ()
endmacro(SETUP_MEMORY_DEBUGGER)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME domain-server)
setup_memory_debugger()
if (UPPER_CMAKE_BUILD_TYPE MATCHES DEBUG AND NOT WIN32)
set(_SHOULD_SYMLINK_RESOURCES TRUE)
else ()
@ -33,11 +35,3 @@ target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES})
include_application_version()
copy_dlls_beside_windows_executable()
if (DEFINED ENV{HIFI_MEMORY_DEBUGGING})
if (UNIX)
MESSAGE("-- domain-server memory debugging is enabled.")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
endif (UNIX)
endif ()

View file

@ -88,4 +88,6 @@ if (ANDROID)
endif (ANDROID)
copy_dlls_beside_windows_executable()
setup_memory_debugger()
copy_dlls_beside_windows_executable()

View file

@ -1,9 +1,11 @@
set(TARGET_NAME ice-server)
setup_memory_debugger()
# setup the project and link required Qt modules
setup_hifi_project(Network)
# link the shared hifi libraries
link_hifi_libraries(embedded-webserver networking shared)
copy_dlls_beside_windows_executable()
copy_dlls_beside_windows_executable()

View file

@ -205,12 +205,6 @@ else (APPLE)
endif()
endif (APPLE)
copy_dlls_beside_windows_executable()
setup_memory_debugger()
if (DEFINED ENV{HIFI_MEMORY_DEBUGGING})
if (UNIX)
MESSAGE("-- interface memory debugging is enabled.")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
endif (UNIX)
endif ()
copy_dlls_beside_windows_executable()

View file

@ -3,4 +3,6 @@ set(TARGET_NAME animation)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Network Script)
link_hifi_libraries(shared gpu model fbx)
setup_memory_debugger()
link_hifi_libraries(shared gpu model fbx)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME audio-client)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Network Multimedia)
@ -25,4 +27,4 @@ if (APPLE)
find_library(CoreAudio CoreAudio)
find_library(CoreFoundation CoreFoundation)
target_link_libraries(${TARGET_NAME} ${CoreAudio} ${CoreFoundation})
endif ()
endif ()

View file

@ -1,5 +1,7 @@
set(TARGET_NAME audio)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Network)

View file

@ -1,3 +1,6 @@
set(TARGET_NAME auto-updater)
setup_memory_debugger()
setup_hifi_library(Network)
link_hifi_libraries(shared networking)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME avatars)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Network Script)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME display-plugins)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(OpenGL)
@ -31,4 +33,4 @@ if (WIN32)
find_package(OpenVR REQUIRED)
target_include_directories(${TARGET_NAME} PRIVATE ${OPENVR_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${OPENVR_LIBRARIES})
endif()
endif()

View file

@ -1,4 +1,6 @@
set(TARGET_NAME embedded-webserver)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Network)
setup_hifi_library(Network)

View file

@ -26,4 +26,6 @@ find_package(PolyVox REQUIRED)
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${POLYVOX_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${POLYVOX_LIBRARIES})
setup_memory_debugger()
link_hifi_libraries(shared gpu script-engine render render-utils)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME entities)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Network Script)

View file

@ -7,4 +7,6 @@ add_dependency_external_projects(glm)
find_package(GLM REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
link_hifi_libraries(shared networking)
setup_memory_debugger()
link_hifi_libraries(shared networking)

View file

@ -7,4 +7,6 @@ add_dependency_external_projects(glm)
find_package(GLM REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
link_hifi_libraries(shared gpu model networking octree)
setup_memory_debugger()
link_hifi_libraries(shared gpu model networking octree)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME gpu)
setup_memory_debugger()
AUTOSCRIBE_SHADER_LIB(gpu)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules

View file

@ -33,6 +33,8 @@ endif()
#target_include_directories(${TARGET_NAME} PRIVATE ${SIXENSE_INCLUDE_DIRS})
#target_link_libraries(${TARGET_NAME} ${SIXENSE_LIBRARIES})
setup_memory_debugger()
# perform standard include and linking for found externals
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
@ -69,4 +71,4 @@ foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
add_definitions(-DSIXENSE_LIB_FILENAME=\"${${${EXTERNAL}_UPPERCASE}_LIBRARY_RELEASE}\")
endif ()
endif ()
endforeach()
endforeach()

View file

@ -1,7 +1,9 @@
set(TARGET_NAME model)
AUTOSCRIBE_SHADER_LIB(gpu model)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library()

View file

@ -1,5 +1,7 @@
set(TARGET_NAME networking)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Network)
@ -29,4 +31,4 @@ target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES} ${TBB_LIBRARIES})
# append tbb includes to our list of includes to bubble
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS})
include_application_version()
include_application_version()

View file

@ -1,5 +1,7 @@
set(TARGET_NAME octree)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library()

View file

@ -1,5 +1,7 @@
set(TARGET_NAME physics)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library()

View file

@ -7,6 +7,7 @@ link_hifi_libraries(shared)
add_dependency_external_projects(glm)
find_package(GLM REQUIRED)
setup_memory_debugger()
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})

View file

@ -40,4 +40,6 @@ add_dependency_external_projects(oglplus)
find_package(OGLPLUS REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${OGLPLUS_INCLUDE_DIRS})
setup_memory_debugger()
link_hifi_libraries(animation fbx shared gpu model render environment)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME render)
setup_memory_debugger()
AUTOSCRIBE_SHADER_LIB(gpu model)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
@ -21,4 +23,4 @@ if (WIN32)
target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}")
endif ()
endif()
endif (WIN32)
endif (WIN32)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME script-engine)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Gui Network Script Widgets)

View file

@ -1,5 +1,7 @@
set(TARGET_NAME shared)
setup_memory_debugger()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
# TODO: there isn't really a good reason to have Script linked here - let's get what is requiring it out (RegisteredMetaTypes.cpp)
setup_hifi_library(Gui Network Script Widgets)

View file

@ -7,6 +7,7 @@ link_hifi_libraries(render-utils shared)
add_dependency_external_projects(glm)
find_package(GLM REQUIRED)
setup_memory_debugger()
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})

View file

@ -35,3 +35,5 @@ set_target_properties("all-tests" PROPERTIES FOLDER "hidden/test-targets")
set_target_properties("all-tests" PROPERTIES
EXCLUDE_FROM_DEFAULT_BUILD TRUE
EXCLUDE_FROM_ALL TRUE)
setup_memory_debugger()

View file

@ -6,4 +6,6 @@ macro (setup_testcase_dependencies)
copy_dlls_beside_windows_executable()
endmacro ()
setup_memory_debugger()
setup_hifi_testcase()

View file

@ -6,4 +6,6 @@ macro (SETUP_TESTCASE_DEPENDENCIES)
copy_dlls_beside_windows_executable()
endmacro ()
setup_hifi_testcase()
setup_memory_debugger()
setup_hifi_testcase()

View file

@ -9,4 +9,6 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
# link in the shared libraries
link_hifi_libraries(entities avatars shared octree gpu model fbx networking animation environment)
copy_dlls_beside_windows_executable()
setup_memory_debugger()
copy_dlls_beside_windows_executable()

View file

@ -7,4 +7,6 @@ macro (setup_testcase_dependencies)
copy_dlls_beside_windows_executable()
endmacro()
setup_hifi_testcase()
setup_memory_debugger()
setup_hifi_testcase()

View file

@ -7,4 +7,6 @@ macro (setup_testcase_dependencies)
copy_dlls_beside_windows_executable()
endmacro ()
setup_hifi_testcase()
setup_memory_debugger()
setup_hifi_testcase()

View file

@ -7,4 +7,6 @@ macro (setup_testcase_dependencies)
copy_dlls_beside_windows_executable()
endmacro ()
setup_hifi_testcase(Script Network)
setup_memory_debugger()
setup_hifi_testcase(Script Network)

View file

@ -21,4 +21,6 @@ macro (SETUP_TESTCASE_DEPENDENCIES)
copy_dlls_beside_windows_executable()
endmacro ()
setup_memory_debugger()
setup_hifi_testcase(Script)

View file

@ -9,4 +9,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
link_hifi_libraries(render-utils gpu shared)
message(${PROJECT_BINARY_DIR})
setup_memory_debugger()
copy_dlls_beside_windows_executable()

View file

@ -18,4 +18,7 @@ include_directories("${PROJECT_BINARY_DIR}/../../libraries/entities-renderer/")
include_directories("${PROJECT_BINARY_DIR}/../../libraries/model/")
message(${PROJECT_BINARY_DIR})
setup_memory_debugger()
copy_dlls_beside_windows_executable()

View file

@ -8,4 +8,6 @@ macro (setup_testcase_dependencies)
copy_dlls_beside_windows_executable()
endmacro ()
setup_hifi_testcase()
setup_memory_debugger()
setup_hifi_testcase()

View file

@ -13,4 +13,6 @@ endif()
# link in the shared libraries
link_hifi_libraries(ui render-utils gpu shared)
copy_dlls_beside_windows_executable()
setup_memory_debugger()
copy_dlls_beside_windows_executable()

View file

@ -1,3 +1,5 @@
setup_memory_debugger()
# add the tool directories
add_subdirectory(mtc)
set_target_properties(mtc PROPERTIES FOLDER "Tools")
@ -7,4 +9,3 @@ set_target_properties(scribe PROPERTIES FOLDER "Tools")
add_subdirectory(vhacd-util)
set_target_properties(vhacd-util PROPERTIES FOLDER "Tools")

View file

@ -1,4 +1,6 @@
set(TARGET_NAME mtc)
setup_hifi_project()
copy_dlls_beside_windows_executable()
setup_memory_debugger()
copy_dlls_beside_windows_executable()

View file

@ -1,2 +1,5 @@
set(TARGET_NAME scribe)
setup_hifi_project()
setup_memory_debugger()
setup_hifi_project()

View file

@ -8,6 +8,8 @@ find_package(VHACD REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${VHACD_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${VHACD_LIBRARIES})
setup_memory_debugger()
if (UNIX AND NOT APPLE)
include(FindOpenMP)
if(OPENMP_FOUND)