forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakepanda.py
More file actions
executable file
·6673 lines (5839 loc) · 303 KB
/
makepanda.py
File metadata and controls
executable file
·6673 lines (5839 loc) · 303 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
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
#!/usr/bin/env python
########################################################################
#
# Caution: there are two separate, independent build systems:
# 'makepanda', and 'ppremake'. Use one or the other, do not attempt
# to use both. This file is part of the 'makepanda' system.
#
# To build panda using this script, type 'makepanda.py' on unix
# or 'makepanda.bat' on windows, and examine the help-text.
# Then run the script again with the appropriate options to compile
# panda3d.
#
########################################################################
try:
import sys, os, platform, time, stat, re, getopt, threading, signal, shutil
if sys.platform == "darwin" or sys.version_info >= (2, 6):
import plistlib
if sys.version_info >= (3, 0):
import queue
else:
import Queue as queue
except:
print("You are either using an incomplete or an old version of Python!")
print("Please install the development package of Python 2.x and try again.")
exit(1)
from makepandacore import *
from installpanda import *
import time
import os
import sys
## jGenPyCode tries to get the directory for Direct from the sys.path. This only works if you
## have installed the sdk using a installer. This would not work if the installer was
## never used and everything was grabbed into a virgin environment using cvs.
sys.path.append(os.getcwd())
########################################################################
##
## PARSING THE COMMAND LINE OPTIONS
##
## You might be tempted to change the defaults by editing them
## here. Don't do it. Instead, create a script that compiles
## panda with your preferred options. Or, create
## a 'makepandaPreferences' file and put it into your python path.
##
########################################################################
COMPILER=0
INSTALLER=0
GENMAN=0
COMPRESSOR="zlib"
THREADCOUNT=0
CFLAGS=""
CXXFLAGS=""
LDFLAGS=""
RTDIST=0
RTDIST_VERSION="dev"
RUNTIME=0
DISTRIBUTOR=""
VERSION=None
DEBVERSION=None
RPMRELEASE="1"
GIT_COMMIT=None
P3DSUFFIX=None
MAJOR_VERSION=None
COREAPI_VERSION=None
PLUGIN_VERSION=None
OSXTARGET=None
UNIVERSAL=False
HOST_URL="https://runtime.panda3d.org/"
global STRDXSDKVERSION, STRMSPLATFORMVERSION, BOOUSEINTELCOMPILER
STRDXSDKVERSION = 'default'
STRMSPLATFORMVERSION = 'default'
BOOUSEINTELCOMPILER = False
if "MACOSX_DEPLOYMENT_TARGET" in os.environ:
OSXTARGET=os.environ["MACOSX_DEPLOYMENT_TARGET"]
PkgListSet(["PYTHON", "DIRECT", # Python support
"GL", "GLES", "GLES2"] + DXVERSIONS + ["TINYDISPLAY", "NVIDIACG", # 3D graphics
"EGL", # OpenGL (ES) integration
"EIGEN", # Linear algebra acceleration
"OPENAL", "FMODEX", # Audio playback
"VORBIS", "FFMPEG", "SWSCALE", "SWRESAMPLE", # Audio decoding
"ODE", "PHYSX", "BULLET", "PANDAPHYSICS", # Physics
"SPEEDTREE", # SpeedTree
"ZLIB", "PNG", "JPEG", "TIFF", "SQUISH", "FREETYPE", # 2D Formats support
] + MAYAVERSIONS + MAXVERSIONS + [ "FCOLLADA", # 3D Formats support
"VRPN", "OPENSSL", # Transport
"FFTW", # Algorithm helpers
"ARTOOLKIT", "OPENCV", "DIRECTCAM", "VISION", # Augmented Reality
"GTK2", # GTK2 is used for PStats on Unix
"NPAPI", "MFC", "WX", "FLTK", # Used for web plug-in only
"ROCKET", "AWESOMIUM", # GUI libraries
"CARBON", "COCOA", # Mac OS X toolkits
"X11", "XF86DGA", "XRANDR", "XCURSOR", # Unix platform support
"PANDATOOL", "PVIEW", "DEPLOYTOOLS", # Toolchain
"SKEL", # Example SKEL project
"PANDAFX", # Some distortion special lenses
"PANDAPARTICLESYSTEM", # Built in particle system
"CONTRIB", # Experimental
"SSE2", "NEON", # Compiler features
"TOUCHINPUT", # Touchinput interface (requires Windows 7)
])
CheckPandaSourceTree()
def keyboardInterruptHandler(x,y):
exit("keyboard interrupt")
signal.signal(signal.SIGINT, keyboardInterruptHandler)
########################################################################
##
## Command-line parser.
##
## You can type "makepanda --help" to see all the options.
##
########################################################################
def usage(problem):
if (problem):
print("")
print("Error parsing command-line input: %s" % (problem))
print("")
print("Makepanda generates a 'built' subdirectory containing a")
print("compiled copy of Panda3D. Command-line arguments are:")
print("")
print(" --help (print the help message you're reading now)")
print(" --verbose (print out more information)")
print(" --runtime (build a runtime build instead of an SDK build)")
print(" --installer (build an installer)")
print(" --optimize X (optimization level can be 1,2,3,4)")
print(" --version X (set the panda version number)")
print(" --lzma (use lzma compression when building Windows installer)")
print(" --distributor X (short string identifying the distributor of the build)")
print(" --outputdir X (use the specified directory instead of 'built')")
print(" --host URL (set the host url (runtime build only))")
print(" --threads N (use the multithreaded build system. see manual)")
print(" --osxtarget N (the OSX version number to build for (OSX only))")
print(" --universal (build universal binaries (OSX only))")
print(" --override \"O=V\" (override dtool_config/prc option value)")
print(" --static (builds libraries for static linking)")
print(" --target X (experimental cross-compilation (android only))")
print(" --arch X (target architecture for cross-compilation)")
print("")
for pkg in PkgListGet():
p = pkg.lower()
print(" --use-%-9s --no-%-9s (enable/disable use of %s)"%(p, p, pkg))
print("")
print(" --nothing (disable every third-party lib)")
print(" --everything (enable every third-party lib)")
print(" --directx-sdk=X (specify version of DX9 SDK to use: jun2010, aug2009, mar2009, aug2006)")
print(" --platform-sdk=X (specify MSPlatSdk to use: win71, win61, win60A, winserver2003r2)")
print(" --use-icl (experimental setting to use an intel compiler instead of MSVC on Windows)")
print("")
print("The simplest way to compile panda is to just type:")
print("")
print(" makepanda --everything")
print("")
os._exit(1)
def parseopts(args):
global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION
global COMPRESSOR,THREADCOUNT,OSXTARGET,UNIVERSAL,HOST_URL
global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX
global STRDXSDKVERSION, STRMSPLATFORMVERSION, BOOUSEINTELCOMPILER
longopts = [
"help","distributor=","verbose","runtime","osxtarget=",
"optimize=","everything","nothing","installer","rtdist","nocolor",
"version=","lzma","no-python","threads=","outputdir=","override=",
"static","host=","debversion=","rpmrelease=","p3dsuffix=",
"directx-sdk=", "platform-sdk=", "use-icl",
"universal", "target=", "arch=", "git-commit="]
anything = 0
optimize = ""
target = None
target_arch = None
for pkg in PkgListGet(): longopts.append("no-"+pkg.lower())
for pkg in PkgListGet(): longopts.append("use-"+pkg.lower())
try:
opts, extras = getopt.getopt(args, "", longopts)
for option,value in opts:
if (option=="--help"): raise Exception
elif (option=="--optimize"): optimize=value
elif (option=="--installer"): INSTALLER=1
elif (option=="--verbose"): SetVerbose(True)
elif (option=="--distributor"): DISTRIBUTOR=value
elif (option=="--rtdist"): RTDIST=1
elif (option=="--runtime"): RUNTIME=1
elif (option=="--genman"): GENMAN=1
elif (option=="--everything"): PkgEnableAll()
elif (option=="--nothing"): PkgDisableAll()
elif (option=="--threads"): THREADCOUNT=int(value)
elif (option=="--outputdir"): SetOutputDir(value.strip())
elif (option=="--osxtarget"): OSXTARGET=value.strip()
elif (option=="--universal"): UNIVERSAL=True
elif (option=="--target"): target = value.strip()
elif (option=="--arch"): target_arch = value.strip()
elif (option=="--nocolor"): DisableColors()
elif (option=="--version"):
VERSION=value
if (len(VERSION.split(".")) != 3): raise Exception
elif (option=="--lzma"): COMPRESSOR="lzma"
elif (option=="--override"): AddOverride(value.strip())
elif (option=="--static"): SetLinkAllStatic(True)
elif (option=="--host"): HOST_URL=value
elif (option=="--debversion"): DEBVERSION=value
elif (option=="--rpmrelease"): RPMRELEASE=value
elif (option=="--git-commit"): GIT_COMMIT=value
elif (option=="--p3dsuffix"): P3DSUFFIX=value
# Backward compatibility, OPENGL was renamed to GL
elif (option=="--use-opengl"): PkgEnable("GL")
elif (option=="--no-opengl"): PkgDisable("GL")
elif (option=="--directx-sdk"):
STRDXSDKVERSION = value.strip().lower()
if STRDXSDKVERSION == '':
print("No DirectX SDK version specified. Using 'default' DirectX SDK search")
STRDXSDKVERSION = 'default'
elif (option=="--platform-sdk"):
STRMSPLATFORMVERSION = value.strip().lower()
if STRMSPLATFORMVERSION == '':
print("No MS Platform SDK version specified. Using 'default' MS Platform SDK search")
STRMSPLATFORMVERSION = 'default'
elif (option=="--use-icl"): BOOUSEINTELCOMPILER = True
else:
for pkg in PkgListGet():
if (option=="--use-"+pkg.lower()):
PkgEnable(pkg)
break
for pkg in PkgListGet():
if (option=="--no-"+pkg.lower()):
PkgDisable(pkg)
break
if (option=="--everything" or option.startswith("--use-")
or option=="--nothing" or option.startswith("--no-")):
anything = 1
except:
usage(0)
print("Exception while parsing commandline:", sys.exc_info()[0])
if not anything:
if RUNTIME:
PkgEnableAll()
else:
usage("You should specify a list of packages to use or --everything to enable all packages.")
if (RTDIST and RUNTIME):
usage("Options --runtime and --rtdist cannot be specified at the same time!")
if (optimize=="" and (RTDIST or RUNTIME)): optimize = "4"
elif (optimize==""): optimize = "3"
if (OSXTARGET != None and OSXTARGET.strip() == ""):
OSXTARGET = None
elif (OSXTARGET != None):
OSXTARGET = OSXTARGET.strip()
if (len(OSXTARGET) != 4 or not OSXTARGET.startswith("10.")):
usage("Invalid setting for OSXTARGET")
try:
OSXTARGET = "10.%d" % (int(OSXTARGET[-1]))
except:
usage("Invalid setting for OSXTARGET")
try:
SetOptimize(int(optimize))
assert GetOptimize() in [1, 2, 3, 4]
except:
usage("Invalid setting for OPTIMIZE")
if GIT_COMMIT is not None and not re.match("^[a-f0-9]{40}$", GIT_COMMIT):
usage("Invalid SHA-1 hash given for --git-commit option!")
if target is not None or target_arch is not None:
SetTarget(target, target_arch)
is_win7 = False
if GetHost() == "windows":
if (STRMSPLATFORMVERSION not in ['winserver2003r2', 'win60A']):
platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1", "InstallationFolder")
if sys.platform == "win32":
# Note: not available in cygwin.
winver = sys.getwindowsversion()
if platsdk and os.path.isdir(platsdk) and winver[0] >= 6 and winver[1] >= 1:
is_win7 = True
if not is_win7:
PkgDisable("TOUCHINPUT")
parseopts(sys.argv[1:])
########################################################################
##
## Handle environment variables.
##
########################################################################
if ("CFLAGS" in os.environ):
CFLAGS = os.environ["CFLAGS"].strip()
if ("CXXFLAGS" in os.environ):
CXXFLAGS = os.environ["CXXFLAGS"].strip()
if ("RPM_OPT_FLAGS" in os.environ):
CFLAGS += " " + os.environ["RPM_OPT_FLAGS"].strip()
CXXFLAGS += " " + os.environ["RPM_OPT_FLAGS"].strip()
if ("LDFLAGS" in os.environ):
LDFLAGS = os.environ["LDFLAGS"].strip()
os.environ["MAKEPANDA"] = os.path.abspath(sys.argv[0])
if (GetHost() == "darwin" and OSXTARGET != None):
os.environ["MACOSX_DEPLOYMENT_TARGET"] = OSXTARGET
########################################################################
##
## Configure things based on the command-line parameters.
##
########################################################################
if (VERSION is None):
if (RUNTIME):
VERSION = ParsePluginVersion("dtool/PandaVersion.pp")
COREAPI_VERSION = VERSION + "." + ParseCoreapiVersion("dtool/PandaVersion.pp")
PLUGIN_VERSION = VERSION
else:
VERSION = ParsePandaVersion("dtool/PandaVersion.pp")
PLUGIN_VERSION = ParsePluginVersion("dtool/PandaVersion.pp")
if (COREAPI_VERSION is None):
COREAPI_VERSION = VERSION
if (DEBVERSION is None):
DEBVERSION = VERSION
MAJOR_VERSION = VERSION[:3]
if (P3DSUFFIX is None):
P3DSUFFIX = MAJOR_VERSION
outputdir_suffix = ""
if (RUNTIME or RTDIST):
# Compiling Maya/Max is pointless in rtdist build
for ver in MAYAVERSIONS + MAXVERSIONS:
PkgDisable(ver)
if (DISTRIBUTOR.strip() == ""):
exit("You must provide a valid distributor name when making a runtime or rtdist build!")
outputdir_suffix += "_" + DISTRIBUTOR.strip()
if (RUNTIME):
outputdir_suffix += "_rt"
RTDIST_VERSION = DISTRIBUTOR.strip() + "_" + MAJOR_VERSION
elif (DISTRIBUTOR == ""):
DISTRIBUTOR = "makepanda"
if not IsCustomOutputDir():
if GetTarget() == "windows" and GetTargetArch() == 'x64':
outputdir_suffix += '_x64'
SetOutputDir("built" + outputdir_suffix)
if (RUNTIME):
for pkg in PkgListGet():
if pkg in ["GTK2"]:
# Optional package(s) for runtime.
pass
elif pkg in ["OPENSSL", "ZLIB", "NPAPI", "JPEG", "PNG"]:
# Required packages for runtime.
if (PkgSkip(pkg)==1):
exit("Runtime must be compiled with OpenSSL, ZLib, NPAPI, JPEG and PNG support!")
else:
# Unused packages for runtime.
PkgDisable(pkg)
if (GetHost() == 'windows'):
os.environ["BISON_SIMPLE"] = GetThirdpartyBase()+"/win-util/bison.simple"
if (INSTALLER and RTDIST):
exit("Cannot build an installer for the rtdist build!")
if (INSTALLER) and (PkgSkip("PYTHON")) and (not RUNTIME) and GetTarget() == 'windows':
exit("Cannot build installer on Windows without python")
if (RTDIST) and (PkgSkip("JPEG")):
exit("Cannot build rtdist without jpeg")
if (RTDIST) and (PkgSkip("WX") and PkgSkip("FLTK")):
exit("Cannot build rtdist without wx or fltk")
if (RUNTIME):
SetLinkAllStatic(True)
if not os.path.isdir("contrib"):
PkgDisable("CONTRIB")
########################################################################
##
## Load the dependency cache.
##
########################################################################
LoadDependencyCache()
########################################################################
##
## Locate various SDKs.
##
########################################################################
MakeBuildTree()
SdkLocateDirectX(STRDXSDKVERSION)
SdkLocateMaya()
SdkLocateMax()
SdkLocateMacOSX(OSXTARGET)
SdkLocatePython(RTDIST)
SdkLocateVisualStudio()
SdkLocateMSPlatform(STRMSPLATFORMVERSION)
SdkLocatePhysX()
SdkLocateSpeedTree()
SdkLocateAndroid()
SdkAutoDisableDirectX()
SdkAutoDisableMaya()
SdkAutoDisableMax()
SdkAutoDisablePhysX()
SdkAutoDisableSpeedTree()
if (RTDIST and DISTRIBUTOR == "cmu"):
if (RTDIST_VERSION == "cmu_1.7" and SDK["PYTHONVERSION"] != "python2.6"):
exit("The CMU 1.7 runtime distribution must be built against Python 2.6!")
elif (RTDIST_VERSION == "cmu_1.8" and SDK["PYTHONVERSION"] != "python2.7"):
exit("The CMU 1.8 runtime distribution must be built against Python 2.7!")
########################################################################
##
## Choose a Compiler.
##
## This should also set up any environment variables needed to make
## the compiler work.
##
########################################################################
if GetHost() == 'windows' and GetTarget() == 'windows':
COMPILER = "MSVC"
else:
COMPILER = "GCC"
SetupBuildEnvironment(COMPILER)
########################################################################
##
## External includes, external libraries, and external defsyms.
##
########################################################################
IncDirectory("ALWAYS", GetOutputDir()+"/tmp")
IncDirectory("ALWAYS", GetOutputDir()+"/include")
if (COMPILER == "MSVC"):
PkgDisable("X11")
PkgDisable("XRANDR")
PkgDisable("XF86DGA")
PkgDisable("XCURSOR")
PkgDisable("GLES")
PkgDisable("GLES2")
PkgDisable("EGL")
PkgDisable("CARBON")
PkgDisable("COCOA")
if (PkgSkip("PYTHON")==0):
IncDirectory("ALWAYS", SDK["PYTHON"] + "/include")
LibDirectory("ALWAYS", SDK["PYTHON"] + "/libs")
SmartPkgEnable("EIGEN", "eigen3", (), ("Eigen/Dense",), target_pkg = 'ALWAYS')
for pkg in PkgListGet():
if (PkgSkip(pkg)==0):
if (pkg[:4]=="MAYA"):
IncDirectory(pkg, SDK[pkg] + "/include")
DefSymbol(pkg, "MAYAVERSION", pkg)
DefSymbol(pkg, "MLIBRARY_DONTUSE_MFC_MANIFEST", "")
elif (pkg[:3]=="MAX"):
IncDirectory(pkg, SDK[pkg] + "/include")
IncDirectory(pkg, SDK[pkg] + "/include/CS")
IncDirectory(pkg, SDK[pkg+"CS"] + "/include")
IncDirectory(pkg, SDK[pkg+"CS"] + "/include/CS")
DefSymbol(pkg, "MAX", pkg)
if (int(pkg[3:]) >= 2013):
DefSymbol(pkg, "UNICODE", "")
DefSymbol(pkg, "_UNICODE", "")
elif (pkg[:2]=="DX"):
IncDirectory(pkg, SDK[pkg] + "/include")
elif GetThirdpartyDir() is not None:
IncDirectory(pkg, GetThirdpartyDir() + pkg.lower() + "/include")
for pkg in DXVERSIONS:
if (PkgSkip(pkg)==0):
vnum=pkg[2:]
if GetTargetArch() == 'x64':
LibDirectory(pkg, SDK[pkg] + '/lib/x64')
else:
LibDirectory(pkg, SDK[pkg] + '/lib/x86')
LibDirectory(pkg, SDK[pkg] + '/lib')
LibName(pkg, 'd3dVNUM.lib'.replace("VNUM", vnum))
LibName(pkg, 'd3dxVNUM.lib'.replace("VNUM", vnum))
if (vnum=="9" and "GENERIC_DXERR_LIBRARY" in SDK):
LibName(pkg, 'dxerr.lib')
else:
LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
#LibName(pkg, 'ddraw.lib')
LibName(pkg, 'dxguid.lib')
IncDirectory("ALWAYS", GetThirdpartyDir() + "extras/include")
LibName("WINSOCK", "wsock32.lib")
LibName("WINSOCK2", "wsock32.lib")
LibName("WINSOCK2", "ws2_32.lib")
LibName("WINCOMCTL", "comctl32.lib")
LibName("WINCOMDLG", "comdlg32.lib")
LibName("WINUSER", "user32.lib")
LibName("WINMM", "winmm.lib")
LibName("WINIMM", "imm32.lib")
LibName("WINKERNEL", "kernel32.lib")
LibName("WINOLE", "ole32.lib")
LibName("WINOLEAUT", "oleaut32.lib")
LibName("WINOLDNAMES", "oldnames.lib")
LibName("WINSHELL", "shell32.lib")
LibName("WINGDI", "gdi32.lib")
LibName("ADVAPI", "advapi32.lib")
LibName("IPHLPAPI", "iphlpapi.lib")
LibName("GL", "opengl32.lib")
LibName("GLES", "libgles_cm.lib")
LibName("GLES2", "libGLESv2.lib")
LibName("EGL", "libEGL.lib")
LibName("MSIMG", "msimg32.lib")
if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "strmiids.lib")
if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "quartz.lib")
if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "odbc32.lib")
if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "odbccp32.lib")
if (PkgSkip("PNG")==0): LibName("PNG", GetThirdpartyDir() + "png/lib/libpng_static.lib")
if (PkgSkip("JPEG")==0): LibName("JPEG", GetThirdpartyDir() + "jpeg/lib/jpeg-static.lib")
if (PkgSkip("TIFF")==0): LibName("TIFF", GetThirdpartyDir() + "tiff/lib/libtiff.lib")
if (PkgSkip("ZLIB")==0): LibName("ZLIB", GetThirdpartyDir() + "zlib/lib/zlibstatic.lib")
if (PkgSkip("VRPN")==0): LibName("VRPN", GetThirdpartyDir() + "vrpn/lib/vrpn.lib")
if (PkgSkip("VRPN")==0): LibName("VRPN", GetThirdpartyDir() + "vrpn/lib/quat.lib")
if (PkgSkip("NVIDIACG")==0): LibName("CGGL", GetThirdpartyDir() + "nvidiacg/lib/cgGL.lib")
if (PkgSkip("NVIDIACG")==0): LibName("CGDX9", GetThirdpartyDir() + "nvidiacg/lib/cgD3D9.lib")
if (PkgSkip("NVIDIACG")==0): LibName("NVIDIACG", GetThirdpartyDir() + "nvidiacg/lib/cg.lib")
if (PkgSkip("OPENSSL")==0): LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandassl.lib")
if (PkgSkip("OPENSSL")==0): LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandaeay.lib")
if (PkgSkip("FREETYPE")==0): LibName("FREETYPE", GetThirdpartyDir() + "freetype/lib/freetype.lib")
if (PkgSkip("FFTW")==0): LibName("FFTW", GetThirdpartyDir() + "fftw/lib/rfftw.lib")
if (PkgSkip("FFTW")==0): LibName("FFTW", GetThirdpartyDir() + "fftw/lib/fftw.lib")
if (PkgSkip("ARTOOLKIT")==0):LibName("ARTOOLKIT",GetThirdpartyDir() + "artoolkit/lib/libAR.lib")
if (PkgSkip("FCOLLADA")==0): LibName("FCOLLADA", GetThirdpartyDir() + "fcollada/lib/FCollada.lib")
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cv.lib")
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/highgui.lib")
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cvaux.lib")
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/ml.lib")
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cxcore.lib")
if (PkgSkip("AWESOMIUM")==0):LibName("AWESOMIUM",GetThirdpartyDir() + "awesomium/lib/Awesomium.lib")
if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avcodec.lib")
if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avformat.lib")
if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avutil.lib")
if (PkgSkip("SWSCALE")==0): LibName("SWSCALE", GetThirdpartyDir() + "ffmpeg/lib/swscale.lib")
if (PkgSkip("SWRESAMPLE")==0):LibName("SWRESAMPLE",GetThirdpartyDir() + "ffmpeg/lib/swresample.lib")
if (PkgSkip("SQUISH")==0):
if GetOptimize() <= 2:
LibName("SQUISH", GetThirdpartyDir() + "squish/lib/squishd.lib")
else:
LibName("SQUISH", GetThirdpartyDir() + "squish/lib/squish.lib")
if (PkgSkip("ROCKET")==0):
LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketCore.lib")
LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketControls.lib")
if (PkgSkip("PYTHON")==0):
LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/" + SDK["PYTHONVERSION"] + "/boost_python-vc100-mt-1_54.lib")
if (GetOptimize() <= 3):
LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketDebugger.lib")
if (PkgSkip("OPENAL")==0): LibName("OPENAL", GetThirdpartyDir() + "openal/lib/OpenAL32.lib")
if (PkgSkip("ODE")==0):
LibName("ODE", GetThirdpartyDir() + "ode/lib/ode_single.lib")
DefSymbol("ODE", "dSINGLE", "")
if (PkgSkip("FMODEX")==0):
if (GetTargetArch() == 'x64'):
LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex64_vc.lib")
else:
LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex_vc.lib")
if (PkgSkip("WX")==0 and RTDIST):
LibName("WX", GetThirdpartyDir() + "wx/lib/wxbase28u.lib")
LibName("WX", GetThirdpartyDir() + "wx/lib/wxmsw28u_core.lib")
DefSymbol("WX", "__WXMSW__", "")
DefSymbol("WX", "_UNICODE", "")
DefSymbol("WX", "UNICODE", "")
if (PkgSkip("FLTK")==0 and RTDIST):
LibName("FLTK", GetThirdpartyDir() + "fltk/lib/fltk.lib")
if (PkgSkip("VORBIS")==0):
LibName("VORBIS", GetThirdpartyDir() + "vorbis/lib/libogg_static.lib")
LibName("VORBIS", GetThirdpartyDir() + "vorbis/lib/libvorbis_static.lib")
LibName("VORBIS", GetThirdpartyDir() + "vorbis/lib/libvorbisfile_static.lib")
for pkg in MAYAVERSIONS:
if (PkgSkip(pkg)==0):
LibName(pkg, '"' + SDK[pkg] + '/lib/Foundation.lib"')
LibName(pkg, '"' + SDK[pkg] + '/lib/OpenMaya.lib"')
LibName(pkg, '"' + SDK[pkg] + '/lib/OpenMayaAnim.lib"')
LibName(pkg, '"' + SDK[pkg] + '/lib/OpenMayaUI.lib"')
for pkg in MAXVERSIONS:
if (PkgSkip(pkg)==0):
LibName(pkg, SDK[pkg] + '/lib/core.lib')
LibName(pkg, SDK[pkg] + '/lib/edmodel.lib')
LibName(pkg, SDK[pkg] + '/lib/gfx.lib')
LibName(pkg, SDK[pkg] + '/lib/geom.lib')
LibName(pkg, SDK[pkg] + '/lib/mesh.lib')
LibName(pkg, SDK[pkg] + '/lib/maxutil.lib')
LibName(pkg, SDK[pkg] + '/lib/paramblk2.lib')
if (PkgSkip("PHYSX")==0):
if GetTargetArch() == 'x64':
LibName("PHYSX", SDK["PHYSXLIBS"] + "/PhysXLoader64.lib")
LibName("PHYSX", SDK["PHYSXLIBS"] + "/NxCharacter64.lib")
else:
LibName("PHYSX", SDK["PHYSXLIBS"] + "/PhysXLoader.lib")
LibName("PHYSX", SDK["PHYSXLIBS"] + "/NxCharacter.lib")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Physics/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/PhysXLoader/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/NxCharacter/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/NxExtensions/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Foundation/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Cooking/include")
if (PkgSkip("SPEEDTREE")==0):
if GetTargetArch() == 'x64':
libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC10.x64/"
p64ext = '64'
else:
libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC10/"
p64ext = ''
debugext = ''
if (GetOptimize() <= 2): debugext = "_d"
libsuffix = "_v%s_VC100MT%s_Static%s.lib" % (
SDK["SPEEDTREEVERSION"], p64ext, debugext)
LibName("SPEEDTREE", "%sSpeedTreeCore%s" % (libdir, libsuffix))
LibName("SPEEDTREE", "%sSpeedTreeForest%s" % (libdir, libsuffix))
LibName("SPEEDTREE", "%sSpeedTree%sRenderer%s" % (libdir, SDK["SPEEDTREEAPI"], libsuffix))
LibName("SPEEDTREE", "%sSpeedTreeRenderInterface%s" % (libdir, libsuffix))
if (SDK["SPEEDTREEAPI"] == "OpenGL"):
LibName("SPEEDTREE", "%sglew32.lib" % (libdir))
LibName("SPEEDTREE", "glu32.lib")
IncDirectory("SPEEDTREE", SDK["SPEEDTREE"] + "/Include")
if (PkgSkip("BULLET")==0):
suffix = '.lib'
if GetTargetArch() == 'x64':
suffix = '_x64.lib'
LibName("BULLET", GetThirdpartyDir() + "bullet/lib/LinearMath" + suffix)
LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletCollision" + suffix)
LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletDynamics" + suffix)
LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletSoftBody" + suffix)
if (COMPILER=="GCC"):
PkgDisable("AWESOMIUM")
if (GetTarget() != "darwin"):
PkgDisable("CARBON")
PkgDisable("COCOA")
elif (RTDIST or RUNTIME):
# We don't support Cocoa in the runtime yet.
PkgDisable("COCOA")
elif (not UNIVERSAL and GetTargetArch() == 'x86_64'):
# 64-bits OS X doesn't have Carbon.
PkgDisable("CARBON")
if (PkgSkip("PYTHON")==0):
IncDirectory("ALWAYS", SDK["PYTHON"])
if (GetHost() == "darwin"):
if (PkgSkip("FREETYPE")==0 and not os.path.isdir(GetThirdpartyDir() + 'freetype')):
IncDirectory("FREETYPE", "/usr/X11/include")
IncDirectory("FREETYPE", "/usr/X11/include/freetype2")
LibDirectory("FREETYPE", "/usr/X11/lib")
if (os.path.isdir("/usr/PCBSD")):
IncDirectory("ALWAYS", "/usr/PCBSD/local/include")
LibDirectory("ALWAYS", "/usr/PCBSD/local/lib")
if (GetHost() == "freebsd"):
IncDirectory("ALWAYS", "/usr/local/include")
LibDirectory("ALWAYS", "/usr/local/lib")
fcollada_libs = ("FColladaD", "FColladaSD", "FColladaS")
# WARNING! The order of the ffmpeg libraries matters!
ffmpeg_libs = ("libavformat", "libavcodec", "libavutil")
# Name pkg-config libs, include(dir)s
if (not RUNTIME):
SmartPkgEnable("EIGEN", "eigen3", (), ("Eigen/Dense",), target_pkg = 'ALWAYS')
SmartPkgEnable("ARTOOLKIT", "", ("AR"), "AR/ar.h")
SmartPkgEnable("FCOLLADA", "", ChooseLib(fcollada_libs, "FCOLLADA"), ("FCollada", "FCollada.h"))
SmartPkgEnable("FFMPEG", ffmpeg_libs, ffmpeg_libs, ffmpeg_libs)
SmartPkgEnable("SWSCALE", "libswscale", "libswscale", ("libswscale", "libswscale/swscale.h"), target_pkg = "FFMPEG")
SmartPkgEnable("SWRESAMPLE","libswresample", "libswresample", ("libswresample", "libswresample/swresample.h"), target_pkg = "FFMPEG")
SmartPkgEnable("FFTW", "", ("fftw", "rfftw"), ("fftw.h", "rfftw.h"))
SmartPkgEnable("FMODEX", "", ("fmodex"), ("fmodex", "fmodex/fmod.h"))
SmartPkgEnable("FREETYPE", "freetype2", ("freetype"), ("freetype2", "freetype2/freetype/freetype.h"))
SmartPkgEnable("GL", "gl", ("GL"), ("GL/gl.h"), framework = "OpenGL")
SmartPkgEnable("GLES", "glesv1_cm", ("GLESv1_CM"), ("GLES/gl.h"), framework = "OpenGLES")
SmartPkgEnable("GLES2", "glesv2", ("GLESv2"), ("GLES2/gl2.h")) #framework = "OpenGLES"?
SmartPkgEnable("EGL", "egl", ("EGL"), ("EGL/egl.h"))
SmartPkgEnable("NVIDIACG", "", ("Cg"), "Cg/cg.h", framework = "Cg")
SmartPkgEnable("ODE", "", ("ode"), "ode/ode.h", tool = "ode-config")
SmartPkgEnable("OPENAL", "openal", ("openal"), "AL/al.h", framework = "OpenAL")
SmartPkgEnable("OPENCV", "opencv", ("cv", "highgui", "cvaux", "ml", "cxcore"), ("opencv", "opencv/cv.h"))
SmartPkgEnable("SQUISH", "", ("squish"), "squish.h")
SmartPkgEnable("TIFF", "", ("tiff"), "tiff.h")
SmartPkgEnable("VRPN", "", ("vrpn", "quat"), ("vrpn", "quat.h", "vrpn/vrpn_Types.h"))
SmartPkgEnable("BULLET", "bullet", ("BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"), ("bullet", "bullet/btBulletDynamicsCommon.h"))
SmartPkgEnable("VORBIS", "vorbisfile",("vorbisfile", "vorbis", "ogg"), ("ogg/ogg.h", "vorbis/vorbisfile.h"))
rocket_libs = ("RocketCore", "RocketControls")
if (GetOptimize() <= 3):
rocket_libs += ("RocketDebugger",)
if (GetHost() != "darwin"):
# We use a statically linked libboost_python on OSX
rocket_libs += ("boost_python",)
SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h")
SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h")
SmartPkgEnable("OPENSSL", "openssl", ("ssl", "crypto"), ("openssl/ssl.h", "openssl/crypto.h"))
SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config")
SmartPkgEnable("ZLIB", "zlib", ("z"), "zlib.h")
SmartPkgEnable("GTK2", "gtk+-2.0")
if (RTDIST and GetHost() == "darwin" and "PYTHONVERSION" in SDK):
# Don't use the framework for the OSX rtdist build. I'm afraid it gives problems somewhere.
SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config")
elif("PYTHONVERSION" in SDK and not RUNTIME):
SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config", framework = "Python")
if (RTDIST):
SmartPkgEnable("WX", tool = "wx-config")
SmartPkgEnable("FLTK", "", ("fltk"), ("Fl/Fl.H"), tool = "fltk-config")
if (RUNTIME):
if (GetHost() == 'darwin'):
SmartPkgEnable("NPAPI", "", (), ("npapi.h"))
if not os.path.isdir(GetThirdpartyDir() + "npapi"):
IncDirectory("NPAPI", "/System/Library/Frameworks/WebKit.framework/Headers")
elif (GetHost() == "freebsd"):
SmartPkgEnable("NPAPI", "mozilla-plugin", (), ("libxul/stable", "libxul/stable/npapi.h", "nspr/prtypes.h", "nspr"))
else:
SmartPkgEnable("NPAPI", "mozilla-plugin", (), ("xulrunner-*/stable", "xulrunner-*/stable/npapi.h", "nspr*/prtypes.h", "nspr*"))
if GetTarget() != 'darwin':
# CgGL is covered by the Cg framework, and we don't need X11 components on OSX
if (PkgSkip("NVIDIACG")==0 and not RUNTIME):
SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h")
if (not RUNTIME):
SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h"))
SmartPkgEnable("XRANDR", "xrandr", "Xrandr", "X11/extensions/Xrandr.h")
SmartPkgEnable("XF86DGA", "xxf86dga", "Xxf86dga", "X11/extensions/xf86dga.h")
SmartPkgEnable("XCURSOR", "xcursor", "Xcursor", "X11/Xcursor/Xcursor.h")
if GetHost() != "darwin":
# Workaround for an issue where pkg-config does not include this path
if GetTargetArch() in ("x86_64", "amd64"):
if (os.path.isdir("/usr/lib64/glib-2.0/include")):
IncDirectory("GTK2", "/usr/lib64/glib-2.0/include")
if (os.path.isdir("/usr/lib64/gtk-2.0/include")):
IncDirectory("GTK2", "/usr/lib64/gtk-2.0/include")
if not PkgSkip("X11"):
if (os.path.isdir("/usr/X11R6/lib64")):
LibDirectory("ALWAYS", "/usr/X11R6/lib64")
else:
LibDirectory("ALWAYS", "/usr/X11R6/lib")
elif not PkgSkip("X11"):
LibDirectory("ALWAYS", "/usr/X11R6/lib")
if (RUNTIME):
# For the runtime, all packages are required
for pkg in ["OPENSSL", "ZLIB", "NPAPI", "JPEG", "PNG"]:
skips = []
if (pkg in PkgListGet() and PkgSkip(pkg)==1):
skips.append(pkg)
if skips:
exit("Runtime must be compiled with OpenSSL, ZLib, NPAPI, JPEG and PNG support (missing %s)" % (', '.join(skips)))
for pkg in MAYAVERSIONS:
if (PkgSkip(pkg)==0 and (pkg in SDK)):
if (GetHost() == "darwin"):
# Sheesh, Autodesk really can't make up their mind
# regarding the location of the Maya devkit on OS X.
if (os.path.isdir(SDK[pkg] + "/Maya.app/Contents/lib")):
LibDirectory(pkg, SDK[pkg] + "/Maya.app/Contents/lib")
if (os.path.isdir(SDK[pkg] + "/Maya.app/Contents/MacOS")):
LibDirectory(pkg, SDK[pkg] + "/Maya.app/Contents/MacOS")
if (os.path.isdir(SDK[pkg] + "/lib")):
LibDirectory(pkg, SDK[pkg] + "/lib")
if (os.path.isdir(SDK[pkg] + "/Maya.app/Contents/include/maya")):
IncDirectory(pkg, SDK[pkg] + "/Maya.app/Contents/include")
if (os.path.isdir(SDK[pkg] + "/devkit/include/maya")):
IncDirectory(pkg, SDK[pkg] + "/devkit/include")
if (os.path.isdir(SDK[pkg] + "/include/maya")):
IncDirectory(pkg, SDK[pkg] + "/include")
else:
LibDirectory(pkg, SDK[pkg] + "/lib")
IncDirectory(pkg, SDK[pkg] + "/include")
DefSymbol(pkg, "MAYAVERSION", pkg)
if GetTarget() == 'darwin':
LibName("ALWAYS", "-framework AppKit")
if (PkgSkip("OPENCV")==0):
LibName("OPENCV", "-framework QuickTime")
LibName("AGL", "-framework AGL")
LibName("CARBON", "-framework Carbon")
LibName("COCOA", "-framework Cocoa")
# Fix for a bug in OSX Leopard:
LibName("GL", "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
if GetTarget() == 'android':
LibName("ALWAYS", '-llog')
LibName("ALWAYS", '-landroid')
LibName("JNIGRAPHICS", '-ljnigraphics')
for pkg in MAYAVERSIONS:
if (PkgSkip(pkg)==0 and (pkg in SDK)):
if GetTarget() == 'darwin':
LibName(pkg, "-Wl,-rpath," + SDK[pkg] + "/Maya.app/Contents/MacOS")
else:
LibName(pkg, "-Wl,-rpath," + SDK[pkg] + "/lib")
LibName(pkg, "-lOpenMaya")
LibName(pkg, "-lOpenMayaAnim")
LibName(pkg, "-lAnimSlice")
LibName(pkg, "-lDeformSlice")
LibName(pkg, "-lModifiers")
LibName(pkg, "-lDynSlice")
LibName(pkg, "-lKinSlice")
LibName(pkg, "-lModelSlice")
LibName(pkg, "-lNurbsSlice")
LibName(pkg, "-lPolySlice")
LibName(pkg, "-lProjectSlice")
LibName(pkg, "-lImage")
LibName(pkg, "-lShared")
LibName(pkg, "-lTranslators")
LibName(pkg, "-lDataModel")
LibName(pkg, "-lRenderModel")
LibName(pkg, "-lNurbsEngine")
LibName(pkg, "-lDependEngine")
LibName(pkg, "-lCommandEngine")
LibName(pkg, "-lFoundation")
LibName(pkg, "-lIMFbase")
if GetTarget() != 'darwin':
LibName(pkg, "-lOpenMayalib")
else:
LibName(pkg, "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
if (PkgSkip("PHYSX")==0):
IncDirectory("PHYSX", SDK["PHYSX"] + "/Physics/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/PhysXLoader/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/NxCharacter/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/NxExtensions/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Foundation/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Cooking/include")
LibDirectory("PHYSX", SDK["PHYSXLIBS"])
if (GetHost() == "darwin"):
LibName("PHYSX", SDK["PHYSXLIBS"] + "/osxstatic/PhysXCooking.a")
LibName("PHYSX", SDK["PHYSXLIBS"] + "/osxstatic/PhysXCore.a")
else:
LibName("PHYSX", "-lPhysXLoader")
LibName("PHYSX", "-lNxCharacter")
DefSymbol("WITHINPANDA", "WITHIN_PANDA", "1")
if GetLinkAllStatic():
DefSymbol("ALWAYS", "LINK_ALL_STATIC", "")
if GetTarget() == 'android':
DefSymbol("ALWAYS", "ANDROID", "")
########################################################################
##
## Give a Status Report on Command-Line Options
##
########################################################################
def printStatus(header,warnings):
if GetVerbose():
print("")
print("-------------------------------------------------------------------")
print(header)
tkeep = ""
tomit = ""
for x in PkgListGet():
if (PkgSkip(x)==0): tkeep = tkeep + x + " "
else: tomit = tomit + x + " "
if RTDIST: print("Makepanda: Runtime distribution build")
elif RUNTIME: print("Makepanda: Runtime build")
else: print("Makepanda: Regular build")
print("Makepanda: Compiler:",COMPILER)
print("Makepanda: Optimize:",GetOptimize())
print("Makepanda: Keep Pkg:",tkeep)
print("Makepanda: Omit Pkg:",tomit)
if (GENMAN): print("Makepanda: Generate API reference manual")
else : print("Makepanda: Don't generate API reference manual")
if (GetHost() == "windows" and not RTDIST):
if INSTALLER: print("Makepanda: Build installer, using",COMPRESSOR)
else : print("Makepanda: Don't build installer")
print("Makepanda: Version ID: "+VERSION)
for x in warnings: print("Makepanda: "+x)
print("-------------------------------------------------------------------")
print("")
sys.stdout.flush()
########################################################################
##
## BracketNameWithQuotes
##
########################################################################
def BracketNameWithQuotes(name):
# Workaround for OSX bug - compiler doesn't like those flags quoted.
if (name.startswith("-framework")): return name
if (name.startswith("-dylib_file")): return name
# Don't add quotes when it's not necessary.
if " " not in name: return name
# Account for quoted name (leave as is) but quote everything else (e.g., to protect spaces within paths from improper parsing)
if (name.startswith('"') and name.endswith('"')): return name
else: return '"' + name + '"'
########################################################################
##
## CompileCxx
##
########################################################################
def CompileCxx(obj,src,opts):
ipath = GetListOption(opts, "DIR:")
optlevel = GetOptimizeOption(opts)
if (COMPILER=="MSVC"):
if not BOOUSEINTELCOMPILER:
cmd = "cl "
if GetTargetArch() == 'x64':
cmd += "/favor:blend "
cmd += "/wd4996 /wd4275 /wd4267 /wd4101 /wd4273 "
# Enable Windows 7 interfaces if we need Touchinput.
if PkgSkip("TOUCHINPUT") == 0:
cmd += "/DWINVER=0x601 "
cmd += "/Fo" + obj + " /nologo /c"
if (GetTargetArch() != 'x64' and PkgSkip("SSE2") == 0):
cmd += " /arch:SSE2"
for x in ipath: cmd += " /I" + x
for (opt,dir) in INCDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
for (opt,var,val) in DEFSYMBOLS:
if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
if (opts.count('NOFLOATWARN')): cmd += ' /wd4244 /wd4305'
if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS"
if (optlevel==2): cmd += " /MDd /Zi"
if (optlevel==3): cmd += " /MD /Zi /O2 /Ob2 /Oi /Ot /fp:fast /DFORCE_INLINING"
if (optlevel==4):
cmd += " /MD /Zi /Ox /Ob2 /Oi /Ot /fp:fast /DFORCE_INLINING /DNDEBUG /GL"
cmd += " /Oy /Zp16" # jean-claude add /Zp16 insures correct static alignment for SSEx
cmd += " /Fd" + os.path.splitext(obj)[0] + ".pdb"
building = GetValueOption(opts, "BUILDING:")
if (building):
cmd += " /DBUILDING_" + building
if ("BIGOBJ" in opts) or GetTargetArch() == 'x64':
cmd += " /bigobj"
cmd += " /EHa /Zm300 /DWIN32_VC /DWIN32"
if GetTargetArch() == 'x64':
cmd += " /DWIN64_VC /DWIN64"
cmd += " /W3 " + BracketNameWithQuotes(src)
oscmd(cmd)
else:
cmd = "icl "
if GetTargetArch() == 'x64':
cmd += "/favor:blend "
cmd += "/wd4996 /wd4275 /wd4267 /wd4101 /wd4273 "
# Enable Windows 7 interfaces if we need Touchinput.
if PkgSkip("TOUCHINPUT") == 0:
cmd += "/DWINVER=0x601 "
cmd += "/Fo" + obj + " /c"
for x in ipath: cmd += " /I" + x
for (opt,dir) in INCDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
for (opt,var,val) in DEFSYMBOLS:
if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
if (opts.count('NOFLOATWARN')): cmd += ' /wd4244 /wd4305'
if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS"
if (optlevel==2): cmd += " /MDd /Zi /arch:SSE3"
# core changes from jean-claude (dec 2011)
# ----------------------------------------