mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 19:42:14 +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
|
||||
doFirst {
|
||||
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
||||
// ensure that required MS Visual Studio is installed where expected
|
||||
String msg = "Microsoft Visual Studio install not found: ${VISUAL_STUDIO_INSTALL_DIR}\n" +
|
||||
"Adjust path in Ghidra/GPL/vsconfig.gradle if needed."
|
||||
if (!file(VISUAL_STUDIO_INSTALL_DIR).exists()) {
|
||||
throw new GradleException(msg);
|
||||
// ensure that required MS Visual Studio is installed
|
||||
if (!VISUAL_STUDIO_INSTALL_DIR) {
|
||||
throw new GradleException("Visual Studio not found!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,17 +13,27 @@ if (!hasProperty("VISUAL_STUDIO_INSTALL_DIR")) {
|
||||
def configureVisualStudio() {
|
||||
|
||||
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
|
||||
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()) {
|
||||
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 vswhereJson = new groovy.json.JsonSlurper().parseText(vswhereOutput);
|
||||
if (vswhereJson.isEmpty()) {
|
||||
throw new GradleException("Failed to find Visual Studio!")
|
||||
println "Visual Studio not found!"
|
||||
return
|
||||
}
|
||||
def vsInstallDir = vswhereJson[0].installationPath
|
||||
println " -> Installation Directory: ${vsInstallDir}"
|
||||
|
@ -43,19 +43,21 @@ if ("win64".equals(getCurrentPlatformName())) {
|
||||
|
||||
String makeName = "win64PDBMake"
|
||||
task(type: Exec, makeName) {
|
||||
|
||||
|
||||
def projectPath = projectDir.toString()
|
||||
def solutionBatchFilePath = projectPath + "/build/buildSolution.bat"
|
||||
|
||||
def projectPathWindows = projectPath.replace("/", File.separator)
|
||||
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 {
|
||||
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}"
|
||||
|
||||
println "Executing: " + msbuildCmd
|
||||
|
||||
new File(solutionBatchFilePath).withWriter { out ->
|
||||
out.println "call " + VISUAL_STUDIO_VCVARS_CMD
|
||||
out.println msbuildCmd
|
||||
|
Loading…
Reference in New Issue
Block a user