3 * Copyright 2001-2004 The Ant-Contrib project
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package net
.sf
.antcontrib
.cpptasks
.compiler
;
18 import net
.sf
.antcontrib
.cpptasks
.OutputTypeEnum
;
19 import net
.sf
.antcontrib
.cpptasks
.SubsystemEnum
;
21 * This class represents the target platform for the compile and link step. The
22 * name is an anachronism and should be changed.
26 public class LinkType
{
27 private OutputTypeEnum outputType
= new OutputTypeEnum();
28 private boolean staticRuntime
= false;
29 private SubsystemEnum subsystem
= new SubsystemEnum();
33 * By default, an gui executable with a dynamically linked runtime
39 * Gets whether the link should produce an executable
43 public boolean isExecutable() {
44 String value
= outputType
.getValue();
45 return value
.equals("executable");
48 * Gets whether the link should produce a plugin module.
52 public boolean isPluginModule() {
53 String value
= outputType
.getValue();
54 return value
.equals("plugin");
57 * Gets whether the link should produce a shared library.
61 public boolean isSharedLibrary() {
62 String value
= outputType
.getValue();
63 return value
.equals("shared") || value
.equals("plugin");
66 * Gets whether the link should produce a static library.
70 public boolean isStaticLibrary() {
71 String value
= outputType
.getValue();
72 return value
.equals("static");
75 * Gets whether the module should use a statically linked runtime library.
79 public boolean isStaticRuntime() {
83 * Gets whether the link should produce a module for a console subsystem.
87 public boolean isSubsystemConsole() {
88 String value
= subsystem
.getValue();
89 return value
.equals("console");
92 * Gets whether the link should produce a module for a graphical user
93 * interface subsystem.
97 public boolean isSubsystemGUI() {
98 String value
= subsystem
.getValue();
99 return value
.equals("gui");
102 * Sets the output type (execuable, shared, etc).
107 public void setOutputType(OutputTypeEnum outputType
) {
108 if (outputType
== null) {
109 throw new IllegalArgumentException("outputType");
111 this.outputType
= outputType
;
114 * Requests use of a static runtime library.
116 * @param staticRuntime
117 * if true, use static runtime library if possible.
119 public void setStaticRuntime(boolean staticRuntime
) {
120 this.staticRuntime
= staticRuntime
;
123 * Sets the subsystem (gui, console, etc).
126 * subsystem, may not be null
128 public void setSubsystem(SubsystemEnum subsystem
) {
129 if (subsystem
== null) {
130 throw new IllegalArgumentException("subsystem");
132 this.subsystem
= subsystem
;