|
| 1 | +# ********************************************************** |
| 2 | +# Copyright (c) 2010-2015 Google, Inc. All rights reserved. |
| 3 | +# Copyright (c) 2009-2010 VMware, Inc. All rights reserved. |
| 4 | +# ********************************************************** |
| 5 | + |
| 6 | +# Redistribution and use in source and binary forms, with or without |
| 7 | +# modification, are permitted provided that the following conditions are met: |
| 8 | +# |
| 9 | +# * Redistributions of source code must retain the above copyright notice, |
| 10 | +# this list of conditions and the following disclaimer. |
| 11 | +# |
| 12 | +# * Redistributions in binary form must reproduce the above copyright notice, |
| 13 | +# this list of conditions and the following disclaimer in the documentation |
| 14 | +# and/or other materials provided with the distribution. |
| 15 | +# |
| 16 | +# * Neither the name of VMware, Inc. nor the names of its contributors may be |
| 17 | +# used to endorse or promote products derived from this software without |
| 18 | +# specific prior written permission. |
| 19 | +# |
| 20 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 21 | +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | +# ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE |
| 24 | +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 25 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 26 | +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 27 | +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 28 | +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 30 | +# DAMAGE. |
| 31 | + |
| 32 | +cmake_minimum_required(VERSION 2.6) |
| 33 | + |
| 34 | +# We do not need libc, and we avoid a 10x size increase in both our |
| 35 | +# dll and pdb (plus we avoid stressing private library isolation) by |
| 36 | +# not using it (i#714). |
| 37 | +set(DynamoRIO_USE_LIBC OFF) |
| 38 | + |
| 39 | +add_library(drltrace SHARED drltrace.c) |
| 40 | +configure_DynamoRIO_client(drltrace) |
| 41 | +use_DynamoRIO_extension(drltrace drmgr) |
| 42 | +use_DynamoRIO_extension(drltrace drwrap) |
| 43 | +use_DynamoRIO_extension(drltrace drx) |
| 44 | +# We keep our shared libs in the lib dir, not the bin dir: |
| 45 | +place_shared_lib_in_lib_dir(drltrace) |
| 46 | + |
| 47 | +# ensure we rebuild if includes change |
| 48 | +add_dependencies(drltrace api_headers) |
| 49 | + |
| 50 | +# Provide a hint for how to use the client |
| 51 | +if (NOT DynamoRIO_INTERNAL OR NOT "${CMAKE_GENERATOR}" MATCHES "Ninja") |
| 52 | + add_custom_command(TARGET drltrace |
| 53 | + POST_BUILD |
| 54 | + COMMAND ${CMAKE_COMMAND} |
| 55 | + ARGS -E echo "Usage: pass to drconfig or drrun: -t drltrace" |
| 56 | + VERBATIM) |
| 57 | +endif () |
| 58 | + |
| 59 | +install_target(drltrace ${INSTALL_CLIENTS_LIB}) |
| 60 | + |
| 61 | +set(INSTALL_DRLTRACE_CONFIG ${INSTALL_CLIENTS_BASE}) |
| 62 | + |
| 63 | +if (X64) |
| 64 | + set(CONFIG ${PROJECT_BINARY_DIR}/drltrace.drrun64) |
| 65 | +else (X64) |
| 66 | + set(CONFIG ${PROJECT_BINARY_DIR}/drltrace.drrun32) |
| 67 | +endif (X64) |
| 68 | + |
| 69 | +file(WRITE ${CONFIG} "# drltrace tool config file\n") |
| 70 | +file(APPEND ${CONFIG} "# DynamoRIO options: may as well optimize the bb lock\n") |
| 71 | +file(APPEND ${CONFIG} "DR_OP=-nop_initial_bblock\n") |
| 72 | +file(APPEND ${CONFIG} "# client tool path\n") |
| 73 | +file(APPEND ${CONFIG} "CLIENT_REL=${INSTALL_CLIENTS_LIB}/${LIB_PFX}drltrace${LIB_EXT}\n") |
| 74 | +file(APPEND ${CONFIG} "# client tool options\n") |
| 75 | +file(APPEND ${CONFIG} "TOOL_OP=\n") |
| 76 | + |
| 77 | +DR_install(FILES "${CONFIG}" DESTINATION ${INSTALL_DRLTRACE_CONFIG}) |
| 78 | +register_tool_file("drltrace") |
0 commit comments