Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,12 @@ as the startup project, and use these arguments:
Use `<binary-tree>\Debug` as the working directory. With `--svc-as-child`, the
UI starts `PresentMonService.exe` from the same directory.

For the Visual Studio Command Line Arguments extension with `-B build`, configure
or re-configure with `-DPMON_LINK_COMMAND_LINE_ARGS=ON` to symlink source-tree
`*.args.json` presets next to generated projects. The
`pmon_link_command_line_args` build target runs the same configure step with that
option enabled (for example after editing presets).

Realtime ETW workflows normally require membership in `Performance Log Users`.
Sign out and back in after adding the user to that group. Debug uses
`uiAccess=false`. Release `PresentMon.exe` uses `uiAccess=true` and normally
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ include(PresentMonShaders)
include(PresentMonUiPayload)
include(PresentMonAuxTestData)
include(PresentMonCTest)
include(PresentMonCommandLineArguments)

pmon_configure_options()
pmon_configure_output_directories()
Expand Down Expand Up @@ -172,6 +173,8 @@ pmon_add_win32_component_signing_targets()
include(PresentMonPackaging)
pmon_register_packaging_targets()

pmon_register_command_line_args_symlinks()

message(STATUS "")
message(STATUS "PresentMon configuration")
message(STATUS " Version: ${PMON_VERSION}")
Expand Down
34 changes: 0 additions & 34 deletions IntelPresentMon/AppCef/AppCef.args.json

This file was deleted.

100 changes: 0 additions & 100 deletions IntelPresentMon/AppCef/CefNano.args.json

This file was deleted.

