diff --git a/.gitignore b/.gitignore index d24ec41..58b3e9d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ **/msvc/*.suo **/msvc/*.aps **/msvc/ipch +**/PublishPath*.txt +**/*.log publish **/appversion.h diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..2097a0c --- /dev/null +++ b/build.gradle @@ -0,0 +1,51 @@ +import versioning.GitVersioner +import versioning.RevoiceVersionInfo + +apply from: 'shared.gradle' +group = 'revoice' + +apply plugin: 'idea' + +idea { + project { + languageLevel = 'JDK_1_7' + } +} + +def gitInfo = GitVersioner.versionForDir(project.rootDir) +if (!gitInfo) { + throw new RuntimeException('Running outside git repository') +} + +RevoiceVersionInfo versionInfo +if (gitInfo.tag && gitInfo.tag[0] == 'v') { + + def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/ + if (!m.find()) { + throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}") + } + + versionInfo = new RevoiceVersionInfo( + majorVersion: m.group(1) as int, + minorVersion: m.group(2) as int, + maintenanceVersion: m.group(4) ? (m.group(4) as int) : null, + countCommit: gitInfo.countCommit, + lastCommitDate: gitInfo.lastCommitDate + ) +} else { + + versionInfo = new RevoiceVersionInfo( + majorVersion: project.majorVersion as int, + minorVersion: project.minorVersion as int, + specialVersion: project.specialVersion, + countCommit: gitInfo.countCommit, + lastCommitDate: gitInfo.lastCommitDate + ) +} + +project.ext.revoiceVersionInfo = versionInfo +project.version = versionInfo.asVersion() + +task wrapper(type: Wrapper) { + gradleVersion = '2.4' +} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 0000000..0d93aa3 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'groovy' + +repositories { + //mavenLocal() + mavenCentral() + maven { + url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/' + } + maven { + url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-snapshots/' + } +} + +dependencies { + compile gradleApi() + compile localGroovy() + compile 'commons-io:commons-io:2.4' + compile 'commons-lang:commons-lang:2.6' + compile 'joda-time:joda-time:2.7' + compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2' + compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r' + compile 'org.apache.velocity:velocity:1.7' +} diff --git a/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy b/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy new file mode 100644 index 0000000..34ead60 --- /dev/null +++ b/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy @@ -0,0 +1,53 @@ +package gradlecpp + +import org.apache.velocity.Template +import org.apache.velocity.VelocityContext +import org.apache.velocity.app.Velocity +import org.joda.time.format.DateTimeFormat +import versioning.RevoiceVersionInfo + +class VelocityUtils { + + static { + Properties p = new Properties(); + + p.setProperty("resource.loader", "class"); + p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); + p.setProperty("class.resource.loader.path", ""); + + p.setProperty("input.encoding", "UTF-8"); + p.setProperty("output.encoding", "UTF-8"); + + Velocity.init(p); + } + static String renderTemplate(File tplFile, RevoiceVersionInfo ctx) { + Template tpl = Velocity.getTemplate(tplFile.absolutePath) + if (!tpl) { + throw new RuntimeException("Failed to load velocity template ${tplFile.absolutePath}: not found") + } + + def templateCtx = [ + verInfo: ctx + ] + + def velocityContext = new VelocityContext(templateCtx) + + if (ctx.specialVersion.length() > 0) { + velocityContext.put("appFlags", 0x0L) + velocityContext.put("formatSpecialVersion", "-" + ctx.specialVersion) + } else { + + velocityContext.put("appFlags", "VS_FF_SPECIALBUILD") + velocityContext.put("formatSpecialVersion", "") + } + + velocityContext.put("current_version", ctx.asVersion()) + + velocityContext.put("_DateTimeFormat", DateTimeFormat) + + def sw = new StringWriter() + tpl.merge(velocityContext, sw) + + return sw.toString() + } +} diff --git a/buildSrc/src/main/groovy/versioning/GitInfo.groovy b/buildSrc/src/main/groovy/versioning/GitInfo.groovy new file mode 100644 index 0000000..0158421 --- /dev/null +++ b/buildSrc/src/main/groovy/versioning/GitInfo.groovy @@ -0,0 +1,13 @@ +package versioning + +import groovy.transform.CompileStatic +import groovy.transform.TypeChecked +import org.joda.time.DateTime + +@CompileStatic @TypeChecked +class GitInfo { + DateTime lastCommitDate + String branch + String tag + Integer countCommit +} diff --git a/buildSrc/src/main/groovy/versioning/GitVersioner.groovy b/buildSrc/src/main/groovy/versioning/GitVersioner.groovy new file mode 100644 index 0000000..ffe3986 --- /dev/null +++ b/buildSrc/src/main/groovy/versioning/GitVersioner.groovy @@ -0,0 +1,53 @@ +package versioning + +import groovy.transform.CompileStatic +import groovy.transform.TypeChecked +import org.eclipse.jgit.api.Git +import org.eclipse.jgit.lib.ObjectId +import org.eclipse.jgit.lib.Repository +import org.eclipse.jgit.revwalk.RevCommit +import org.eclipse.jgit.revwalk.RevWalk +import org.eclipse.jgit.storage.file.FileRepositoryBuilder +import org.joda.time.DateTime +import org.joda.time.DateTimeZone + +@CompileStatic @TypeChecked +class GitVersioner { + + static GitInfo versionForDir(String dir) { + versionForDir(new File(dir)) + } + static int getCountCommit(Repository repo) { + Iterable commits = Git.wrap(repo).log().call() + int count = 0; + commits.each { + count++; + } + + return count; + } + static GitInfo versionForDir(File dir) { + FileRepositoryBuilder builder = new FileRepositoryBuilder() + Repository repo = builder.setWorkTree(dir).findGitDir().build() + + ObjectId head = repo.resolve('HEAD') + if (!head) { + return null + } + + def commit = new RevWalk(repo).parseCommit(head) + def branch = repo.getBranch() + def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC) + + int commitCount = getCountCommit(repo); + + String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key + + return new GitInfo( + lastCommitDate: commitDate, + branch: branch, + tag: tag, + countCommit: commitCount + ) + } +} diff --git a/buildSrc/src/main/groovy/versioning/RevoiceVersionInfo.groovy b/buildSrc/src/main/groovy/versioning/RevoiceVersionInfo.groovy new file mode 100644 index 0000000..8ff8d5a --- /dev/null +++ b/buildSrc/src/main/groovy/versioning/RevoiceVersionInfo.groovy @@ -0,0 +1,41 @@ +package versioning + +import groovy.transform.CompileStatic +import groovy.transform.ToString +import groovy.transform.TypeChecked +import org.joda.time.DateTime + +@CompileStatic @TypeChecked +@ToString(includeNames = true) +class RevoiceVersionInfo { + int majorVersion + int minorVersion + Integer maintenanceVersion + String specialVersion + Integer countCommit + DateTime lastCommitDate + + String format(String versionSeparator, String suffixSeparator, boolean includeSuffix) { + StringBuilder sb = new StringBuilder() + sb.append(majorVersion).append(versionSeparator).append(minorVersion) + if (maintenanceVersion != null) { + sb.append(versionSeparator).append(maintenanceVersion) + } + + if (specialVersion && includeSuffix) { + sb.append(suffixSeparator).append(specialVersion) + } + + return sb.toString() + } + String asVersion() { + if (specialVersion.length() > 0) { + sprintf("%d.%d.%d-%s", majorVersion, minorVersion, countCommit, specialVersion) + } + else + sprintf("%d.%d.%d", majorVersion, minorVersion, countCommit) + } + String asMavenVersion() { + format('.', '-', true) + } +} diff --git a/dep/silk/build.gradle b/dep/silk/build.gradle new file mode 100644 index 0000000..4b9e2b0 --- /dev/null +++ b/dep/silk/build.gradle @@ -0,0 +1,68 @@ +import org.doomedsociety.gradlecpp.cfg.ToolchainConfig +import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils +import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig +import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig +import org.doomedsociety.gradlecpp.toolchain.icc.Icc +import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin +import org.gradle.nativeplatform.NativeBinarySpec +import org.gradle.nativeplatform.NativeLibrarySpec +import org.gradle.nativeplatform.toolchain.VisualCpp + +apply plugin: 'cpp' +apply plugin: IccCompilerPlugin + +void setupToolchain(NativeBinarySpec b) { + ToolchainConfig cfg = rootProject.createToolchainConfig(b) + + if (cfg instanceof MsvcToolchainConfig) { + cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GR-' + } else if (cfg instanceof GccToolchainConfig) { + cfg.compilerOptions.languageStandard = 'c++0x' + cfg.compilerOptions.args '-msse2', '-fp-model fast=2', '-fomit-frame-pointer', '-fvisibility=hidden', '-fvisibility-inlines-hidden', '-fno-rtti', '-g0', '-s' + } + + ToolchainConfigUtils.apply(project, cfg, b) +} + +model { + buildTypes { + debug + release + } + + platforms { + x86 { + architecture "x86" + } + } + + toolChains { + visualCpp(VisualCpp) { + } + icc(Icc) { + } + } + + components { + silk(NativeLibrarySpec) { + targetPlatform 'x86' + + sources { + silk_src(CppSourceSet) { + source { + srcDir "src" + include "**/*.c" + } + + exportedHeaders { + srcDir "include" + } + } + } + + binaries.all { NativeBinarySpec b -> + project.setupToolchain(b) + } + } + } +} diff --git a/dep/speex/build.gradle b/dep/speex/build.gradle new file mode 100644 index 0000000..fc50453 --- /dev/null +++ b/dep/speex/build.gradle @@ -0,0 +1,68 @@ +import org.doomedsociety.gradlecpp.cfg.ToolchainConfig +import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils +import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig +import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig +import org.doomedsociety.gradlecpp.toolchain.icc.Icc +import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin +import org.gradle.nativeplatform.NativeBinarySpec +import org.gradle.nativeplatform.NativeLibrarySpec +import org.gradle.nativeplatform.toolchain.VisualCpp + +apply plugin: 'cpp' +apply plugin: IccCompilerPlugin + +void setupToolchain(NativeBinarySpec b) { + ToolchainConfig cfg = rootProject.createToolchainConfig(b) + + if (cfg instanceof MsvcToolchainConfig) { + cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GR-' + } else if (cfg instanceof GccToolchainConfig) { + cfg.compilerOptions.languageStandard = 'c++0x' + cfg.compilerOptions.args '-msse2', '-fp-model fast=2', '-fomit-frame-pointer', '-fvisibility=hidden', '-fvisibility-inlines-hidden', '-fno-rtti', '-g0', '-s' + } + + ToolchainConfigUtils.apply(project, cfg, b) +} + +model { + buildTypes { + debug + release + } + + platforms { + x86 { + architecture "x86" + } + } + + toolChains { + visualCpp(VisualCpp) { + } + icc(Icc) { + } + } + + components { + speex(NativeLibrarySpec) { + targetPlatform 'x86' + + sources { + speex_src(CppSourceSet) { + source { + srcDir "src" + include "**/*.c" + } + + exportedHeaders { + srcDir "include" + } + } + } + + binaries.all { NativeBinarySpec b -> + project.setupToolchain(b) + } + } + } +} diff --git a/dep/speex/src/ltp.c b/dep/speex/src/ltp.c index f95d215..90142bd 100644 --- a/dep/speex/src/ltp.c +++ b/dep/speex/src/ltp.c @@ -234,9 +234,9 @@ int *cdbk_index float sum=0; float g0,g1,g2; ptr = gain_cdbk+3*i; - g0=0.015625*ptr[0]+.5; - g1=0.015625*ptr[1]+.5; - g2=0.015625*ptr[2]+.5; + g0=0.015625f*ptr[0]+.5f; + g1=0.015625f*ptr[1]+.5f; + g2=0.015625f*ptr[2]+.5f; sum += C[0]*g0; sum += C[1]*g1; @@ -244,13 +244,13 @@ int *cdbk_index sum -= C[3]*g0*g1; sum -= C[4]*g2*g1; sum -= C[5]*g2*g0; - sum -= .5*C[6]*g0*g0; - sum -= .5*C[7]*g1*g1; - sum -= .5*C[8]*g2*g2; + sum -= .5f*C[6]*g0*g0; + sum -= .5f*C[7]*g1*g1; + sum -= .5f*C[8]*g2*g2; /* If 1, force "safe" pitch values to handle packet loss better */ if (0) { - float tot = fabs(ptr[1]); + float tot = fabs((float)ptr[1]); if (ptr[0]>0) tot+=ptr[0]; if (ptr[2]>0) diff --git a/dep/speex/src/vbr.c b/dep/speex/src/vbr.c index b035dbc..e675ddd 100644 --- a/dep/speex/src/vbr.c +++ b/dep/speex/src/vbr.c @@ -38,8 +38,8 @@ #define sqr(x) ((x)*(x)) -#define MIN_ENERGY 6000 -#define NOISE_POW .3 +#define MIN_ENERGY 6000.0f +#define NOISE_POW .3f float vbr_nb_thresh[9][11]={ @@ -80,7 +80,7 @@ void vbr_init(VBRState *vbr) vbr->last_pitch_coef=0; vbr->last_quality=0; - vbr->noise_accum = .05*pow(MIN_ENERGY, NOISE_POW); + vbr->noise_accum = .05f*pow(MIN_ENERGY, NOISE_POW); vbr->noise_accum_count=.05; vbr->noise_level=vbr->noise_accum/vbr->noise_accum_count; vbr->consec_noise=0; @@ -141,12 +141,12 @@ float vbr_analysis(VBRState *vbr, float *sig, int len, int pitch, float pitch_co if (non_st>1) non_st=1; - voicing = 3*(pitch_coef-.4)*fabs(pitch_coef-.4); + voicing = 3*(pitch_coef-.4f)*fabs(pitch_coef-.4f); vbr->average_energy = (1-vbr->energy_alpha)*vbr->average_energy + vbr->energy_alpha*ener; vbr->noise_level=vbr->noise_accum/vbr->noise_accum_count; pow_ener = pow(ener,NOISE_POW); if (vbr->noise_accum_count<.06 && ener>MIN_ENERGY) - vbr->noise_accum = .05*pow_ener; + vbr->noise_accum = .05f*pow_ener; if ((voicing<.3 && non_st < .2 && pow_ener < 1.2*vbr->noise_level) || (voicing<.3 && non_st < .05 && pow_ener < 1.5*vbr->noise_level) @@ -162,8 +162,8 @@ float vbr_analysis(VBRState *vbr, float *sig, int len, int pitch, float pitch_co tmp = pow_ener; if (vbr->consec_noise>=4) { - vbr->noise_accum = .95*vbr->noise_accum + .05*tmp; - vbr->noise_accum_count = .95*vbr->noise_accum_count + .05; + vbr->noise_accum = .95f*vbr->noise_accum + .05f*tmp; + vbr->noise_accum_count = .95f*vbr->noise_accum_count + .05f; } } else { va = 1; @@ -172,18 +172,18 @@ float vbr_analysis(VBRState *vbr, float *sig, int len, int pitch, float pitch_co if (pow_ener < vbr->noise_level && ener>MIN_ENERGY) { - vbr->noise_accum = .95*vbr->noise_accum + .05*pow_ener; - vbr->noise_accum_count = .95*vbr->noise_accum_count + .05; + vbr->noise_accum = .95f*vbr->noise_accum + .05f*pow_ener; + vbr->noise_accum_count = .95f*vbr->noise_accum_count + .05f; } /* Checking for very low absolute energy */ if (ener < 30000) { - qual -= .7; + qual -= .7f; if (ener < 10000) - qual-=.7; + qual-=.7f; if (ener < 3000) - qual-=.7; + qual-=.7f; } else { float short_diff, long_diff; short_diff = log((ener+1)/(1+vbr->last_energy)); @@ -196,25 +196,25 @@ float vbr_analysis(VBRState *vbr, float *sig, int len, int pitch, float pitch_co long_diff=2; if (long_diff>0) - qual += .6*long_diff; + qual += .6f*long_diff; if (long_diff<0) - qual += .5*long_diff; + qual += .5f*long_diff; if (short_diff>0) { if (short_diff>5) short_diff=5; - qual += .5*short_diff; + qual += .5f*short_diff; } /* Checking for energy increases */ - if (ener2 > 1.6*ener1) - qual += .5; + if (ener2 > 1.6f*ener1) + qual += .5f; } vbr->last_energy = ener; - vbr->soft_pitch = .6*vbr->soft_pitch + .4*pitch_coef; - qual += 2.2*((pitch_coef-.4) + (vbr->soft_pitch-.4)); + vbr->soft_pitch = .6f*vbr->soft_pitch + .4f*pitch_coef; + qual += 2.2f*((pitch_coef-.4f) + (vbr->soft_pitch-.4f)); if (qual < vbr->last_quality) - qual = .5*qual + .5*vbr->last_quality; + qual = .5f*qual + .5f*vbr->last_quality; if (qual<4) qual=4; if (qual>10) @@ -232,19 +232,19 @@ float vbr_analysis(VBRState *vbr, float *sig, int len, int pitch, float pitch_co qual=4; if (vbr->consec_noise) - qual -= 1.0 * (log(3.0 + vbr->consec_noise)-log(3)); + qual -= 1.0 * (log(3.0 + vbr->consec_noise)-log(3.0f)); if (qual<0) qual=0; if (ener<60000) { if (vbr->consec_noise>2) - qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3)); + qual-=0.5f*(log(3.0 + vbr->consec_noise)-log(3.0f)); if (ener<10000&&vbr->consec_noise>2) - qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3)); + qual-=0.5f*(log(3.0 + vbr->consec_noise)-log(3.0f)); if (qual<0) qual=0; - qual += .3*log(ener/60000.0); + qual += .3f*log(ener/60000.0); } if (qual<-1) qual=-1; diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e74de4e --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +majorVersion=0 +minorVersion=1 +specialVersion= diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..175c642 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..82683f2 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat May 02 13:29:15 BRT 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..91a7e26 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/revoice/build.gradle b/revoice/build.gradle new file mode 100644 index 0000000..40c1a34 --- /dev/null +++ b/revoice/build.gradle @@ -0,0 +1,189 @@ +import org.doomedsociety.gradlecpp.GradleCppUtils +import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin +import org.doomedsociety.gradlecpp.toolchain.icc.Icc +import org.doomedsociety.gradlecpp.cfg.ToolchainConfig +import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig +import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig +import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils +import org.gradle.language.cpp.CppSourceSet +import org.gradle.language.rc.tasks.WindowsResourceCompile +import org.gradle.nativeplatform.NativeBinarySpec +import versioning.RevoiceVersionInfo +import gradlecpp.VelocityUtils + +apply plugin: 'cpp' +apply plugin: 'windows-resources' +apply plugin: IccCompilerPlugin + +project.ext.dep_silk = project(':dep/silk') +project.ext.dep_speex = project(':dep/speex') + +List getRcCompileTasks(NativeBinarySpec binary) { + def linkTask = GradleCppUtils.getLinkTask(binary) + + def res = linkTask.taskDependencies.getDependencies(linkTask).findAll { Task t -> t instanceof WindowsResourceCompile } + return res as List +} + +void postEvaluate(NativeBinarySpec b) { + if (GradleCppUtils.windows) { + getRcCompileTasks(b).each { Task t -> + t.dependsOn project.generateAppVersion + } + } else { + // attach generateAppVersion task to all 'compile source' tasks + GradleCppUtils.getCompileTasks(b).each { Task t -> + t.dependsOn project.generateAppVersion + } + } +} + +void setupToolchain(NativeBinarySpec b) { + ToolchainConfig cfg = rootProject.createToolchainConfig(b) + cfg.projectInclude(project, '', '/src') + cfg.projectInclude(rootProject, '/dep/rehlsdk/common', '/dep/rehlsdk/engine', '/dep/rehlsdk/dlls', '/dep/rehlsdk/public', '/dep/metamod', '/revoice/public') + + if (cfg instanceof MsvcToolchainConfig) { + cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( + enabled: true, + pchHeader: 'precompiled.h', + pchSourceSet: 'revoice_pch' + ) + cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GR-' + cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') + cfg.extraLibs 'ws2_32.lib' + } else if (cfg instanceof GccToolchainConfig) { + cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( + enabled: true, + pchSourceSet: 'revoice_pch' + ) + cfg.compilerOptions.languageStandard = 'c++0x' + cfg.defines([ + '_stricmp': 'strcasecmp', + '_strnicmp': 'strncasecmp', + '_vsnprintf': 'vsnprintf', + '_snprintf': 'snprintf' + ]) + + cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-msse2', '-fp-model fast', '-fomit-frame-pointer', '-fvisibility=hidden', '-fvisibility-inlines-hidden', '-fno-rtti', '-g0', '-s' + } + + ToolchainConfigUtils.apply(project, cfg, b) + + GradleCppUtils.onTasksCreated(project, 'postEvaluate', { + postEvaluate(b) + }) +} + +model { + buildTypes { + debug + release + } + + platforms { + x86 { + architecture "x86" + } + } + + toolChains { + visualCpp(VisualCpp) { + } + icc(Icc) { + } + } + + components { + revoice(NativeLibrarySpec) { + targetPlatform 'x86' + baseName GradleCppUtils.windows ? 'revoice_mm' : 'revoice_mm_i386' + + sources { + + revoice_pch(CppSourceSet) { + source { + srcDirs "src" + include "precompiled.cpp" + } + + exportedHeaders { + srcDirs "include", "version" + } + + lib project: ':dep/silk', library: 'silk', linkage: 'static' + lib project: ':dep/speex', library: 'speex', linkage: 'static' + } + + revoice_src(CppSourceSet) { + source { + srcDirs "src", "public" + include "**/*.cpp" + + exclude "precompiled.cpp" + exclude "engine_api.cpp" + } + + exportedHeaders { + srcDirs "include", "version" + } + + lib project: ':dep/silk', library: 'silk', linkage: 'static' + lib project: ':dep/speex', library: 'speex', linkage: 'static' + } + rc { + source { + srcDir "msvc" + include "ReVoice.rc" + } + exportedHeaders { + srcDirs "msvc" + } + } + } + + binaries.all { + NativeBinarySpec b -> project.setupToolchain(b) + } + } + } +} + +afterEvaluate { + project.binaries.all { + NativeBinarySpec binary -> + Tool linker = binary.linker + + if (GradleCppUtils.windows) { + linker.args "/DEF:${projectDir}\\msvc\\ReVoice.def" + } + } +} + +task buildRelease { + dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> + blib.buildable && blib.buildType.name == 'release' + } +} + +tasks.clean.doLast { + project.file('version/appversion.h').delete() +} + +task generateAppVersion { + + RevoiceVersionInfo verInfo = (RevoiceVersionInfo) rootProject.revoiceVersionInfo + def tplversionFile = project.file('version/appversion.vm') + def versionFile = project.file('version/appversion.h') + + inputs.file tplversionFile + inputs.file project.file('gradle.properties') + outputs.file versionFile + + doLast { + + def versionContent = VelocityUtils.renderTemplate(tplversionFile, verInfo) + versionFile.delete() + versionFile.write(versionContent, 'utf-8') + } +} diff --git a/revoice/msvc/PreBuild.bat b/revoice/msvc/PreBuild.bat new file mode 100644 index 0000000..34cddef --- /dev/null +++ b/revoice/msvc/PreBuild.bat @@ -0,0 +1,168 @@ +@echo OFF +:: +:: Pre-build auto-versioning script +:: + +SET srcdir=%~1 +SET repodir=%~2 + +SET old_version= +set old_specialbuild="" +SET version_revision=0 +set version_specialbuild= +SET version_pdate_1=%date:~-4%-%date:~3,2%-%date:~0,2% +SET version_pdate=%version_pdate_1% %time:~0,2%:%time:~3,2%:%time:~6,2% +SET version_date=%version_pdate_1%__%time:~0,2%-%time:~3,2%-%time:~6,2% +SET version_major=0 +SET version_minor=0 +SET version_specialversion= + +:: +:: Check for git.exe presence +:: +CALL git.exe describe >NUL 2>&1 +set errlvl="%ERRORLEVEL%" + +:: +:: Read old appversion.h, if present +:: +IF EXIST "%srcdir%\appversion.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( + IF %%i==#define ( + IF %%j==APP_VERSION_C SET old_version=%%k + IF %%j==APP_VERSION_SPECIALBUILD SET old_specialbuild=%%k + ) + ) +) + +IF %errlvl% == "1" ( + echo can't locate git.exe - auto-versioning step won't be performed + + :: if we haven't appversion.h, we need to create it + IF NOT "%old_version%" == "" ( + SET version_revision=0 + ) +) + +:: +:: Read major, minor and maintenance version components from Version.h +:: +IF EXIST "%srcdir%\version.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do ( + IF %%i==#define ( + IF %%j==VERSION_MAJOR SET version_major=%%k + IF %%j==VERSION_MINOR SET version_minor=%%k + IF %%j==VERSION_SPECIALVERSION SET version_specialversion=%%k + ) + ) +) ELSE ( + FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do ( + IF NOT [%%j] == [] ( + IF %%i==majorVersion SET version_major=%%j + IF %%i==minorVersion SET version_minor=%%j + IF %%i==specialVersion SET version_specialversion=%%j + ) + ) +) + +:: +:: Read revision and release date from it +:: +IF NOT %errlvl% == "1" ( + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --all | wc -l"') DO ( + IF NOT [%%i] == [] ( + set version_revision=%%i + ) + ) +) + +:: +:: Now form full version string like 1.0.0.1 +:: + +set new_version=%version_major%,%version_minor%,0,%version_revision% + +:: +:: Detect local modifications +:: +SET localChanged=0 +IF NOT %errlvl% == "1" ( + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO ( + SET localChanged=1 + ) +) + +IF [%localChanged%]==[1] ( + IF NOT [%version_specialversion%] == [] ( + set version_specialbuild=%version_specialversion% + ) ELSE ( + set version_specialbuild=m + ) +) ELSE ( + set version_specialbuild= +) + +:: +:: Update appversion.h if version has changed or modifications/mixed revisions detected +:: +IF NOT "%new_version%"=="%old_version%" goto _update +IF NOT "%version_specialbuild%"==%old_specialbuild% goto _update +goto _exit + +:_update +echo Updating appversion.h, new version is "%new_version%", the old one was "%old_version%" +echo new special build is "%version_specialbuild%", the old one was %old_specialbuild% + +echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" +echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo // This file is generated automatically.>>"%srcdir%\appversion.h" +echo // Don't edit it.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // Version defines>>"%srcdir%\appversion.h" + +IF "%version_specialversion%" == "" ( + echo #define APP_VERSION_D %version_major%.%version_minor%.%version_revision% >>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRD "%version_major%.%version_minor%.%version_revision%">>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRD_RC "%version_major%.%version_minor%.%version_revision%">>"%srcdir%\appversion.h" + echo #define APP_VERSION_C %version_major%,%version_minor%,0,%version_revision% >>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRCS "%version_major%, %version_minor%, 0, %version_revision%">>"%srcdir%\appversion.h" +) ELSE ( + echo #define APP_VERSION_D %version_major%.%version_minor%.%version_maintenance%.%version_revision% >>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRD "%version_major%.%version_minor%.%version_maintenance%.%version_revision%">>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRD_RC "%version_major%.%version_minor%.%version_maintenance%.%version_revision%">>"%srcdir%\appversion.h" + echo #define APP_VERSION_C %version_major%,%version_minor%,%version_maintenance%,%version_revision% >>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRCS "%version_major%, %version_minor%, %version_maintenance%, %version_revision%">>"%srcdir%\appversion.h" +) + +echo.>>"%srcdir%\appversion.h" +echo #define APP_VERSION_DATE %version_date%>>"%srcdir%\appversion.h" +echo #define APP_VERSION_DATE_STR "%version_date%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo #define APP_VERSION_PDATE_STR "%version_pdate%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo #define APP_VERSION_YMD_STR "%version_pdate_1%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +IF NOT "%version_specialbuild%" == "" ( + echo #define APP_VERSION_FLAGS VS_FF_SPECIALBUILD>>"%srcdir%\appversion.h" + echo #define APP_VERSION_SPECIALBUILD "%version_specialbuild%">>"%srcdir%\appversion.h" + echo #define APP_VERSION APP_VERSION_STRD "" APP_VERSION_SPECIALBUILD>>"%srcdir%\appversion.h" +) ELSE ( + echo #define APP_VERSION_FLAGS 0x0L>>"%srcdir%\appversion.h" + echo #define APP_VERSION APP_VERSION_STRD>>"%srcdir%\appversion.h" +) +echo.>>"%srcdir%\appversion.h" + +echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +:: +:: Do update of version.cpp file last modify time to force it recompile +:: +copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp" + +:_exit +exit /B 0 \ No newline at end of file diff --git a/revoice/msvc/PublishPath.txt b/revoice/msvc/PublishPath.txt deleted file mode 100644 index ae7cc7c..0000000 --- a/revoice/msvc/PublishPath.txt +++ /dev/null @@ -1 +0,0 @@ -d:\rehlds_hbtrace\cstrike\addons\revoice\ diff --git a/revoice/msvc/ReVoice.rc b/revoice/msvc/ReVoice.rc new file mode 100644 index 0000000..461778c --- /dev/null +++ b/revoice/msvc/ReVoice.rc @@ -0,0 +1,108 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" +#include "..\version\appversion.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1251) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +VS_VERSION_INFO VERSIONINFO +FILEVERSION APP_VERSION_C +PRODUCTVERSION APP_VERSION_C +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS (APP_VERSION_FLAGS | VS_FF_DEBUG) +#else + FILEFLAGS (APP_VERSION_FLAGS) +#endif +FILEOS VOS__WINDOWS32 +FILETYPE VFT_DLL +FILESUBTYPE VFT2_UNKNOWN + +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "041904b0" + BEGIN + VALUE "CompanyName", "" + VALUE "FileDescription", "Voice transcoding module for ReHLDS" + VALUE "FileVersion", APP_VERSION_STRD_RC + VALUE "InternalName", "Revoice" + VALUE "LegalCopyright", "" + VALUE "OriginalFilename", "revoice_mm.dll" + VALUE "ProductName", "Revoice" + VALUE "ProductVersion", APP_VERSION_STRD_RC + #if APP_VERSION_FLAGS != 0x0L + VALUE "SpecialBuild", APP_VERSION_SPECIALBUILD + #endif + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x419, 1200 + END +END + +#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/revoice/msvc/ReVoice.vcxproj b/revoice/msvc/ReVoice.vcxproj index fffc53c..2d14f3f 100644 --- a/revoice/msvc/ReVoice.vcxproj +++ b/revoice/msvc/ReVoice.vcxproj @@ -41,11 +41,19 @@ + + true + true + + - + + true + true + @@ -64,6 +72,10 @@ + + true + true + @@ -73,6 +85,17 @@ {966de7a9-ec15-4c1d-8b46-ea813a845723} + + + + true + true + + + + + + {DAEFE371-7D77-4B72-A8A5-3CD3D1A55786} Win32Proj @@ -131,6 +154,24 @@ Automatic deployment script + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") + + + Setup version from Git revision + + + echo Empty Action + + + Force build to run Pre-Build event + + + subversion.always.run + + + subversion.always.run + @@ -148,9 +189,33 @@ true true true - $(OutDir)\speex.lib;ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;%(AdditionalDependencies) revoice.def + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") + + + Setup version from Git revision + + + IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") + + + Automatic deployment script + + + echo Empty Action + + + Force build to run Pre-Build event + + + subversion.always.run + + + subversion.always.run + diff --git a/revoice/msvc/ReVoice.vcxproj.filters b/revoice/msvc/ReVoice.vcxproj.filters index a732740..f645c28 100644 --- a/revoice/msvc/ReVoice.vcxproj.filters +++ b/revoice/msvc/ReVoice.vcxproj.filters @@ -10,6 +10,12 @@ {2a5fb3db-9e29-48b6-8700-dce875791baf} + + {3b33f11d-6bb6-40ed-8d55-a1609f01adeb} + + + {91057668-b802-4bd5-913c-b79adf8bff09} + @@ -102,6 +108,10 @@ src + + + version + @@ -158,5 +168,20 @@ src + + version + + + + + + version + + + gradle + + + + \ No newline at end of file diff --git a/revoice/msvc/resource.h b/revoice/msvc/resource.h new file mode 100644 index 0000000..7c3f681 --- /dev/null +++ b/revoice/msvc/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by ReVoice.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/revoice/version/appversion.h b/revoice/version/appversion.h deleted file mode 100644 index 46effdc..0000000 --- a/revoice/version/appversion.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __APPVERSION_H__ -#define __APPVERSION_H__ - -// -// This file is generated automatically. -// Don't edit it. -// - -// Version defines -#define VERSION_MAJOR 0 -#define VERSION_MINOR 1 - -#define APP_VERSION_D 0.1 -#define APP_VERSION_C 0,1,0,47 - -#define APP_VERSION_STRD "0.1.47" -#define APP_VERSION_STRD_RC "0.1.47" - -#define APP_VERSION_FLAGS VS_FF_SPECIALBUILD -#define APP_VERSION_SPECIALBUILD "" - - -#define APP_VERSION_YMD_STR "2015-10-17" -#define APP_VERSION APP_VERSION_STRD - -#endif //__APPVERSION_H__ diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..9260068 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,4 @@ +rootProject.name = 'revoice' +include 'revoice' +include 'dep/silk' +include 'dep/speex' diff --git a/shared.gradle b/shared.gradle new file mode 100644 index 0000000..cc61691 --- /dev/null +++ b/shared.gradle @@ -0,0 +1,33 @@ +import org.doomedsociety.gradlecpp.cfg.BinaryKind +import org.doomedsociety.gradlecpp.toolchain.icc.Icc +import org.gradle.nativeplatform.NativeBinarySpec +import org.gradle.nativeplatform.NativeExecutableBinarySpec +import org.gradle.nativeplatform.SharedLibraryBinarySpec +import org.gradle.nativeplatform.StaticLibraryBinarySpec +import org.gradle.nativeplatform.toolchain.VisualCpp + +apply from: 'shared_msvc.gradle' +apply from: 'shared_icc.gradle' + +rootProject.ext.createToolchainConfig = { NativeBinarySpec bin -> + BinaryKind binaryKind + if (bin instanceof NativeExecutableBinarySpec) { + binaryKind = BinaryKind.EXECUTABLE + } else if (bin instanceof SharedLibraryBinarySpec) { + binaryKind = BinaryKind.SHARED_LIBRARY + } else if (bin instanceof StaticLibraryBinarySpec) { + binaryKind = BinaryKind.STATIC_LIBRARY + } else { + throw new RuntimeException("Unknown executable kind ${bin.class.name}") + } + + boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release' + + if (bin.toolChain instanceof VisualCpp) { + return rootProject.createMsvcConfig(releaseBuild, binaryKind) + } else if (bin.toolChain instanceof Icc) { + return rootProject.createIccConfig(releaseBuild, binaryKind) + } else { + throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") + } +} diff --git a/shared_icc.gradle b/shared_icc.gradle new file mode 100644 index 0000000..9fb7e9d --- /dev/null +++ b/shared_icc.gradle @@ -0,0 +1,66 @@ +import org.doomedsociety.gradlecpp.cfg.BinaryKind +import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig +import org.doomedsociety.gradlecpp.gcc.OptimizationLevel + +rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind -> + GccToolchainConfig cfg + if (release) { + cfg = new GccToolchainConfig( + compilerOptions: new GccToolchainConfig.CompilerOptions( + optimizationLevel: OptimizationLevel.LEVEL_3, + stackProtector: false, + interProceduralOptimizations: true, + noBuiltIn: true, + intelExtensions: false, + asmBlocks: true, + positionIndependentCode: false, + + extraDefines: [ + 'linux': null, + '__linux__': null, + 'NDEBUG': null + ] + ), + + linkerOptions: new GccToolchainConfig.LinkerOptions( + interProceduralOptimizations: true, + stripSymbolTable: true, + staticLibGcc: true, + staticIntel: true, + ), + + librarianOptions: new GccToolchainConfig.LibrarianOptions( + ) + ) + } else { + //debug + cfg = new GccToolchainConfig( + compilerOptions: new GccToolchainConfig.CompilerOptions( + optimizationLevel: OptimizationLevel.DISABLE, + stackProtector: true, + interProceduralOptimizations: false, + noBuiltIn: true, + intelExtensions: false, + asmBlocks: true, + + extraDefines: [ + 'linux': null, + '__linux__': null, + 'NDEBUG': null + ] + ), + + linkerOptions: new GccToolchainConfig.LinkerOptions( + interProceduralOptimizations: false, + stripSymbolTable: false, + staticLibGcc: true, + staticIntel: true, + ), + + librarianOptions: new GccToolchainConfig.LibrarianOptions( + ) + ) + } + + return cfg; +} diff --git a/shared_msvc.gradle b/shared_msvc.gradle new file mode 100644 index 0000000..254b63b --- /dev/null +++ b/shared_msvc.gradle @@ -0,0 +1,125 @@ +import org.doomedsociety.gradlecpp.cfg.BinaryKind +import org.doomedsociety.gradlecpp.msvc.CallingConvention +import org.doomedsociety.gradlecpp.msvc.CodeGenerationKind +import org.doomedsociety.gradlecpp.msvc.CppExceptions +import org.doomedsociety.gradlecpp.msvc.DebugInfoFormat +import org.doomedsociety.gradlecpp.msvc.EnhancedInstructionsSet +import org.doomedsociety.gradlecpp.msvc.ErrorReporting +import org.doomedsociety.gradlecpp.msvc.FloatingPointModel +import org.doomedsociety.gradlecpp.msvc.LinkTimeCodeGenKind +import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig +import org.doomedsociety.gradlecpp.msvc.OptimizationLevel +import org.doomedsociety.gradlecpp.msvc.RuntimeChecks +import org.doomedsociety.gradlecpp.msvc.WarningLevel + +rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind -> + MsvcToolchainConfig cfg + if (release) { + cfg = new MsvcToolchainConfig( + compilerOptions: new MsvcToolchainConfig.CompilerOptions( + codeGeneration: CodeGenerationKind.MULTITHREADED, + optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, + debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, + runtimeChecks: RuntimeChecks.DEFAULT, + cppExceptions: CppExceptions.DISABLED, + warningLevel: WarningLevel.LEVEL_3, + callingConvention: CallingConvention.CDECL, + enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, + floatingPointModel: FloatingPointModel.FAST, + + enableMinimalRebuild: false, + omitFramePointers: true, + wholeProgramOptimization: true, + enabledFunctionLevelLinking: true, + enableSecurityCheck: false, + analyzeCode: false, + sdlChecks: false, + treatWarningsAsErrors: false, + treatWchartAsBuiltin: true, + forceConformanceInForLoopScope: true, + + extraDefines: [ + 'WIN32': null, + '_MBCS': null, + 'NDEBUG': null, + 'NOMINMAX': null + ] + ), + + linkerOptions: new MsvcToolchainConfig.LinkerOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, + errorReportingMode: ErrorReporting.NO_ERROR_REPORT, + + enableIncrementalLinking: false, + eliminateUnusedRefs: true, + enableCOMDATFolding: true, + generateDebugInfo: true, + dataExecutionPrevention: true, + randomizedBaseAddress: true + ), + + librarianOptions: new MsvcToolchainConfig.LibrarianOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG + ), + + generatePdb: true + ) + } else { + //debug + cfg = new MsvcToolchainConfig( + compilerOptions: new MsvcToolchainConfig.CompilerOptions( + codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, + optimizationLevel: OptimizationLevel.DISABLED, + debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, + runtimeChecks: RuntimeChecks.DEFAULT, + cppExceptions: CppExceptions.ENABLED_WITH_SEH, + warningLevel: WarningLevel.LEVEL_3, + callingConvention: CallingConvention.CDECL, + enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, + floatingPointModel: FloatingPointModel.FAST, + + enableMinimalRebuild: true, + omitFramePointers: false, + wholeProgramOptimization: false, + enabledFunctionLevelLinking: true, + enableSecurityCheck: true, + analyzeCode: false, + sdlChecks: false, + treatWarningsAsErrors: false, + treatWchartAsBuiltin: true, + forceConformanceInForLoopScope: true, + + extraDefines: [ + 'WIN32': null, + '_MBCS': null, + '_DEBUG': null, + 'NOMINMAX': null, + ] + ), + + linkerOptions: new MsvcToolchainConfig.LinkerOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, + errorReportingMode: ErrorReporting.NO_ERROR_REPORT, + + enableIncrementalLinking: true, + eliminateUnusedRefs: false, + enableCOMDATFolding: false, + generateDebugInfo: true, + dataExecutionPrevention: true, + randomizedBaseAddress: true + ), + + librarianOptions: new MsvcToolchainConfig.LibrarianOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG + ), + + generatePdb: true + ) + + if (binKind == BinaryKind.STATIC_LIBRARY) { + cfg.compilerConfig.extraDefines['_LIB'] = null + } + } + + return cfg +}