-
Notifications
You must be signed in to change notification settings - Fork 40
/
SConstruct
1720 lines (1552 loc) · 70.2 KB
/
SConstruct
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import os
import scons.utils
import scons.checks
SetOption('num_jobs', scons.utils.detectCPUs())
def isQuiet():
import sys
return '-s' in sys.argv
def isPlatform(platform):
import sys
return platform in sys.platform
def isWindows():
return isPlatform("win32")
def isOSX104():
import platform
return isPlatform("darwin") and platform.processor() == 'powerpc'
# Assume 10.6 and up
def isOSX():
return isPlatform("darwin") and not isOSX104()
def file_exists(path):
return os.path.exists(path)
def makeUseEnvironment(key, default):
def use():
import os
try:
return int(os.environ[key]) == 1
except KeyError:
return default
return use
def makeUseArgument(key, default):
def use():
try:
return int(ARGUMENTS[key]) == 1
except KeyError:
return default
return use
# Functions made with `makeUseArgument' should be set by command line arguments
# to scons:
# $ scons gch=1
# If `makeUseEnvironment' is used instead then a shell variable should be set:
# $ export prx=1
# $ scons
usePrx = makeUseEnvironment('prx', False)
isVerbose = makeUseArgument('verbose', False)
useIntel = makeUseEnvironment('intel', False)
useMinpspw = makeUseEnvironment('minpspw', False)
useAndroid = makeUseEnvironment('android', False)
useAndroidX86 = makeUseEnvironment('androidx86', False)
useAndroidX64 = makeUseEnvironment('androidx64', False)
useIos = makeUseEnvironment('ios', False)
usePs3 = makeUseEnvironment('ps3', False)
useNDS = makeUseEnvironment('nds', False)
useDingoo = makeUseEnvironment('dingoo', False)
useXenon = makeUseEnvironment('xenon', False)
usePandora = makeUseEnvironment('pandora', False)
useWii = makeUseEnvironment('wii', False)
useLLVM = makeUseEnvironment('llvm', False)
useMingwCross = makeUseEnvironment('mingwx', False)
useNacl = makeUseEnvironment('nacl', False)
useMad = makeUseEnvironment('mad', False)
useGCW = makeUseEnvironment('gcw', False)
nativeCompile = makeUseEnvironment('native', False)
enableProfiled = makeUseEnvironment('PROFILE', False)
showTiming = makeUseEnvironment('timing', False)
def ps3devPath():
try:
return os.environ['PS3DEV']
except KeyError:
return '/opt/ps3dev'
def wrapSymbols(env):
wrapped_symbols = Split("""open read close lseek lstat access""")
def wrap(symbol):
return '-Wl,--wrap=%s' % symbol
env.Append(LINKFLAGS = map(wrap, wrapped_symbols))
def checkAllegro(context):
context.Message("Checking for Allegro 4... ")
def testAllegro(context):
return context.TryLink("""
#include <allegro.h>
int main(int argc, char ** argv){
install_allegro(0, NULL, NULL);
return 0;
}
END_OF_MAIN()
""", ".c")
# use pkg-config
def allegro44(context):
tmp = context.env.Clone()
env = context.env
ok = 1
try:
scons.utils.safeParseConfig(env, 'pkg-config allegro --cflags --libs')
env.Append(CPPDEFINES = ['USE_ALLEGRO'])
ok = testAllegro(context)
except OSError:
ok = 0
if not ok:
context.sconf.env = tmp
else:
context.Message('found 4.4')
return ok
# use allegro-config
def allegro42(context):
tmp = context.env.Clone()
env = context.env
ok = 1
try:
def enableAllegro(env2):
scons.utils.safeParseConfig(env2, 'allegro-config --cflags --libs')
env2.Append(CPPDEFINES = ['USE_ALLEGRO'])
scons.utils.safeParseConfig(env, 'allegro-config --cflags --libs')
env['paintown_enableAllegro'] = enableAllegro
env.Append(CPPDEFINES = ['USE_ALLEGRO'])
ok = testAllegro(context)
except OSError:
ok = 0
if not ok:
context.sconf.env = tmp
else:
context.Message('found 4.2')
return ok
ok = allegro44(context) or allegro42(context)
context.Result(scons.utils.colorResult(ok))
return ok
# find freetype in windows since we dont have freetype-config
def checkWindowsFreeType(context):
context.Message("Checking for Freetype... ")
def build():
return context.TryCompile("""
#include <ft2build.h>
#include FT_FREETYPE_H
int main(int argc, char ** argv){
int major = FREETYPE_MAJOR;
return 0;
}
""", ".c")
if not build():
if useMingw():
import os
tmp = context.env.Clone()
mingw = os.environ['MINGDIR']
context.env.Append(CPPPATH = ["%s/include/freetype2" % mingw])
if not build():
context.env = tmp
context.Result(scons.utils.colorResult(0))
return 0
else:
context.Message("don't know how to find freetype for a non-mingw compiler")
context.Result(scons.utils.colorResult(0))
return 0
context.Result(scons.utils.colorResult(1))
return 1
def isCygwin():
try:
return os.environ['CYGWIN'] == '1'
except:
return False
def useMingw():
try:
return "mingw" in ARGUMENTS[ 'env' ]
except KeyError:
return False
def readExec( program ):
try:
return os.popen(program).readline().replace("\n",'')
except OSError:
return ""
def useDistcc():
try:
return int(os.environ['USE_DISTCC']) == 1
except KeyError:
return False
def getDebug():
try:
return int(os.environ['DEBUG'])
except KeyError:
return 0
def less_verbose(env):
link_color = 'light-red'
ar_color = 'yellow'
ranlib_color = 'light-purple'
peg_color = 'light-cyan'
env['CCCOMSTR'] = "%s %s" % (scons.utils.colorize('Compiling c file', 'light-green'), scons.utils.colorize('$SOURCE', 'light-blue'))
env['SHCCCOMSTR'] = "%s %s" % (scons.utils.colorize('Compiling c file', 'light-green'), scons.utils.colorize('$SOURCE', 'light-blue'))
env['CXXCOMSTR'] = "%s %s" % (scons.utils.colorize('Compiling c++ file', 'light-green'), scons.utils.colorize('$SOURCE', 'light-blue'))
env['SHCXXCOMSTR'] = "%s %s" % (scons.utils.colorize('Compiling c++ file', 'light-green'), scons.utils.colorize('$SOURCE', 'light-blue'))
env['LINKCOMSTR'] = "%s %s" % (scons.utils.colorize('Linking', link_color), scons.utils.colorize('$TARGET', 'light-blue'))
env['SHLINKCOMSTR'] = "%s %s" % (scons.utils.colorize('Linking', link_color), scons.utils.colorize('$TARGET', 'light-blue'))
env['ARCOMSTR'] = "%s %s" % (scons.utils.colorize('Building library', ar_color), scons.utils.colorize('$TARGET', 'light-blue'))
env['RANLIBCOMSTR'] = "%s %s" % (scons.utils.colorize('Indexing library', ranlib_color), scons.utils.colorize('$TARGET', 'light-blue'))
env['PEG_MAKE'] = "%s %s" % (scons.utils.colorize('Creating peg parser', peg_color), scons.utils.colorize('$TARGET', 'light-blue'))
return env
def getEnvironment(debug):
def intel(env):
env['CC'] = 'icc'
env['CXX'] = 'icpc'
# '-Werror-all', '-Weffc++'
# TODO: replace these flags with descriptive names
env.Append(CCFLAGS = ['-wd981', '-wd2259'],
CXXFLAGS = ['-wd981', '-wd271',
'-wd383', '-wd869',
'-wd1599'])
return env
def xenon(env):
print "Environment is Xenon"
xenon = "/usr/local/xenon"
prefix = "xenon-"
def setup(pre, x):
return '%s%s' % (pre, x)
env['CC'] = setup(prefix, 'gcc')
env['LD'] = setup(prefix, 'ld')
env['CXX'] = setup(prefix, 'g++')
env['AS'] = setup(prefix, 'as')
env['AR'] = setup(prefix, 'ar')
env['OBJCOPY'] = setup(prefix, 'objcopy')
env.Append(LIBS = Split("""xenon m fat"""))
# env.Append(CCFLAGS = Split("""-m32 -mcpu=cell -mtune=cell -mpowerpc64 -mhard-float -ffunction-sections -fdata-sections -maltivec -fno-pic"""))
env.Append(CCFLAGS = Split("""-m32 -mcpu=cell -mtune=cell -mpowerpc64 -mhard-float -maltivec -fno-pic"""))
env.Append(CPPDEFINES = ['XENON'])
env.Append(CPPPATH = ['%(xenon)s/usr/include' % {'xenon': xenon}])
env.Append(LIBPATH = ['%(xenon)s/xenon/lib/32' % {'xenon': xenon}])
env.Append(LIBPATH = ['%(xenon)s/usr/lib' % {'xenon': xenon}])
env.Append(LINKFLAGS = Split("""-m32 -maltivec -mpowerpc64 -mhard-float -fno-pic -n -T %(xenon)s/app.lds""" % {'xenon': xenon}))
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
env.PrependENVPath('PATH', setup(xenon, '/bin'))
env.PrependENVPath('PATH', setup(xenon, '/usr/bin'))
return env
def dingux(env):
import os
print "Environment is Dingux"
mips = '/opt/mipsel-linux-uclibc'
bin_path = mips + '/usr/bin'
prefix = 'mipsel-linux-'
def setup(pre, x):
return '%s%s' % (pre, x)
env['CC'] = setup(prefix, 'gcc')
env['LD'] = setup(prefix, 'ld')
env['CXX'] = setup(prefix, 'g++')
env['AS'] = setup(prefix, 'as')
env['AR'] = setup(prefix, 'ar')
env['OBJCOPY'] = setup(prefix, 'objcopy')
env.Append(CPPDEFINES = ['DINGOO'])
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
# env.Append(CPPDEFINES = ['DINGOO', 'LINUX', 'MPU_JZ4740'])
#env.Append(CPPPATH = [setup(dingoo_path, "/include"),
# setup(dingoo_path, "/include/SDL"),
# setup(dingoo_path, "/include/freetype2")])
#env.Append(LIBPATH = [setup(dingoo_path, '/lib')])
#flags = ['-G0', '-mips32', '-mno-abicalls', '-msoft-float', '-fno-builtin', '-fno-pic']
#env.Append(CCFLAGS = flags)
#env.Append(CXXFLAGS = flags)
#env.Append(LINKFLAGS = ['-nodefaultlibs', '%s/lib/dingoo.xn' % dingoo_path])
# env.Append(LIBS = ['c', 'm', 'fgl', 'sml', 'jz4740', 'gcc'])
#env.Append(LIBS = ['SDL', 'jz4740', 'sml', 'fgl', 'c', 'gcc'])
#env['LINKCOM'] = '$LD $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET'
env.PrependENVPath('PATH', bin_path)
# env.PrependENVPath('PATH', '%s/bin' % dingoo_path)
return env
def dingoo(env):
import os
print "Environment is Dingoo"
dingoo_path = os.environ['DINGOO_SDK']
mips_path = os.environ['MIPSTOOLS']
bin_path = mips_path + '/bin'
prefix = 'mipsel-linux-'
def setup(pre, x):
return '%s%s' % (pre, x)
env['CC'] = setup(prefix, 'gcc')
env['LD'] = setup(prefix, 'ld')
env['CXX'] = setup(prefix, 'g++')
env['AS'] = setup(prefix, 'as')
env['AR'] = setup(prefix, 'ar')
env['OBJCOPY'] = setup(prefix, 'objcopy')
env.Append(CPPDEFINES = ['DINGOO', 'LINUX', 'MPU_JZ4740'])
env.Append(CPPPATH = [setup(dingoo_path, "/include"),
setup(dingoo_path, "/include/SDL"),
setup(dingoo_path, "/include/freetype2")])
env.Append(LIBPATH = [setup(dingoo_path, '/lib')])
flags = ['-G0', '-mips32', '-mno-abicalls', '-msoft-float', '-fno-builtin', '-fno-pic']
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env.Append(LINKFLAGS = ['-nodefaultlibs', '%s/lib/dingoo.xn' % dingoo_path])
# env.Append(LIBS = ['c', 'm', 'fgl', 'sml', 'jz4740', 'gcc'])
env.Append(LIBS = ['SDL', 'jz4740', 'sml', 'fgl', 'c', 'gcc'])
env['LINKCOM'] = '$LD $LINKFLAGS $SOURCES $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET'
env.PrependENVPath('PATH', bin_path)
env.PrependENVPath('PATH', '%s/bin' % dingoo_path)
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
return env
def mingwCross(env):
import os
print "Environment is Mingw Cross Compiler"
prefix = 'i686-w64-mingw32-'
def setup(pre, x):
return '%s%s' % (pre, x)
env['CC'] = setup(prefix, 'gcc')
env['LD'] = setup(prefix, 'ld')
env['CXX'] = setup(prefix, 'g++')
env['AS'] = setup(prefix, 'as')
env['AR'] = setup(prefix, 'ar')
env['RANLIB'] = setup(prefix, 'ranlib')
env['OBJCOPY'] = setup(prefix, 'objcopy')
# Probably don't want to hard code all these libraries here..
env.Append(LIBS = Split("wsock32 vorbis vorbisfile ogg glu32 winmm psapi shlwapi opengl32 gdi32 ole32 jpeg png15"))
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
env.Append(CPPPATH = ['/opt/mingw/include'])
env.Append(LIBPATH = ['/opt/mingw/lib'])
env.Append(LINKFLAGS = ['-static-libstdc++', '-static-libgcc', '-mwindows', '-Wl,-subsystem,windows'])
env.PrependENVPath('PKG_CONFIG_PATH', '/opt/mingw/lib/pkgconfig')
os.environ['ALLEGRO5'] = '1'
return env
def pandora(env):
import os
print "Environment is Pandora"
env['CC'] = os.environ['CC']
env['CXX'] = os.environ['CXX']
env['LD'] = os.environ['CC']
env['AS'] = os.environ['AS']
env['AR'] = os.environ['AR']
env.Append(CPPDEFINES = ['PANDORA'])
flags = ['-O3', '-pipe', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=neon', '-mfloat-abi=softfp', '-ftree-vectorize', '-ffast-math', '-fsingle-precision-constant']
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
return env
def nds(env):
print "Environment is nds"
path = '/opt/devkitARM'
bin_path = path + '/bin'
# libexec_path = path + '/libexec/gcc/arm-eabi/4.5.1'
prefix = 'arm-eabi-'
def setup(pre, x):
return '%s%s' % (pre, x)
env['CC'] = setup(prefix, 'gcc')
env['LD'] = setup(prefix, 'ld')
env['CXX'] = setup(prefix, 'g++')
env['AS'] = setup(prefix, 'as')
env['AR'] = setup(prefix, 'ar')
env['OBJCOPY'] = setup(prefix, 'objcopy')
env.Append(CPPPATH = [setup(path, "/libnds/include"),
setup(path, "/libnds/include/SDL"),
setup(path, "/libnds/include/freetype2")])
env.Append(LIBPATH = [setup(path, '/libnds/lib')])
env.Append(CPPDEFINES = ['NDS'])
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
env.PrependENVPath('PATH', bin_path)
# env.PrependENVPath('PATH', libexec_path)
return env
# minpspw for psp dev environment on windows (and linux?)
def minpspw(env):
print "Environment is minpspw (psp development)"
# on linux, symlink the pspsdk to /opt/pspsdk, or just put it there
path = '/opt/pspsdk'
try:
path = os.environ['MINPSPWDIR']
except KeyError:
pass
bin_path = path + '/bin/'
prefix = 'psp-'
def setup(pre, x):
return '%s%s' % (pre, x)
env['CC'] = setup(prefix, 'gcc')
env['LD'] = setup(prefix, 'ld')
env['CXX'] = setup(prefix, 'g++')
env['AS'] = setup(prefix, 'as')
env['AR'] = setup(prefix, 'ar')
env['OBJCOPY'] = setup(prefix, 'objcopy')
# FIXME: try to use freetype-config and sdl-config to find these paths
# instead of hard coding them
env.Append(CPPPATH = [setup(path, "/psp/include"),
setup(path, "/psp/include/SDL"),
setup(path, "/psp/include/freetype2"),
setup(path, "/psp/sdk/include")])
env.Append(CPPDEFINES = ['MINPSPW','_PSP_FW_VERSION=150'])
env.Append(LIBPATH = [setup(path, '/psp/lib'),
setup(path, '/psp/sdk/lib')])
if usePrx():
env.Append(LINKFLAGS = ['-specs=%s/psp/sdk/lib/prxspecs' % path,
'-Wl,-q,-T%s/psp/sdk/lib/linkfile.prx' % path])
# So that xmain.cpp can pick up on windows requirement
if isWindows():
env.Append(CPPDEFINES = ['INCLUDE_SCE_MODULE_INFO'])
flags = ['-G0', '-fexceptions']
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env['LINKCOM'] = '$CC $LINKFLAGS -Wl,--start-group $ARCHIVES $SOURCES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
env.Append(LINKFLAGS = flags)
# pthread-psp
all = Split("""
SDL
SDL_image
SDL_mixer
SDLmain
pspdebug
ogg
vorbis
vorbisfile
GL
stdc++
m
freetype
png
z
jpeg
c
pspctrl
pspvfpu
pspdisplay
psphprm
pspaudio
pspgu
pspge
psprtc
pspsdk
pspuser
pspkernel
pspnet_inet
""")
env.Append(LIBS = all)
# os.environ['PATH'] = "%s:%s" % (bin_path, os.environ['PATH'])
env.PrependENVPath('PATH', bin_path)
return env
# ps3toolchain with psl1ght dev environment on linux
def ps3(env):
print "Environment is ps3 (ps3 development)"
# symlink the ps3dev to /opt/ps3dev, or just put it there
# Needs these environment variables
# export PS3DEV=/opt/ps3dev
# export PATH=$PATH:$PS3DEV/bin
# export PATH=$PATH:$PS3DEV/ppu/bin
# export PATH=$PATH:$PS3DEV/spu/bin
# export PSL1GHT=$PS3DEV/psl1ght
# export PATH=$PATH:$PSL1GHT/bin
path = ps3devPath()
bin_path = path + '/ppu/bin/'
prefix = 'ppu-'
def setup(pre, x):
return '%s%s' % (pre, x)
env['CC'] = setup(prefix, 'gcc')
env['LD'] = setup(prefix, 'ld')
env['CXX'] = setup(prefix, 'g++')
env['AS'] = setup(prefix, 'as')
env['AR'] = setup(prefix, 'ar')
env['OBJCOPY'] = setup(prefix, 'objcopy')
# FIXME: try to use sdl-config to find these paths
# instead of hard coding them
scons.utils.safeParseConfig(env, path + '/portlibs/ppu/bin/freetype-config --cflags --libs')
scons.utils.safeParseConfig(env, path + '/portlibs/ppu/bin/libpng-config --cflags --libs')
# FIXME: it uses -lc-glue-ppu which I can't find maybe I missed something in the setup for now I'll put it down below
#env.ParseConfig(bin_path +'sdl-config --cflags --libs')
env.Append(CPPPATH = [setup(path, "/ppu/include"),
setup(path, "/spu/include"),
setup(path, "/portlibs/ppu/include"),
setup(path, "/portlibs/ppu/include/SDL"),
setup(path, "/portlibs/ppu/include/vorbis"),
setup(path, "/portlibs/ppu/include/ogg"),
setup(path, "/psl1ght/ppu/include"),
setup(path, "/psl1ght/spu/include")])
env.Append(CPPDEFINES = ['PS3'])
env.Append(LIBPATH = [setup(path, '/ppu/lib'),
setup(path, '/spu/lib'),
setup(path, '/portlibs/ppu/lib'),
setup(path, '/psl1ght/ppu/lib'),
setup(path, '/psl1ght/spu/lib')])
# -mminimal-toc puts less stuff in the table of contents "TOC".
# I don't know why this is important for the ps3 compiler but apparently
# paintown was overflowing the TOC causing it to crash on startup.
flags = ['-mcpu=cell', '-mhard-float', '-fmodulo-sched', '-ffunction-sections', '-fdata-sections', '-maltivec', '-mminimal-toc']
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env['LINKCOM'] = '$CC $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
env.Append(LINKFLAGS = flags)
# Removed reality and psl1ght
all = Split("""
SDL
ogg
vorbis
vorbisfile
stdc++
m
gcm_sys
sysutil
lv2
io
net
sysmodule
audio
png
z
jpeg
c
rsx
""")
env.Append(LIBS = all)
env.PrependENVPath('PATH', bin_path)
env.PrependENVPath('PKG_CONFIG_PATH', path + '/portlibs/ppu/lib/pkgconfig')
return env
# use the devkitpro stuff for wii/gamecube
def wii(env):
bin_path = "%s/bin" % os.environ['DEVKITPPC']
ogc_bin_path = "%s/libogc/bin" % os.environ['DEVKITPRO']
prefix = 'powerpc-eabi-'
def setup(x):
return '%s%s' % (prefix, x)
env['CC'] = setup('gcc')
env['LD'] = setup('ld')
env['CXX'] = setup('g++')
env['AS'] = setup('as')
env['AR'] = setup('ar')
env['OBJCOPY'] = setup('objcopy')
if isWindows():
env.Append(CPPDEFINES = ['USE_SDL_MAIN'])
env.Append(CPPPATH = ["%s/libogc/include" % os.environ['DEVKITPRO'],
"%s/libogc/include/SDL" % os.environ['DEVKITPRO'],
"%s/libogc/include/freetype2" % os.environ['DEVKITPRO']])
env.Append(LIBPATH = ["%s/libogc/lib" % os.environ['DEVKITPRO'],
"%s/libogc/lib/wii" % os.environ['DEVKITPRO']])
env.Append(LIBS = ['SDL', 'SDL_image', 'SDL_mixer', 'png', 'freetype', 'z'])
else:
env.Append(CPPPATH = ["%s/libogc/include" % os.environ['DEVKITPRO']])
env.Append(CPPDEFINES = ['GEKKO', 'WII'])
flags = ['-mrvl', '-mcpu=750', '-meabi', '-mhard-float']
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env.Append(LINKFLAGS = flags)
env.Append(CPPPATH = ['#src/wii'])
env['LINKCOM'] = '$CXX $LINKFLAGS -Wl,--start-group $ARCHIVES $SOURCES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
env.Append(LIBS = ['wiiuse', 'wiikeyboard', 'iberty', 'bte', 'fat', 'ogc', 'm'])
# os.environ['PATH'] = "%s:%s:%s" % (bin_path, ogc_bin_path, os.environ['PATH'])
env.PrependENVPath('PATH', bin_path)
env.PrependENVPath('PATH', ogc_bin_path)
return env
def androidX86(env):
# Sets up the environment for Google Android
def setup(pre, x):
return '%s%s' % (pre, x)
platform = 'android-9'
arch = 'x86'
path = '/opt/android/android-x86-toolchain'
# bin_path = setup(path, '/arm-linux-androideabi-4.4.3/bin')
bin_path = setup(path, '/bin')
prefix = 'i686-linux-android-'
def set_prefix(x):
return '%s%s' % (prefix, x)
env['CC'] = set_prefix('gcc')
env['LD'] = set_prefix('ld')
env['CXX'] = set_prefix('g++')
env['AS'] = set_prefix('as')
env['AR'] = set_prefix('ar')
env['OBJCOPY'] = set_prefix('objcopy')
base = setup(path, '/user/%(arch)s' % {'arch': arch})
env.Append(CPPPATH = ['%s/include' % base,
# '%s/include/allegro5' % base
])
#env.Append(CPPPATH = [setup(path, '/arm-linux-androideabi-4.4.3/include'),
# setup(path, '/platforms/%s/arch-arm/usr/include' % platform),
# setup(path, '/platforms/%s/arch-arm/usr/include/SDL' % platform),
# setup(path, '/platforms/%s/arch-arm/usr/include/freetype' % platform),
# setup(path, '/sources/cxx-stl/gnu-libstdc++/include')
# ])
env.Append(CPPDEFINES = Split("""ANDROID"""))
# flags = ['-fpic', '-fexceptions', '-ffunction-sections', '-funwind-tables', '-fstack-protector', '-Wno-psabi', '-march=armv5te', '-mtune=xscale', '-msoft-float', '-mthumb', '-Os', '-fomit-frame-pointer', '-fno-strict-aliasing', '-finline-limit=64',]
flags = ['-shared', '-fpic', '-fexceptions', '-ffunction-sections', '-funwind-tables', '-Wno-psabi', '-O2', '-fno-strict-aliasing']
# linkflags = flags + ['-Wl,--allow-shlib-undefined']
linkflags = flags + ['-Wl,--no-undefined']
# libs = ['freetype', 'png', 'SDL', 'm', 'log', 'jnigraphics', 'c', 'm', 'supc++',]
# Copy the static stdc++ from gnu-libstdc++
# gnustdlib = env.InstallAs('misc/libgnustdc++.a', '/opt/android/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a')
# libs = Split("""freetype2-static png SDL m log c jnigraphics supc++ EGL GLESv2 GLESv1_CM z gnustdc++""")
# libs = Split("""freetype2-static allegro m log c jnigraphics EGL GLESv2 GLESv1_CM z gnustl_static""")
libs = Split("""freetype2-static allegro log z""")
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env.Append(LINKFLAGS = linkflags)
env.Append(CPPPATH = ['#src/android'])
env['LINKCOM'] = '$CXX $LINKFLAGS -Wl,--start-group $SOURCES $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
# Hack to put libstdc++ at the end
# env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS /opt/android/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a -o $TARGET'
# env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET'
env.Append(LIBS = libs)
env.Append(LIBPATH = ['%s/lib' % base,
#setup(path, '/platforms/%s/arch-arm/usr/lib' % platform),
])
env.PrependENVPath('PATH', bin_path)
return env
def androidX64(env):
# Sets up the environment for Google Android
def setup(pre, x):
return '%s%s' % (pre, x)
platform = 'android-9'
arch = 'x86_64'
path = '/opt/android/android-x64-toolchain'
# bin_path = setup(path, '/arm-linux-androideabi-4.4.3/bin')
bin_path = setup(path, '/bin')
prefix = 'x86_64-linux-android-'
def set_prefix(x):
return '%s%s' % (prefix, x)
env['CC'] = set_prefix('gcc')
env['LD'] = set_prefix('ld')
env['CXX'] = set_prefix('g++')
env['AS'] = set_prefix('as')
env['AR'] = set_prefix('ar')
env['OBJCOPY'] = set_prefix('objcopy')
base = setup(path, '/user/%(arch)s' % {'arch': arch})
env.Append(CPPPATH = ['%s/include' % base,
# '%s/include/allegro5' % base
])
#env.Append(CPPPATH = [setup(path, '/arm-linux-androideabi-4.4.3/include'),
# setup(path, '/platforms/%s/arch-arm/usr/include' % platform),
# setup(path, '/platforms/%s/arch-arm/usr/include/SDL' % platform),
# setup(path, '/platforms/%s/arch-arm/usr/include/freetype' % platform),
# setup(path, '/sources/cxx-stl/gnu-libstdc++/include')
# ])
env.Append(CPPDEFINES = Split("""ANDROID"""))
# flags = ['-fpic', '-fexceptions', '-ffunction-sections', '-funwind-tables', '-fstack-protector', '-Wno-psabi', '-march=armv5te', '-mtune=xscale', '-msoft-float', '-mthumb', '-Os', '-fomit-frame-pointer', '-fno-strict-aliasing', '-finline-limit=64',]
flags = ['-shared', '-fpic', '-fexceptions', '-ffunction-sections', '-funwind-tables', '-Wno-psabi', '-O2', '-fno-strict-aliasing']
# linkflags = flags + ['-Wl,--allow-shlib-undefined']
linkflags = flags + ['-Wl,--no-undefined']
# libs = ['freetype', 'png', 'SDL', 'm', 'log', 'jnigraphics', 'c', 'm', 'supc++',]
# Copy the static stdc++ from gnu-libstdc++
# gnustdlib = env.InstallAs('misc/libgnustdc++.a', '/opt/android/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a')
# libs = Split("""freetype2-static png SDL m log c jnigraphics supc++ EGL GLESv2 GLESv1_CM z gnustdc++""")
# libs = Split("""freetype2-static allegro m log c jnigraphics EGL GLESv2 GLESv1_CM z gnustl_static""")
libs = Split("""freetype2-static allegro log r-tech1 z""")
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env.Append(LINKFLAGS = linkflags)
env.Append(CPPPATH = ['#src/android'])
env['LINKCOM'] = '$CXX $LINKFLAGS -Wl,--start-group $SOURCES $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
# Hack to put libstdc++ at the end
# env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS /opt/android/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a -o $TARGET'
# env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET'
env.Append(LIBS = libs)
env.Append(LIBPATH = ['%s/lib' % base,
#setup(path, '/platforms/%s/arch-arm/usr/lib' % platform),
])
env.PrependENVPath('PATH', bin_path)
return env
def android(env):
# Sets up the environment for Google Android
def setup(pre, x):
return '%s%s' % (pre, x)
platform = 'android-9'
arch = 'armeabi-v7a'
path = '/opt/android/android-toolchain'
# bin_path = setup(path, '/arm-linux-androideabi-4.4.3/bin')
bin_path = setup(path, '/bin')
prefix = 'arm-linux-androideabi-'
def set_prefix(x):
return '%s%s' % (prefix, x)
env['CC'] = set_prefix('gcc')
env['LD'] = set_prefix('ld')
env['CXX'] = set_prefix('g++')
env['AS'] = set_prefix('as')
env['AR'] = set_prefix('ar')
env['OBJCOPY'] = set_prefix('objcopy')
base = setup(path, '/user/%(arch)s' % {'arch': arch})
env.PrependENVPath('PKG_CONFIG_PATH', base + '/lib/pkgconfig')
env.Append(CPPPATH = ['%s/include' % base,
# '%s/include/allegro5' % base
])
#env.Append(CPPPATH = [setup(path, '/arm-linux-androideabi-4.4.3/include'),
# setup(path, '/platforms/%s/arch-arm/usr/include' % platform),
# setup(path, '/platforms/%s/arch-arm/usr/include/SDL' % platform),
# setup(path, '/platforms/%s/arch-arm/usr/include/freetype' % platform),
# setup(path, '/sources/cxx-stl/gnu-libstdc++/include')
# ])
env.Append(CPPDEFINES = Split("""ANDROID __ARM_ARCH_5__ __ARM_ARCH_5T__ __ARM_ARCH_5E__ __ARM_ARCH_5TE__"""))
# flags = ['-fpic', '-fexceptions', '-ffunction-sections', '-funwind-tables', '-fstack-protector', '-Wno-psabi', '-march=armv5te', '-mtune=xscale', '-msoft-float', '-mthumb', '-Os', '-fomit-frame-pointer', '-fno-strict-aliasing', '-finline-limit=64',]
flags = ['-shared', '-fpic', '-fexceptions', '-ffunction-sections', '-funwind-tables', '-Wno-psabi', '-march=armv5te', '-mtune=xscale', '-msoft-float', '-mthumb', '-Os', '-fomit-frame-pointer', '-fno-strict-aliasing', '-finline-limit=64']
# linkflags = flags + ['-Wl,--allow-shlib-undefined']
linkflags = flags + ['-Wl,--no-undefined']
# libs = ['freetype', 'png', 'SDL', 'm', 'log', 'jnigraphics', 'c', 'm', 'supc++',]
# Copy the static stdc++ from gnu-libstdc++
# gnustdlib = env.InstallAs('misc/libgnustdc++.a', '/opt/android/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a')
# libs = Split("""freetype2-static png SDL m log c jnigraphics supc++ EGL GLESv2 GLESv1_CM z gnustdc++""")
# libs = Split("""freetype2-static png m log c jnigraphics EGL GLESv2 GLESv1_CM z gnustl_static""")
libs = Split("""freetype2-static png m log c jnigraphics EGL GLESv2 GLESv1_CM z""")
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env.Append(LINKFLAGS = linkflags)
env.Append(CPPPATH = ['#src/android'])
env['LINKCOM'] = '$CXX $LINKFLAGS -Wl,--start-group $SOURCES $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
# Hack to put libstdc++ at the end
# env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS /opt/android/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a -o $TARGET'
# env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET'
env.Append(LIBS = libs)
env.Append(LIBPATH = ['%s/lib' % base,
#setup(path, '/platforms/%s/arch-arm/usr/lib' % platform),
])
env.PrependENVPath('PATH', bin_path)
return env
def ios(env):
# Sets up the environment for Apple IOS
# FIXME Target correct arm or simulator
# iPhoneOS.platform
# iPhoneSimulator.platform
def setup(pre, x):
return '%s%s' % (pre, x)
# Check for or target above mentioned platforms
platform = 'iPhoneOS.platform'
# Target sdk
sdk = 'SDKs/iPhoneOS4.3.sdk'
path = '/Developer/Platforms/%s/Developer' % platform
bin_path = setup(path, 'usr/bin')
# Prefix may depend on target platform
prefix = 'arm-apple-darwin10-'
def set_prefix(x):
return '%s%s' % (prefix, x)
env['CC'] = set_prefix('gcc')
env['LD'] = set_prefix('ld')
env['CXX'] = set_prefix('g++')
env['AS'] = set_prefix('as')
env['AR'] = set_prefix('ar')
env['OBJCOPY'] = set_prefix('objcopy')
env.Append(CPPPATH = [setup(path, '/include'),
setup(path, '/%s/usr/include' % sdk)
])
env.Append(CPPDEFINES = ['IOS'])
flags = ['-shared', '-fpic', '-fexceptions', '-ffunction-sections', '-funwind-tables', '-Wno-psabi', '-march=armv5te', '-mtune=xscale', '-msoft-float', '-mthumb', '-Os', '-fomit-frame-pointer', '-fno-strict-aliasing', '-finline-limit=64']
linkflags = flags
libs = Split("""m c z""")
env.Append(CCFLAGS = flags)
env.Append(CXXFLAGS = flags)
env.Append(LINKFLAGS = linkflags)
env.Append(CPPPATH = ['#src/ios'])
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
env.Append(LIBS = libs)
env.Append(LIBPATH = [setup(path, '%s/usr/lib' % sdk),
'#misc'])
env.PrependENVPath('PATH', bin_path)
return env
def nacl(env):
# Sets up the environment for Googles Native Client
# check for architecture
print "Environment is for Google Native Client"
import platform
arch = platform.architecture()[0]
def nacl32():
try:
return os.environ['nacl_32'] == '1'
except KeyError:
return False
def nacl64():
try:
return os.environ['nacl_64'] == '1'
except KeyError:
return False
arch_override = ''
if nacl32():
arch_override = '32bit'
print "Forcing 32bit compile"
elif nacl64():
print "Forcing 64bit compile"
arch_override = '64bit'
def setup(pre, x):
return '%s%s' % (pre, x)
path = '/opt/nacl_sdk'
# Choices are 'glibc' and 'newlib'
toolchain_path = '/toolchain/linux_x86_newlib'
bin_path = setup(path, '%s/bin' % toolchain_path)
env.PrependENVPath('PATH', bin_path)
flags = []
paths = []
libs = ['srpc', 'ppapi_cpp', 'ppapi', 'ppruntime', 'nosys']
env['PAINTOWN_NACL_ARCH'] = '32'
if arch == '64bit' and not arch_override == '32bit' or arch_override == '64bit':
prefix = 'x86_64-nacl-'
flags += ['-m64']
libs.append('')
paths.append([setup(path, '%s/x86_64-nacl/usr/include/' % toolchain_path)])
usr_path = setup(path, '%s/x86_64-nacl/usr' % toolchain_path)
env['PAINTOWN_NACL_ARCH'] = '64'
elif arch == '32bit' or arch_override == '32bit':
prefix = 'i686-nacl-'
flags += ['-m32']
libs.append('')
paths.append([setup(path, '%s/i686-nacl/usr/include' % toolchain_path)])
usr_path = setup(path, '%s/i686-nacl/usr' % toolchain_path)
env.PrependENVPath('PATH', usr_path)
env.PrependENVPath('PKG_CONFIG_PATH', "%s/%s" % (usr_path, "lib/pkgconfig"))
paths.append([setup(usr_path,'/include')])
def set_prefix(x):
return '%s%s' % (prefix, x)
env['CC'] = set_prefix('gcc')
env['LD'] = set_prefix('ld')
env['CXX'] = set_prefix('g++')
env['AS'] = set_prefix('as')
env['AR'] = set_prefix('ar')
env['OBJCOPY'] = set_prefix('objcopy')
scons.utils.safeParseConfig(env, usr_path + '/bin/libpng-config --cflags --libs')
scons.utils.safeParseConfig(env, usr_path + '/bin/freetype-config --cflags --libs')
scons.utils.safeParseConfig(env, usr_path + '/bin/sdl-config --cflags --libs')
compile_flags = ['-fno-builtin', '-fno-stack-protector', '-fdiagnostics-show-option']
env.Append(CPPDEFINES = ['NACL'])
env.Append(CPPPATH = paths)
env.Append(CCFLAGS = flags + compile_flags)
env.Append(CXXFLAGS = flags + compile_flags)
env.Append(LIBPATH = setup(path, '%s/lib' % toolchain_path))
env.Append(LINKFLAGS = flags + ['-melf_nacl'])
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
env.Append(LIBS = libs)
wrapSymbols(env)
return env
def gcw(env):
root = '/opt/gcw0-toolchain'
env.PrependENVPath('PATH', '%s/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin' % root)
env.PrependENVPath('PKG_CONFIG_PATH', '%s/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib/pkgconfig' % root)
env.Append(CPPPATH = '%s/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include' % root)
env.PrependENVPath('PATH', '%s/usr/bin' % root)
env.Append(CPPDEFINES = ['UCLIBC', 'GCW0', '_FILE_OFFSET_BITS=64'])
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES $_LIBDIRFLAGS $_LIBFLAGS -Wl,--end-group -o $TARGET'
def setup(x):
return 'mipsel-linux-%s' % x
env['CC'] = setup('gcc')
env['CXX'] = setup('g++')
env['AR'] = setup('ar')
env['LD'] = setup('ld')
return env
def gcc(env):
# Allow environment variables to overwrite the default compiler
try:
env['CC'] = os.environ['CC']
except:
pass
try:
env['CXX'] = os.environ['CXX']
except:
pass
if useDistcc():
env['CC'] = 'distcc'
env['CXX'] = 'distcc g++'
if isOSX():
env.Append(CCFLAGS = Split("""-arch i386 -arch x86_64"""))
# env.Append(LINKFLAGS = Split("""-arch i386 -arch x86_64"""))
if isOSX104():
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES $_FRAMEWORKS -Wl,-all_load $_LIBDIRFLAGS $_LIBFLAGS $ARCHIVES -o $TARGET'
else:
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES -Wl,--end-group $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET'
return env
def llvm(env):
#env['CC'] = 'llvm-gcc'
#env['CXX'] = 'llvm-g++'
env['CXX'] = 'clang++'
env['CC'] = 'clang'
env['LINKCOM'] = '$CXX $LINKFLAGS $SOURCES -Wl,--start-group $ARCHIVES -Wl,--end-group $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET'
if getDebug() and False:
sanitize_flags = ['-fsanitize=undefined', '-fsanitize=integer']
env.Append(CCFLAGS = sanitize_flags)
env.Append(CXXFLAGS = sanitize_flags)
env.Append(LINKFLAGS = sanitize_flags)
# Speeds up compiles by not shelling out to 'as', but not mature yet
# env.Append(CCFLAGS = ['-integrated-as'])
# <nicholas> ah. don't replace AR or LD or RANLIB.
# <jonrafkind> dont use llvm-ar and llvm-ld?
# <nicholas> that's correct.
# <jonrafkind> ok.. but why do those exist?
# <nicholas> if you switch CXX to llvm-g++ and change nothing else, it'll work.
# <jonrafkind> ok
# <nicholas> well, that's a great question. :)
# <jonrafkind> heh
# <nicholas> the llvm-foo tools do what the native tools except to llvm bitcode instead
#env['AR'] = 'llvm-ar'
#env['AS'] = 'llvm-as'
#env['LD'] = 'llvm-ld'
#env['RANLIB'] = 'llvm-ranlib'
return env
def raw():
defines = []
if isOSX() or isOSX104():
defines.append('MACOSX')
# env.Append(CPPDEFINES = 'MACOSX')
cflags = []
if debug:
defines.append('DEBUG')
# for gcov:
# ['-fprofile-arcs', '-ftest-coverage']
# cflags.append( ['-g3','-ggdb', '-Werror'])
cflags.extend(['-g3', '-O0', '-Wfatal-errors'])
else:
# -march=native
if nativeCompile():
cflags.extend(['-O2', '-g', '-pipe', '-march=native'])
if not enableProfiled():
cflags.extend(['-fomit-frame-pointer'])
else:
cflags.extend(['-O2'])
if isCygwin():
import SCons.Tool.zip
env = Environment(ENV = os.environ, tools = ['mingw'])
env['CXX'] = 'C:\\MinGW\\bin\\g++.exe'
env['CC'] = 'C:\\MinGW\\bin\\gcc.exe'
env['AR'] = 'C:\\MinGW\\bin\\ar.exe'
SCons.Tool.zip.generate(env)
return env
elif useMingw():
return gcc(Environment(ENV = os.environ, CPPDEFINES = defines, CCFLAGS = cflags, tools = ['mingw', 'zip']))
else:
if useIntel():
print "Using the intel compiler"
return intel(Environment(ENV = os.environ, CPPDEFINES = defines, CCFLAGS = cflags))
elif usePandora():
return pandora(Environment(ENV = os.environ, CPPDEFINES = defines, CCFLAGS = cflags))
elif useMingwCross():
return mingwCross(Environment(ENV = os.environ, CPPDEFINES = defines, CCFLAGS = cflags))
elif useNDS():
return nds(Environment(ENV = os.environ, CPPDEFINES = defines, CCFLAGS = cflags))
elif useGCW():
return gcw(Environment(ENV = os.environ, CPPDEFINES = defines, CCFLAGS = cflags))
elif useDingoo():
return dingux(Environment(ENV = os.environ, CPPDEFINES = defines, CCFLAGS = cflags))
elif useXenon():
return xenon(Environment(ENV = os.environ, CPPDEFINES = defines, CCFLAGS = cflags))