]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkType.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / compiler / LinkType.java
1 /*
2 *
3 * Copyright 2001-2004 The Ant-Contrib project
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17 package net.sf.antcontrib.cpptasks.compiler;
18 import net.sf.antcontrib.cpptasks.OutputTypeEnum;
19 import net.sf.antcontrib.cpptasks.SubsystemEnum;
20 /**
21 * This class represents the target platform for the compile and link step. The
22 * name is an anachronism and should be changed.
23 *
24 * @author Curt Arnold
25 */
26 public class LinkType {
27 private OutputTypeEnum outputType = new OutputTypeEnum();
28 private boolean staticRuntime = false;
29 private SubsystemEnum subsystem = new SubsystemEnum();
30 /**
31 * Constructor
32 *
33 * By default, an gui executable with a dynamically linked runtime
34 *
35 */
36 public LinkType() {
37 }
38 /**
39 * Gets whether the link should produce an executable
40 *
41 * @return boolean
42 */
43 public boolean isExecutable() {
44 String value = outputType.getValue();
45 return value.equals("executable");
46 }
47 /**
48 * Gets whether the link should produce a plugin module.
49 *
50 * @return boolean
51 */
52 public boolean isPluginModule() {
53 String value = outputType.getValue();
54 return value.equals("plugin");
55 }
56 /**
57 * Gets whether the link should produce a shared library.
58 *
59 * @return boolean
60 */
61 public boolean isSharedLibrary() {
62 String value = outputType.getValue();
63 return value.equals("shared") || value.equals("plugin");
64 }
65 /**
66 * Gets whether the link should produce a static library.
67 *
68 * @return boolean
69 */
70 public boolean isStaticLibrary() {
71 String value = outputType.getValue();
72 return value.equals("static");
73 }
74 /**
75 * Gets whether the module should use a statically linked runtime library.
76 *
77 * @return boolean
78 */
79 public boolean isStaticRuntime() {
80 return staticRuntime;
81 }
82 /**
83 * Gets whether the link should produce a module for a console subsystem.
84 *
85 * @return boolean
86 */
87 public boolean isSubsystemConsole() {
88 String value = subsystem.getValue();
89 return value.equals("console");
90 }
91 /**
92 * Gets whether the link should produce a module for a graphical user
93 * interface subsystem.
94 *
95 * @return boolean
96 */
97 public boolean isSubsystemGUI() {
98 String value = subsystem.getValue();
99 return value.equals("gui");
100 }
101 /**
102 * Sets the output type (execuable, shared, etc).
103 *
104 * @param outputType,
105 * may not be null
106 */
107 public void setOutputType(OutputTypeEnum outputType) {
108 if (outputType == null) {
109 throw new IllegalArgumentException("outputType");
110 }
111 this.outputType = outputType;
112 }
113 /**
114 * Requests use of a static runtime library.
115 *
116 * @param staticRuntime
117 * if true, use static runtime library if possible.
118 */
119 public void setStaticRuntime(boolean staticRuntime) {
120 this.staticRuntime = staticRuntime;
121 }
122 /**
123 * Sets the subsystem (gui, console, etc).
124 *
125 * @param subsystem
126 * subsystem, may not be null
127 */
128 public void setSubsystem(SubsystemEnum subsystem) {
129 if (subsystem == null) {
130 throw new IllegalArgumentException("subsystem");
131 }
132 this.subsystem = subsystem;
133 }
134 }