+++ /dev/null
-/*\r
- * \r
- * Copyright 2001-2004 The Ant-Contrib project\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package net.sf.antcontrib.cpptasks.sun;\r
-import java.io.File;\r
-import java.util.Vector;\r
-\r
-import net.sf.antcontrib.cpptasks.CUtil;\r
-import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
-import net.sf.antcontrib.cpptasks.compiler.Linker;\r
-import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;\r
-import net.sf.antcontrib.cpptasks.OptimizationEnum;\r
-/**\r
- * Adapter for the Sun (r) Forte (tm) C++ compiler\r
- * \r
- * @author Curt Arnold\r
- */\r
-public final class ForteCCCompiler extends GccCompatibleCCompiler {\r
- private static final ForteCCCompiler instance = new ForteCCCompiler("CC");\r
- /**\r
- * Gets singleton instance of this class\r
- */\r
- public static ForteCCCompiler getInstance() {\r
- return instance;\r
- }\r
- private String identifier;\r
- private File[] includePath;\r
- /**\r
- * Private constructor. Use ForteCCCompiler.getInstance() to get singleton\r
- * instance of this class.\r
- */\r
- private ForteCCCompiler(String command) {\r
- super(command, "-V", false, null, false, null);\r
- }\r
- public void addImpliedArgs(final Vector args, \r
- final boolean debug,\r
- final boolean multithreaded, \r
- final boolean exceptions, \r
- final LinkType linkType,\r
- final Boolean rtti,\r
- final OptimizationEnum optimization) {\r
- args.addElement("-c");\r
- if (debug) {\r
- args.addElement("-g");\r
- }\r
- if (optimization != null) {\r
- if (optimization.isSpeed()) {\r
- args.addElement("-xO2");\r
- }\r
- }\r
- if (rtti != null) {\r
- if (rtti.booleanValue()) {\r
- args.addElement("-features=rtti");\r
- } else {\r
- args.addElement("-features=no%rtti");\r
- }\r
- }\r
- if (multithreaded) {\r
- args.addElement("-mt");\r
- }\r
- if (linkType.isSharedLibrary()) {\r
- args.addElement("-KPIC");\r
- }\r
- \r
- }\r
- public void addWarningSwitch(Vector args, int level) {\r
- switch (level) {\r
- case 0 :\r
- args.addElement("-w");\r
- break;\r
- case 1 :\r
- case 2 :\r
- args.addElement("+w");\r
- break;\r
- case 3 :\r
- case 4 :\r
- case 5 :\r
- args.addElement("+w2");\r
- break;\r
- }\r
- }\r
- public File[] getEnvironmentIncludePath() {\r
- if (includePath == null) {\r
- File ccLoc = CUtil.getExecutableLocation("CC");\r
- if (ccLoc != null) {\r
- File compilerIncludeDir = new File(\r
- new File(ccLoc, "../include").getAbsolutePath());\r
- if (compilerIncludeDir.exists()) {\r
- includePath = new File[2];\r
- includePath[0] = compilerIncludeDir;\r
- }\r
- }\r
- if (includePath == null) {\r
- includePath = new File[1];\r
- }\r
- includePath[includePath.length - 1] = new File("/usr/include");\r
- }\r
- return includePath;\r
- }\r
- public Linker getLinker(LinkType linkType) {\r
- return ForteCCLinker.getInstance().getLinker(linkType);\r
- }\r
- public int getMaximumCommandLength() {\r
- return Integer.MAX_VALUE;\r
- }\r
-}\r