Esempio n. 1
0
		public PBXProject (string name, XCConfigurationList configuration, PBXGroup mainGroup, PBXGroup productGroup)
		{
			this.targets = new List<PBXNativeTarget> ();
			this.configuration = configuration;
			this.productGroup = productGroup;
			this.mainGroup = mainGroup;
			this.name = name;

			configuration.Target = this;
		}
Esempio n. 2
0
		public PBXProject (string name, XCConfigurationList configuration, PBXGroup mainGroup, PBXGroup productGroup)
		{
			this.KnownRegions = new HashSet<string> ();
			this.targets = new List<PBXNativeTarget> ();
			this.configuration = configuration;
			this.productGroup = productGroup;
			this.mainGroup = mainGroup;
			this.name = name;

			configuration.Target = this;
			
			KnownRegions.Add ("en");
		}
		public XcodeProject (string name, string sdkRoot, string configName)
		{
			this.name = name;
			rootGroup = new PBXGroup ("CustomTemplate");
			this.frameworksBuildPhase = new PBXFrameworksBuildPhase ();
			this.resourcesBuildPhase = new PBXResourcesBuildPhase ();
			this.sourcesBuildPhase = new PBXSourcesBuildPhase ();
			this.files = new List<PBXFileReference> ();
			this.sources = new List<PBXBuildFile> ();
			this.groups = new List<PBXGroup> ();
			this.groups.Add (rootGroup);
			
			this.target = new PBXFileReference (name, string.Format ("{0}.app", name), "BUILT_PRODUCTS_DIR");
			this.nativeConfigurationList = new XCConfigurationList ();
			this.projectConfigurationList = new XCConfigurationList ();
			this.nativeBuildConfiguration = new XCBuildConfiguration (configName);
			this.projectBuildConfiguration = new XCBuildConfiguration (configName);
			this.nativeTarget = new PBXNativeTarget (name, nativeConfigurationList, target);
			this.project = new PBXProject (projectConfigurationList, rootGroup);

			nativeBuildConfiguration.AddSetting ("ALWAYS_SEARCH_USER_PATHS", "NO");
			nativeBuildConfiguration.AddSetting ("COPY_PHASE_STRIP", "NO");
			nativeBuildConfiguration.AddSetting ("GCC_DYNAMIC_NO_PIC", "NO");
			nativeBuildConfiguration.AddSetting ("GCC_OPTIMIZATION_LEVEL", "0");
			nativeBuildConfiguration.AddSetting ("GCC_PRECOMPILE_PREFIX_HEADER", "NO");
			nativeBuildConfiguration.AddSetting ("INFOPLIST_FILE", "\"Info.plist\"");
			nativeBuildConfiguration.AddSetting ("PRODUCT_NAME", name);

			this.nativeConfigurationList.AddBuildConfiguration (nativeBuildConfiguration);

			projectBuildConfiguration.AddSetting ("ARCHS", "\"$(ARCHS_STANDARD_32_BIT)\"");
			//projectBuildConfiguration.AddSetting ("\"CODE_SIGN_IDENTITY[sdk=" + sdkRoot + "*]\"", "\"IPhone Developer\"");
			projectBuildConfiguration.AddSetting ("GCC_C_LANGUAGE_STANDARD", "c99");
			projectBuildConfiguration.AddSetting ("GCC_WARN_ABOUT_RETURN_TYPE", "YES");
			projectBuildConfiguration.AddSetting ("GCC_WARN_UNUSED_VARIABLE", "YES");
			projectBuildConfiguration.AddSetting ("PREBINDING", "NO");
			projectBuildConfiguration.AddSetting ("SDKROOT", sdkRoot);
			projectBuildConfiguration.AddSetting ("OTHER_CFLAGS", "\"\"");
			projectBuildConfiguration.AddSetting ("OTHER_LDFLAGS", "\"\"");

			this.projectConfigurationList.AddBuildConfiguration (projectBuildConfiguration);

			this.rootGroup.AddChild (this.target);
			
			this.nativeTarget.AddBuildPhase (frameworksBuildPhase);
			this.nativeTarget.AddBuildPhase (sourcesBuildPhase);
			this.nativeTarget.AddBuildPhase (resourcesBuildPhase);

			this.files.Add (target);
			this.project.AddNativeTarget (nativeTarget);
		}
