iphonelazext: fixing the warning (ansi to wide, wide to ansi) shown on fpc 3. Updating building script. Forcing to use the script file on Xcode project generation. Using custom options in Xcode project. Fix resolving of project paths

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5045 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2016-07-29 03:34:23 +00:00
parent 43a1354fe2
commit 70fe3a5109
11 changed files with 224 additions and 88 deletions

View File

@@ -1,31 +1,93 @@
## start ## The script builds the project for both 32 and 64-bit architectures
## It's requirement for Apple to support both arm32 and arm64 for a device
## Some Simulators might still be 32-bit (iPhone4, iPads), thus both x86 and x86_64
## are compiled
echo "compiling FPC project" echo "compiling FPC project"
export RESULT_EXE=${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH} export RESULT_EXE=${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}
export IOSHEADERS=
cd $FPC_MAIN_DIR cd $FPC_MAIN_DIR
#rm $RESULT_EXE
export TargetCPU=${PLATFORM_PREFERRED_ARCH}
export TargetCPU=${PLATFORM_PREFERRED_ARCH}
## default compile options, assuming ARM
export OPT32=${FPC_OPT_A32}
export OPT64=${FPC_OPT_A64}
export CPU32="arm"
export CPU64="aarch64"
export TargetOS="darwin"
## Simulator has been selected in Xcode project
## switching options to Intel
if [ "${PLATFORM_NAME}" == "iphonesimulator" ]; then if [ "${PLATFORM_NAME}" == "iphonesimulator" ]; then
export TargetOS="iphonesim" export OPT32=${FPC_OPT_I32}
export OPT64=${FPC_OPT_I64}
export CPU32="i386"
export CPU64="x86_64"
export TargetOS="iphonesim"
fi fi
## 64-bit compilation
export Result64=${RESULT_EXE}_64
export TargetCPU=${CPU64}
export Target=${TargetCPU}-${TargetOS} export Target=${TargetCPU}-${TargetOS}
pwd ## making output directory
echo ${RESULT_EXE} export outdir=lib/${Target}
mkdir -p ${outdir}
## debugging echo
echo ${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} \
${FPC_CUSTOM_OPTIONS} ${OPT64} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-o${Result64}
${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} \
${FPC_CUSTOM_OPTIONS} ${OPT64} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-o${Result64}
${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} -MDelphi -Scghi -O1 -l -dIPHONEALL \
${FPC_CUSTOM_OPTIONS} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-o${RESULT_EXE}
export RES=$? export RES=$?
## if compiler returned an error, stop the script and exit with error
if [ $RES != 0 ]; then if [ $RES != 0 ]; then
exit $RES exit $RES
fi fi
echo ${RESULT_EXE}
exit $FPCRES ## 32-bit complication
export Result32=${RESULT_EXE}_32
export TargetCPU=${CPU32}
export Target=${TargetCPU}-${TargetOS}
## making output directory
export outdir=lib/${Target}
mkdir -p ${outdir}
echo ${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} \
${FPC_CUSTOM_OPTIONS} ${OPT32} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-o${Result32}
${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} \
${FPC_CUSTOM_OPTIONS} ${OPT32} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-o${Result32}
export RES=$?
## if compiler returned an error, stop the script and exit with error
if [ $RES != 0 ]; then
exit $RES
fi
## both 32 and 64 are done, making the fat binary
lipo -create ${Result32} ${Result64} -output ${RESULT_EXE}
## removing 32 and 64 bit
rm ${Result32}
rm ${Result64}
exit $FPCRES

View File

