Blame ptxed/CMakeLists.txt

Packit b1f7ae
# Copyright (c) 2013-2017, Intel Corporation
Packit b1f7ae
#
Packit b1f7ae
# Redistribution and use in source and binary forms, with or without
Packit b1f7ae
# modification, are permitted provided that the following conditions are met:
Packit b1f7ae
#
Packit b1f7ae
#  * Redistributions of source code must retain the above copyright notice,
Packit b1f7ae
#    this list of conditions and the following disclaimer.
Packit b1f7ae
#  * Redistributions in binary form must reproduce the above copyright notice,
Packit b1f7ae
#    this list of conditions and the following disclaimer in the documentation
Packit b1f7ae
#    and/or other materials provided with the distribution.
Packit b1f7ae
#  * Neither the name of Intel Corporation nor the names of its contributors
Packit b1f7ae
#    may be used to endorse or promote products derived from this software
Packit b1f7ae
#    without specific prior written permission.
Packit b1f7ae
#
Packit b1f7ae
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit b1f7ae
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit b1f7ae
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit b1f7ae
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
Packit b1f7ae
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Packit b1f7ae
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Packit b1f7ae
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit b1f7ae
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Packit b1f7ae
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Packit b1f7ae
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Packit b1f7ae
# POSSIBILITY OF SUCH DAMAGE.
Packit b1f7ae
Packit b1f7ae
set(XED_INCLUDE "" CACHE PATH "")
Packit b1f7ae
set(XED_LIBDIR  "" CACHE PATH "")
Packit b1f7ae
Packit b1f7ae
option(FEATURE_ELF "Support loading ELF files in ptxed." OFF)
Packit b1f7ae
if (FEATURE_ELF)
Packit b1f7ae
  add_definitions(-DFEATURE_ELF)
Packit b1f7ae
endif (FEATURE_ELF)
Packit b1f7ae
Packit b1f7ae
include_directories(
Packit b1f7ae
  include
Packit b1f7ae
  ../libipt/internal/include
Packit b1f7ae
)
Packit b1f7ae
Packit b1f7ae
include_directories(SYSTEM
Packit b1f7ae
  ${XED_INCLUDE}
Packit b1f7ae
)
Packit b1f7ae
Packit b1f7ae
link_directories(
Packit b1f7ae
  ${XED_LIBDIR}
Packit b1f7ae
)
Packit b1f7ae
Packit b1f7ae
set(PTXED_FILES
Packit b1f7ae
  src/ptxed.c
Packit b1f7ae
  ../libipt/src/pt_cpu.c
Packit b1f7ae
)
Packit b1f7ae
Packit b1f7ae
if (CMAKE_HOST_UNIX)
Packit b1f7ae
  set(PTXED_FILES ${PTXED_FILES} ../libipt/src/posix/pt_cpuid.c)
Packit b1f7ae
endif (CMAKE_HOST_UNIX)
Packit b1f7ae
Packit b1f7ae
if (CMAKE_HOST_WIN32)
Packit b1f7ae
  set(PTXED_FILES ${PTXED_FILES} ../libipt/src/windows/pt_cpuid.c)
Packit b1f7ae
endif (CMAKE_HOST_WIN32)
Packit b1f7ae
Packit b1f7ae
if (FEATURE_ELF)
Packit b1f7ae
  set(PTXED_FILES ${PTXED_FILES} src/load_elf.c)
Packit b1f7ae
endif (FEATURE_ELF)
Packit b1f7ae
Packit b1f7ae
add_executable(ptxed
Packit b1f7ae
  ${PTXED_FILES}
Packit b1f7ae
)
Packit b1f7ae
target_link_libraries(ptxed libipt)
Packit b1f7ae
target_link_libraries(ptxed xed)
Packit b1f7ae
Packit b1f7ae
if (CMAKE_HOST_WIN32)
Packit b1f7ae
  # suppress warnings from XED header files
Packit b1f7ae
  #
Packit b1f7ae
  #   w4127: conditional expression is constant
Packit b1f7ae
  #   w4244: conversion: possible loss of data
Packit b1f7ae
  #
Packit b1f7ae
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127")
Packit b1f7ae
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244")
Packit b1f7ae
Packit b1f7ae
endif (CMAKE_HOST_WIN32)