]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*\r |
2 | * \r | |
3 | * Copyright 2001-2004 The Ant-Contrib project\r | |
4 | *\r | |
5 | * Licensed under the Apache License, Version 2.0 (the "License");\r | |
6 | * you may not use this file except in compliance with the License.\r | |
7 | * You may obtain a copy of the License at\r | |
8 | *\r | |
9 | * http://www.apache.org/licenses/LICENSE-2.0\r | |
10 | *\r | |
11 | * Unless required by applicable law or agreed to in writing, software\r | |
12 | * distributed under the License is distributed on an "AS IS" BASIS,\r | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r | |
14 | * See the License for the specific language governing permissions and\r | |
15 | * limitations under the License.\r | |
16 | */\r | |
17 | package net.sf.antcontrib.cpptasks.compiler;\r | |
18 | import net.sf.antcontrib.cpptasks.OutputTypeEnum;\r | |
19 | import net.sf.antcontrib.cpptasks.SubsystemEnum;\r | |
20 | /**\r | |
21 | * This class represents the target platform for the compile and link step. The\r | |
22 | * name is an anachronism and should be changed.\r | |
23 | * \r | |
24 | * @author Curt Arnold\r | |
25 | */\r | |
26 | public class LinkType {\r | |
27 | private OutputTypeEnum outputType = new OutputTypeEnum();\r | |
28 | private boolean staticRuntime = false;\r | |
29 | private SubsystemEnum subsystem = new SubsystemEnum();\r | |
30 | /**\r | |
31 | * Constructor\r | |
32 | * \r | |
33 | * By default, an gui executable with a dynamically linked runtime\r | |
34 | * \r | |
35 | */\r | |
36 | public LinkType() {\r | |
37 | }\r | |
38 | /**\r | |
39 | * Gets whether the link should produce an executable\r | |
40 | * \r | |
41 | * @return boolean\r | |
42 | */\r | |
43 | public boolean isExecutable() {\r | |
44 | String value = outputType.getValue();\r | |
45 | return value.equals("executable");\r | |
46 | }\r | |
47 | /**\r | |
48 | * Gets whether the link should produce a plugin module.\r | |
49 | * \r | |
50 | * @return boolean\r | |
51 | */\r | |
52 | public boolean isPluginModule() {\r | |
53 | String value = outputType.getValue();\r | |
54 | return value.equals("plugin");\r | |
55 | }\r | |
56 | /**\r | |
57 | * Gets whether the link should produce a shared library.\r | |
58 | * \r | |
59 | * @return boolean\r | |
60 | */\r | |
61 | public boolean isSharedLibrary() {\r | |
62 | String value = outputType.getValue();\r | |
63 | return value.equals("shared") || value.equals("plugin");\r | |
64 | }\r | |
65 | /**\r | |
66 | * Gets whether the link should produce a static library.\r | |
67 | * \r | |
68 | * @return boolean\r | |
69 | */\r | |
70 | public boolean isStaticLibrary() {\r | |
71 | String value = outputType.getValue();\r | |
72 | return value.equals("static");\r | |
73 | }\r | |
74 | /**\r | |
75 | * Gets whether the module should use a statically linked runtime library.\r | |
76 | * \r | |
77 | * @return boolean\r | |
78 | */\r | |
79 | public boolean isStaticRuntime() {\r | |
80 | return staticRuntime;\r | |
81 | }\r | |
82 | /**\r | |
83 | * Gets whether the link should produce a module for a console subsystem.\r | |
84 | * \r | |
85 | * @return boolean\r | |
86 | */\r | |
87 | public boolean isSubsystemConsole() {\r | |
88 | String value = subsystem.getValue();\r | |
89 | return value.equals("console");\r | |
90 | }\r | |
91 | /**\r | |
92 | * Gets whether the link should produce a module for a graphical user\r | |
93 | * interface subsystem.\r | |
94 | * \r | |
95 | * @return boolean\r | |
96 | */\r | |
97 | public boolean isSubsystemGUI() {\r | |
98 | String value = subsystem.getValue();\r | |
99 | return value.equals("gui");\r | |
100 | }\r | |
101 | /**\r | |
102 | * Sets the output type (execuable, shared, etc).\r | |
103 | * \r | |
104 | * @param outputType,\r | |
105 | * may not be null\r | |
106 | */\r | |
107 | public void setOutputType(OutputTypeEnum outputType) {\r | |
108 | if (outputType == null) {\r | |
109 | throw new IllegalArgumentException("outputType");\r | |
110 | }\r | |
111 | this.outputType = outputType;\r | |
112 | }\r | |
113 | /**\r | |
114 | * Requests use of a static runtime library.\r | |
115 | * \r | |
116 | * @param staticRuntime\r | |
117 | * if true, use static runtime library if possible.\r | |
118 | */\r | |
119 | public void setStaticRuntime(boolean staticRuntime) {\r | |
120 | this.staticRuntime = staticRuntime;\r | |
121 | }\r | |
122 | /**\r | |
123 | * Sets the subsystem (gui, console, etc).\r | |
124 | * \r | |
125 | * @param subsystem\r | |
126 | * subsystem, may not be null\r | |
127 | */\r | |
128 | public void setSubsystem(SubsystemEnum subsystem) {\r | |
129 | if (subsystem == null) {\r | |
130 | throw new IllegalArgumentException("subsystem");\r | |
131 | }\r | |
132 | this.subsystem = subsystem;\r | |
133 | }\r | |
134 | }\r |