2 changes: 1 addition & 1 deletion IntelPresentMon/KernelProcess/KernelProcess.args.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 2,
"Id": "8524c555-b172-46ef-be42-7b7b7bb102e4",
"Id": "8c0e1bd8-b73e-3984-9efe-97ab72e66965",
"Items": [
{
"Id": "05c87f08-36f8-4173-995d-dea7a6601ccc",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 2,
"Id": "3a848e5b-a376-4a22-bbac-e9b3c01bd385",
"Id": "ef4330bd-ec4d-3bc0-b96b-58fa1582404d",
"Items": [
{
"Id": "c0207ae5-487c-4379-8ccb-e99281ade16e",
Expand Down
2 changes: 1 addition & 1 deletion IntelPresentMon/SampleClient/SampleClient.args.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 2,
"Id": "79fe382a-c29c-4c32-a028-b8d1abdf51b0",
"Id": "533b4126-92bb-3643-a791-13454b368dc1",
"Items": [
{
"Id": "2cf4c62a-0c43-4a7f-a686-8dc38ffc3868",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 2,
"Id": "4eb9794b-1f12-48ce-adc1-917e9810f29e",
"Id": "ee26d35d-37b9-3efd-a573-3cf0433f8b4f",
"Items": [
{
"Id": "87896970-fc2f-44e1-8336-e0ed41901412",
Expand Down
2 changes: 1 addition & 1 deletion PresentMonService.args.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 2,
"Id": "3a848e5b-a376-4a22-bbac-e9b3c01bd385",
"Id": "ef4330bd-ec4d-3bc0-b96b-58fa1582404d",
"Items": [
{
"Id": "c0207ae5-487c-4379-8ccb-e99281ade16e",
Expand Down
34 changes: 0 additions & 34 deletions Tests/PresentMonTests.args.json

This file was deleted.

2 changes: 1 addition & 1 deletion Tools/ETLTrimmer/ETLTrimmer.args.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 2,
"Id": "f9bd47f5-4aa3-4ba3-91f2-2ac7b270299c",
"Id": "c0bccb39-2630-30ac-bb26-880b8a120193",
"Items": [
{
"Id": "0f02ddbd-6110-43dd-982a-900bffd8549c",
Expand Down
106 changes: 106 additions & 0 deletions cmake/PresentMonCommandLineArguments.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
include_guard(GLOBAL)

function(_pmon_command_line_args_is_build_binary_dir out_var)
cmake_path(SET _pmon_expected_build_dir "${CMAKE_SOURCE_DIR}/build" NORMALIZE)
cmake_path(SET _pmon_actual_binary_dir "${CMAKE_BINARY_DIR}" NORMALIZE)
Comment on lines +4 to +5
if(_pmon_actual_binary_dir STREQUAL _pmon_expected_build_dir)
set("${out_var}" TRUE PARENT_SCOPE)
else()
set("${out_var}" FALSE PARENT_SCOPE)
endif()
endfunction()

function(_pmon_command_line_args_apply)
set(_pmon_mappings
"IntelPresentMon/KernelProcess|KernelProcess|IntelPresentMon/KernelProcess/KernelProcess.args.json"
"IntelPresentMon/PresentMonService|PresentMonService|IntelPresentMon/PresentMonService/PresentMonService.args.json"
"PresentMon|PresentMonConsole|PresentMon/PresentMonConsole.args.json"
"IntelPresentMon/SampleClient|SampleClient|IntelPresentMon/SampleClient/SampleClient.args.json"
"Tools/ETLTrimmer|ETLTrimmer|Tools/ETLTrimmer/ETLTrimmer.args.json"
)

set(_pmon_linked 0)

foreach(_pmon_mapping IN LISTS _pmon_mappings)
string(REPLACE "|" ";" _pmon_fields "${_pmon_mapping}")
list(GET _pmon_fields 0 _pmon_subdir)
list(GET _pmon_fields 1 _pmon_target)
list(GET _pmon_fields 2 _pmon_source_rel)

set(_pmon_vcxproj "${CMAKE_BINARY_DIR}/${_pmon_subdir}/${_pmon_target}.vcxproj")
if(NOT TARGET "${_pmon_target}" AND NOT EXISTS "${_pmon_vcxproj}")
continue()
Comment thread
Copilot marked this conversation as resolved.
endif()

set(_pmon_source "${CMAKE_SOURCE_DIR}/${_pmon_source_rel}")
if(NOT EXISTS "${_pmon_source}")
message(
WARNING
"Command line args symlink: missing source preset ${_pmon_source_rel}."
)
continue()
endif()

set(_pmon_link "${CMAKE_BINARY_DIR}/${_pmon_subdir}/${_pmon_target}.args.json")
if(EXISTS "${_pmon_link}")
file(REMOVE "${_pmon_link}")
endif()

file(CREATE_LINK "${_pmon_source}" "${_pmon_link}" SYMBOLIC RESULT _pmon_link_result)
if(_pmon_link_result)
message(
WARNING
"Command line args symlink: could not link\n"
" ${_pmon_link}\n"
" -> ${_pmon_source}\n"
" (${_pmon_link_result}). Enable Windows Developer Mode or run from an elevated shell."
)
continue()
endif()

math(EXPR _pmon_linked "${_pmon_linked} + 1")
endforeach()

if(_pmon_linked GREATER 0)
message(STATUS "Linked ${_pmon_linked} Command Line Arguments preset(s) under ${CMAKE_BINARY_DIR}.")
endif()
endfunction()

function(pmon_register_command_line_args_symlinks)
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
return()
endif()

_pmon_command_line_args_is_build_binary_dir(_pmon_is_build_dir)
if(NOT _pmon_is_build_dir)
if(PMON_LINK_COMMAND_LINE_ARGS)
message(
STATUS
"PMON_LINK_COMMAND_LINE_ARGS is ON but the binary directory is not "
"${CMAKE_SOURCE_DIR}/build; skipping command line args symlinks."
)
endif()
return()
endif()

add_custom_target(
pmon_link_command_line_args
COMMAND
${CMAKE_COMMAND}
-S "${CMAKE_SOURCE_DIR}"
-B "${CMAKE_BINARY_DIR}"
-DPMON_LINK_COMMAND_LINE_ARGS=ON
USES_TERMINAL
VERBATIM
)
set_target_properties(
pmon_link_command_line_args
PROPERTIES
EXCLUDE_FROM_DEFAULT_BUILD TRUE
FOLDER "Build"
)

if(PMON_LINK_COMMAND_LINE_ARGS)
_pmon_command_line_args_apply()
endif()
endfunction()
5 changes: 5 additions & 0 deletions cmake/PresentMonOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ function(pmon_configure_options)
"Register CTest entry for the Tests/Full gold CSV suite"
OFF
)
option(
PMON_LINK_COMMAND_LINE_ARGS
"Symlink source-tree *.args.json presets beside generated Visual Studio projects in -B build"
OFF
)

cmake_dependent_option(
PMON_BUILD_PRESENTMON_TESTS
Expand Down
Loading