Esempio n. 4
0
		public XcodeProject (string name, string sdkRoot, string configName)
		{
			this.name = name;

			frameworksGroup = new PBXGroup ("Frameworks", XcodeObjectSortDirection.Descending);
			mainGroup = new PBXGroup (null, XcodeObjectSortDirection.None);
			productsGroup = new PBXGroup ("Products");
			projectGroup = new PBXGroup (name);
			
			this.frameworksBuildPhase = new PBXFrameworksBuildPhase ();
			this.resourcesBuildPhase = new PBXResourcesBuildPhase ();
			this.sourcesBuildPhase = new PBXSourcesBuildPhase ();
			this.files = new List<PBXFileReference> ();
			this.sources = new List<PBXBuildFile> ();
			this.groups = new List<PBXGroup> ();
			
			this.groups.Add (mainGroup);
			this.groups.Add (productsGroup);
			this.groups.Add (frameworksGroup);
			this.groups.Add (projectGroup);

			mainGroup.AddChild (projectGroup);
			mainGroup.AddChild (frameworksGroup);
			mainGroup.AddChild (productsGroup);
			
			this.target = new PBXFileReference (string.Format ("{0}.app", name), "BUILT_PRODUCTS_DIR");
			productsGroup.AddChild (this.target);
			
			this.nativeConfigurationList = new XCConfigurationList ();
			this.projectConfigurationList = new XCConfigurationList ();
			this.nativeBuildConfiguration = new XCBuildConfiguration (configName);
			this.projectBuildConfiguration = new XCBuildConfiguration (configName);
			this.nativeTarget = new PBXNativeTarget (name, nativeConfigurationList, target);
			this.project = new PBXProject (name, projectConfigurationList, mainGroup, productsGroup);

			projectBuildConfiguration.AddSetting ("ALWAYS_SEARCH_USER_PATHS", "NO");
			projectBuildConfiguration.AddSetting ("ARCHS", "\"$(ARCHS_STANDARD_32_BIT)\"");
			//projectBuildConfiguration.AddSetting ("\"CODE_SIGN_IDENTITY[sdk=" + sdkRoot + "*]\"", "\"IPhone Developer\"");
			projectBuildConfiguration.AddSetting ("COPY_PHASE_STRIP", "NO");
			projectBuildConfiguration.AddSetting ("GCC_C_LANGUAGE_STANDARD", "gnu99");
			projectBuildConfiguration.AddSetting ("GCC_DYNAMIC_NO_PIC", "NO");
			projectBuildConfiguration.AddSetting ("GCC_OPTIMIZATION_LEVEL", "0");
			//projectBuildConfiguration.AddSetting ("GCC_PREPROCESSOR_DEFINITIONS", "(\"DEBUG=1\", \"$(inherited)\", )");
			projectBuildConfiguration.AddSetting ("GCC_SYMBOLS_PRIVATE_EXTERN", "NO");
			projectBuildConfiguration.AddSetting ("GCC_VERSION", "com.apple.compilers.llvm.clang.1_0");
			projectBuildConfiguration.AddSetting ("GCC_WARN_ABOUT_MISSING_PROTOTYPES", "YES");
			projectBuildConfiguration.AddSetting ("GCC_WARN_ABOUT_RETURN_TYPE", "YES");
			projectBuildConfiguration.AddSetting ("GCC_WARN_UNUSED_VARIABLE", "YES");
			//projectBuildConfiguration.AddSetting ("IPHONEOS_DEPLOYMENT_TARGET", "5.0");
			projectBuildConfiguration.AddSetting ("OTHER_CFLAGS", "\"\"");
			projectBuildConfiguration.AddSetting ("OTHER_LDFLAGS", "\"\"");
			projectBuildConfiguration.AddSetting ("SDKROOT", sdkRoot);

			this.projectConfigurationList.AddBuildConfiguration (projectBuildConfiguration);

			nativeBuildConfiguration.AddSetting ("GCC_PRECOMPILE_PREFIX_HEADER", "NO");
			//nativeBuildConfiguration.AddSetting ("INFOPLIST_FILE", "\"Info.plist\"");
			nativeBuildConfiguration.AddSetting ("PRODUCT_NAME", name);
			nativeBuildConfiguration.AddSetting ("WRAPPER_EXTENSION", "app");

			this.nativeConfigurationList.AddBuildConfiguration (nativeBuildConfiguration);

			this.nativeTarget.AddBuildPhase (sourcesBuildPhase);
			this.nativeTarget.AddBuildPhase (frameworksBuildPhase);
			this.nativeTarget.AddBuildPhase (resourcesBuildPhase);

			this.files.Add (target);
			this.project.AddNativeTarget (nativeTarget);
		}
