mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-12 23:23:17 +00:00
GT-3304: Do not require Visual Studio do be installed to get past
configuration phase.
This commit is contained in:
parent
3f91b703ea
commit
0a58b856a2
@ -49,11 +49,9 @@ task CheckToolChain {
|
|||||||
// Native C/Cpp plugins will trigger failure if no tool chain found
|
// Native C/Cpp plugins will trigger failure if no tool chain found
|
||||||
doFirst {
|
doFirst {
|
||||||
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
||||||
// ensure that required MS Visual Studio is installed where expected
|
// ensure that required MS Visual Studio is installed
|
||||||
String msg = "Microsoft Visual Studio install not found: ${VISUAL_STUDIO_INSTALL_DIR}\n" +
|
if (!VISUAL_STUDIO_INSTALL_DIR) {
|
||||||
"Adjust path in Ghidra/GPL/vsconfig.gradle if needed."
|
throw new GradleException("Visual Studio not found!");
|
||||||
if (!file(VISUAL_STUDIO_INSTALL_DIR).exists()) {
|
|
||||||
throw new GradleException(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,17 +13,27 @@ if (!hasProperty("VISUAL_STUDIO_INSTALL_DIR")) {
|
|||||||
def configureVisualStudio() {
|
def configureVisualStudio() {
|
||||||
|
|
||||||
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
||||||
|
|
||||||
|
// Initialize variables
|
||||||
|
rootProject.ext.VISUAL_STUDIO_INSTALL_DIR = ""
|
||||||
|
rootProject.ext.VISUAL_STUDIO_TOOLS_VERSION_DEFAULT = ""
|
||||||
|
rootProject.ext.VISUAL_STUDIO_SDK_DIR_DEFAULT = ""
|
||||||
|
rootProject.ext.VISUAL_STUDIO_SDK_VERSION_DEFAULT = ""
|
||||||
|
rootProject.ext.VISUAL_STUDIO_SDK_VERSION_OVERRIDE = ""
|
||||||
|
rootProject.ext.VISUAL_STUDIO_VCVARS_CMD = ""
|
||||||
|
|
||||||
// Use vswhere.exe to search for latest Visual Studio installation
|
// Use vswhere.exe to search for latest Visual Studio installation
|
||||||
println "Searching for latest Visual Studio and required components..."
|
println "Searching for latest Visual Studio and required components..."
|
||||||
def vswherePath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe"
|
def vswherePath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe"
|
||||||
if (!file(vswherePath).exists()) {
|
if (!file(vswherePath).exists()) {
|
||||||
throw new GradleException("Required file does not exist: " + vswherePath);
|
println "Visual Studio not found!"
|
||||||
|
return
|
||||||
}
|
}
|
||||||
def vswhereOutput = "${vswherePath} -latest -format json".execute().text.trim()
|
def vswhereOutput = "${vswherePath} -latest -format json".execute().text.trim()
|
||||||
def vswhereJson = new groovy.json.JsonSlurper().parseText(vswhereOutput);
|
def vswhereJson = new groovy.json.JsonSlurper().parseText(vswhereOutput);
|
||||||
if (vswhereJson.isEmpty()) {
|
if (vswhereJson.isEmpty()) {
|
||||||
throw new GradleException("Failed to find Visual Studio!")
|
println "Visual Studio not found!"
|
||||||
|
return
|
||||||
}
|
}
|
||||||
def vsInstallDir = vswhereJson[0].installationPath
|
def vsInstallDir = vswhereJson[0].installationPath
|
||||||
println " -> Installation Directory: ${vsInstallDir}"
|
println " -> Installation Directory: ${vsInstallDir}"
|
||||||
|
@ -43,19 +43,21 @@ if ("win64".equals(getCurrentPlatformName())) {
|
|||||||
|
|
||||||
String makeName = "win64PDBMake"
|
String makeName = "win64PDBMake"
|
||||||
task(type: Exec, makeName) {
|
task(type: Exec, makeName) {
|
||||||
|
|
||||||
def projectPath = projectDir.toString()
|
def projectPath = projectDir.toString()
|
||||||
def solutionBatchFilePath = projectPath + "/build/buildSolution.bat"
|
def solutionBatchFilePath = projectPath + "/build/buildSolution.bat"
|
||||||
|
|
||||||
def projectPathWindows = projectPath.replace("/", File.separator)
|
def projectPathWindows = projectPath.replace("/", File.separator)
|
||||||
def solutionPathWindows = "${projectPathWindows}\\src\\pdb\\pdb.sln"
|
def solutionPathWindows = "${projectPathWindows}\\src\\pdb\\pdb.sln"
|
||||||
def platformToolset = 'v' + VISUAL_STUDIO_TOOLS_VERSION_DEFAULT.substring(0, 4).replace('.', '');
|
|
||||||
def windowsTargetPlatformVersion = VISUAL_STUDIO_SDK_VERSION_OVERRIDE ?: VISUAL_STUDIO_SDK_VERSION_DEFAULT
|
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
file("build/os/win64").mkdirs()
|
file("build/os/win64").mkdirs()
|
||||||
|
|
||||||
|
def platformToolset = 'v' + VISUAL_STUDIO_TOOLS_VERSION_DEFAULT.substring(0, 4).replace('.', '');
|
||||||
|
def windowsTargetPlatformVersion = VISUAL_STUDIO_SDK_VERSION_OVERRIDE ?: VISUAL_STUDIO_SDK_VERSION_DEFAULT
|
||||||
def msbuildCmd = "msbuild ${solutionPathWindows} /p:Configuration=Release /p:PlatformToolset=${platformToolset} /p:WindowsTargetPlatformVersion=${windowsTargetPlatformVersion}"
|
def msbuildCmd = "msbuild ${solutionPathWindows} /p:Configuration=Release /p:PlatformToolset=${platformToolset} /p:WindowsTargetPlatformVersion=${windowsTargetPlatformVersion}"
|
||||||
|
|
||||||
println "Executing: " + msbuildCmd
|
println "Executing: " + msbuildCmd
|
||||||
|
|
||||||
new File(solutionBatchFilePath).withWriter { out ->
|
new File(solutionBatchFilePath).withWriter { out ->
|
||||||
out.println "call " + VISUAL_STUDIO_VCVARS_CMD
|
out.println "call " + VISUAL_STUDIO_VCVARS_CMD
|
||||||
out.println msbuildCmd
|
out.println msbuildCmd
|
||||||
|
Loading…
Reference in New Issue
Block a user