mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 19:42:14 +00:00
Merge branch 'GT-2565_ghidra1_nativeBuild' into patch
This commit is contained in:
commit
4f08d79732
@ -15,38 +15,65 @@
|
||||
apply plugin: 'cpp'
|
||||
apply plugin: 'c'
|
||||
|
||||
// Unclear if we can rely on the VisualCpp plugin to identify the correct Visual Studio paths
|
||||
|
||||
project.ext.VISUAL_STUDIO_BASE_DIR = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017"
|
||||
project.ext.WINDOWS_KITS_DIR = "C:/Program Files (x86)/Windows Kits/10"
|
||||
|
||||
/****************************************************************************
|
||||
* Method for extracting value from <name>=<value> pairs
|
||||
****************************************************************************/
|
||||
ext.getEnvironmentValue = { envLines, name ->
|
||||
String assignment = name + "="
|
||||
for (String line : envLines) {
|
||||
if (line.startsWith(assignment)) {
|
||||
String[] parts = line.split("=")
|
||||
String value = parts[1].trim()
|
||||
// remove trailing \ if present
|
||||
if (value.endsWith("\\")) {
|
||||
value = value.substring(0, value.length()-1)
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// Ok, this is stupid, but mac and linux can't handle files paths that start with c:
|
||||
// These paths are actually only used when running on windows, but the paths gets evaulated
|
||||
// as a file no matter what platform you run gradle on. So the best solution I can think of is as
|
||||
// follows.
|
||||
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
||||
|
||||
|
||||
project.ext.VISUAL_STUDIO_INSTALL_DIR = project.ext.VISUAL_STUDIO_BASE_DIR + "\\Professional"
|
||||
if (!file(project.ext.VISUAL_STUDIO_INSTALL_DIR).exists()) {
|
||||
project.ext.VISUAL_STUDIO_INSTALL_DIR = project.ext.VISUAL_STUDIO_BASE_DIR + "\\Community"
|
||||
}
|
||||
println "Visual Studio Path: ${VISUAL_STUDIO_INSTALL_DIR}"
|
||||
|
||||
// TODO: Use of this will require coping with VC version in path
|
||||
project.ext.WINDOWS_KITS_DIR = "C:/Program Files (x86)/Windows Kits/10.0"
|
||||
|
||||
project.ext.VISUAL_STUDIO_VCVARS_CMD = "\"${VISUAL_STUDIO_INSTALL_DIR}\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x86_amd64"
|
||||
|
||||
// TODO: force VisualCpp installDir and windowsSdkDir
|
||||
|
||||
// NOTE: Windows 7 targeting requires the use of the Windows 8.1 SDK and setting the
|
||||
// WINVER property a value of "0x0601" which may be specified to the compiler/linker.
|
||||
// If using a VS Solution this must be specified within the project file(s).
|
||||
project.ext.WINVER = "0x0601"
|
||||
|
||||
// Rely on vcvars script to supply SDK versions
|
||||
def c = VISUAL_STUDIO_VCVARS_CMD + " && env"
|
||||
String envText = c.execute().text
|
||||
String[] envLines = c.execute().text.split("\n")
|
||||
project.ext.MSVC_SDK_VERSION = getEnvironmentValue(envLines, "WINDOWSSDKVERSION")
|
||||
println "Visual Studio SDK Version: ${MSVC_SDK_VERSION}"
|
||||
project.ext.MSVC_TOOLS_VERSION = getEnvironmentValue(envLines, "VCTOOLSVERSION")
|
||||
println "Visual Studio VCTools Version: ${MSVC_TOOLS_VERSION}"
|
||||
}
|
||||
else {
|
||||
project.ext.VISUAL_STUDIO_INSTALL_DIR = "/"
|
||||
project.ext.WINDOWS_KITS_DIR = "/"
|
||||
project.ext.VISUAL_STUDIO_VCVARS_CMD = "NA"
|
||||
project.ext.MSVC_SDK_VERSION = "?"
|
||||
project.ext.MSVC_TOOLS_VERSION = "?"
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Defines the platforms we have to support in Ghidra. This model is used
|
||||
* for all native builds and should be extended by each module as-needed.
|
||||
|
Loading…
Reference in New Issue
Block a user