summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorcarnold <[email protected]>2008-01-30 05:19:46 +0000
committercarnold <[email protected]>2008-01-30 05:19:46 +0000
commit105ab312debc0bf5939a48d2a8a887cb8ff7b017 (patch)
treed87511e350eb97111a2106a9516c70797b4a8ee0 /src
parent62752574bace0402a20f94e2e6297333b673eac0 (diff)
Add projectRoot that XCode 3 keeps asking for
git-svn-id: file:///home/sven/projects/JOGL/temp/ant-contrib/svn/ant-contrib-code/cpptasks/trunk@147 32d7a393-a5a9-423c-abd3-5d954feb1f2f
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java10
-rw-r--r--src/samples/hello/build.xml3
-rw-r--r--src/samples/hello/src/main/c/hello.c2
3 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java b/src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java
index bbd96f3..1d77c29 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/apple/XcodeProjectWriter.java
@@ -169,8 +169,13 @@ public final class XcodeProjectWriter
//
// add project to property list
//
+ //
+ // Calculate path (typically several ../..) of the root directory
+ // (where build.xml lives) relative to the XCode project directory.
+ // XCode 3.0 will now prompt user to supply the value if not specified.
+ String projectRoot = CUtil.getRelativePath(basePath, projectDef.getProject().getBaseDir());
PBXObjectRef project = createPBXProject(compilerConfigurations, mainGroup,
- projectDirPath, projectTargets);
+ projectDirPath, projectRoot, projectTargets);
objects.put(project.getID(), project.getProperties());
@@ -564,11 +569,13 @@ public final class XcodeProjectWriter
* @param mainGroup main group.
* @param projectDirPath project directory path.
* @param targets targets.
+ * @param projectRoot projectRoot directory relative to
* @return project.
*/
private static PBXObjectRef createPBXProject(final PBXObjectRef buildConfigurationList,
final PBXObjectRef mainGroup,
final String projectDirPath,
+ final String projectRoot,
final List targets) {
Map map = new HashMap();
map.put("isa", "PBXProject");
@@ -577,6 +584,7 @@ public final class XcodeProjectWriter
map.put("mainGroup", mainGroup.getID());
map.put("projectDirPath", projectDirPath);
map.put("targets", targets);
+ map.put("projectRoot", projectRoot);
return new PBXObjectRef(map);
}
diff --git a/src/samples/hello/build.xml b/src/samples/hello/build.xml
index afefbc7..b8e0b78 100644
--- a/src/samples/hello/build.xml
+++ b/src/samples/hello/build.xml
@@ -19,8 +19,9 @@
<taskdef resource="cpptasks.tasks"/>
<target name="compile">
<mkdir dir="target/main/obj"/>
- <cc outtype="executable" subsystem="console" outfile="target/hello" objdir="target/main/obj">
+ <cc outtype="static" subsystem="console" outfile="target/hello" objdir="target/main/obj">
<fileset dir="src/main/c" includes="*.c"/>
+ <project type="xcode" outfile="hello" overwrite="true"/>
</cc>
</target>
</project>
diff --git a/src/samples/hello/src/main/c/hello.c b/src/samples/hello/src/main/c/hello.c
index b0183a5..6912199 100644
--- a/src/samples/hello/src/main/c/hello.c
+++ b/src/samples/hello/src/main/c/hello.c
@@ -21,5 +21,5 @@
int main(int argc, const char** argv) {
puts("Hello, World.");
- return 1;
+ return 0;
}