ghidra/GPL/DemanglerGnu/build.gradle
Ryan Kurtz 00533b2869 GP-1106: Platform naming convention now supports different
architectures. Support for building on ARM.
2021-08-17 13:41:47 -04:00

168 lines
4 KiB
Groovy

/* ###
* IP: Public Domain
*/
if (findProject(':Generic') != null) {
apply from: "$rootProject.projectDir/gradle/nativeProject.gradle"
apply from: "$rootProject.projectDir/gradle/distributableGPLModule.gradle"
}
else {
apply from: "../utils.gradle"
apply from: "../nativePlatforms.gradle"
apply from: "../nativeBuildProperties.gradle"
}
apply plugin: 'eclipse'
eclipse.project.name = 'GPL DemanglerGnu'
def v33_1 = "demangler_gnu_v2_33_1"
def v24 = "demangler_gnu_v2_24"
def srcVersion33_1 = "src/demangler_gnu_v2_33_1"
def srcVersion24 = "src/demangler_gnu_v2_24"
/**
* This project has some native 'c' code we need to include in the zip for licensing
* and build reasons. So include them here, but we have to do something special: the
* source is divided up into folders for makefiles, headers and .c files:
* /headers
* /c
* /build
*
* The contents of all these need to be merged into the same folder for distribution.
* Hence the following 3 'from' clauses:
*/
task zipBuildableSource(type:Zip) {
group 'private'
description "Collects the source files needed to build this module."
archiveBaseName = project.name + "-src-for-build"
archiveExtension = 'zip'
//
// Version 2.33.1
//
from (project.projectDir.toString() + "/" + srcVersion33_1 + "c") {
into "/" + srcVersion33_1
}
from (project.projectDir.toString() + "/" + srcVersion33_1 + "/headers") {
into "/" + srcVersion33_1
}
from (project.projectDir.toString() + "/" + srcVersion33_1 + "/build") {
into "/" + srcVersion33_1
}
from (project.projectDir.toString() + "/" + srcVersion33_1 + "/README.txt")
//
// Version 2.24
//
from (project.projectDir.toString() + "/" + srcVersion24 + "c") {
into "/" + srcVersion24
}
from (project.projectDir.toString() + "/" + srcVersion24 + "/headers") {
into "/" + srcVersion24
}
from (project.projectDir.toString() + "/" + srcVersion24 + "/build") {
into "/" + srcVersion24
}
from (project.projectDir.toString() + "/" + srcVersion24 + "/README.txt")
}
model {
//
// Version 2.33.1
//
components {
demangler_gnu_v2_33_1(NativeExecutableSpec) {
targetPlatform "win_x86_64"
targetPlatform "linux_x86_64"
targetPlatform "linux_arm_64"
targetPlatform "mac_x86_64"
targetPlatform "mac_arm_64"
sources {
c {
source {
srcDir srcVersion33_1 + "/c"
}
exportedHeaders {
srcDir srcVersion33_1 + "/headers"
}
}
}
}
//
// Version 2.24
//
demangler_gnu_v2_24(NativeExecutableSpec) {
targetPlatform "win_x86_64"
targetPlatform "linux_x86_64"
targetPlatform "linux_arm_64"
targetPlatform "mac_x86_64"
targetPlatform "mac_arm_64"
sources {
c {
source {
srcDir srcVersion24 + "/c"
}
exportedHeaders {
srcDir srcVersion24 + "/headers"
}
}
}
}
}
}
model {
binaries {
/*
Note: 'all' will pass all binary output, which is each platform for each version
*/
all{ b ->
def version = b.getApplication().getName()
if (version.equals(v33_1)) {
if (toolChain in Gcc) {
//cCompiler.args "-DCP_DEMANGLE_DEBUG"
cCompiler.args "-DHAVE_STDLIB_H"
cCompiler.args "-DHAVE_STRING_H"
}
else if (toolChain in VisualCpp) {
cCompiler.args "/D_CONSOLE"
cCompiler.args "-DHAVE_STDLIB_H"
cCompiler.args "-DHAVE_STRING_H"
}
else if (toolChain in Clang) {
cCompiler.args "-DHAVE_STDLIB_H"
cCompiler.args "-DHAVE_STRING_H"
}
}
else if (version.equals(v24)) {
if (toolChain in Gcc) {
cCompiler.args "-DMAIN_CPLUS_DEM"
cCompiler.args "-DHAVE_STDLIB_H"
cCompiler.args "-DHAVE_STRING_H"
}
else if (toolChain in VisualCpp) {
cCompiler.args "/D_CONSOLE"
cCompiler.args "/DMAIN_CPLUS_DEM"
cCompiler.args "-DHAVE_STDLIB_H"
cCompiler.args "-DHAVE_STRING_H"
}
else if (toolChain in Clang) {
cCompiler.args "-DMAIN_CPLUS_DEM"
cCompiler.args "-DHAVE_STDLIB_H"
cCompiler.args "-DHAVE_STRING_H"
}
}
}
}
}