Esempio n. 5
0
		public PBXGroup GetGroup (PBXGroup parent, string name)
		{
			foreach (var obj in parent) {
				var grp = obj as PBXGroup;
				if (grp != null && grp.Name ==name)
					return grp;
			}
			return null;
		}
Esempio n. 6
0
		public PBXGroup AddGroup (PBXGroup parent, string name)
		{
			var result = new PBXGroup (name);
			parent.AddChild (result);
			groups.Add (result);
			return result;
		}
Esempio n. 7
0
		public void AddSource (string name, PBXGroup grp = null)
		{
			//sourcesBuildPhase.AddSource (AddFile (Path.GetFileName (name), Path.GetDirectoryName (name), "\"<group>\""));
			sourcesBuildPhase.AddSource (AddFile (name, "\"<group>\"", grp));
		}
Esempio n. 8
0
		public void AddResource (string path, PBXGroup grp = null)
		{
			resourcesBuildPhase.AddResource (AddFile (path, "\"<group>\"", grp));
		}
Esempio n. 9
0
		PBXBuildFile AddFile (string path, string tree, PBXGroup grp = null)
		{
			var fileref = new PBXFileReference (path, tree);
			var buildfile = new PBXBuildFile (fileref);

			files.Add (fileref);
			sources.Add (buildfile);
			if (grp == null) {
				grp = projectGroup;
				
				var parts = path.Split (new [] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
				for (int i = 0; i < parts.Length - 1; i ++)
					grp = (PBXGroup) (grp.GetGroup (parts [i]) ?? AddGroup (grp, parts [i]));
			}
			
			grp.AddChild (fileref);

			return buildfile;
		}
		public PBXGroup AddGroup (string name)
		{
			var result = new PBXGroup (name);
			this.rootGroup.AddChild (result);
			groups.Insert (0, result);
			return result;
		}
		public void AddResource (string name, PBXGroup grp = null)
		{
			AddResource (name, name, grp);
		}
		PBXBuildFile AddFile (string name, string path, string tree, PBXGroup grp = null)
		{
			var fileref = new PBXFileReference (name, path, tree);
			var buildfile = new PBXBuildFile (fileref);

			files.Add (fileref);
			sources.Add (buildfile);
			(grp ?? this.rootGroup).AddChild (fileref);

			return buildfile;
		}
Esempio n. 13
0
		public PBXProject (XCConfigurationList configuration, PBXGroup group)
		{
			this.configuration = configuration;
			this.group = group;
			this.targets = new List<PBXNativeTarget> ();
		}
Esempio n. 14
0
		public void AddSource (string path, PBXGroup grp = null)
		{
			PBXBuildFile buildFile;
			
			if (grp == null)
				grp = CreateGroupFromPath (path);
			
			buildFile = AddFile (path, "\"<group>\"", grp);
			sourcesBuildPhase.AddSource (buildFile);
		}
Esempio n. 15
0
		public void AddResource (string path, PBXGroup grp = null)
		{
			string dir = Path.GetDirectoryName (path);
			PBXBuildFile buildFile;
			
			if (dir.EndsWith (".lproj")) {
				string name = Path.GetFileName (path);
				PBXVariantGroup variant = GetGroup (name) as PBXVariantGroup;
				
				if (variant == null) {
					variant = new PBXVariantGroup (name);
					groups.Add (variant);
					
					if (grp == null)
						projectGroup.AddChild (variant);
					else
						grp.AddChild (variant);
					
					buildFile = new PBXBuildFile (variant);
					resourcesBuildPhase.AddResource (buildFile);
				}
				
				string lang = dir.Substring (0, dir.LastIndexOf ('.'));
				project.KnownRegions.Add (lang);
				
				var fileref = new PBXFileReference (path, "\"<group>\"");
				variant.AddChild (fileref);
				files.Add (fileref);
			} else {
				if (grp == null)
					grp = CreateGroupFromPath (path);
				
				buildFile = AddFile (path, "\"<group>\"", grp);
				resourcesBuildPhase.AddResource (buildFile);
			}
		}
Esempio n. 16
0
		PBXBuildFile AddFile (string path, string tree, PBXGroup grp)
		{
			var fileref = new PBXFileReference (path, tree);
			var buildfile = new PBXBuildFile (fileref);
			
			files.Add (fileref);
			grp.AddChild (fileref);
			sources.Add (buildfile);
			
			return buildfile;
		}