From 80e6bf0456ab6fdaf05312488e8b265d80a8316a Mon Sep 17 00:00:00 2001 From: Xiaoyin Liu Date: Sat, 8 Oct 2022 02:33:04 -0700 Subject: [PATCH 1/4] Allow Gradle to use VS Build Tools vswhere can find Visual Studio Build Tools if "-products *" is specified. Gradle doesn't use Build Tools unless we set "installDir" to the Build Tools' install directory. --- GPL/nativeBuildProperties.gradle | 7 +++++++ GPL/vsconfig.gradle | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/GPL/nativeBuildProperties.gradle b/GPL/nativeBuildProperties.gradle index f83073e35b..730829463e 100644 --- a/GPL/nativeBuildProperties.gradle +++ b/GPL/nativeBuildProperties.gradle @@ -52,6 +52,13 @@ model { } } } + if (isCurrentWindows()) { + // specify installDir because Gradle doesn't find VS Build Tools. + // See https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288 + visualCpp(VisualCpp) { + installDir VISUAL_STUDIO_INSTALL_DIR + } + } } } diff --git a/GPL/vsconfig.gradle b/GPL/vsconfig.gradle index 915b90ea90..d6dae0ee5a 100644 --- a/GPL/vsconfig.gradle +++ b/GPL/vsconfig.gradle @@ -32,7 +32,7 @@ def configureVisualStudio() { println "Visual Studio not found!" return } - def vswhereOutput = "${vswherePath} -latest -format json".execute().text.trim() + def vswhereOutput = "${vswherePath} -products * -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -format json".execute().text.trim() def vswhereJson = new groovy.json.JsonSlurper().parseText(vswhereOutput); if (vswhereJson.isEmpty()) { println "Visual Studio not found!" From 663e9d6d39b160bc7c446d461adfbdfaf50df59d Mon Sep 17 00:00:00 2001 From: Xiaoyin Liu Date: Sat, 8 Oct 2022 06:37:20 -0700 Subject: [PATCH 2/4] Add VC Build Tools to README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 43fa6ef08a..72dd0cb84e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ To create the latest development build for your platform from this source reposi * [JDK 17 64-bit][jdk17] * [Gradle 7.3+][gradle] * make, gcc, and g++ (Linux/macOS-only) -* [Microsoft Visual Studio][vs] (Windows-only) +* [Microsoft Visual Studio][vs] or [Microsoft C++ Build Tools][vcbuildtools] (Windows-only) ##### Download and extract the source: [Download from GitHub][master] @@ -116,6 +116,7 @@ source project. [jdk17]: https://adoptium.net/temurin/releases [gradle]: https://gradle.org/releases/ [vs]: https://visualstudio.microsoft.com/vs/community/ +[vcbuildtools]: https://visualstudio.microsoft.com/visual-cpp-build-tools/ [eclipse]: https://www.eclipse.org/downloads/packages/ [master]: https://github.com/NationalSecurityAgency/ghidra/archive/refs/heads/master.zip [security]: https://github.com/NationalSecurityAgency/ghidra/security/advisories \ No newline at end of file From a437164b72c969b23ac590cdedfe65da31be3029 Mon Sep 17 00:00:00 2001 From: Xiaoyin Liu Date: Sat, 8 Oct 2022 06:46:39 -0700 Subject: [PATCH 3/4] Add VC Build Tools to InstallationGuide.html --- GhidraDocs/InstallationGuide.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GhidraDocs/InstallationGuide.html b/GhidraDocs/InstallationGuide.html index 1809a7220a..15d079a79c 100644 --- a/GhidraDocs/InstallationGuide.html +++ b/GhidraDocs/InstallationGuide.html @@ -326,7 +326,8 @@ system:

  • make, gcc, and g++ (Linux/macOS-only)
  • Microsoft Visual Studio - 2017 or later (Windows-only) + 2017 or later, or + Microsoft C++ Build Tools (Windows-only)
  • To build the native binaries for your current platform, execute the following script:

    From cddcf3d3e7309a8c166004de7c117fbee1f6871d Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Wed, 2 Nov 2022 11:01:47 -0400 Subject: [PATCH 4/4] GP-2786: A few improvements --- GPL/nativeBuildProperties.gradle | 2 +- GPL/vsconfig.gradle | 4 ++-- GhidraDocs/InstallationGuide.html | 7 ++++++- README.md | 6 +++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/GPL/nativeBuildProperties.gradle b/GPL/nativeBuildProperties.gradle index 730829463e..4d887dba10 100644 --- a/GPL/nativeBuildProperties.gradle +++ b/GPL/nativeBuildProperties.gradle @@ -52,7 +52,7 @@ model { } } } - if (isCurrentWindows()) { + if (isCurrentWindows() && VISUAL_STUDIO_INSTALL_DIR) { // specify installDir because Gradle doesn't find VS Build Tools. // See https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288 visualCpp(VisualCpp) { diff --git a/GPL/vsconfig.gradle b/GPL/vsconfig.gradle index d6dae0ee5a..4fe1edc223 100644 --- a/GPL/vsconfig.gradle +++ b/GPL/vsconfig.gradle @@ -29,13 +29,13 @@ def configureVisualStudio() { println "Searching for latest Visual Studio and required components..." def vswherePath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe" if (!file(vswherePath).exists()) { - println "Visual Studio not found!" + println " -> Visual Studio vswhere.exe not found!" return } def vswhereOutput = "${vswherePath} -products * -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -format json".execute().text.trim() def vswhereJson = new groovy.json.JsonSlurper().parseText(vswhereOutput); if (vswhereJson.isEmpty()) { - println "Visual Studio not found!" + println " -> Visual Studio not found!" return } def vsInstallDir = vswhereJson[0].installationPath diff --git a/GhidraDocs/InstallationGuide.html b/GhidraDocs/InstallationGuide.html index 15d079a79c..25372f59b7 100644 --- a/GhidraDocs/InstallationGuide.html +++ b/GhidraDocs/InstallationGuide.html @@ -327,7 +327,12 @@ system:

  • Microsoft Visual Studio 2017 or later, or - Microsoft C++ Build Tools (Windows-only) + Microsoft C++ Build Tools with the following components installed (Windows-only): +
      +
    • MSVC
    • +
    • Windows SDK
    • +
    • C++ ATL
    • +
  • To build the native binaries for your current platform, execute the following script:

    diff --git a/README.md b/README.md index 72dd0cb84e..f6ca04aa62 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,11 @@ To create the latest development build for your platform from this source reposi * [JDK 17 64-bit][jdk17] * [Gradle 7.3+][gradle] * make, gcc, and g++ (Linux/macOS-only) -* [Microsoft Visual Studio][vs] or [Microsoft C++ Build Tools][vcbuildtools] (Windows-only) +* [Microsoft Visual Studio][vs] or [Microsoft C++ Build Tools][vcbuildtools] with the following + components installed (Windows-only): + - MSVC + - Windows SDK + - C++ ATL ##### Download and extract the source: [Download from GitHub][master]