vld LyX/cmake integration

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21912 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2007-12-02 11:17:01 +00:00
parent c0708a5c5e
commit e80d447ad2
6 changed files with 366 additions and 2 deletions

View File

@ -24,6 +24,8 @@
#pragma once
#ifndef VLD_BUILD
#ifdef _DEBUG
#pragma comment(lib, "vld.lib")
@ -95,4 +97,7 @@ __declspec(dllimport) void VLDEnable ();
#define VLDEnable()
#define VLDDisable()
#endif // _DEBUG
#endif // _DEBUG
#endif //VLD_BUILD

View File

@ -0,0 +1,53 @@
///////////////////////////////////////////////////////////////////////////////
//
// 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)

View File

@ -0,0 +1,31 @@
///////////////////////////////////////////////////////////////////////////////
//
// 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)

View File

@ -0,0 +1,250 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="vld"
ProjectGUID="{0D30FFCB-45DA-4D2B-8E3C-81BC145BF2DE}"
RootNamespace="vld"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32, UNICODE, _UNICODE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
WarningLevel="4"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
BaseAddress="0x03200000"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AssemblyIdentity=""
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
FavorSizeOrSpeed="1"
EnableFiberSafeOptimizations="true"
PreprocessorDefinitions="UNICODE, _UNICODE"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
FloatingPointModel="2"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
OptimizeForWindows98="1"
BaseAddress="0x03200000"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AssemblyIdentity=""
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\callstack.cpp"
>
</File>
<File
RelativePath="..\..\src\ntapi.cpp"
>
</File>
<File
RelativePath="..\..\src\utility.cpp"
>
</File>
<File
RelativePath="..\..\src\vld.cpp"
>
</File>
<File
RelativePath="..\..\src\vldapi.cpp"
>
</File>
<File
RelativePath="..\..\src\vldheap.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\src\callstack.h"
>
</File>
<File
RelativePath="..\..\src\map.h"
>
</File>
<File
RelativePath="..\..\src\ntapi.h"
>
</File>
<File
RelativePath="..\..\src\set.h"
>
</File>
<File
RelativePath="..\..\src\tree.h"
>
</File>
<File
RelativePath="..\..\src\utility.h"
>
</File>
<File
RelativePath="..\..\include\vld.h"
>
</File>
<File
RelativePath="..\..\src\vldheap.h"
>
</File>
<File
RelativePath="..\..\src\vldint.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -206,6 +206,23 @@ else()
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)

View File

@ -44,10 +44,17 @@ else()
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
@ -58,7 +65,8 @@ target_link_libraries(lyx
graphics
support
intl
${QT_QTMAIN_LIBRARY})
${QT_QTMAIN_LIBRARY}
${vld_dll})
if(ASPELL_FOUND)
target_link_libraries(lyx ${ASPELL_LIBRARY})