#pragma once
+#ifndef VLD_BUILD
+
#ifdef _DEBUG
#pragma comment(lib, "vld.lib")
#define VLDEnable()
#define VLDDisable()
-#endif // _DEBUG
\ No newline at end of file
+#endif // _DEBUG
+
+#endif //VLD_BUILD
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+//
+// Visual Leak Detector - CallStack Class Implementations
+// Copyright (c) 2005-2006 Dan Moulding
+// Copyright (c) 2007 Peter Kümmel, CMake files
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+// See COPYING.txt for the full terms of the GNU Lesser General Public License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+project(vld)
+
+include(CheckCXXSourceCompiles)
+
+check_cxx_source_compiles(
+ "
+ #pragma comment(lib, \"dbghelp.lib\")
+ #define UNICODE
+ #define _UNICODE
+ #include <windows.h>
+ #include <dbghelp.h>
+ int main(){void* ptr = (void*)&SymInitializeW; return 0;}
+ "
+HAVE_DEBUGGING_TOOLS_FOR_WINDOWS)
+
+if (NOT HAVE_DEBUGGING_TOOLS_FOR_WINDOWS)
+ message(STATUS "'Debugging Tools for Windows' not found.")
+ message(STATUS "Please install the tools from http://www.microsoft.com/whdc/devtools/debugging/default.mspx")
+ message(STATUS "and add it to the Visual Studio include and lib serach paths.")
+ message(FATAL_ERROR "")
+endif (NOT HAVE_DEBUGGING_TOOLS_FOR_WINDOWS)
+
+file(GLOB vld_sources ${vld_path}/src/*.cpp)
+file(GLOB vld_headers ${vld_path}/src/*.h)
+
+add_definitions(-DVLD_BUILD -DUNICODE -D_UNICODE)
+
+add_library(vld SHARED ${vld_sources} ${vld_headers} ${vld_path}/include/vld.h)
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+//
+// Visual Leak Detector - CallStack Class Implementations
+// Copyright (c) 2005-2006 Dan Moulding
+// Copyright (c) 2007 Peter Kümmel, CMake files
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+// See COPYING.txt for the full terms of the GNU Lesser General Public License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+# This triggers the useage of vld in all other projects
+include_directories(${vld_path}/include)
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /FIvld.h")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /FIvld.h")
+set(vld_dll vld)
+
+add_subdirectory(${vld_path}/tools/cmake ${CMAKE_BINARY_DIR}/vld)
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="8,00"\r
+ Name="vld"\r
+ ProjectGUID="{0D30FFCB-45DA-4D2B-8E3C-81BC145BF2DE}"\r
+ RootNamespace="vld"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ PreprocessorDefinitions="WIN32, UNICODE, _UNICODE"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ EnableFunctionLevelLinking="true"\r
+ WarningLevel="4"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ GenerateDebugInformation="true"\r
+ BaseAddress="0x03200000"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ AssemblyIdentity=""\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="2"\r
+ WholeProgramOptimization="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="3"\r
+ FavorSizeOrSpeed="1"\r
+ EnableFiberSafeOptimizations="true"\r
+ PreprocessorDefinitions="UNICODE, _UNICODE"\r
+ StringPooling="true"\r
+ RuntimeLibrary="2"\r
+ BufferSecurityCheck="false"\r
+ FloatingPointModel="2"\r
+ DebugInformationFormat="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ GenerateDebugInformation="true"\r
+ OptimizeReferences="2"\r
+ EnableCOMDATFolding="2"\r
+ OptimizeForWindows98="1"\r
+ BaseAddress="0x03200000"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ AssemblyIdentity=""\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <Filter\r
+ Name="Source Files"\r
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+ >\r
+ <File\r
+ RelativePath="..\..\src\callstack.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\ntapi.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\utility.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\vld.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\vldapi.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\vldheap.cpp"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Header Files"\r
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+ >\r
+ <File\r
+ RelativePath="..\..\src\callstack.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\map.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\ntapi.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\set.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\tree.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\utility.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\include\vld.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\vldheap.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\vldint.h"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Resource Files"\r
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+ >\r
+ </Filter>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
endif()
if(MSVC)
+ if(vld)
+ set(vld 1 CACHE TYPE STRING FORCE)
+ set(LYX_LEAK_DETECTION 1 CACHE TYPE STRING FORCE)
+ message(STATUS "")
+ message(STATUS "Leak detection enabled, disable with -Dvld=0")
+ message(STATUS "")
+ set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
+ set(vld_path ${CMAKE_CURRENT_SOURCE_DIR}/../Win32/vld)
+ include(${vld_path}/tools/cmake/vld.cmake)
+ else()
+ set(vld 0 CACHE TYPE STRING FORCE)
+ set(LYX_LEAK_DETECTION 0 CACHE TYPE STRING FORCE)
+ message(STATUS "")
+ message(STATUS "Enable leak detection with -Dvld=1")
+ message(STATUS "")
+ endif()
+
if(WALL)
set(WALL 1 CACHE TYPE STRING FORCE)
set(lyx_sources ${_allinone_files})
endif()
+if(LYX_LEAK_DETECTION)
+ configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/vld.ini COPYONLY)
+ configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt COPYONLY)
+ set(vld_files ${CMAKE_CURRENT_BINARY_DIR}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt)
+endif()
+
add_executable(lyx
${WIN32_CONSOLE}
${lyx_sources}
${lyx_headers}
+ ${vld_files}
)
target_link_libraries(lyx
graphics
support
intl
- ${QT_QTMAIN_LIBRARY})
+ ${QT_QTMAIN_LIBRARY}
+ ${vld_dll})
if(ASPELL_FOUND)
target_link_libraries(lyx ${ASPELL_LIBRARY})