forked from dcariola/XCodeEditor-for-Unity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXCBuildConfiguration.cs
More file actions
184 lines (146 loc) · 5.91 KB
/
XCBuildConfiguration.cs
File metadata and controls
184 lines (146 loc) · 5.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
using UnityEngine;
using System.Collections;
namespace UnityEditor.SKZXCodeEditor
{
public class XCBuildConfiguration : PBXObject
{
protected const string BUILDSETTINGS_KEY = "buildSettings";
protected const string HEADER_SEARCH_PATHS_KEY = "HEADER_SEARCH_PATHS";
protected const string LIBRARY_SEARCH_PATHS_KEY = "LIBRARY_SEARCH_PATHS";
protected const string FRAMEWORK_SEARCH_PATHS_KEY = "FRAMEWORK_SEARCH_PATHS";
protected const string LD_RUNPATH_SEARCH_PATHS_KEY = "LD_RUNPATH_SEARCH_PATHS";
protected const string OTHER_C_FLAGS_KEY = "OTHER_CFLAGS";
protected const string OTHER_LD_FLAGS_KEY = "OTHER_LDFLAGS";
protected const string GCC_ENABLE_CPP_EXCEPTIONS_KEY = "GCC_ENABLE_CPP_EXCEPTIONS";
protected const string GCC_ENABLE_OBJC_EXCEPTIONS_KEY = "GCC_ENABLE_OBJC_EXCEPTIONS";
public XCBuildConfiguration( string guid, PBXDictionary dictionary ) : base( guid, dictionary )
{
}
public PBXDictionary buildSettings {
get {
if( ContainsKey( BUILDSETTINGS_KEY ) )
return (PBXDictionary)_data[BUILDSETTINGS_KEY];
return null;
}
}
protected bool AddSearchPaths( string path, string key, bool recursive = true )
{
PBXList paths = new PBXList();
paths.Add( path );
return AddSearchPaths( paths, key, recursive );
}
protected bool AddSearchPaths( PBXList paths, string key, bool recursive = true )
{
bool modified = false;
if( !ContainsKey( BUILDSETTINGS_KEY ) )
this.Add( BUILDSETTINGS_KEY, new PBXDictionary() );
foreach( string path in paths ) {
string currentPath = path;
if( recursive && !path.EndsWith( "/**" ) )
currentPath += "/**";
if( !((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey( key ) ) {
((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add( key, new PBXList() );
}
else if( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] is string ) {
PBXList list = new PBXList();
list.Add( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] );
((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] = list;
}
currentPath = "\\\"" + currentPath + "\\\"";
if( !((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Contains( currentPath ) ) {
((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Add( currentPath );
modified = true;
}
}
return modified;
}
public bool AddLDRuntimeSearchPaths( PBXList paths, bool recursive = true )
{
return this.AddSearchPaths( paths, LD_RUNPATH_SEARCH_PATHS_KEY, recursive );
}
public bool AddHeaderSearchPaths( PBXList paths, bool recursive = true )
{
return this.AddSearchPaths( paths, HEADER_SEARCH_PATHS_KEY, recursive );
}
public bool AddLibrarySearchPaths( PBXList paths, bool recursive = true )
{
return this.AddSearchPaths( paths, LIBRARY_SEARCH_PATHS_KEY, recursive );
}
public bool AddFrameworkSearchPaths(PBXList paths, bool recursive = true)
{
return this.AddSearchPaths(paths, FRAMEWORK_SEARCH_PATHS_KEY, recursive);
}
public bool AddOtherCFlags( string flag )
{
//Debug.Log( "INIZIO 1" );
PBXList flags = new PBXList();
flags.Add( flag );
return AddOtherCFlags( flags );
}
public bool AddOtherCFlags( PBXList flags )
{
//Debug.Log( "INIZIO 2" );
bool modified = false;
if( !ContainsKey( BUILDSETTINGS_KEY ) )
this.Add( BUILDSETTINGS_KEY, new PBXDictionary() );
foreach( string flag in flags ) {
if( !((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey( OTHER_C_FLAGS_KEY ) ) {
((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add( OTHER_C_FLAGS_KEY, new PBXList() );
}
else if ( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[ OTHER_C_FLAGS_KEY ] is string ) {
string tempString = (string)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_C_FLAGS_KEY];
((PBXDictionary)_data[BUILDSETTINGS_KEY])[ OTHER_C_FLAGS_KEY ] = new PBXList();
((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_C_FLAGS_KEY]).Add( tempString );
}
if( !((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_C_FLAGS_KEY]).Contains( flag ) ) {
((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_C_FLAGS_KEY]).Add( flag );
modified = true;
}
}
return modified;
}
public bool AddOtherLDFlags( string flag )
{
//Debug.Log( "INIZIO A" );
PBXList flags = new PBXList();
flags.Add( flag );
return AddOtherLDFlags( flags );
}
public bool AddOtherLDFlags( PBXList flags )
{
//Debug.Log( "INIZIO B" );
bool modified = false;
if( !ContainsKey( BUILDSETTINGS_KEY ) )
this.Add( BUILDSETTINGS_KEY, new PBXDictionary() );
foreach( string flag in flags ) {
if( !((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey( OTHER_LD_FLAGS_KEY ) ) {
((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add( OTHER_LD_FLAGS_KEY, new PBXList() );
}
else if ( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[ OTHER_LD_FLAGS_KEY ] is string ) {
string tempString = (string)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_LD_FLAGS_KEY];
((PBXDictionary)_data[BUILDSETTINGS_KEY])[ OTHER_LD_FLAGS_KEY ] = new PBXList();
((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_LD_FLAGS_KEY]).Add( tempString );
}
if( !((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_LD_FLAGS_KEY]).Contains( flag ) ) {
((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_LD_FLAGS_KEY]).Add( flag );
modified = true;
}
}
return modified;
}
public bool GccEnableCppExceptions (string value)
{
if (!ContainsKey (BUILDSETTINGS_KEY))
this.Add (BUILDSETTINGS_KEY, new PBXDictionary ());
((PBXDictionary)_data [BUILDSETTINGS_KEY])[GCC_ENABLE_CPP_EXCEPTIONS_KEY] = value;
return true;
}
public bool GccEnableObjCExceptions (string value)
{
if (!ContainsKey (BUILDSETTINGS_KEY))
this.Add (BUILDSETTINGS_KEY, new PBXDictionary ());
((PBXDictionary)_data [BUILDSETTINGS_KEY])[GCC_ENABLE_OBJC_EXCEPTIONS_KEY] = value;
return true;
}
}
}