[Orxonox-commit 3729] r8409 - in code/trunk: cmake/tools src

rgrieder at orxonox.net rgrieder at orxonox.net
Fri May 6 03:37:01 CEST 2011


Author: rgrieder
Date: 2011-05-06 03:37:01 +0200 (Fri, 06 May 2011)
New Revision: 8409

Modified:
   code/trunk/cmake/tools/TargetUtilities.cmake
   code/trunk/src/OrxonoxConfig.cmake
   code/trunk/src/OrxonoxConfig.h.in
Log:
Found a better solution to make the Visual Leak Detector (MSVC specific) work so that it doesn't need to be included in every single source file.

Modified: code/trunk/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/TargetUtilities.cmake	2011-05-05 21:16:33 UTC (rev 8408)
+++ code/trunk/cmake/tools/TargetUtilities.cmake	2011-05-06 01:37:01 UTC (rev 8409)
@@ -303,6 +303,11 @@
     TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBS_UNIX})
   ENDIF()
 
+  # Visual Leak Detector specific stuff (avoids the include)
+  IF(HAVE_VLD)
+    TARGET_LINK_LIBRARIES(${_target_name} ${VLD_LIBRARY})
+  ENDIF()
+
   # RPATH settings for the installation
   IF("${_target_type}" STREQUAL "LIBRARY")
     IF(_arg_MODULE)

Modified: code/trunk/src/OrxonoxConfig.cmake
===================================================================
--- code/trunk/src/OrxonoxConfig.cmake	2011-05-05 21:16:33 UTC (rev 8408)
+++ code/trunk/src/OrxonoxConfig.cmake	2011-05-06 01:37:01 UTC (rev 8409)
@@ -91,6 +91,10 @@
     ELSE()
       SET(VISUAL_LEAK_DETECTOR_ENABLE off)
     ENDIF()
+    SET(VLD_LIBRARY vld.lib)
+    # Force symbol reference
+    # The alternative would be to include vld.h everywhere (includes windows.h)
+    ADD_LINKER_FLAGS("-INCLUDE:__imp_?vld@@3VVisualLeakDetector@@A" Debug)
   ENDIF()
   MARK_AS_ADVANCED(VLD_DLL)
 ENDIF()

Modified: code/trunk/src/OrxonoxConfig.h.in
===================================================================
--- code/trunk/src/OrxonoxConfig.h.in	2011-05-05 21:16:33 UTC (rev 8408)
+++ code/trunk/src/OrxonoxConfig.h.in	2011-05-06 01:37:01 UTC (rev 8409)
@@ -186,20 +186,6 @@
 #  define ORXONOX_RELEASE
 #endif
 
-// Include memory leak detector if available and not building actual release
-#cmakedefine HAVE_VLD
-#if defined(HAVE_VLD) && !defined(NDEBUG)
-typedef uint32_t UINT32;
-typedef wchar_t WCHAR;
-struct HINSTANCE__;
-typedef struct HINSTANCE__* HINSTANCE;
-typedef HINSTANCE HMODULE;
-#  ifndef NULL
-#    define NULL 0
-#  endif
-#  include <vld.h>
-#endif
-
 // Forward declare the everywhere used std::string
 namespace std
 {




More information about the Orxonox-commit mailing list