Skip to content

Commit a709113

Browse files
Add support for building iOS using Gyp
1 parent 6accc9b commit a709113

24 files changed

+568
-58
lines changed

config/exclusions.gypi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
{
2626
'sources/':
2727
[
28-
['exclude', '_osx\\.cpp$'],
29-
['exclude', '(^|/)osx.+\\.cpp$'],
28+
['exclude', '_osx\\.(cpp|mm)$'],
29+
['exclude', '(^|/)osx.+\\.(cpp|mm)$'],
30+
['exclude', '(^|/)mac-.+\\.(cpp|mm)$'],
3031
],
3132
},
3233
],
@@ -37,7 +38,6 @@
3738
[
3839
['exclude', '_lnx\\.cpp$'],
3940
['exclude', '(^|/)lnx.+\\.cpp$'],
40-
['exclude', '(^|/)unx.+\\.cpp$'],
4141
],
4242
},
4343
],

config/ios.gypi

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
'variables':
3+
{
4+
'mobile': 1,
5+
},
6+
7+
'xcode_config_file': '../version',
8+
9+
'xcode_settings':
10+
{
11+
'SDKROOT': 'iphoneos',
12+
13+
'SOLUTION_DIR': '<(DEPTH)',
14+
'SYMROOT': '$(SOLUTION_DIR)/_build/ios/$(SDK_NAME)',
15+
'OBJROOT': '$(SOLUTION_DIR)/_cache/ios/$(SDK_NAME)',
16+
'CONFIGURATION_BUILD_DIR': '$(SYMROOT)/$(CONFIGURATION)',
17+
'CONFIGURATION_TEMP_DIR': '$(OBJROOT)/$(CONFIGURATION)',
18+
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',
19+
'GCC_ENABLE_CPP_RTTI': 'NO',
20+
'GCC_THREADSAFE_STATICS': 'NO',
21+
'SHARED_PRECOMPS_DIR': '$(OBJROOT)/Precompiled/$(CURRENT_ARCH)',
22+
'GCC_VERSION': '',
23+
'ALWAYS_SEARCH_USER_PATHS': 'NO',
24+
'IPHONEOS_DEPLOYMENT_TARGET[arch=armv7]': '5.1.1',
25+
'IPHONEOS_DEPLOYMENT_TARGET[arch=i386]': '5.1.1',
26+
'IPHONEOS_DEPLOYMENT_TARGET[arch=arm64]': '7.0.0',
27+
'IPHONEOS_DEPLOYMENT_TARGET[arch=x86_64]': '7.0.0',
28+
'TARGETED_DEVICE_FAMILY': '1,2',
29+
'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
30+
'ARCHS_STANDARD': 'armv7 arm64',
31+
'CLANG_CXX_LIBRARY': 'libc++',
32+
33+
'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer',
34+
},
35+
36+
'target_defaults':
37+
{
38+
'variables':
39+
{
40+
'ios_external_symbol_list': '',
41+
},
42+
43+
'defines':
44+
[
45+
'_MOBILE',
46+
'TARGET_PLATFORM_MOBILE',
47+
'TARGET_SUBPLATFORM_IPHONE',
48+
],
49+
50+
'configurations':
51+
{
52+
'Debug':
53+
{
54+
'defines':
55+
[
56+
'_DEBUG',
57+
],
58+
},
59+
60+
'Release':
61+
{
62+
'defines':
63+
[
64+
'_RELEASE',
65+
'NDEBUG',
66+
],
67+
},
68+
},
69+
70+
'target_conditions':
71+
[
72+
[
73+
# Convert externals into the correct form for iOS
74+
'_type == "loadable_module"',
75+
{
76+
'mac_bundle': 0,
77+
'product_extension': 'a',
78+
79+
# Don't actually do any linking yet...
80+
'xcode_settings':
81+
{
82+
'MACH_O_TYPE': 'staticlib',
83+
},
84+
85+
'postbuilds':
86+
[
87+
{
88+
'postbuild_name': 'create-ios-external',
89+
'message': 'Creating ">(_target_name)" iOS external',
90+
91+
'inputs':
92+
[
93+
'../tools/build-extension-ios.sh',
94+
],
95+
96+
'action':
97+
[
98+
'<@(_inputs)',
99+
'>(ios_external_symbols)',
100+
'>(ios_external_symbol_list)',
101+
],
102+
},
103+
],
104+
},
105+
],
106+
],
107+
},
108+
109+
'configurations':
110+
{
111+
'Debug':
112+
{
113+
'xcode_settings':
114+
{
115+
'COPY_PHASE_STRIP': 'NO',
116+
'GCC_OPTIMIZATION_LEVEL': '0',
117+
},
118+
},
119+
120+
'Release':
121+
{
122+
'xcode_settings':
123+
{
124+
'GCC_OPTIMIZATION_LEVEL': '3',
125+
'GCC_THUMB_SUPPORT[arch=armv6]': 'NO',
126+
'GCC_THUMB_SUPPORT[arch=armv7]': 'YES',
127+
},
128+
},
129+
},
130+
}