@@ -25,6 +25,7 @@ uses
Graphics, Controls, Forms, Dialogs, LazFileUtils, Graphics, Controls, Forms, Dialogs, LazFileUtils,
{Lazarus Interface} {Lazarus Interface}
LazIDEIntf, MenuIntf, ProjectIntf, IDEOptionsIntf, IDEMsgIntf LazIDEIntf, MenuIntf, ProjectIntf, IDEOptionsIntf, IDEMsgIntf
,CompOptsIntf
,IDEExternToolIntf ,IDEExternToolIntf
,project_iphone_options, xcodetemplate, iphonelog_form, ,project_iphone_options, xcodetemplate, iphonelog_form,
@@ -395,6 +396,7 @@ var
Info : TiPhoneBundleInfo; Info : TiPhoneBundleInfo;
opt : string; opt : string;
prjopt : TLazCompilerOptions;
begin begin
// the create .plist would be used by XCode project // the create .plist would be used by XCode project
// the simulator .plist in created with InstallAppToSim. // the simulator .plist in created with InstallAppToSim.
@@ -413,12 +415,12 @@ begin
build.Add('FPC_MAIN_FILE','"'+LazarusIDE.ActiveProject.MainFile.Filename+'"'); build.Add('FPC_MAIN_FILE','"'+LazarusIDE.ActiveProject.MainFile.Filename+'"');
opt:=''; opt:='';
with LazarusIDE.ActiveProject.LazCompilerOptions do begin prjopt:=LazarusIDE.ActiveProject.LazCompilerOptions;
opt:=opt + ' ' +BreakPathsStringToOption(OtherUnitFiles, '-Fu', '\"'); opt:=opt + ' ' +BreakPathsStringToOption(prjopt.GetUnitPath(true, coptParsedPlatformIndependent), '-Fu', '\"');
opt:=opt + ' ' +BreakPathsStringToOption(IncludePath, '-Fi', '\"'); opt:=opt + ' ' +BreakPathsStringToOption(prjopt.GetIncludePath(true, coptParsedPlatformIndependent), '-Fi', '\"');
opt:=opt + ' ' +BreakPathsStringToOption(ObjectPath, '-Fo', '\"'); opt:=opt + ' ' +BreakPathsStringToOption(prjopt.GetObjectPath(true, coptParsedPlatformIndependent), '-Fo', '\"');
opt:=opt + ' ' +BreakPathsStringToOption(Libraries, '-Fl', '\"'); opt:=opt + ' ' +BreakPathsStringToOption(prjopt.GetLibraryPath(true, coptParsedPlatformIndependent), '-Fl', '\"');
end; opt:=opt + ' ' +prjopt.CustomOptions;
dir:=ResolveProjectPath('xcode'); dir:=ResolveProjectPath('xcode');
dir:=dir+'/'; dir:=dir+'/';
@@ -469,6 +471,14 @@ begin
templates.Values['mainfile']:=LazarusIDE.ActiveProject.MainFile.Filename; templates.Values['mainfile']:=LazarusIDE.ActiveProject.MainFile.Filename;
templates.Values['projoptions']:=opt; templates.Values['projoptions']:=opt;
if FileExists(EnvOptions.ScriptTemplate) then begin
try
DefaultBuildScript:=ReadBuildScriptFile( EnvOptions.ScriptTemplate );
except
end;
end;
if not UpdateProject(projName, templates, ProjOptions.ResFiles) then if not UpdateProject(projName, templates, ProjOptions.ResFiles) then
IDEMsg(Format(strXcodeUpdFailed,[projdir])) IDEMsg(Format(strXcodeUpdFailed,[projdir]))
else else

View File

