diff --git a/BUILDING.md b/BUILDING.md index f3cd047da..432859a10 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -644,6 +644,12 @@ as the startup project, and use these arguments: Use `\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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 755676e93..6316b4180 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,7 @@ include(PresentMonShaders) include(PresentMonUiPayload) include(PresentMonAuxTestData) include(PresentMonCTest) +include(PresentMonCommandLineArguments) pmon_configure_options() pmon_configure_output_directories() @@ -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}") diff --git a/IntelPresentMon/AppCef/AppCef.args.json b/IntelPresentMon/AppCef/AppCef.args.json deleted file mode 100644 index 811de24a8..000000000 --- a/IntelPresentMon/AppCef/AppCef.args.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "FileVersion": 2, - "Id": "3c80b001-e165-4e0e-a92d-5767cf4fb1f8", - "Items": [ - { - "Id": "1dc49fdb-5f81-4e67-b00d-73fd9b974d2c", - "Command": "--p2c-allow-tearing" - }, - { - "Id": "070d8dbb-d8f5-454d-ae83-baf060dcd1a5", - "Command": "--p2c-no-net-fail" - }, - { - "Id": "f8cae6d1-4f95-472b-945d-8f51fdeb0aee", - "Command": "--p2c-log-black" - }, - { - "Id": "4f37c40f-bf0a-4f65-a732-26f5ebdd215b", - "Command": "--p2c-files-working" - }, - { - "Id": "85807b6c-301d-4b9b-9f63-28ec30c95fb1", - "Command": "--p2c-verbose" - }, - { - "Id": "892e9566-9271-49a0-8eea-4c1750a4c3bb", - "Command": "--p2c-url \"http://localhost:8080/\"" - }, - { - "Id": "84d92b33-37d5-43e8-b7ed-fe8bf667b0fd", - "Command": "--p2c-url \"https://google.com\"" - } - ] -} \ No newline at end of file diff --git a/IntelPresentMon/AppCef/CefNano.args.json b/IntelPresentMon/AppCef/CefNano.args.json deleted file mode 100644 index b802078ee..000000000 --- a/IntelPresentMon/AppCef/CefNano.args.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "FileVersion": 2, - "Id": "3c80b001-e165-4e0e-a92d-5767cf4fb1f8", - "Items": [ - { - "Id": "68df55d8-bc72-4454-b591-f82e6968f905", - "Command": "standalone-svc", - "Items": [ - { - "Id": "26627e74-25b8-48b2-8801-e4a4ff273b75", - "Command": "--p2c-control-pipe \"\\\\.\\pipe\\eff\"" - }, - { - "Id": "fa923157-5981-494d-b492-569bc67f6af4", - "Command": "--p2c-shm-name pm_my_intro" - } - ] - }, - { - "Id": "04791b9f-ca9c-4ced-a572-c50f972877a3", - "Command": "--p2c-files-working" - }, - { - "Id": "f2f9d663-3ac6-4f2a-b62c-6defb750e639", - "Command": "--p2c-log-level debug" - }, - { - "Id": "8244ec79-0c35-4e62-b3b0-36b5efffa371", - "Command": "--p2c-log-level verbose" - }, - { - "Id": "8634f48b-7ed1-45af-8b73-5973c7b4b3c7", - "Command": "--p2c-log-svc-pipe-enable" - }, - { - "Id": "b0fec119-97eb-46b4-bdd7-e1eb8b857c45", - "Command": "--p2c-middleware-dll-path .\\PresentMonAPI2.dll" - }, - { - "Id": "0fb8cd38-1cf3-417f-a81c-894f60801ce8", - "Command": "--p2c-log-middleware-copy" - }, - { - "Id": "bc2faf34-6d97-458c-8ff1-67f3102617da", - "Command": "--p2c-enable-ui-dev-options" - }, - { - "Id": "3cfde9b7-02ee-4be8-b351-ea76191989a7", - "Command": "--p2c-enable-timestamp-column" - }, - { - "Id": "613c6ffc-013b-41c6-84db-eb54d1a0c3df", - "Command": "--p2c-url \"http://localhost:5173\"" - }, - { - "Id": "ba03a214-d200-4c5b-802b-52b2e44baadf", - "Command": "--p2c-enable-diagnostic" - }, - { - "Id": "f7483465-0c24-4c48-b3ac-e27310feb3a1", - "Command": "--p2c-log-allow-list \"b stak.txt\"" - }, - { - "Id": "72b2a6c6-ef95-4c88-89db-e3e601ecb3e0", - "Command": "--p2c-log-deny-list \"b stak.txt\"" - }, - { - "Id": "b8037124-662e-4823-9248-a2242ea02142", - "Command": "--p2c-log-folder C:\\scratch" - }, - { - "Id": "94236dab-b7fa-4401-a163-f7ceee4e8fe1", - "Command": "--p2c-log-trace-level warning" - }, - { - "Id": "00da8547-bd17-45b6-84a7-8d4e51ba4b62", - "Command": "--p2c-allow-tearing" - }, - { - "Id": "97d3977e-2f1d-49f0-8956-03fbf7ac96ea", - "Command": "--p2c-disable-alpha" - }, - { - "Id": "fc633c46-6b09-43e6-9c02-3e4817ef382e", - "Command": "--p2c-debug-wait-render" - }, - { - "Id": "f556bf27-cb7e-4a17-a7cb-3c0400aeb7d1", - "Command": "--p2c-debug-wait-client" - }, - { - "Id": "92d25458-0b38-4e99-a582-49f0c90979c2", - "Command": "--help" - }, - { - "Id": "55e7fd71-7671-4a27-9bc8-6c8ed651597f", - "Command": "--remote-allow-origins=http://127.0.0.1:9009" - } - ] -} \ No newline at end of file diff --git a/IntelPresentMon/KernelProcess/KernelProcess.args.json b/IntelPresentMon/KernelProcess/KernelProcess.args.json index 05cfe9d05..6845dafe8 100644 --- a/IntelPresentMon/KernelProcess/KernelProcess.args.json +++ b/IntelPresentMon/KernelProcess/KernelProcess.args.json @@ -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", diff --git a/IntelPresentMon/PMInstallerExtension/PMInstallerExtension.args.json b/IntelPresentMon/PMInstallerExtension/PMInstallerExtension.args.json deleted file mode 100644 index 473e2a590..000000000 --- a/IntelPresentMon/PMInstallerExtension/PMInstallerExtension.args.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "FileVersion": 2, - "Id": "9e3c74bb-12bb-40ac-86bf-818d20140cba", - "Items": [ - { - "Id": "ccd5d4f9-221a-4bdc-9546-04755edfb952", - "Command": "Debug", - "ProjectConfig": "Debug", - "ProjectPlatform": "Any CPU", - "Items": [ - { - "Id": "66a30189-7267-494c-b97a-04152dcc0971", - "Command": "--help" - } - ] - } - ] -} \ No newline at end of file diff --git a/IntelPresentMon/PresentMonService/PresentMonService.args.json b/IntelPresentMon/PresentMonService/PresentMonService.args.json index 4323cd864..3a204374f 100644 --- a/IntelPresentMon/PresentMonService/PresentMonService.args.json +++ b/IntelPresentMon/PresentMonService/PresentMonService.args.json @@ -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", diff --git a/IntelPresentMon/SampleClient/SampleClient.args.json b/IntelPresentMon/SampleClient/SampleClient.args.json index 978823012..dbced0239 100644 --- a/IntelPresentMon/SampleClient/SampleClient.args.json +++ b/IntelPresentMon/SampleClient/SampleClient.args.json @@ -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", diff --git a/PresentMon/PresentMon.args.json b/PresentMon/PresentMonConsole.args.json similarity index 98% rename from PresentMon/PresentMon.args.json rename to PresentMon/PresentMonConsole.args.json index 4497ccf1e..07e4292ef 100644 --- a/PresentMon/PresentMon.args.json +++ b/PresentMon/PresentMonConsole.args.json @@ -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", diff --git a/PresentMonService.args.json b/PresentMonService.args.json index 22344f276..3305bddd4 100644 --- a/PresentMonService.args.json +++ b/PresentMonService.args.json @@ -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", diff --git a/Tests/PresentMonTests.args.json b/Tests/PresentMonTests.args.json deleted file mode 100644 index a09eda0a6..000000000 --- a/Tests/PresentMonTests.args.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "FileVersion": 2, - "Id": "0f60dfd9-208e-443e-8d01-43c902b458a6", - "Items": [ - { - "Id": "0a297b29-b817-4fec-899b-b608a7e51bc4", - "Command": "Debug|x64", - "ProjectConfig": "Debug", - "ProjectPlatform": "x64", - "Items": [ - { - "Id": "a6fb5569-0d64-4e0d-85eb-2409faee14cc", - "Command": "WindowsLocalDebugger", - "Items": [ - { - "Id": "24c8b220-ee14-4795-bc47-8e8202db9798", - "Command": "--help --debug_verbose_trace --track_gpu_video --qpc_time --output_file vvv.csv --etl_file \"C:\\Users\\Chili\\Desktop\\cpp\\ipm-relay\\Tests\\Gold\\test_case_4.etl\" --stop_existing_session --no_console_stats" - } - ] - }, - { - "Id": "461dab48-e20b-4a91-b9a4-601f6847153f", - "Command": "WindowsRemoteDebugger", - "Items": [ - { - "Id": "96c9e57a-c06b-46ab-bc78-89c193c23249", - "Command": "--help --debug_verbose_trace --track_gpu_video --qpc_time --output_file vvv.csv --etl_file \"C:\\Users\\Chili\\Desktop\\cpp\\ipm-relay\\Tests\\Gold\\test_case_4.etl\" --stop_existing_session --no_console_stats" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/Tools/ETLTrimmer/ETLTrimmer.args.json b/Tools/ETLTrimmer/ETLTrimmer.args.json index 8c065533a..18ab32b70 100644 --- a/Tools/ETLTrimmer/ETLTrimmer.args.json +++ b/Tools/ETLTrimmer/ETLTrimmer.args.json @@ -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", diff --git a/cmake/PresentMonCommandLineArguments.cmake b/cmake/PresentMonCommandLineArguments.cmake new file mode 100644 index 000000000..5d3558c5c --- /dev/null +++ b/cmake/PresentMonCommandLineArguments.cmake @@ -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 NORMALIZE "${CMAKE_SOURCE_DIR}/build") + cmake_path(SET _pmon_actual_binary_dir NORMALIZE "${CMAKE_BINARY_DIR}") + 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() + 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() diff --git a/cmake/PresentMonOptions.cmake b/cmake/PresentMonOptions.cmake index a5cef1b56..a8bc030b4 100644 --- a/cmake/PresentMonOptions.cmake +++ b/cmake/PresentMonOptions.cmake @@ -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