config/target_os.gypi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2+
'variables':
3+
{
4+
'mobile': 0,
5+
},
6+
27
'conditions':
38
[
49
[
@@ -28,5 +33,14 @@
2833
],
2934
},
3035
],
36+
[
37+
'OS == "ios"',
38+
{
39+
'includes':
40+
[
41+
'ios.gypi',
42+
],
43+
},
44+
],
3145
],
3246
}

engine/bind-ios-standalone.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
if [ -e "${PLATFORM_DEVELOPER_BIN_DIR}/g++" ] ; then
4+
BIN_DIR="${PLATFORM_DEVELOPER_BIN_DIR}"
5+
else
6+
BIN_DIR="${DEVELOPER_BIN_DIR}"
7+
fi
8+
9+
if [ "${CONFIGURATION}" = "Debug" ] ; then
10+
STRIP_FLAG="-Wl,-x"
11+
else
12+
STRIP_FLAG=""
13+
fi
14+
15+
"${BIN_DIR}/g++" -nodefaultlibs -Wl,-r ${STRIP_FLAG} -arch ${ARCHS//\ /\ -arch\ } -isysroot "${SDKROOT}" -o $@ -Wl,-sectcreate -Wl,-__MISC -Wl,__deps -Wl,"${SRCROOT}/standalone.ios" -Wl,-exported_symbol -Wl,_main -Wl,-exported_symbol -Wl,_load_module -Wl,-exported_symbol -Wl,_resolve_symbol
16+

engine/engine-sources.gypi

Lines changed: 94 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
'src/debug.h',
130130
'src/dllst.h',
131131
'src/eventqueue.h',
132+
'src/fiber.h',
132133
'src/filedefs.h',
133134
'src/flst.h',
134135
'src/globals.h',
@@ -160,6 +161,7 @@
160161
'src/debug.cpp',
161162
'src/dllst.cpp',
162163
'src/eventqueue.cpp',
164+
'src/fiber.cpp',
163165
'src/globals.cpp',
164166
'src/mcerror.cpp',
165167
'src/mcio.cpp',
@@ -172,7 +174,8 @@
172174
'src/ports.cpp',
173175
'src/regex.cpp',
174176
'src/securemode.cpp',
175-
'src/sha1.cpp',
177+
'src/sha1.cpp',
178+
'src/sysspec.cpp',
176179
'src/text.cpp',
177180
'src/transfer.cpp',
178181
'src/uidc.cpp',
@@ -302,14 +305,37 @@
302305
'src/vclip.cpp',
303306

304307
# Group "Mobile"
308+
'src/mblad.h',
309+
'src/mblcalendar.h',
310+
'src/mblcontact.h',
311+
'src/mblcontrol.h',
305312
'src/mbldc.h',
306313
'src/mblevent.h',
307314
'src/mblflst.h',
315+
'src/mblnotification.h',
316+
'src/mblsensor.h',
317+
'src/mblstore.h',
318+
'src/mblsyntax.h',
319+
'src/mblactivityindicator.cpp',
320+
'src/mblad.cpp',
321+
'src/mblalert.cpp',
322+
'src/mblbusyindicator.cpp',
323+
'src/mblcalendar.cpp',
324+
'src/mblcamera.cpp',
325+
'src/mblcontact.cpp',
326+
'src/mblcontrol.cpp',
308327
'src/mbldc.cpp',
328+
'src/mbldialog.cpp',
309329
'src/mblflst.cpp',
310330
'src/mblmain.cpp',
331+
'src/mblnotification.cpp',
332+
'src/mblsensor.cpp',
311333
'src/mblspec.cpp',
312334
'src/mblstack.cpp',
335+
'src/mblstore.cpp',
336+
'src/mblsound.cpp',
337+
'src/mbltextmessaging.cpp',
338+
'src/mbltheme.cpp',
313339

314340
# Group "Mobile - Android"
315341
'src/mblandroid.h',
@@ -379,27 +405,46 @@
379405

380406
# Group "Mobile - iOS"
381407
'src/mbliphone.h',
408+
'src/mbliphoneapp.h',
382409
'src/mbliphonecontrol.h',
383410
'src/mbliphoneview.h',
384411
'src/mbliphone.mm',
412+
'src/mbliphonead.mm',
413+
'src/mbliphoneactivityindicator.mm',
414+
'src/mbliphonealert.mm',
415+
'src/mbliphoneapp.mm',
416+
'src/mbliphoneappview.mm',
385417
'src/mbliphonebrowser.mm',
418+
'src/mbliphonebusyindicator.mm',
419+
'src/mbliphonecalendar.mm',
420+
'src/mbliphonecamera.mm',
421+
'src/mbliphonecontact.mm',
386422
'src/mbliphonecontrol.mm',
387423
'src/mbliphonedc.mm',
388424
'src/mbliphonedialog.mm',
425+
'src/mbliphoneembedded.mm',
426+
'src/mbliphoneembeddedtest.mm',
389427
'src/mbliphoneextra.mm',
428+
'src/mbliphonefs.mm',
390429
'src/mbliphonegfx.mm',
391430
'src/mbliphonehooks.cpp',
392431
'src/mbliphoneinput.mm',
393432
'src/mbliphonelocation.mm',
394433
'src/mbliphonemail.mm',
434+
'src/mbliphonemediapick.mm',
395435
'src/mbliphonemisc.mm',
436+
'src/mbliphonenotification.mm',
396437
'src/mbliphonepick.mm',
438+
'src/mbliphonepickdate.mm',
397439
'src/mbliphoneplayer.mm',
398440
'src/mbliphonereachability.mm',
399441
'src/mbliphonescroller.mm',
442+
'src/mbliphonesensor.mm',
400443
'src/mbliphonesound.mm',
401444
'src/mbliphonestack.mm',
445+
'src/mbliphonestore.mm',
402446
'src/mbliphonetextlayout.mm',
447+
'src/mbliphonetextmessaging.mm',
403448
'src/mbliphoneurl.mm',
404449
'src/mbliphonevideo.mm',
405450

@@ -667,8 +712,6 @@
667712
'src/srvtheme.cpp',
668713
'src/srvspec.cpp',
669714
'src/srvstack.cpp',
670-
671-
'src/sysspec.cpp',
672715
],
673716