@@ -61,6 +61,92 @@ function RandomSpaceName: WideString;
implementation implementation
(* Build script:
## start
echo "compiling FPC project"
export RESULT_EXE=${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}
export IOSHEADERS=
cd $FPC_MAIN_DIR
export TargetCPU=${PLATFORM_PREFERRED_ARCH}
export OPT32=${FPC_OPT_A32}
export OPT64=${FPC_OPT_A64}
export CPU32="arm"
export CPU64="aarch64"
export TargetOS="darwin"
if [ "${PLATFORM_NAME}" == "iphonesimulator" ]; then
export OPT32=${FPC_OPT_I32}
export OPT64=${FPC_OPT_I64}
export CPU32="i386"
export CPU64="x86_64"
export TargetOS="iphonesim"
fi
# 64-bit compilation
export Result64=${RESULT_EXE}_64
export TargetCPU=${CPU64}
export Target=${TargetCPU}-${TargetOS}
## making output directory
export outdir=lib/${Target}
mkdir -p ${outdir}
echo ${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} -MDelphi -Scghi -O3 -l -dIPHONEALL \
${FPC_CUSTOM_OPTIONS} ${OPT64} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-o${Result64}
${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} -MDelphi -Scghi -O3 -l -dIPHONEALL \
${FPC_CUSTOM_OPTIONS} ${OPT64} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-k-F/Users/dmitry/FPC_laz/paseng/tests/testBomber3UI -k-t \
-o${Result64}
export RES=$?
if [ $RES != 0 ]; then
exit $RES
fi
# 32-bit complication
export Result32=${RESULT_EXE}_32
export TargetCPU=${CPU32}
export Target=${TargetCPU}-${TargetOS}
## making output directory
export outdir=lib/${Target}
mkdir -p ${outdir}
echo ${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} -MDelphi -Scghi -Cg -O3 -l -dIPHONEALL \
${FPC_CUSTOM_OPTIONS} ${OPT32} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-k-F/Users/dmitry/FPC_laz/paseng/tests/testBomber3UI \
-o${Result32}
${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} -MDelphi -Scghi -Cg -O3 -l -dIPHONEALL \
${FPC_CUSTOM_OPTIONS} ${OPT32} \
-Filib/${Target} -FUlib/${Target} \
-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \
-k-F/Users/dmitry/FPC_laz/paseng/tests/testBomber3UI \
-o${Result32}
export RES=$?
if [ $RES != 0 ]; then
exit $RES
fi
lipo -create ${Result32} ${Result64} -output ${RESULT_EXE}
rm ${Result32}
rm ${Result64}
exit $FPCRES
*)
uses uses
iPhoneExtOptions; iPhoneExtOptions;
@@ -72,7 +158,7 @@ begin
CreateGUID(g); CreateGUID(g);
id:=GUIDToString(g); id:=GUIDToString(g);
id:=Copy(id, 2, length(id)-2); id:=Copy(id, 2, length(id)-2);
Result:=id; Result:=UTF8Decode(id);
end; end;
@@ -119,7 +205,7 @@ begin
if DirectoryExistsUTF8(p) then if DirectoryExistsUTF8(p) then
Result:=UTF8Decode(p) Result:=UTF8Decode(p)
else if DirectoryExistsUTF8(path8) then else if DirectoryExistsUTF8(path8) then
result:=path8 result:=UTF8Decode(path8)
else else
result :=''; result :='';
end; end;
@@ -145,7 +231,7 @@ var
begin begin
s := EnvOptions.SimAppsPath; s := EnvOptions.SimAppsPath;
EnvOptions.SubstituteMacros(s); EnvOptions.SubstituteMacros(s);
result := s; result := UTF8Decode(s);
end; end;
{ {
@@ -226,12 +312,13 @@ var
pl : TPListFile; pl : TPListFile;
arr : TPListValue; arr : TPListValue;
begin begin
Result:=false;
pl := TPListFile.Create; pl := TPListFile.Create;
try try
if not FileExists(InfoFileName) then begin if not FileExists(InfoFileName) then begin
InitDefaultPlist(pl); InitDefaultPlist(pl);
end else end else
LoadFromFile(InfoFileName, pl); LoadFromFile( UTF8Encode(InfoFileName), pl);
SetStr(pl, 'CFBundleDisplayName', info.DisplayName); SetStr(pl, 'CFBundleDisplayName', info.DisplayName);
SetStr(pl, 'CFBundleExecutable', ExeName); SetStr(pl, 'CFBundleExecutable', ExeName);
SetStr(pl, 'CFBundleIdentifier', info.AppID); SetStr(pl, 'CFBundleIdentifier', info.AppID);
@@ -241,7 +328,7 @@ begin
SetStr(pl, 'DTPlatformName', info.iPlatform); SetStr(pl, 'DTPlatformName', info.iPlatform);
SetStr(pl, 'DTSDKName', info.SDKVersion); SetStr(pl, 'DTSDKName', info.SDKVersion);
SaveToXMLFile(pl, InfoFileName); Result:=SaveToXMLFile(pl, UTF8Encode(InfoFileName));
finally finally
pl.Free; pl.Free;
end; end;
@@ -260,7 +347,7 @@ const
' <key>CFBundleIdentifier</key>'#10+ ' <string>%s</string>'#10+ {company + bundle name} ' <key>CFBundleIdentifier</key>'#10+ ' <string>%s</string>'#10+ {company + bundle name}
' <key>CFBundleInfoDictionaryVersion</key>'#10+ ' <string>6.0</string>'#10+ ' <key>CFBundleInfoDictionaryVersion</key>'#10+ ' <string>6.0</string>'#10+
' <key>CFBundleName</key>'#10+ ' <string>%s</string>'#10+ {bundle name} ' <key>CFBundleName</key>'#10+ ' <string>%s</string>'#10+ {bundle name}
' <key>CFBundlePackageType</key>'#10+ ' <string>APPL</string>'#10+ ' <key>CFBundlePackageType</key>'#10+ ' <string>APPL</string>'#10+ // must be present for AppStore deployment!
' <key>CFBundleSignature</key>'#10+ ' <string>????</string>'#10+ ' <key>CFBundleSignature</key>'#10+ ' <string>????</string>'#10+
' <key>CFBundleSupportedPlatforms</key>'#10+ ' <array>'#10+' <string>%s</string>'#10+' </array>'#10+ {platform} ' <key>CFBundleSupportedPlatforms</key>'#10+ ' <array>'#10+' <string>%s</string>'#10+' </array>'#10+ {platform}
'%s'+ // optional MainNib name '%s'+ // optional MainNib name

View File

@@ -21,7 +21,7 @@ interface
uses uses
Classes, SysUtils, IDEOptionsIntf, LazIDEIntf, ProjectIntf, MacroIntf, Classes, SysUtils, IDEOptionsIntf, LazIDEIntf, ProjectIntf, MacroIntf,
iPhoneBundle, XMLConf, XcodeUtils, PlistFile iPhoneBundle, XMLConf, XcodeUtils
, LazFileUtils, LazFilesUtils , LazFileUtils, LazFilesUtils
, iphonesimctrl, xcodeproj; , iphonesimctrl, xcodeproj;
@@ -306,15 +306,15 @@ begin
try try
xmlcfg.RootName:='config'; xmlcfg.RootName:='config';
xmlcfg.Filename:=XMLFileName; xmlcfg.Filename:=XMLFileName;
fPlatformsBaseDir := UTF8Encode(xmlcfg.GetValue('Platforms', fPlatformsBaseDir )); fPlatformsBaseDir := UTF8Encode(xmlcfg.GetValue('Platforms', UTF8Decode(fPlatformsBaseDir) ));
fCompilerPath := UTF8Encode(xmlcfg.GetValue('Compiler', fCompilerPath)); fCompilerPath := UTF8Encode(xmlcfg.GetValue('Compiler', UTF8Decode(fCompilerPath)));
fBaseRTLPath := UTF8Encode(xmlcfg.GetValue('RTLPath', fBaseRTLPath)); fBaseRTLPath := UTF8Encode(xmlcfg.GetValue('RTLPath', UTF8Decode(fBaseRTLPath)));
fCommonOpt := UTF8Encode(xmlcfg.GetValue('CompilerOptions', fCommonOpt)); fCommonOpt := UTF8Encode(xmlcfg.GetValue('CompilerOptions', UTF8Decode(fCommonOpt)));
fSimBundle := UTF8Encode(xmlcfg.GetValue('SimBundle', fSimBundle)); fSimBundle := UTF8Encode(xmlcfg.GetValue('SimBundle', UTF8Decode(fSimBundle)));
fSimAppsPath := UTF8Encode(xmlcfg.GetValue('SimAppPath', fSimAppsPath)); fSimAppsPath := UTF8Encode(xmlcfg.GetValue('SimAppPath', UTF8Decode(fSimAppsPath)));
fDefaultSDK := UTF8Encode(xmlcfg.GetValue('DefaultSDK', fDefaultSDK)); fDefaultSDK := UTF8Encode(xmlcfg.GetValue('DefaultSDK', UTF8Decode(fDefaultSDK)));
fDefaultDeviceID := UTF8Encode(xmlcfg.GetValue('DefaultDevice', fDefaultDeviceID)); fDefaultDeviceID := UTF8Encode(xmlcfg.GetValue('DefaultDevice', UTF8Decode(fDefaultDeviceID)));
fScriptTemplate := UTF8Encode(xmlcfg.GetValue('ScriptTemplate', fScriptTemplate)); fScriptTemplate := UTF8Encode(xmlcfg.GetValue('ScriptTemplate', UTF8Decode(fScriptTemplate)));
RefreshVersions; RefreshVersions;
if (fDefaultSDK = '') and (fVersions.Count>0) then if (fDefaultSDK = '') and (fVersions.Count>0) then

View File

@@ -24,7 +24,7 @@
</CodeGeneration> </CodeGeneration>
<Other> <Other>
<CompilerMessages> <CompilerMessages>
<IgnoredMessages idx5091="True" idx5060="True" idx5057="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True" idx4055="True"/> <IgnoredMessages idx5091="True" idx5060="True" idx5057="True" idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True" idx4055="True"/>
</CompilerMessages> </CompilerMessages>
</Other> </Other>
</CompilerOptions> </CompilerOptions>

View File

@@ -267,7 +267,6 @@ var
l : string; l : string;
st : TStringList; st : TStringList;
i : integer; i : integer;
j : integer;
ip : string; // install path ip : string; // install path
fp : string; // content path fp : string; // content path
begin begin

View File

@@ -711,7 +711,7 @@ const
FlagGet = 3; // 1 + 2 //ptField = 0; FlagGet = 3; // 1 + 2 //ptField = 0;
FlagSet = 12; // 4 + 8 , 16 + 32 //ptStatic = 1; FlagSet = 12; // 4 + 8 , 16 + 32 //ptStatic = 1;
FlagSP = 16 + 32; //ptVirtual = 2; FlagSP = 16 + 32; //ptVirtual = 2;
FlagIdx = 64; //ptConst = 3; } FlagIdx = 64; //ptConst = 3;
begin begin
if (not Assigned(obj)) or (not Assigned(srz)) then Exit; if (not Assigned(obj)) or (not Assigned(srz)) then Exit;

View File

@@ -698,7 +698,7 @@ end;
function ProjectCreateMin: PBXProject; function ProjectCreateMin: PBXProject;
var var
p : PBXProject; p : PBXProject;
cfg : XCBuildConfiguration; //cfg : XCBuildConfiguration;
begin begin
// requirements: // requirements:
// * at least one build configuration // * at least one build configuration
@@ -709,8 +709,8 @@ begin
p.buildConfigurationList._headerComment:='Build configuration list for PBXProject'; p.buildConfigurationList._headerComment:='Build configuration list for PBXProject';
p.buildConfigurationList.defaultConfigurationIsVisible:='0'; p.buildConfigurationList.defaultConfigurationIsVisible:='0';
cfg:=p.buildConfigurationList.addConfig('Debug'); p.buildConfigurationList.addConfig('Debug');
cfg:=p.buildConfigurationList.addConfig('Release'); p.buildConfigurationList.addConfig('Release');
// default name must be present // default name must be present
p.buildConfigurationList.defaultConfigurationName:='Release'; p.buildConfigurationList.defaultConfigurationName:='Release';
Result:=p; Result:=p;

View File

@@ -145,7 +145,6 @@ var
res : integer; res : integer;
{$ifdef darwin} {$ifdef darwin}
xs : string; xs : string;
err : LongWord;
m : TStringStream; m : TStringStream;
doc : TXMLDocument; doc : TXMLDocument;
{$endif} {$endif}
@@ -255,7 +254,7 @@ begin
ltDict: begin ltDict: begin
dst.Add(pfx+'<dict>'); dst.Add(pfx+'<dict>');
for i:=0 to v.count-1 do begin for i:=0 to v.count-1 do begin
dst.Add(XMLPFX+'<key>'+XMLEncodeText(v.names[i])+'</key>'); dst.Add(XMLPFX+'<key>'+XMLEncodeText(UTF8Decode(v.names[i]))+'</key>');
WriteXMLValue(v.items[i], dst, pfx+XMLPFX); WriteXMLValue(v.items[i], dst, pfx+XMLPFX);
end; end;
dst.Add(pfx+'</dict>'); dst.Add(pfx+'</dict>');
@@ -374,7 +373,7 @@ var
begin begin
Result:=nil; Result:=nil;
if not Assigned(valnode) then Exit; if not Assigned(valnode) then Exit;
if not NodeNameToPListType(valnode.NodeName, tp) then Exit; if not NodeNameToPListType( UTF8Encode(valnode.NodeName), tp) then Exit;
Result:=TPListValue.Create(tp); Result:=TPListValue.Create(tp);
case tp of case tp of
ltBoolean: Result.bool:=(valnode.NodeName='true'); // false is false ltBoolean: Result.bool:=(valnode.NodeName='true'); // false is false

View File

@@ -28,7 +28,7 @@ function UpdateProject(const ProjFileName: string; TemplateValues, ResFiles: TSt
procedure UpdateBldConfig(const proj: PBXProject; optName, optVal: string); procedure UpdateBldConfig(const proj: PBXProject; optName, optVal: string);
procedure UpdateMainFile(const proj: PBXProject; mainfile: string); procedure UpdateMainFile(const proj: PBXProject; mainfile: string);
procedure UpdateCompileOpts(const proj: PBXProject; const options: string); procedure UpdateCompileOpts(const proj: PBXProject; const aoptions: string);
const const
XCodeProjectTemplateIconID : AnsiString ='0AE3FFA610F3C9AF00A9B007,'; XCodeProjectTemplateIconID : AnsiString ='0AE3FFA610F3C9AF00A9B007,';
@@ -206,43 +206,19 @@ const
' rootObject = 0A52AE8310F0D05300478C4F /* Project object */;'#10+ ' rootObject = 0A52AE8310F0D05300478C4F /* Project object */;'#10+
'}'#10; '}'#10;
BuildScript = var
'## start'#13 // global variable... a bad pattern must be replaced
+'echo "compiling FPC project"'#13 DefaultBuildScript : string = '';
+''#13
+'export RESULT_EXE=${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'#13
+'export IOSHEADERS='#13
+'cd $FPC_MAIN_DIR'#13
+'#rm $RESULT_EXE'#13
+'export TargetCPU=${PLATFORM_PREFERRED_ARCH}'#13
+''#13
+'if [ "${PLATFORM_NAME}" == "iphonesimulator" ]; then'#13
+' export TargetOS="iphonesim"'#13
+'fi'#13
+'export Target=${TargetCPU}-${TargetOS}'#13
+''#13
+'pwd'#13
+'echo ${RESULT_EXE}'#13
+''#13
+'${FPC_DIR}fpc -T${TargetOS} -P${TargetCPU} -MDelphi -Scghi -O1 -l -dIPHONEALL \'#13
+' ${FPC_CUSTOM_OPTIONS} \'#13
//-Fu~/iOS_6_0 -Fu.
+'-Filib/${Target} -FUlib/${Target} \'#13
+'-XR${SDKROOT} -FD${PLATFORM_DEVELOPER_BIN_DIR} $FPC_MAIN_FILE \'#13
+' -o${RESULT_EXE}'#13
+'export RES=$?'#13
+''#13
+'if [ $RES != 0 ]; then'#13
+' exit $RES'#13
+'fi'#13
+''#13
+'echo ${RESULT_EXE}'#13
+''#13
+'exit $FPCRES'#13;
function ReadBuildScriptFile(const fn: string): string;
implementation implementation
function EmptyBuildScript: string;
begin
Result:='';
end;
function GetValueName(const Source: String; idx: Integer): String; function GetValueName(const Source: String; idx: Integer): String;
var var
i : integer; i : integer;
@@ -355,8 +331,9 @@ begin
Result:=StringReplace(Result, '$(TargetOS)', os, [rfReplaceAll, rfIgnoreCase]); Result:=StringReplace(Result, '$(TargetOS)', os, [rfReplaceAll, rfIgnoreCase]);
end; end;
procedure UpdateCompileOpts(const proj: PBXProject; const options: string); procedure UpdateCompileOpts(const proj: PBXProject; const aoptions: string);
var var
options : string;
opt : string; opt : string;
i32opt : string; i32opt : string;
i64opt : string; i64opt : string;
@@ -367,6 +344,7 @@ var
begin begin
//UpdateBldConfig(proj, 'FPC_CUSTOM_OPTIONS', options); //UpdateBldConfig(proj, 'FPC_CUSTOM_OPTIONS', options);
UpdateBldConfig(proj, 'FPC_CUSTOM_OPTIONS', ''); UpdateBldConfig(proj, 'FPC_CUSTOM_OPTIONS', '');
options:=aoptions+' '; // trailing space, always to consume the last options
i:=1; i:=1;
j:=1; j:=1;
l:=length(options); l:=length(options);
@@ -521,7 +499,7 @@ begin
if not Assigned(TargetFindRunScript(trg)) then begin if not Assigned(TargetFindRunScript(trg)) then begin
scr:=TargetAddRunScript(trg); scr:=TargetAddRunScript(trg);
scr.shellScript:=BuildScript; scr.shellScript:=DefaultBuildScript;
scr.showEnvVarsInLog:=true; scr.showEnvVarsInLog:=true;
end; end;
@@ -563,8 +541,9 @@ begin
prj.Free; prj.Free;
Exit; Exit;
end; end;
end else end else begin
prj:=ProjectCreate3_2; prj:=ProjectCreate3_2;
end;
try try
PrepareTemplateFile(prj, TemplateValues, Resfiles); PrepareTemplateFile(prj, TemplateValues, Resfiles);

View File

@@ -185,7 +185,7 @@ end;
procedure DoReadXibDoc(ADoc: TXMLDocument; var Obj: TXibObject); procedure DoReadXibDoc(ADoc: TXMLDocument; var Obj: TXibObject);
const const
DataNode = 'data'; //DataNode = 'data';
XibObject = 'object'; XibObject = 'object';
var var
node : TDOMNode; node : TDOMNode;
@@ -288,7 +288,7 @@ begin
n:=fXibNode.FirstChild; n:=fXibNode.FirstChild;
while Assigned(n) do begin while Assigned(n) do begin
if (n.NodeName='string') and (TDOMElement(n).AttribStrings['key']='') then if (n.NodeName='string') and (TDOMElement(n).AttribStrings['key']='') then
list.Add(n.TextContent); list.Add(UTF8Encode(n.TextContent));
n:=n.NextSibling; n:=n.NextSibling;
end; end;
end; end;
@@ -319,13 +319,13 @@ var
n : TDOMNode; n : TDOMNode;
begin begin
n:=FindProperty(PropName); n:=FindProperty(PropName);
if Assigned(n) and (n.NodeName='string') then Result:=n.TextContent if Assigned(n) and (n.NodeName='string') then Result:=UTF8Encode(n.TextContent)
else Result:=''; else Result:='';
end; end;
function isKeyAttr(n: TDomNode; const KeyAttrVal: String): Boolean; function isKeyAttr(n: TDomNode; const KeyAttrVal: String): Boolean;
begin begin
Result:=Assigned(n) and (n is TDOMElement) and (TDOMElement(n).AttribStrings['key']=KeyAttrVal) Result:=Assigned(n) and (n is TDOMElement) and (TDOMElement(n).AttribStrings['key']=UTF8Decode(KeyAttrVal))
end; end;
function TXibObject.FindProperty(const PropName:String):TDOMNode; function TXibObject.FindProperty(const PropName:String):TDOMNode;
@@ -344,7 +344,7 @@ begin
Result:=''; Result:='';
Exit; Exit;
end; end;
Result:=TDOMElement(fXibNode).AttribStrings['key']; Result:=UTF8Encode(TDOMElement(fXibNode).AttribStrings['key']);
end; end;
function TXibObject.GetXibClass:String; function TXibObject.GetXibClass:String;
@@ -353,7 +353,7 @@ begin
Result:=''; Result:='';
Exit; Exit;
end; end;
Result:=TDOMElement(fXibNode).AttribStrings['class']; Result:=UTF8Encode(TDOMElement(fXibNode).AttribStrings['class']);
end; end;
procedure ListClassesDescr(const FileName: AnsiString; DstList : TList); overload; procedure ListClassesDescr(const FileName: AnsiString; DstList : TList); overload;