From 592c45e79fef4bbceb2e3fc94c74e0147eee9255 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sat, 26 Jun 2021 17:28:42 +0200 Subject: [PATCH 1/3] Port to cmkr --- .gitignore | 394 +-------------------------------- .gitmodules | 3 - CMakeLists.txt | 73 ++++++ cmake.toml | 16 ++ cmkr.cmake | 162 ++++++++++++++ dependencies/CMakeLists.txt | 58 +++++ dependencies/cmake.toml | 10 + dependencies/vmprofiler | 2 +- src/main.cpp | 1 - vmprofiler-cli.sln | 127 ----------- vmprofiler-cli.vcxproj | 140 ------------ vmprofiler-cli.vcxproj.filters | 212 ------------------ 12 files changed, 326 insertions(+), 872 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 cmake.toml create mode 100644 cmkr.cmake create mode 100644 dependencies/CMakeLists.txt create mode 100644 dependencies/cmake.toml delete mode 100644 vmprofiler-cli.sln delete mode 100644 vmprofiler-cli.vcxproj delete mode 100644 vmprofiler-cli.vcxproj.filters diff --git a/.gitignore b/.gitignore index 72de34f..52f271d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,388 +1,6 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.tlog -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Nuget personal access tokens and Credentials -nuget.config - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -.idea/ -*.sln.iml \ No newline at end of file +.idea/ +cmake-build*/ +build*/ +out/ +.vs/ +.cache/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 0d92ff0..ef4e931 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "dependencies/vmprofiler"] path = dependencies/vmprofiler url = https://githacks.org/vmp2/vmprofiler.git -[submodule "cli-parser"] - path = cli-parser - url = https://githacks.org/_xeroxz/cli-parser.git [submodule "dependencies/cli-parser"] path = dependencies/cli-parser url = https://githacks.org/_xeroxz/cli-parser.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a46e41e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,73 @@ +# This file is automatically generated from cmake.toml - DO NOT EDIT +# See https://github.com/build-cpp/cmkr for more information + +cmake_minimum_required(VERSION 3.15) + +# Regenerate CMakeLists.txt automatically in the root project +set(CMKR_ROOT_PROJECT OFF) +if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(CMKR_ROOT_PROJECT ON) + + # Bootstrap cmkr + include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT) + if(CMKR_INCLUDE_RESULT) + cmkr() + endif() + + # Enable folder support + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +endif() + +# Create a configure-time dependency on cmake.toml to improve IDE support +if(CMKR_ROOT_PROJECT) + configure_file(cmake.toml cmake.toml COPYONLY) +endif() + +project(vmprofiler-cli) + +# dependencies +set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER}) +if(CMAKE_FOLDER) + set(CMAKE_FOLDER "${CMAKE_FOLDER}/dependencies") +else() + set(CMAKE_FOLDER dependencies) +endif() +add_subdirectory(dependencies) +set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER}) + +# Target vmprofiler-cli +set(CMKR_TARGET vmprofiler-cli) +set(vmprofiler-cli_SOURCES "") + +list(APPEND vmprofiler-cli_SOURCES + "src/main.cpp" + "src/icon.rc" +) + +list(APPEND vmprofiler-cli_SOURCES + cmake.toml +) + +set(CMKR_SOURCES ${vmprofiler-cli_SOURCES}) +add_executable(vmprofiler-cli) + +if(vmprofiler-cli_SOURCES) + target_sources(vmprofiler-cli PRIVATE ${vmprofiler-cli_SOURCES}) +endif() + +get_directory_property(CMKR_VS_STARTUP_PROJECT DIRECTORY ${PROJECT_SOURCE_DIR} DEFINITION VS_STARTUP_PROJECT) +if(NOT CMKR_VS_STARTUP_PROJECT) + set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT vmprofiler-cli) +endif() + +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${vmprofiler-cli_SOURCES}) + +target_link_libraries(vmprofiler-cli PRIVATE + cli-parser + xtils + vmprofiler +) + +unset(CMKR_TARGET) +unset(CMKR_SOURCES) + diff --git a/cmake.toml b/cmake.toml new file mode 100644 index 0000000..4c57847 --- /dev/null +++ b/cmake.toml @@ -0,0 +1,16 @@ +[project] +name = "vmprofiler-cli" + +[subdir.dependencies] + +[target.vmprofiler-cli] +type = "executable" +sources = [ + "src/main.cpp", + "src/icon.rc", +] +link-libraries = [ + "cli-parser", + "xtils", + "vmprofiler", +] \ No newline at end of file diff --git a/cmkr.cmake b/cmkr.cmake new file mode 100644 index 0000000..0f22d5d --- /dev/null +++ b/cmkr.cmake @@ -0,0 +1,162 @@ +include_guard() + +# Change these defaults to point to your infrastructure if desired +set(CMKR_REPO "https://github.com/build-cpp/cmkr" CACHE STRING "cmkr git repository" FORCE) +set(CMKR_TAG "archive_264e4ace" CACHE STRING "cmkr git tag (this needs to be available forever)" FORCE) + +# Set these from the command line to customize for development/debugging purposes +set(CMKR_EXECUTABLE "" CACHE FILEPATH "cmkr executable") +set(CMKR_SKIP_GENERATION OFF CACHE BOOL "skip automatic cmkr generation") + +# Disable cmkr if generation is disabled +if(DEFINED ENV{CI} OR CMKR_SKIP_GENERATION) + message(STATUS "[cmkr] Skipping automatic cmkr generation") + macro(cmkr) + endmacro() + return() +endif() + +# Disable cmkr if no cmake.toml file is found +if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake.toml") + message(AUTHOR_WARNING "[cmkr] Not found: ${CMAKE_CURRENT_SOURCE_DIR}/cmake.toml") + macro(cmkr) + endmacro() + return() +endif() + +# Convert a Windows native path to CMake path +if(CMKR_EXECUTABLE MATCHES "\\\\") + string(REPLACE "\\" "/" CMKR_EXECUTABLE_CMAKE "${CMKR_EXECUTABLE}") + set(CMKR_EXECUTABLE "${CMKR_EXECUTABLE_CMAKE}" CACHE FILEPATH "" FORCE) + unset(CMKR_EXECUTABLE_CMAKE) +endif() + +# Helper macro to execute a process (COMMAND_ERROR_IS_FATAL ANY is 3.19 and higher) +function(cmkr_exec) + execute_process(COMMAND ${ARGV} RESULT_VARIABLE CMKR_EXEC_RESULT) + if(NOT CMKR_EXEC_RESULT EQUAL 0) + message(FATAL_ERROR "cmkr_exec(${ARGV}) failed (exit code ${CMKR_EXEC_RESULT})") + endif() +endfunction() + +# Windows-specific hack (CMAKE_EXECUTABLE_PREFIX is not set at the moment) +if(WIN32) + set(CMKR_EXECUTABLE_NAME "cmkr.exe") +else() + set(CMKR_EXECUTABLE_NAME "cmkr") +endif() + +# Use cached cmkr if found +set(CMKR_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_cmkr_${CMKR_TAG}") +set(CMKR_CACHED_EXECUTABLE "${CMKR_DIRECTORY}/bin/${CMKR_EXECUTABLE_NAME}") + +if(NOT CMKR_CACHED_EXECUTABLE STREQUAL CMKR_EXECUTABLE AND CMKR_EXECUTABLE MATCHES "^${CMAKE_CURRENT_BINARY_DIR}/_cmkr") + message(AUTHOR_WARNING "[cmkr] Upgrading '${CMKR_EXECUTABLE}' to '${CMKR_CACHED_EXECUTABLE}'") + unset(CMKR_EXECUTABLE CACHE) +endif() + +if(CMKR_EXECUTABLE AND EXISTS "${CMKR_EXECUTABLE}") + message(VERBOSE "[cmkr] Found cmkr: '${CMKR_EXECUTABLE}'") +elseif(CMKR_EXECUTABLE AND NOT CMKR_EXECUTABLE STREQUAL CMKR_CACHED_EXECUTABLE) + message(FATAL_ERROR "[cmkr] '${CMKR_EXECUTABLE}' not found") +else() + set(CMKR_EXECUTABLE "${CMKR_CACHED_EXECUTABLE}" CACHE FILEPATH "Full path to cmkr executable" FORCE) + message(VERBOSE "[cmkr] Bootstrapping '${CMKR_EXECUTABLE}'") + + message(STATUS "[cmkr] Fetching cmkr...") + if(EXISTS "${CMKR_DIRECTORY}") + cmkr_exec("${CMAKE_COMMAND}" -E rm -rf "${CMKR_DIRECTORY}") + endif() + find_package(Git QUIET REQUIRED) + cmkr_exec("${GIT_EXECUTABLE}" + clone + --config advice.detachedHead=false + --branch ${CMKR_TAG} + --depth 1 + ${CMKR_REPO} + "${CMKR_DIRECTORY}" + ) + message(STATUS "[cmkr] Building cmkr...") + cmkr_exec("${CMAKE_COMMAND}" + --no-warn-unused-cli + "${CMKR_DIRECTORY}" + "-B${CMKR_DIRECTORY}/build" + "-DCMAKE_BUILD_TYPE=Release" + "-DCMAKE_INSTALL_PREFIX=${CMKR_DIRECTORY}" + "-DCMKR_GENERATE_DOCUMENTATION=OFF" + ) + cmkr_exec("${CMAKE_COMMAND}" + --build "${CMKR_DIRECTORY}/build" + --config Release + --parallel + ) + cmkr_exec("${CMAKE_COMMAND}" + --install "${CMKR_DIRECTORY}/build" + --config Release + --prefix "${CMKR_DIRECTORY}" + --component cmkr + ) + if(NOT EXISTS ${CMKR_EXECUTABLE}) + message(FATAL_ERROR "[cmkr] Failed to bootstrap '${CMKR_EXECUTABLE}'") + endif() + cmkr_exec("${CMKR_EXECUTABLE}" version) + message(STATUS "[cmkr] Bootstrapped ${CMKR_EXECUTABLE}") +endif() +execute_process(COMMAND "${CMKR_EXECUTABLE}" version + RESULT_VARIABLE CMKR_EXEC_RESULT +) +if(NOT CMKR_EXEC_RESULT EQUAL 0) + message(FATAL_ERROR "[cmkr] Failed to get version, try clearing the cache and rebuilding") +endif() + +# This is the macro that contains black magic +macro(cmkr) + # When this macro is called from the generated file, fake some internal CMake variables + get_source_file_property(CMKR_CURRENT_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}" CMKR_CURRENT_LIST_FILE) + if(CMKR_CURRENT_LIST_FILE) + set(CMAKE_CURRENT_LIST_FILE "${CMKR_CURRENT_LIST_FILE}") + get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) + endif() + + # File-based include guard (include_guard is not documented to work) + get_source_file_property(CMKR_INCLUDE_GUARD "${CMAKE_CURRENT_LIST_FILE}" CMKR_INCLUDE_GUARD) + if(NOT CMKR_INCLUDE_GUARD) + set_source_files_properties("${CMAKE_CURRENT_LIST_FILE}" PROPERTIES CMKR_INCLUDE_GUARD TRUE) + + file(SHA256 "${CMAKE_CURRENT_LIST_FILE}" CMKR_LIST_FILE_SHA256_PRE) + + # Generate CMakeLists.txt + cmkr_exec("${CMKR_EXECUTABLE}" gen + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + ) + + file(SHA256 "${CMAKE_CURRENT_LIST_FILE}" CMKR_LIST_FILE_SHA256_POST) + + # Delete the temporary file if it was left for some reason + set(CMKR_TEMP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CMakerLists.txt") + if(EXISTS "${CMKR_TEMP_FILE}") + file(REMOVE "${CMKR_TEMP_FILE}") + endif() + + if(NOT CMKR_LIST_FILE_SHA256_PRE STREQUAL CMKR_LIST_FILE_SHA256_POST) + # Copy the now-generated CMakeLists.txt to CMakerLists.txt + # This is done because you cannot include() a file you are currently in + configure_file(CMakeLists.txt "${CMKR_TEMP_FILE}" COPYONLY) + + # Add the macro required for the hack at the start of the cmkr macro + set_source_files_properties("${CMKR_TEMP_FILE}" PROPERTIES + CMKR_CURRENT_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}" + ) + + # 'Execute' the newly-generated CMakeLists.txt + include("${CMKR_TEMP_FILE}") + + # Delete the generated file + file(REMOVE "${CMKR_TEMP_FILE}") + + # Do not execute the rest of the original CMakeLists.txt + return() + endif() + # Resume executing the unmodified CMakeLists.txt + endif() +endmacro() diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt new file mode 100644 index 0000000..2f81bf4 --- /dev/null +++ b/dependencies/CMakeLists.txt @@ -0,0 +1,58 @@ +# This file is automatically generated from cmake.toml - DO NOT EDIT +# See https://github.com/build-cpp/cmkr for more information + +# Create a configure-time dependency on cmake.toml to improve IDE support +if(CMKR_ROOT_PROJECT) + configure_file(cmake.toml cmake.toml COPYONLY) +endif() + +# vmprofiler +set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER}) +if(CMAKE_FOLDER) + set(CMAKE_FOLDER "${CMAKE_FOLDER}/vmprofiler") +else() + set(CMAKE_FOLDER vmprofiler) +endif() +add_subdirectory(vmprofiler) +set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER}) + +# Target cli-parser +set(CMKR_TARGET cli-parser) +set(cli-parser_SOURCES "") + +set(CMKR_SOURCES ${cli-parser_SOURCES}) +add_library(cli-parser INTERFACE) + +if(cli-parser_SOURCES) + target_sources(cli-parser INTERFACE ${cli-parser_SOURCES}) +endif() + +target_include_directories(cli-parser INTERFACE + cli-parser +) + +unset(CMKR_TARGET) +unset(CMKR_SOURCES) + +# Target xtils +set(CMKR_TARGET xtils) +set(xtils_SOURCES "") + +set(CMKR_SOURCES ${xtils_SOURCES}) +add_library(xtils INTERFACE) + +if(xtils_SOURCES) + target_sources(xtils INTERFACE ${xtils_SOURCES}) +endif() + +target_compile_definitions(xtils INTERFACE + UNICODE +) + +target_include_directories(xtils INTERFACE + xtils +) + +unset(CMKR_TARGET) +unset(CMKR_SOURCES) + diff --git a/dependencies/cmake.toml b/dependencies/cmake.toml new file mode 100644 index 0000000..875ccdb --- /dev/null +++ b/dependencies/cmake.toml @@ -0,0 +1,10 @@ +[subdir.vmprofiler] + +[target.cli-parser] +type = "interface" +include-directories = ["cli-parser"] + +[target.xtils] +type = "interface" +include-directories = ["xtils"] +compile-definitions = ["UNICODE"] \ No newline at end of file diff --git a/dependencies/vmprofiler b/dependencies/vmprofiler index e75104f..e8eb794 160000 --- a/dependencies/vmprofiler +++ b/dependencies/vmprofiler @@ -1 +1 @@ -Subproject commit e75104fbb3b07540be51fcef169e9eaffd1cfee2 +Subproject commit e8eb794dc1c853807b406815e308f3d201fa2a93 diff --git a/src/main.cpp b/src/main.cpp index 9a0c86d..cbeced4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,3 @@ -#define NOMINMAX #include #include #include diff --git a/vmprofiler-cli.sln b/vmprofiler-cli.sln deleted file mode 100644 index 72914c0..0000000 --- a/vmprofiler-cli.sln +++ /dev/null @@ -1,127 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30907.101 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Zydis", "dependencies\vmprofiler\dependencies\zydis\msvc\zydis\Zydis.vcxproj", "{88A23124-5640-35A0-B890-311D7A67A7D2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmprofiler-cli", "vmprofiler-cli.vcxproj", "{92E23FAE-8ABA-48E7-8771-9FD837AB8DB7}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmprofiler", "dependencies\vmprofiler\vmprofiler.vcxproj", "{D0B6092A-9944-4F24-9486-4B7DAE372619}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VTIL", "dependencies\vmprofiler\dependencies\vtil\VTIL\VTIL.vcxproj", "{8163E74C-DDE4-4507-BD3D-064CD95FF33B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VTIL-Architecture", "dependencies\vmprofiler\dependencies\vtil\VTIL-Architecture\VTIL-Architecture.vcxproj", "{A79E2869-7626-4801-B09D-5C12F5163BA3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VTIL-Common", "dependencies\vmprofiler\dependencies\vtil\VTIL-Common\VTIL-Common.vcxproj", "{EC6B8F7F-730C-4086-B143-4664CC16DF8F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VTIL-Compiler", "dependencies\vmprofiler\dependencies\vtil\VTIL-Compiler\VTIL-Compiler.vcxproj", "{F960486B-2DB4-44AF-91BB-0F19F228ABCF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VTIL-SymEx", "dependencies\vmprofiler\dependencies\vtil\VTIL-SymEx\VTIL-SymEx.vcxproj", "{FE3202CE-D05C-4E04-AE9B-D30305D8CE31}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dependencies", "dependencies", "{F34DD14D-D25C-488B-A89B-BBD0E5DBB4CF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VTIL", "VTIL", "{B5988828-3BE2-4AB4-B43B-AF061B2C1D17}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "keystone", "dependencies\vmprofiler\dependencies\vtil\dependencies\keystone\msvc\llvm\keystone\keystone.vcxproj", "{E4754E3E-2503-307A-8076-8AC2AD8B75B2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "capstone-static", "dependencies\vmprofiler\dependencies\vtil\dependencies\capstone\msvc\capstone-static.vcxproj", "{A0471FDD-F210-3D7E-B4EA-20543BC10911}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - DBG|x64 = DBG|x64 - DBG|x86 = DBG|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {88A23124-5640-35A0-B890-311D7A67A7D2}.DBG|x64.ActiveCfg = Debug MD|x64 - {88A23124-5640-35A0-B890-311D7A67A7D2}.DBG|x64.Build.0 = Debug MD|x64 - {88A23124-5640-35A0-B890-311D7A67A7D2}.DBG|x86.ActiveCfg = Debug MD DLL|Win32 - {88A23124-5640-35A0-B890-311D7A67A7D2}.DBG|x86.Build.0 = Debug MD DLL|Win32 - {88A23124-5640-35A0-B890-311D7A67A7D2}.Release|x64.ActiveCfg = Release MT|x64 - {88A23124-5640-35A0-B890-311D7A67A7D2}.Release|x64.Build.0 = Release MT|x64 - {88A23124-5640-35A0-B890-311D7A67A7D2}.Release|x86.ActiveCfg = Release MD DLL|Win32 - {88A23124-5640-35A0-B890-311D7A67A7D2}.Release|x86.Build.0 = Release MD DLL|Win32 - {92E23FAE-8ABA-48E7-8771-9FD837AB8DB7}.DBG|x64.ActiveCfg = Release|x64 - {92E23FAE-8ABA-48E7-8771-9FD837AB8DB7}.DBG|x64.Build.0 = Release|x64 - {92E23FAE-8ABA-48E7-8771-9FD837AB8DB7}.DBG|x86.ActiveCfg = Release|x64 - {92E23FAE-8ABA-48E7-8771-9FD837AB8DB7}.DBG|x86.Build.0 = Release|x64 - {92E23FAE-8ABA-48E7-8771-9FD837AB8DB7}.Release|x64.ActiveCfg = Release|x64 - {92E23FAE-8ABA-48E7-8771-9FD837AB8DB7}.Release|x64.Build.0 = Release|x64 - {92E23FAE-8ABA-48E7-8771-9FD837AB8DB7}.Release|x86.ActiveCfg = Release|x64 - {D0B6092A-9944-4F24-9486-4B7DAE372619}.DBG|x64.ActiveCfg = DBG|x64 - {D0B6092A-9944-4F24-9486-4B7DAE372619}.DBG|x64.Build.0 = DBG|x64 - {D0B6092A-9944-4F24-9486-4B7DAE372619}.DBG|x86.ActiveCfg = DBG|x64 - {D0B6092A-9944-4F24-9486-4B7DAE372619}.Release|x64.ActiveCfg = Release|x64 - {D0B6092A-9944-4F24-9486-4B7DAE372619}.Release|x64.Build.0 = Release|x64 - {D0B6092A-9944-4F24-9486-4B7DAE372619}.Release|x86.ActiveCfg = Release|x64 - {8163E74C-DDE4-4507-BD3D-064CD95FF33B}.DBG|x64.ActiveCfg = Debug|x64 - {8163E74C-DDE4-4507-BD3D-064CD95FF33B}.DBG|x64.Build.0 = Debug|x64 - {8163E74C-DDE4-4507-BD3D-064CD95FF33B}.DBG|x86.ActiveCfg = Debug|x64 - {8163E74C-DDE4-4507-BD3D-064CD95FF33B}.DBG|x86.Build.0 = Debug|x64 - {8163E74C-DDE4-4507-BD3D-064CD95FF33B}.Release|x64.ActiveCfg = Release|x64 - {8163E74C-DDE4-4507-BD3D-064CD95FF33B}.Release|x64.Build.0 = Release|x64 - {8163E74C-DDE4-4507-BD3D-064CD95FF33B}.Release|x86.ActiveCfg = Release|x64 - {A79E2869-7626-4801-B09D-5C12F5163BA3}.DBG|x64.ActiveCfg = Debug|x64 - {A79E2869-7626-4801-B09D-5C12F5163BA3}.DBG|x64.Build.0 = Debug|x64 - {A79E2869-7626-4801-B09D-5C12F5163BA3}.DBG|x86.ActiveCfg = Debug|x64 - {A79E2869-7626-4801-B09D-5C12F5163BA3}.DBG|x86.Build.0 = Debug|x64 - {A79E2869-7626-4801-B09D-5C12F5163BA3}.Release|x64.ActiveCfg = Release|x64 - {A79E2869-7626-4801-B09D-5C12F5163BA3}.Release|x64.Build.0 = Release|x64 - {A79E2869-7626-4801-B09D-5C12F5163BA3}.Release|x86.ActiveCfg = Release|x64 - {EC6B8F7F-730C-4086-B143-4664CC16DF8F}.DBG|x64.ActiveCfg = Debug|x64 - {EC6B8F7F-730C-4086-B143-4664CC16DF8F}.DBG|x64.Build.0 = Debug|x64 - {EC6B8F7F-730C-4086-B143-4664CC16DF8F}.DBG|x86.ActiveCfg = Debug|x64 - {EC6B8F7F-730C-4086-B143-4664CC16DF8F}.DBG|x86.Build.0 = Debug|x64 - {EC6B8F7F-730C-4086-B143-4664CC16DF8F}.Release|x64.ActiveCfg = Release|x64 - {EC6B8F7F-730C-4086-B143-4664CC16DF8F}.Release|x64.Build.0 = Release|x64 - {EC6B8F7F-730C-4086-B143-4664CC16DF8F}.Release|x86.ActiveCfg = Release|x64 - {F960486B-2DB4-44AF-91BB-0F19F228ABCF}.DBG|x64.ActiveCfg = Debug|x64 - {F960486B-2DB4-44AF-91BB-0F19F228ABCF}.DBG|x64.Build.0 = Debug|x64 - {F960486B-2DB4-44AF-91BB-0F19F228ABCF}.DBG|x86.ActiveCfg = Debug|x64 - {F960486B-2DB4-44AF-91BB-0F19F228ABCF}.DBG|x86.Build.0 = Debug|x64 - {F960486B-2DB4-44AF-91BB-0F19F228ABCF}.Release|x64.ActiveCfg = Release|x64 - {F960486B-2DB4-44AF-91BB-0F19F228ABCF}.Release|x64.Build.0 = Release|x64 - {F960486B-2DB4-44AF-91BB-0F19F228ABCF}.Release|x86.ActiveCfg = Release|x64 - {FE3202CE-D05C-4E04-AE9B-D30305D8CE31}.DBG|x64.ActiveCfg = Debug|x64 - {FE3202CE-D05C-4E04-AE9B-D30305D8CE31}.DBG|x64.Build.0 = Debug|x64 - {FE3202CE-D05C-4E04-AE9B-D30305D8CE31}.DBG|x86.ActiveCfg = Debug|x64 - {FE3202CE-D05C-4E04-AE9B-D30305D8CE31}.DBG|x86.Build.0 = Debug|x64 - {FE3202CE-D05C-4E04-AE9B-D30305D8CE31}.Release|x64.ActiveCfg = Release|x64 - {FE3202CE-D05C-4E04-AE9B-D30305D8CE31}.Release|x64.Build.0 = Release|x64 - {FE3202CE-D05C-4E04-AE9B-D30305D8CE31}.Release|x86.ActiveCfg = Release|x64 - {E4754E3E-2503-307A-8076-8AC2AD8B75B2}.DBG|x64.ActiveCfg = Debug|x64 - {E4754E3E-2503-307A-8076-8AC2AD8B75B2}.DBG|x64.Build.0 = Debug|x64 - {E4754E3E-2503-307A-8076-8AC2AD8B75B2}.DBG|x86.ActiveCfg = RelWithDebInfo|x64 - {E4754E3E-2503-307A-8076-8AC2AD8B75B2}.DBG|x86.Build.0 = RelWithDebInfo|x64 - {E4754E3E-2503-307A-8076-8AC2AD8B75B2}.Release|x64.ActiveCfg = Release|x64 - {E4754E3E-2503-307A-8076-8AC2AD8B75B2}.Release|x64.Build.0 = Release|x64 - {E4754E3E-2503-307A-8076-8AC2AD8B75B2}.Release|x86.ActiveCfg = Release|x64 - {A0471FDD-F210-3D7E-B4EA-20543BC10911}.DBG|x64.ActiveCfg = Debug|x64 - {A0471FDD-F210-3D7E-B4EA-20543BC10911}.DBG|x64.Build.0 = Debug|x64 - {A0471FDD-F210-3D7E-B4EA-20543BC10911}.DBG|x86.ActiveCfg = RelWithDebInfo|x64 - {A0471FDD-F210-3D7E-B4EA-20543BC10911}.DBG|x86.Build.0 = RelWithDebInfo|x64 - {A0471FDD-F210-3D7E-B4EA-20543BC10911}.Release|x64.ActiveCfg = Release|x64 - {A0471FDD-F210-3D7E-B4EA-20543BC10911}.Release|x64.Build.0 = Release|x64 - {A0471FDD-F210-3D7E-B4EA-20543BC10911}.Release|x86.ActiveCfg = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {88A23124-5640-35A0-B890-311D7A67A7D2} = {F34DD14D-D25C-488B-A89B-BBD0E5DBB4CF} - {D0B6092A-9944-4F24-9486-4B7DAE372619} = {F34DD14D-D25C-488B-A89B-BBD0E5DBB4CF} - {8163E74C-DDE4-4507-BD3D-064CD95FF33B} = {B5988828-3BE2-4AB4-B43B-AF061B2C1D17} - {A79E2869-7626-4801-B09D-5C12F5163BA3} = {B5988828-3BE2-4AB4-B43B-AF061B2C1D17} - {EC6B8F7F-730C-4086-B143-4664CC16DF8F} = {B5988828-3BE2-4AB4-B43B-AF061B2C1D17} - {F960486B-2DB4-44AF-91BB-0F19F228ABCF} = {B5988828-3BE2-4AB4-B43B-AF061B2C1D17} - {FE3202CE-D05C-4E04-AE9B-D30305D8CE31} = {B5988828-3BE2-4AB4-B43B-AF061B2C1D17} - {B5988828-3BE2-4AB4-B43B-AF061B2C1D17} = {F34DD14D-D25C-488B-A89B-BBD0E5DBB4CF} - {E4754E3E-2503-307A-8076-8AC2AD8B75B2} = {F34DD14D-D25C-488B-A89B-BBD0E5DBB4CF} - {A0471FDD-F210-3D7E-B4EA-20543BC10911} = {F34DD14D-D25C-488B-A89B-BBD0E5DBB4CF} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B8861886-C9EA-4C44-878C-D7BC28AB3413} - EndGlobalSection -EndGlobal diff --git a/vmprofiler-cli.vcxproj b/vmprofiler-cli.vcxproj deleted file mode 100644 index 348fd74..0000000 --- a/vmprofiler-cli.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Release - x64 - - - - 16.0 - Win32Proj - {92e23fae-8aba-48e7-8771-9fd837ab8db7} - vmprofiler - 10.0 - vmprofiler-cli - - - - Application - false - v142 - true - Unicode - - - - - - - - - - - - false - $(ProjectDir)dependencies\vmprofiler\include\;$(ProjectDir)dependencies\vmprofiler\dependencies\zydis\include;$(ProjectDir)dependencies\vmprofiler\dependencies\zydis\msvc;$(ProjectDir)dependencies\vmprofiler\dependencies\zydis\dependencies\zycore\include;$(ProjectDir)dependencies\cli-parser\;$(ProjectDir)dependencies\xtils\;$(ProjectDir)dependencies\vmprofiler\dependencies\vtil\VTIL\includes\;$(ProjectDir)dependencies\vmprofiler\dependencies\vtil\VTIL-Architecture\includes\;$(ProjectDir)dependencies\vmprofiler\dependencies\vtil\VTIL-Common\includes\;$(ProjectDir)dependencies\vmprofiler\dependencies\vtil\VTIL-Compiler\includes\;$(ProjectDir)dependencies\vmprofiler\dependencies\vtil\VTIL-SymEx\includes\;$(ProjectDir)dependencies\vmprofiler\dependencies\vtil\dependencies\capstone\include;$(ProjectDir)dependencies\vmprofiler\dependencies\vtil\dependencies\keystone\include;$(IncludePath) - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ZYDIS_STATIC_DEFINE;%(PreprocessorDefinitions) - true - stdcpplatest - Disabled - MultiThreadedDLL - - - Console - true - true - true - $(ProjectDir)..\libs\*;%(AdditionalDependencies) - 4194304 - 4194304 - - - - - {8163e74c-dde4-4507-bd3d-064cd95ff33b} - - - {88a23124-5640-35a0-b890-311d7a67a7d2} - - - {d0b6092a-9944-4f24-9486-4b7dae372619} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vmprofiler-cli.vcxproj.filters b/vmprofiler-cli.vcxproj.filters deleted file mode 100644 index e69a945..0000000 --- a/vmprofiler-cli.vcxproj.filters +++ /dev/null @@ -1,212 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {faf4cf50-0bc3-4674-80ff-fec015d82127} - - - {ab5cf1fc-f056-4d4c-b00f-d111109aa610} - - - {9bd82e24-4e3f-4444-b5df-98d02537beea} - - - {a9886b41-1872-4765-ad66-e61c999d61fc} - - - {ef756627-8757-4365-9367-e9f880b6af45} - - - {b21444ff-896e-4fad-931e-306b139b5b47} - - - {c62d8614-612e-48d3-9fdc-873a0d338dfb} - - - - - Resource Files - - - - - Resource Files - - - - - Resource Files - - - - - Source Files - - - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore - - - Header Files\Zycore\API - - - Header Files\Zycore\API - - - Header Files\Zycore\API - - - Header Files\Zycore\API - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis - - - Header Files\Zydis\Generated - - - Header Files\Zydis\Generated - - - Header Files\Zydis\Generated - - - Header Files\Zydis\Generated - - - Header Files\Zydis\Generated - - - Header Files\Zydis\Internal - - - Header Files\Zydis\Internal - - - Header Files\Zydis\Internal - - - Header Files\Zydis\Internal - - - Header Files\Zydis\Internal - - - Header Files\Zydis\Internal - - - Header Files - - - Header Files - - - Header Files\vmprofiler - - - Header Files\vmprofiler - - - Header Files\vmprofiler - - - Header Files\vmprofiler - - - Header Files\vmprofiler - - - Header Files\vmprofiler - - - Header Files\vmprofiler - - - Header Files\vmprofiler - - - Header Files\vmprofiler - - - \ No newline at end of file From 64c8539659178c349f9034eab8ddee9d8635565f Mon Sep 17 00:00:00 2001 From: _xeroxz Date: Sat, 26 Jun 2021 21:40:09 +0000 Subject: [PATCH 2/3] Update README.md --- README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 42ab69f..e42d9ba 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,36 @@ vmprofiler-cli is a CLI program which displays all details of a specified VMProtect 2 virtual machine. This information includes virtual instruction pointer advancment direction, all vm handlers, virtual instruction rva decrypt instructions, vm handler table entry decrypt instruction, and much more. +# Build Instructions + +Clone the repository and all submodules using `git clone --recursive https://githacks.org/vmp2/vmprofiler-cli.git`. Then execute the following commands: + +``` +cd vmprofiler-cli +mkdir msvc +cmake -G + +# there should be a list of generators something like this... +Generators +* Visual Studio 16 2019 = Generates Visual Studio 2019 project files. + Use -A option to specify architecture. + Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files. + Optional [arch] can be "Win64" or "ARM". + Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files. + Optional [arch] can be "Win64" or "ARM". + Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files. + Optional [arch] can be "Win64" or "ARM". + Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files. + Optional [arch] can be "Win64" or "ARM". + Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files. + Optional [arch] can be "Win64" or "IA64". + Visual Studio 9 2008 [arch] = Generates Visual Studio 2008 project files. + Optional [arch] can be "Win64" or "IA64" + +# please use Visual Studio 2019 as VTIL uses the concept keyword... + +``` + # usage ``` @@ -114,4 +144,4 @@ vmprofiler-cli.exe --vmpbin vmptest.vmp.exe --vmentry 0x1000 neg esi not esi ================================================================================== -``` \ No newline at end of file +``` From e2b15f024817962ad0f6b28f627d0f7f1702fab2 Mon Sep 17 00:00:00 2001 From: _xeroxz Date: Sat, 26 Jun 2021 21:45:28 +0000 Subject: [PATCH 3/3] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e42d9ba..7640eec 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,11 @@ Generators Optional [arch] can be "Win64" or "IA64" # please use Visual Studio 2019 as VTIL uses the concept keyword... - +cmake -G "Visual Studio 16 2019" ``` +Now you can open vmprofiler-cli.sln, select "Release" and "x64" on the top of the visual studios window. Building should take a few minutes. + # usage ```