vcpkg/ports/presentmon/CMakeLists.txt
aggieNick02 c90db9a65e
Port for PresentMon, windows-only ETW swap-chain presentation capture and analysis tool (#16628)
* Port for presentmon, a windows-only tool

* run x-add-version

* Add expected failures to ci file for presentmon port

* Update scripts/ci.baseline.txt

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/presentmon/vcpkg.json

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update versions/p-/presentmon.json

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* CMake-based port for presentmon, based on source provided by JackBoosY

* Rerun x-add-version

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
2021-04-07 13:53:17 -07:00

73 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 3.11)
project(presentmon)
set(PRESENTMON_VERSION 1.6.0)
option(INSTALL_HEADERS "Install presentmon headers" ON)
option(BUILD_TOOLS "Build tool PresentMon" OFF)
set(PRESENTDATA_SRCS
PresentData/Debug.cpp
PresentData/MixedRealityTraceConsumer.cpp
PresentData/PresentMonTraceConsumer.cpp
PresentData/TraceConsumer.cpp
PresentData/TraceSession.cpp
)
set(PRESENTDATA_HDRS
PresentData/Debug.hpp
PresentData/MixedRealityTraceConsumer.hpp
PresentData/PresentMonTraceConsumer.hpp
PresentData/TraceConsumer.hpp
PresentData/TraceSession.hpp
${CMAKE_BINARY_DIR}/generated/version.h
)
file(GLOB EXTRA_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/PresentData/ETW/*.h)
file(WRITE ${CMAKE_BINARY_DIR}/generated/version.h "char const* PRESENT_MON_VERSION = \"1.6.0\";")
add_library(PresentData STATIC ${PRESENTDATA_SRCS} ${PRESENTDATA_HDRS} ${EXTRA_INCLUDES})
target_include_directories(PresentData PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/PresentData>
$<INSTALL_INTERFACE:include/presentmon>
)
target_compile_definitions(PresentData PRIVATE UNICODE)
# Install targets
install(TARGETS PresentData
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if (BUILD_TOOLS)
set(PresentMon_SRCS
PresentMon/CommandLine.cpp
PresentMon/Console.cpp
PresentMon/ConsumerThread.cpp
PresentMon/CsvOutput.cpp
PresentMon/LateStageReprojectionData.cpp
PresentMon/MainThread.cpp
PresentMon/OutputThread.cpp
PresentMon/Privilege.cpp
PresentMon/TraceSession.cpp
)
add_executable(PresentMon ${PresentMon_SRCS})
target_include_directories(PresentMon PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/PresentMon ${CMAKE_BINARY_DIR})
target_compile_definitions(PresentMon PRIVATE UNICODE)
target_link_libraries(PresentMon PRIVATE PresentData Tdh Shlwapi)
install(TARGETS PresentMon
RUNTIME DESTINATION bin
)
endif()
# Install headers
if (INSTALL_HEADERS)
install(FILES ${PRESENTDATA_HDRS} DESTINATION include/presentmon)
install(FILES ${EXTRA_INCLUDES} DESTINATION include/presentmon/ETW)
endif()