Initial import.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -0,0 +1,70 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2001-2005 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import net.sf.antcontrib.cpptasks.compiler.CommandLineAslcompiler;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Linker;
|
||||
|
||||
/**
|
||||
* Adaptor for Microsoft ASL compiler.
|
||||
*
|
||||
*/
|
||||
public final class DevStudioAslcompiler extends CommandLineAslcompiler {
|
||||
private final static String[] sourceExtensions = new String[] { ".asl" };
|
||||
|
||||
private final static String[] headerExtensions = new String[] {};
|
||||
|
||||
private final static String[] defaultflags = new String[] {};
|
||||
|
||||
private static final DevStudioAslcompiler instance = new DevStudioAslcompiler(
|
||||
"asl", sourceExtensions, headerExtensions, false);
|
||||
|
||||
/**
|
||||
* Gets asl adapter
|
||||
*/
|
||||
public static DevStudioAslcompiler getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor. Use DevStudioAslcompiler.getInstance() to get
|
||||
* singleton instance of this class.
|
||||
*/
|
||||
private DevStudioAslcompiler (String command, String[] sourceExtensions,
|
||||
String[] headerExtensions, boolean isLibtool) {
|
||||
super(command, null, sourceExtensions, headerExtensions, ".aml");
|
||||
}
|
||||
|
||||
public void addImpliedArgs(Vector args, boolean debug, Boolean defaultflag) {
|
||||
if (defaultflag != null && defaultflag.booleanValue()) {
|
||||
for (int i = 0; i < defaultflags.length; i++) {
|
||||
args.addElement(defaultflags[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaximumCommandLength() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public Linker getLinker(LinkType linkType) {
|
||||
return DevStudioLinker.getInstance().getLinker(linkType);
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2001-2005 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.sf.antcontrib.cpptasks.CUtil;
|
||||
import net.sf.antcontrib.cpptasks.compiler.CommandLineAssembler;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Linker;
|
||||
|
||||
/**
|
||||
* Adaptor for Microsoft MASM
|
||||
*
|
||||
*/
|
||||
public final class DevStudioAssembler extends CommandLineAssembler {
|
||||
private final static String[] sourceExtensions = new String[] { ".asm" };
|
||||
|
||||
private final static String[] headerExtensions = new String[] { ".h",
|
||||
".inc" };
|
||||
|
||||
private final static String[] defaultflags = new String[] { "/nologo", "/c" };
|
||||
|
||||
private static final DevStudioAssembler instance = new DevStudioAssembler(
|
||||
"ml", sourceExtensions, headerExtensions, false);
|
||||
|
||||
/**
|
||||
* Gets masm adapter
|
||||
*/
|
||||
public static DevStudioAssembler getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor. Use DevStudioAssembler.getInstance() to get
|
||||
* singleton instance of this class.
|
||||
*/
|
||||
private DevStudioAssembler (String command, String[] sourceExtensions,
|
||||
String[] headerExtensions, boolean isLibtool) {
|
||||
super(command, null, sourceExtensions, headerExtensions, ".obj");
|
||||
}
|
||||
|
||||
public void addImpliedArgs(Vector args, boolean debug, Boolean defaultflag) {
|
||||
if (defaultflag != null && defaultflag.booleanValue()) {
|
||||
for (int i = 0; i < defaultflags.length; i++) {
|
||||
args.addElement(defaultflags[i]);
|
||||
}
|
||||
}
|
||||
if (debug) {
|
||||
args.addElement("Zi");
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaximumCommandLength() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public Linker getLinker(LinkType linkType) {
|
||||
return DevStudioLinker.getInstance().getLinker(linkType);
|
||||
}
|
||||
|
||||
protected File[] getEnvironmentIncludePath() {
|
||||
return CUtil.getPathFromEnvironment("INCLUDE", ";");
|
||||
}
|
||||
|
||||
protected String getIncludeDirSwitch(String includeDir) {
|
||||
return "/I" + includeDir.replace('/', '\\');
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2002-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Linker;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Processor;
|
||||
|
||||
import org.apache.tools.ant.types.Environment;
|
||||
/**
|
||||
* Adapter for the Microsoft(r) C/C++ Optimizing Compiler
|
||||
*
|
||||
* @author Adam Murdoch
|
||||
*/
|
||||
public final class DevStudioCCompiler extends DevStudioCompatibleCCompiler {
|
||||
private static final DevStudioCCompiler instance = new DevStudioCCompiler(
|
||||
"cl", false, null);
|
||||
public static DevStudioCCompiler getInstance() {
|
||||
return instance;
|
||||
}
|
||||
private DevStudioCCompiler(String command, boolean newEnvironment,
|
||||
Environment env) {
|
||||
super(command, "/bogus", newEnvironment, env);
|
||||
}
|
||||
public Processor changeEnvironment(boolean newEnvironment, Environment env) {
|
||||
if (newEnvironment || env != null) {
|
||||
return new DevStudioCCompiler(getCommand(), newEnvironment, env);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public Linker getLinker(LinkType type) {
|
||||
return DevStudioLinker.getInstance().getLinker(type);
|
||||
}
|
||||
public int getMaximumCommandLength() {
|
||||
return 4096;
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2002-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
import net.sf.antcontrib.cpptasks.CUtil;
|
||||
import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
|
||||
import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.compiler.PrecompilingCommandLineCCompiler;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.types.Environment;
|
||||
import net.sf.antcontrib.cpptasks.OptimizationEnum;
|
||||
|
||||
/**
|
||||
* An abstract base class for compilers that are basically command line
|
||||
* compatible with Microsoft(r) C/C++ Optimizing Compiler
|
||||
*
|
||||
* @author Curt Arnold
|
||||
*/
|
||||
public abstract class DevStudioCompatibleCCompiler
|
||||
extends
|
||||
PrecompilingCommandLineCCompiler {
|
||||
private static String[] mflags = new String[]{
|
||||
//
|
||||
// first four are single-threaded
|
||||
// (runtime=static,debug=false), (..,debug=true),
|
||||
// (runtime=dynamic,debug=true), (..,debug=false), (not supported)
|
||||
// next four are multi-threaded, same sequence
|
||||
"/ML", "/MLd", null, null, "/MT", "/MTd", "/MD", "/MDd"};
|
||||
private static String[] defaultflags = new String[]{"/nologo", "/c"};
|
||||
protected DevStudioCompatibleCCompiler(String command,
|
||||
String identifierArg, boolean newEnvironment, Environment env) {
|
||||
super(command, identifierArg, new String[]{".c", ".cc", ".cpp", ".cxx",
|
||||
".c++"}, new String[]{".h", ".hpp", ".inl"}, ".obj", false,
|
||||
null, newEnvironment, env);
|
||||
}
|
||||
protected void addImpliedArgs(final Vector args,
|
||||
final boolean debug,
|
||||
final boolean multithreaded,
|
||||
final boolean exceptions,
|
||||
final LinkType linkType,
|
||||
final Boolean rtti,
|
||||
final OptimizationEnum optimization,
|
||||
final Boolean defaultflag) {
|
||||
if (defaultflag != null && defaultflag.booleanValue()) {
|
||||
for (int i = 0; i < defaultflags.length; i++) {
|
||||
args.addElement(defaultflags[i]);
|
||||
}
|
||||
}
|
||||
if (exceptions) {
|
||||
args.addElement("/GX");
|
||||
}
|
||||
int mindex = 0;
|
||||
if (multithreaded) {
|
||||
mindex += 4;
|
||||
}
|
||||
boolean staticRuntime = linkType.isStaticRuntime();
|
||||
if (!staticRuntime) {
|
||||
mindex += 2;
|
||||
}
|
||||
if (debug) {
|
||||
mindex += 1;
|
||||
args.addElement("/Zi");
|
||||
args.addElement("/Od");
|
||||
args.addElement("/GZ");
|
||||
args.addElement("/D_DEBUG");
|
||||
} else {
|
||||
if (optimization != null) {
|
||||
if (optimization.isSize()) {
|
||||
args.addElement("/O1");
|
||||
}
|
||||
if (optimization.isSpeed()) {
|
||||
args.addElement("/O2");
|
||||
}
|
||||
}
|
||||
args.addElement("/DNDEBUG");
|
||||
}
|
||||
String mflag = mflags[mindex];
|
||||
if (mflag == null) {
|
||||
throw new BuildException(
|
||||
"multithread='false' and runtime='dynamic' not supported");
|
||||
}
|
||||
args.addElement(mflag);
|
||||
if (rtti != null && rtti.booleanValue()) {
|
||||
args.addElement("/GR");
|
||||
}
|
||||
}
|
||||
protected void addWarningSwitch(Vector args, int level) {
|
||||
DevStudioProcessor.addWarningSwitch(args, level);
|
||||
}
|
||||
protected CompilerConfiguration createPrecompileGeneratingConfig(
|
||||
CommandLineCompilerConfiguration baseConfig, File prototype,
|
||||
String lastInclude) {
|
||||
String[] additionalArgs = new String[]{
|
||||
"/Fp" + CUtil.getBasename(prototype) + ".pch", "/Yc"};
|
||||
return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
|
||||
null, true);
|
||||
}
|
||||
protected CompilerConfiguration createPrecompileUsingConfig(
|
||||
CommandLineCompilerConfiguration baseConfig, File prototype,
|
||||
String lastInclude, String[] exceptFiles) {
|
||||
String[] additionalArgs = new String[]{
|
||||
"/Fp" + CUtil.getBasename(prototype) + ".pch",
|
||||
"/Yu" + lastInclude};
|
||||
return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
|
||||
exceptFiles, false);
|
||||
}
|
||||
protected void getDefineSwitch(StringBuffer buffer, String define,
|
||||
String value) {
|
||||
DevStudioProcessor.getDefineSwitch(buffer, define, value);
|
||||
}
|
||||
protected File[] getEnvironmentIncludePath() {
|
||||
return CUtil.getPathFromEnvironment("INCLUDE", ";");
|
||||
}
|
||||
protected String getIncludeDirSwitch(String includeDir) {
|
||||
return DevStudioProcessor.getIncludeDirSwitch(includeDir);
|
||||
}
|
||||
protected void getUndefineSwitch(StringBuffer buffer, String define) {
|
||||
DevStudioProcessor.getUndefineSwitch(buffer, define);
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2002-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
|
||||
/**
|
||||
* Abstract base adapter for librarians with command line options compatible
|
||||
* with the Microsoft(r) Library Manager
|
||||
*
|
||||
* @author Curt Arnold
|
||||
*/
|
||||
public abstract class DevStudioCompatibleLibrarian extends CommandLineLinker {
|
||||
private static String[] defaultflags = new String[]{"/nologo"};
|
||||
public DevStudioCompatibleLibrarian(String command, String identifierArg) {
|
||||
super(command, identifierArg, new String[]{".obj"}, new String[0],
|
||||
".lib", false, null);
|
||||
}
|
||||
protected void addBase(long base, Vector args) {
|
||||
}
|
||||
protected void addFixed(Boolean fixed, Vector args) {
|
||||
}
|
||||
protected void addImpliedArgs(boolean debug, LinkType linkType,
|
||||
Vector args, Boolean defaultflag) {
|
||||
if(defaultflag != null && defaultflag.booleanValue()){
|
||||
for (int i = 0; i < defaultflags.length; i++) {
|
||||
args.addElement(defaultflags[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void addIncremental(boolean incremental, Vector args) {
|
||||
}
|
||||
protected void addMap(boolean map, Vector args) {
|
||||
}
|
||||
protected void addStack(int stack, Vector args) {
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
|
||||
*/
|
||||
protected void addEntry(String entry, Vector args) {
|
||||
}
|
||||
|
||||
protected String getCommandFileSwitch(String cmdFile) {
|
||||
return "@" + cmdFile;
|
||||
}
|
||||
public File[] getLibraryPath() {
|
||||
return new File[0];
|
||||
}
|
||||
public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
|
||||
return new String[0];
|
||||
}
|
||||
public int getMaximumCommandLength() {
|
||||
return 4096;
|
||||
}
|
||||
public String[] getOutputFileSwitch(String outFile) {
|
||||
StringBuffer buf = new StringBuffer("/OUT:");
|
||||
if (outFile.indexOf(' ') >= 0) {
|
||||
buf.append('"');
|
||||
buf.append(outFile);
|
||||
buf.append('"');
|
||||
} else {
|
||||
buf.append(outFile);
|
||||
}
|
||||
return new String[]{buf.toString()};
|
||||
}
|
||||
public boolean isCaseSensitive() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2002-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.sf.antcontrib.cpptasks.CUtil;
|
||||
import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
|
||||
/**
|
||||
* Abstract base class for linkers that try to mimic the command line arguments
|
||||
* for the Microsoft (r) Incremental Linker
|
||||
*
|
||||
* @author Curt Arnold
|
||||
*/
|
||||
public abstract class DevStudioCompatibleLinker extends CommandLineLinker {
|
||||
private static String[] defaultflags = new String[]{"/NOLOGO"};
|
||||
public DevStudioCompatibleLinker(String command, String identifierArg,
|
||||
String outputSuffix) {
|
||||
super(command, identifierArg, new String[]{".obj", ".lib", ".res"},
|
||||
new String[]{".map", ".pdb", ".lnk", ".dll"}, outputSuffix,
|
||||
false, null);
|
||||
}
|
||||
protected void addBase(long base, Vector args) {
|
||||
if (base >= 0) {
|
||||
String baseAddr = Long.toHexString(base);
|
||||
args.addElement("/BASE:0x" + baseAddr);
|
||||
}
|
||||
}
|
||||
protected void addFixed(Boolean fixed, Vector args) {
|
||||
if (fixed != null) {
|
||||
if (fixed.booleanValue()) {
|
||||
args.addElement("/FIXED");
|
||||
} else {
|
||||
args.addElement("/FIXED:NO");
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void addImpliedArgs(boolean debug, LinkType linkType,
|
||||
Vector args, Boolean defaultflag) {
|
||||
if(defaultflag != null && defaultflag.booleanValue()){
|
||||
for (int i = 0; i < defaultflags.length; i++) {
|
||||
args.addElement(defaultflags[i]);
|
||||
}
|
||||
}
|
||||
if (debug) {
|
||||
args.addElement("/DEBUG");
|
||||
}
|
||||
if (linkType.isSharedLibrary()) {
|
||||
args.addElement("/DLL");
|
||||
}
|
||||
/*
|
||||
* if(linkType.isSubsystemGUI()) {
|
||||
* args.addElement("/SUBSYSTEM:WINDOWS"); } else {
|
||||
* if(linkType.isSubsystemConsole()) {
|
||||
* args.addElement("/SUBSYSTEM:CONSOLE"); } }
|
||||
*/
|
||||
}
|
||||
protected void addIncremental(boolean incremental, Vector args) {
|
||||
if (incremental) {
|
||||
args.addElement("/INCREMENTAL:YES");
|
||||
} else {
|
||||
args.addElement("/INCREMENTAL:NO");
|
||||
}
|
||||
}
|
||||
protected void addMap(boolean map, Vector args) {
|
||||
if (map) {
|
||||
args.addElement("/MAP");
|
||||
}
|
||||
}
|
||||
protected void addStack(int stack, Vector args) {
|
||||
if (stack >= 0) {
|
||||
String stackStr = Integer.toHexString(stack);
|
||||
args.addElement("/STACK:0x" + stackStr);
|
||||
}
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
|
||||
*/
|
||||
protected void addEntry(String entry, Vector args) {
|
||||
if (entry != null) {
|
||||
args.addElement("/ENTRY:" + entry);
|
||||
}
|
||||
}
|
||||
|
||||
public String getCommandFileSwitch(String commandFile) {
|
||||
return "@" + commandFile;
|
||||
}
|
||||
public File[] getLibraryPath() {
|
||||
return CUtil.getPathFromEnvironment("LIB", ";");
|
||||
}
|
||||
public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
String[] patterns = new String[libnames.length];
|
||||
for (int i = 0; i < libnames.length; i++) {
|
||||
buf.setLength(0);
|
||||
buf.append(libnames[i]);
|
||||
buf.append(".lib");
|
||||
patterns[i] = buf.toString();
|
||||
}
|
||||
return patterns;
|
||||
}
|
||||
public int getMaximumCommandLength() {
|
||||
return 4096;
|
||||
}
|
||||
public String[] getOutputFileSwitch(String outputFile) {
|
||||
return new String[]{"/OUT:" + outputFile};
|
||||
}
|
||||
public boolean isCaseSensitive() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2002-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Linker;
|
||||
/**
|
||||
* Adapter for the Microsoft (r) Library Manager
|
||||
*
|
||||
* @author Curt Arnold
|
||||
*/
|
||||
public final class DevStudioLibrarian extends DevStudioCompatibleLibrarian {
|
||||
private static final DevStudioLibrarian instance = new DevStudioLibrarian();
|
||||
public static DevStudioLibrarian getInstance() {
|
||||
return instance;
|
||||
}
|
||||
private DevStudioLibrarian() {
|
||||
super("lib", "/bogus");
|
||||
}
|
||||
public Linker getLinker(LinkType type) {
|
||||
return DevStudioLinker.getInstance().getLinker(type);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2001-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Linker;
|
||||
/**
|
||||
* Adapter for the Microsoft (r) Incremental Linker
|
||||
*
|
||||
* @author Adam Murdoch
|
||||
* @author Curt Arnold
|
||||
*/
|
||||
public final class DevStudioLinker extends DevStudioCompatibleLinker {
|
||||
private static final DevStudioLinker dllLinker = new DevStudioLinker(".dll");
|
||||
private static final DevStudioLinker instance = new DevStudioLinker(".exe");
|
||||
public static DevStudioLinker getInstance() {
|
||||
return instance;
|
||||
}
|
||||
private DevStudioLinker(String outputSuffix) {
|
||||
super("link", "/DLL", outputSuffix);
|
||||
}
|
||||
public Linker getLinker(LinkType type) {
|
||||
if (type.isSharedLibrary()) {
|
||||
return dllLinker;
|
||||
}
|
||||
if (type.isStaticLibrary()) {
|
||||
return DevStudioLibrarian.getInstance();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2002-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
import net.sf.antcontrib.cpptasks.CUtil;
|
||||
import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Linker;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Processor;
|
||||
import net.sf.antcontrib.cpptasks.parser.CParser;
|
||||
import net.sf.antcontrib.cpptasks.parser.Parser;
|
||||
import org.apache.tools.ant.types.Environment;
|
||||
import net.sf.antcontrib.cpptasks.OptimizationEnum;
|
||||
|
||||
/**
|
||||
* Adapter for the Microsoft (r) MIDL Compiler
|
||||
*
|
||||
* @author Curt Arnold
|
||||
*/
|
||||
public final class DevStudioMIDLCompiler extends CommandLineCompiler {
|
||||
private static final DevStudioMIDLCompiler instance = new DevStudioMIDLCompiler(
|
||||
false, null);
|
||||
public static DevStudioMIDLCompiler getInstance() {
|
||||
return instance;
|
||||
}
|
||||
private DevStudioMIDLCompiler(boolean newEnvironment, Environment env) {
|
||||
super("midl", null, new String[]{".idl", ".odl"}, new String[]{},
|
||||
".tlb", false, null, newEnvironment, env);
|
||||
}
|
||||
protected void addImpliedArgs(final Vector args,
|
||||
final boolean debug,
|
||||
final boolean multithreaded,
|
||||
final boolean exceptions,
|
||||
final LinkType linkType,
|
||||
final Boolean rtti,
|
||||
final OptimizationEnum optimization,
|
||||
final Boolean defaultflag) {
|
||||
}
|
||||
protected void addWarningSwitch(Vector args, int level) {
|
||||
DevStudioProcessor.addWarningSwitch(args, level);
|
||||
}
|
||||
public Processor changeEnvironment(boolean newEnvironment, Environment env) {
|
||||
if (newEnvironment || env != null) {
|
||||
return new DevStudioMIDLCompiler(newEnvironment, env);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* The include parser for C will work just fine, but we didn't want to
|
||||
* inherit from CommandLineCCompiler
|
||||
*/
|
||||
protected Parser createParser(File source) {
|
||||
return new CParser();
|
||||
}
|
||||
protected int getArgumentCountPerInputFile() {
|
||||
return 3;
|
||||
}
|
||||
protected void getDefineSwitch(StringBuffer buffer, String define,
|
||||
String value) {
|
||||
DevStudioProcessor.getDefineSwitch(buffer, define, value);
|
||||
}
|
||||
protected File[] getEnvironmentIncludePath() {
|
||||
return CUtil.getPathFromEnvironment("INCLUDE", ";");
|
||||
}
|
||||
protected String getIncludeDirSwitch(String includeDir) {
|
||||
return DevStudioProcessor.getIncludeDirSwitch(includeDir);
|
||||
}
|
||||
protected String getInputFileArgument(File outputDir, String filename,
|
||||
int index) {
|
||||
switch (index) {
|
||||
case 0 :
|
||||
return "/tlb";
|
||||
case 1 :
|
||||
return new File(outputDir, getOutputFileName(filename))
|
||||
.getAbsolutePath();
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
public Linker getLinker(LinkType type) {
|
||||
return DevStudioLinker.getInstance().getLinker(type);
|
||||
}
|
||||
public int getMaximumCommandLength() {
|
||||
return 1024;
|
||||
}
|
||||
protected int getMaximumInputFilesPerCommand() {
|
||||
return 1;
|
||||
}
|
||||
protected int getTotalArgumentLengthForInputFile(File outputDir,
|
||||
String inputFile) {
|
||||
String arg1 = getInputFileArgument(outputDir, inputFile, 0);
|
||||
String arg2 = getInputFileArgument(outputDir, inputFile, 1);
|
||||
String arg3 = getInputFileArgument(outputDir, inputFile, 2);
|
||||
return arg1.length() + arg2.length() + arg3.length() + 3;
|
||||
}
|
||||
protected void getUndefineSwitch(StringBuffer buffer, String define) {
|
||||
DevStudioProcessor.getUndefineSwitch(buffer, define);
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2002-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import java.util.Vector;
|
||||
/**
|
||||
* A add-in class for Microsoft Developer Studio processors
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DevStudioProcessor {
|
||||
public static void addWarningSwitch(Vector args, int level) {
|
||||
switch (level) {
|
||||
case 0 :
|
||||
args.addElement("/W0");
|
||||
break;
|
||||
case 1 :
|
||||
args.addElement("/W1");
|
||||
break;
|
||||
case 2 :
|
||||
break;
|
||||
case 3 :
|
||||
args.addElement("/W3");
|
||||
break;
|
||||
case 4 :
|
||||
args.addElement("/W4");
|
||||
break;
|
||||
case 5 :
|
||||
args.addElement("/WX");
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static String getCommandFileSwitch(String cmdFile) {
|
||||
StringBuffer buf = new StringBuffer("@");
|
||||
if (cmdFile.indexOf(' ') >= 0) {
|
||||
buf.append('\"');
|
||||
buf.append(cmdFile.replace('/', '\\'));
|
||||
buf.append('\"');
|
||||
} else {
|
||||
buf.append(cmdFile);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
public static void getDefineSwitch(StringBuffer buffer, String define,
|
||||
String value) {
|
||||
buffer.append("/D");
|
||||
buffer.append(define);
|
||||
if (value != null && value.length() > 0) {
|
||||
buffer.append('=');
|
||||
buffer.append(value);
|
||||
}
|
||||
}
|
||||
public static String getIncludeDirSwitch(String includeDir) {
|
||||
return "/I" + includeDir.replace('/', '\\');
|
||||
}
|
||||
public static String[] getOutputFileSwitch(String outPath) {
|
||||
StringBuffer buf = new StringBuffer("/Fo");
|
||||
if (outPath.indexOf(' ') >= 0) {
|
||||
buf.append('\"');
|
||||
buf.append(outPath);
|
||||
buf.append('\"');
|
||||
} else {
|
||||
buf.append(outPath);
|
||||
}
|
||||
String[] retval = new String[]{buf.toString()};
|
||||
return retval;
|
||||
}
|
||||
public static void getUndefineSwitch(StringBuffer buffer, String define) {
|
||||
buffer.append("/U");
|
||||
buffer.append(define);
|
||||
}
|
||||
public static boolean isCaseSensitive() {
|
||||
return false;
|
||||
}
|
||||
private DevStudioProcessor() {
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2002-2004 The Ant-Contrib project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.antcontrib.cpptasks.devstudio;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.sf.antcontrib.cpptasks.CUtil;
|
||||
import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
|
||||
import net.sf.antcontrib.cpptasks.compiler.LinkType;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Linker;
|
||||
import net.sf.antcontrib.cpptasks.compiler.Processor;
|
||||
import net.sf.antcontrib.cpptasks.parser.CParser;
|
||||
import net.sf.antcontrib.cpptasks.parser.Parser;
|
||||
import net.sf.antcontrib.cpptasks.OptimizationEnum;
|
||||
|
||||
import org.apache.tools.ant.types.Environment;
|
||||
/**
|
||||
* Adapter for the Microsoft (r) Windows 32 Resource Compiler
|
||||
*
|
||||
* @author Curt Arnold
|
||||
*/
|
||||
public final class DevStudioResourceCompiler extends CommandLineCompiler {
|
||||
private static final DevStudioResourceCompiler instance = new DevStudioResourceCompiler(
|
||||
false, null);
|
||||
public static DevStudioResourceCompiler getInstance() {
|
||||
return instance;
|
||||
}
|
||||
private String identifier;
|
||||
private DevStudioResourceCompiler(boolean newEnvironment, Environment env) {
|
||||
super("rc", null, new String[]{".rc"}, new String[]{".h", ".hpp",
|
||||
".inl"}, ".res", false, null, newEnvironment, env);
|
||||
}
|
||||
protected void addImpliedArgs(final Vector args,
|
||||
final boolean debug,
|
||||
final boolean multithreaded,
|
||||
final boolean exceptions,
|
||||
final LinkType linkType,
|
||||
final Boolean rtti,
|
||||
final OptimizationEnum optimization,
|
||||
final Boolean defaultflag) {
|
||||
if (debug) {
|
||||
args.addElement("/D_DEBUG");
|
||||
} else {
|
||||
args.addElement("/DNDEBUG");
|
||||
}
|
||||
}
|
||||
protected void addWarningSwitch(Vector args, int level) {
|
||||
}
|
||||
public Processor changeEnvironment(boolean newEnvironment, Environment env) {
|
||||
if (newEnvironment || env != null) {
|
||||
return new DevStudioResourceCompiler(newEnvironment, env);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* The include parser for C will work just fine, but we didn't want to
|
||||
* inherit from CommandLineCCompiler
|
||||
*/
|
||||
protected Parser createParser(File source) {
|
||||
return new CParser();
|
||||
}
|
||||
protected int getArgumentCountPerInputFile() {
|
||||
return 2;
|
||||
}
|
||||
protected void getDefineSwitch(StringBuffer buffer, String define,
|
||||
String value) {
|
||||
DevStudioProcessor.getDefineSwitch(buffer, define, value);
|
||||
}
|
||||
protected File[] getEnvironmentIncludePath() {
|
||||
return CUtil.getPathFromEnvironment("INCLUDE", ";");
|
||||
}
|
||||
protected String getIncludeDirSwitch(String includeDir) {
|
||||
return DevStudioProcessor.getIncludeDirSwitch(includeDir);
|
||||
}
|
||||
protected String getInputFileArgument(File outputDir, String filename,
|
||||
int index) {
|
||||
if (index == 0) {
|
||||
String outputFileName = getOutputFileName(filename);
|
||||
String fullOutputName = new File(outputDir, outputFileName)
|
||||
.toString();
|
||||
return "/fo" + fullOutputName;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
public Linker getLinker(LinkType type) {
|
||||
return DevStudioLinker.getInstance().getLinker(type);
|
||||
}
|
||||
public int getMaximumCommandLength() {
|
||||
return 1024;
|
||||
}
|
||||
protected int getMaximumInputFilesPerCommand() {
|
||||
return 1;
|
||||
}
|
||||
protected int getTotalArgumentLengthForInputFile(File outputDir,
|
||||
String inputFile) {
|
||||
String arg1 = getInputFileArgument(outputDir, inputFile, 0);
|
||||
String arg2 = getInputFileArgument(outputDir, inputFile, 1);
|
||||
return arg1.length() + arg2.length() + 2;
|
||||
}
|
||||
protected void getUndefineSwitch(StringBuffer buffer, String define) {
|
||||
DevStudioProcessor.getUndefineSwitch(buffer, define);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user