674717
# Files to be excluded from server builds
@@ -770,6 +813,7 @@
770813

771814
'sources!':
772815
[
816+
'src/fiber.cpp',
773817
'src/player-legacy.cpp',
774818
'src/player-platform.cpp',
775819
'src/tilecachegl.cpp',
@@ -795,8 +839,7 @@
795839
{
796840
'sources!':
797841
[
798-
'src/cgimageutil.cpp',
799-
'src/coretextfonts.cpp',
842+
800843
'src/desktop.cpp',
801844
'src/desktop-ans.cpp',
802845
'src/desktop-dc.cpp',
@@ -808,6 +851,16 @@
808851
'src/platform-recorder.cpp',
809852
'src/platform-surface.cpp',
810853
'src/platform-window.cpp',
854+
],
855+
},
856+
],
857+
[
858+
'OS != "mac" and OS != "ios"',
859+
{
860+
'sources!':
861+
[
862+
'src/cgimageutil.cpp',
863+
'src/coretextfonts.cpp',
811864
'src/syscfdate.cpp',
812865
'src/tilecachecg.cpp',
813866
],
@@ -823,6 +876,42 @@
823876
]
824877
},
825878
],
879+
[
880+
'OS == "ios"',
881+
{
882+
'sources!':
883+
[
884+
'src/stacke.cpp',
885+
'src/sysunxdate.cpp',
886+
887+
'src/mbliphoneembedded.mm',
888+
'src/mbliphoneembeddedtest.mm',
889+
],
890+
},
891+
],
892+
[
893+
'mobile != 0',
894+
{
895+
'sources/':
896+
[
897+
# Note that this does *not* exclude player.cpp
898+
['exclude', '^src/player.+\\.(cpp|mm)$'],
899+
],
900+
},
901+
],
902+
],
903+
904+
'target_conditions':
905+
[
906+
[
907+
'server_mode == 0 and (OS == "mac" or OS == "win" or OS == "linux")',
908+
{
909+
'sources!':
910+
[
911+
'src/sysspec.cpp',
912+
],
913+
},
914+
],
826915
],
827916
},
828917
}

0 commit comments

Comments
 (0)