[Orxonox-commit 3732] r8412 - in code/trunk: cmake cmake/tools src

rgrieder at orxonox.net rgrieder at orxonox.net
Sat May 7 00:06:57 CEST 2011


Author: rgrieder
Date: 2011-05-07 00:06:56 +0200 (Sat, 07 May 2011)
New Revision: 8412

Added:
   code/trunk/cmake/tools/FindVLD.cmake
Modified:
   code/trunk/cmake/LibraryConfig.cmake
   code/trunk/cmake/tools/TargetUtilities.cmake
   code/trunk/src/CMakeLists.txt
   code/trunk/src/OrxonoxConfig.cmake
Log:
MSVC specific:
Sorted out Visual Leak Detector handling (it's now treated like a real library, not as a hack).
Also, the vld.h include is gone and with it windows.h.

Modified: code/trunk/cmake/LibraryConfig.cmake
===================================================================
--- code/trunk/cmake/LibraryConfig.cmake	2011-05-06 02:40:30 UTC (rev 8411)
+++ code/trunk/cmake/LibraryConfig.cmake	2011-05-06 22:06:56 UTC (rev 8412)
@@ -128,6 +128,10 @@
 IF(WIN32)
   FIND_PACKAGE(DbgHelp)
   FIND_PACKAGE(DirectX       REQUIRED)
+  IF(MSVC)
+    # Check whether we can use Visual Leak Detector
+    FIND_PACKAGE(VLD QUIET)
+  ENDIF()
 ENDIF()
 
 

Added: code/trunk/cmake/tools/FindVLD.cmake
===================================================================
--- code/trunk/cmake/tools/FindVLD.cmake	                        (rev 0)
+++ code/trunk/cmake/tools/FindVLD.cmake	2011-05-06 22:06:56 UTC (rev 8412)
@@ -0,0 +1,45 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Finds the Visual Leak Detector if installed
+ #
+
+INCLUDE(FindPackageHandleStandardArgs)
+
+FIND_PATH(VLD_INCLUDE_DIR vld.h
+  PATH_SUFFIXES "Visual Leak Detector/include"
+)
+FIND_LIBRARY(VLD_LIBRARY
+  NAMES vld
+  PATH_SUFFIXES "Visual Leak Detector/lib/Win32"
+)
+
+# Handle the REQUIRED argument and set POCO_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(VLD DEFAULT_MSG
+  VLD_LIBRARY
+  VLD_INCLUDE_DIR
+)
+
+MARK_AS_ADVANCED(
+  VLD_INCLUDE_DIR
+  VLD_LIBRARY
+)


Property changes on: code/trunk/cmake/tools/FindVLD.cmake
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: code/trunk/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/TargetUtilities.cmake	2011-05-06 02:40:30 UTC (rev 8411)
+++ code/trunk/cmake/tools/TargetUtilities.cmake	2011-05-06 22:06:56 UTC (rev 8412)
@@ -304,8 +304,8 @@
   ENDIF()
 
   # Visual Leak Detector specific stuff (avoids the include)
-  IF(HAVE_VLD)
-    TARGET_LINK_LIBRARIES(${_target_name} ${VLD_LIBRARY})
+  IF(VISUAL_LEAK_DETECTOR_ENABLE)
+    TARGET_LINK_LIBRARIES(${_target_name} debug ${VLD_LIBRARY})
   ENDIF()
 
   # RPATH settings for the installation

Modified: code/trunk/src/CMakeLists.txt
===================================================================
--- code/trunk/src/CMakeLists.txt	2011-05-06 02:40:30 UTC (rev 8411)
+++ code/trunk/src/CMakeLists.txt	2011-05-06 22:06:56 UTC (rev 8412)
@@ -54,6 +54,20 @@
   ADD_COMPILER_FLAGS("-DNTDDI_VERSION=0x05010000")
 ENDIF(WIN32)
 
+# Visual Leak Dectector configuration
+IF(MSVC AND VLD_FOUND)
+  OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" OFF)
+  IF(VISUAL_LEAK_DETECTOR_ENABLE)
+    # Force library linking by forcing the inclusion of a symbol
+    ADD_LINKER_FLAGS("-INCLUDE:__imp_?vld@@3VVisualLeakDetector@@A" Debug)
+    IF(MSVC90)
+      # VS 2008 incremental linker crashes with /INCLUDE most of the time
+      REMOVE_LINKER_FLAGS("-INCREMENTAL:YES" Debug)
+      ADD_LINKER_FLAGS   ("-INCREMENTAL:NO"  Debug)
+    ENDIF()
+  ENDIF()
+ENDIF()
+
 ######### Library Behaviour (external) ##########
 
 # Use TinyXML++
@@ -111,6 +125,10 @@
   INCLUDE_DIRECTORIES(${DBGHELP_INCLUDE_DIR})
 ENDIF()
 
+IF(VISUAL_LEAK_DETECTOR_ENABLE)
+  INCLUDE_DIRECTORIES(${VLD_INCLUDE_DIR})
+ENDIF()
+
 ############## CEGUI OGRE Renderer ##############
 
 IF(CEGUI_OGRE_RENDERER_BUILD_REQUIRED)

Modified: code/trunk/src/OrxonoxConfig.cmake
===================================================================
--- code/trunk/src/OrxonoxConfig.cmake	2011-05-06 02:40:30 UTC (rev 8411)
+++ code/trunk/src/OrxonoxConfig.cmake	2011-05-06 22:06:56 UTC (rev 8412)
@@ -79,26 +79,6 @@
 ADD_COMPILER_FLAGS("-DCMAKE_RelWithDebInfo_BUILD" RelWithDebInfo)
 ADD_COMPILER_FLAGS("-DCMAKE_MinSizeRel_BUILD"     MinSizeRel)
 
-IF(MSVC)
-  # Check whether we can use Visual Leak Detector
-  FIND_FILE(VLD_DLL vld_x86.dll)
-  IF(VLD_DLL)
-    SET(HAVE_VLD TRUE)
-    OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" off)
-    # Make sure the value is "on" or "off" for vld.ini
-    IF(VISUAL_LEAK_DETECTOR_ENABLE)
-      SET(VISUAL_LEAK_DETECTOR_ENABLE on)
-    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()
-
 ############## Configured Headers ###############
 
 SET(GENERATED_FILE_COMMENT




More information about the Orxonox-commit mailing list