Corrected Visual Studio gradle configuration which must also support

standalone GPL builds
This commit is contained in:
ghidra1 2019-09-10 16:03:25 -04:00
parent af3fdf5391
commit d9da0f0b66
4 changed files with 60 additions and 37 deletions

View File

@ -2,3 +2,4 @@
##MODULE IP: Public Domain
gpl.gradle||Public Domain||||END|
nativeBuildProperties.gradle||Public Domain||||END|
vsconfig.gradle||GHIDRA||||END|

View File

@ -2,8 +2,18 @@
// BIN_REPO only useable in full Ghidra source configuration
project.ext.BIN_REPO = file("../../../ghidra.bin").absolutePath
/****************************************************************************
* Create a set containing all the platforms we need when building native
* artifacts.
****************************************************************************/
project.ext.set("OS_NAMES", ["osx64", "win32", "win64", "linux64"])
/****************************************************************************
* Establish Visual Studio configuration environment for Windows native builds
* NOTE: vsconfig.gradle path is relative to each GPL project module
****************************************************************************/
apply from: "../vsconfig.gradle"
/*********************************************************************************
* Returns the local platform name.
*********************************************************************************/

48
GPL/vsconfig.gradle Normal file
View File

@ -0,0 +1,48 @@
/****************************************************************************
* Establish Visual Studio configuration environment for Windows native builds
*
* NOTE: We do not rely on the VisualCpp plugin to identify paths since it has
* proven in the past to be unreliable when multiple versions of Visual Studio
* and SDKs are installed.
****************************************************************************/
if (!hasProperty("VISUAL_STUDIO_BASE_DIR")) {
configureVisualStudio()
}
def configureVisualStudio() {
rootProject.ext.VISUAL_STUDIO_BASE_DIR = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017"
rootProject.ext.WINDOWS_KITS_DIR = "C:\\Program Files (x86)\\Windows Kits\\10"
rootProject.ext.VISUAL_STUDIO_INSTALL_DIR = "/"
rootProject.ext.VISUAL_STUDIO_VCVARS_CMD = "UNKNOWN"
rootProject.ext.MSVC_SDK_VERSION = "UNKNOWN"
rootProject.ext.MSVC_TOOLS_VERSION = "UNKNOWN"
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
rootProject.ext.VISUAL_STUDIO_INSTALL_DIR = "${VISUAL_STUDIO_BASE_DIR}\\Professional"
if (!file(rootProject.ext.VISUAL_STUDIO_INSTALL_DIR).exists()) {
rootProject.ext.VISUAL_STUDIO_INSTALL_DIR = "${VISUAL_STUDIO_BASE_DIR}\\Community"
}
if (file(rootProject.ext.VISUAL_STUDIO_INSTALL_DIR).exists()) {
println "Visual Studio Path: ${VISUAL_STUDIO_INSTALL_DIR}"
rootProject.ext.VISUAL_STUDIO_VCVARS_CMD = "\"${VISUAL_STUDIO_INSTALL_DIR}\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x86_amd64"
// 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).
rootProject.ext.WINVER = "0x0601"
// Rely on vcvars script to supply SDK versions
def COMMAND = "cmd /v:ON /c ${VISUAL_STUDIO_VCVARS_CMD} > nul && cmd /c echo"
rootProject.ext.MSVC_SDK_VERSION = "${COMMAND} !WINDOWSSDKVERSION!".execute().text.trim().replace('\\', '')
println "Visual Studio SDK Version: ${MSVC_SDK_VERSION}"
rootProject.ext.MSVC_TOOLS_VERSION = "${COMMAND} !VCTOOLSVERSION!".execute().text.trim().replace('\\', '')
println "Visual Studio VCTools Version: ${MSVC_TOOLS_VERSION}"
}
}
}

View File

@ -74,43 +74,7 @@ project.ext.set("OS_NAMES", ["osx64", "win32", "win64", "linux64"])
/****************************************************************************
* Establish Visual Studio configuration environment for Windows native builds
****************************************************************************/
// Unclear if we can rely on the VisualCpp plugin to properly identify the correct
// Visual Studio paths when multiple versions of Visual Studio and SDKs are installed
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"
project.ext.VISUAL_STUDIO_INSTALL_DIR = "/"
project.ext.VISUAL_STUDIO_VCVARS_CMD = "UNKNOWN"
project.ext.MSVC_SDK_VERSION = "UNKNOWN"
project.ext.MSVC_TOOLS_VERSION = "UNKNOWN"
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"
}
if (file(project.ext.VISUAL_STUDIO_INSTALL_DIR).exists()) {
println "Visual Studio Path: ${VISUAL_STUDIO_INSTALL_DIR}"
project.ext.VISUAL_STUDIO_VCVARS_CMD = "\"${VISUAL_STUDIO_INSTALL_DIR}\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x86_amd64"
// 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 COMMAND = "cmd /v:ON /c ${VISUAL_STUDIO_VCVARS_CMD} > nul && cmd /c echo"
project.ext.MSVC_SDK_VERSION = "${COMMAND} !WINDOWSSDKVERSION!".execute().text.trim().replace('\\', '')
println "Visual Studio SDK Version: ${MSVC_SDK_VERSION}"
project.ext.MSVC_TOOLS_VERSION = "${COMMAND} !VCTOOLSVERSION!".execute().text.trim().replace('\\', '')
println "Visual Studio VCTools Version: ${MSVC_TOOLS_VERSION}"
}
}
apply from: "GPL/vsconfig.gradle"
/*********************************************************************************
* Imports