makepanda.py 267 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177
  1. #!/usr/bin/env python
  2. ########################################################################
  3. #
  4. # To build panda using this script, type 'makepanda.py' on unix
  5. # or 'makepanda.bat' on windows, and examine the help-text.
  6. # Then run the script again with the appropriate options to compile
  7. # panda3d.
  8. #
  9. ########################################################################
  10. import sys
  11. if sys.version_info < (3, 8):
  12. print("This version of Python is not supported, use version 3.8 or higher.")
  13. exit(1)
  14. try:
  15. import os
  16. import time
  17. import re
  18. import getopt
  19. import threading
  20. import signal
  21. import shutil
  22. import plistlib
  23. import queue
  24. except KeyboardInterrupt:
  25. raise
  26. except:
  27. print("You are either using an incomplete or an old version of Python!")
  28. print("Please install the development package of Python and try again.")
  29. exit(1)
  30. from makepandacore import *
  31. from sysconfig import get_platform
  32. try:
  33. import zlib
  34. except:
  35. zlib = None
  36. ########################################################################
  37. ##
  38. ## PARSING THE COMMAND LINE OPTIONS
  39. ##
  40. ## You might be tempted to change the defaults by editing them
  41. ## here. Don't do it. Instead, create a script that compiles
  42. ## panda with your preferred options. Or, create
  43. ## a 'makepandaPreferences' file and put it into your python path.
  44. ##
  45. ########################################################################
  46. COMPILER=0
  47. INSTALLER=0
  48. WHEEL=0
  49. RUNTESTS=0
  50. GENMAN=0
  51. COMPRESSOR="zlib"
  52. THREADCOUNT=0
  53. CFLAGS=""
  54. CXXFLAGS=""
  55. LDFLAGS=""
  56. DISTRIBUTOR=""
  57. VERSION=None
  58. DEBVERSION=None
  59. WHLVERSION=None
  60. RPMVERSION=None
  61. RPMRELEASE="1"
  62. GIT_COMMIT=None
  63. MAJOR_VERSION=None
  64. OSX_ARCHS=[]
  65. STRDXSDKVERSION = 'default'
  66. WINDOWS_SDK = None
  67. MSVC_VERSION = None
  68. BOOUSEINTELCOMPILER = False
  69. OPENCV_VER_23 = False
  70. PLATFORM = None
  71. COPY_PYTHON = True
  72. PkgListSet(["PYTHON", "DIRECT", # Python support
  73. "GL", "GLES", "GLES2"] + DXVERSIONS + ["TINYDISPLAY", "NVIDIACG", # 3D graphics
  74. "EGL", # OpenGL (ES) integration
  75. "EIGEN", # Linear algebra acceleration
  76. "OPENAL", "FMODEX", # Audio playback
  77. "VORBIS", "OPUS", "FFMPEG", "SWSCALE", "SWRESAMPLE", # Audio decoding
  78. "ODE", "BULLET", "PANDAPHYSICS", # Physics
  79. "SPEEDTREE", # SpeedTree
  80. "ZLIB", "PNG", "JPEG", "TIFF", "OPENEXR", "SQUISH", # 2D Formats support
  81. "FCOLLADA", "ASSIMP", "EGG", # 3D Formats support
  82. "FREETYPE", "HARFBUZZ", # Text rendering
  83. "VRPN", "OPENSSL", # Transport
  84. "FFTW", # Algorithm helpers
  85. "ARTOOLKIT", "OPENCV", "DIRECTCAM", "VISION", # Augmented Reality
  86. "GTK3", # GTK3 is used for PStats on Unix
  87. "MFC", "WX", "FLTK", # Used for web plug-in only
  88. "COCOA", # macOS toolkits
  89. "X11", # Unix platform support
  90. "PANDATOOL", "PVIEW", "DEPLOYTOOLS", # Toolchain
  91. "SKEL", # Example SKEL project
  92. "PANDAFX", # Some distortion special lenses
  93. "PANDAPARTICLESYSTEM", # Built in particle system
  94. "CONTRIB", # Experimental
  95. "SSE2", "NEON", # Compiler features
  96. "MIMALLOC", # Memory allocators
  97. ])
  98. CheckPandaSourceTree()
  99. def keyboardInterruptHandler(x,y):
  100. exit("keyboard interrupt")
  101. signal.signal(signal.SIGINT, keyboardInterruptHandler)
  102. ########################################################################
  103. ##
  104. ## Command-line parser.
  105. ##
  106. ## You can type "makepanda --help" to see all the options.
  107. ##
  108. ########################################################################
  109. def usage(problem):
  110. if problem:
  111. print("")
  112. print("Error parsing command-line input: %s" % (problem))
  113. print("")
  114. print("Makepanda generates a 'built' subdirectory containing a")
  115. print("compiled copy of Panda3D. Command-line arguments are:")
  116. print("")
  117. print(" --help (print the help message you're reading now)")
  118. print(" --verbose (print out more information)")
  119. print(" --tests (run the test suite)")
  120. print(" --installer (build an installer)")
  121. print(" --wheel (build a pip-installable .whl)")
  122. print(" --optimize X (optimization level can be 1,2,3,4)")
  123. print(" --version X (set the panda version number)")
  124. print(" --lzma (use lzma compression when building Windows installer)")
  125. print(" --distributor X (short string identifying the distributor of the build)")
  126. print(" --outputdir X (use the specified directory instead of 'built')")
  127. print(" --threads N (use the multithreaded build system. see manual)")
  128. print(" --universal (build universal binaries (macOS 11.0+ only))")
  129. print(" --override \"O=V\" (override dtool_config/prc option value)")
  130. print(" --static (builds libraries for static linking)")
  131. print(" --target X (experimental cross-compilation (android only))")
  132. print(" --arch X (target architecture for cross-compilation)")
  133. print("")
  134. for pkg in PkgListGet():
  135. p = pkg.lower()
  136. print(" --use-%-9s --no-%-9s (enable/disable use of %s)"%(p, p, pkg))
  137. if sys.platform != 'win32':
  138. print(" --<PKG>-incdir (custom location for header files of thirdparty package)")
  139. print(" --<PKG>-libdir (custom location for library files of thirdparty package)")
  140. print("")
  141. print(" --nothing (disable every third-party lib)")
  142. print(" --everything (enable every third-party lib)")
  143. print(" --directx-sdk=X (specify version of DirectX SDK to use: jun2010, aug2009)")
  144. print(" --windows-sdk=X (specify Windows SDK version, eg. 7.1, 8.1, 10 or 11. Default is 8.1)")
  145. print(" --msvc-version=X (specify Visual C++ version, eg. 14.1, 14.2, 14.3. Default is 14.1)")
  146. print(" --use-icl (experimental setting to use an intel compiler instead of MSVC on Windows)")
  147. print("")
  148. print("The simplest way to compile panda is to just type:")
  149. print("")
  150. print(" makepanda --everything")
  151. print("")
  152. os._exit(1)
  153. def parseopts(args):
  154. global INSTALLER,WHEEL,RUNTESTS,GENMAN,DISTRIBUTOR,VERSION
  155. global COMPRESSOR,THREADCOUNT,OSX_ARCHS
  156. global DEBVERSION,WHLVERSION,RPMVERSION,RPMRELEASE,GIT_COMMIT
  157. global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER
  158. global COPY_PYTHON
  159. # Options for which to display a deprecation warning.
  160. removedopts = [
  161. "use-touchinput", "no-touchinput", "no-awesomium", "no-directscripts",
  162. "no-carbon", "no-physx", "no-rocket", "host", "osxtarget=",
  163. "no-max6", "no-max7", "no-max8", "no-max9", "no-max2009",
  164. "no-max2010", "no-max2011", "no-max2012", "no-max2013", "no-max2014",
  165. "no-maya6", "no-maya65", "no-maya7", "no-maya8", "no-maya85",
  166. "no-maya2008", "no-maya2009", "no-maya2010", "no-maya2011",
  167. "no-maya2012", "no-maya2013", "no-maya20135", "no-maya2014",
  168. "no-maya2015", "no-maya2016", "no-maya20165", "no-maya2017",
  169. "no-maya2018", "no-maya2019", "no-maya2020", "no-maya2022",
  170. ]
  171. # All recognized options.
  172. longopts = [
  173. "help","distributor=","verbose","tests",
  174. "optimize=","everything","nothing","installer","wheel","rtdist","nocolor",
  175. "version=","lzma","no-python","threads=","outputdir=","override=",
  176. "static","debversion=","rpmversion=","rpmrelease=","p3dsuffix=","rtdist-version=",
  177. "directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl",
  178. "universal", "target=", "arch=", "git-commit=", "no-copy-python",
  179. "cggl-incdir=", "cggl-libdir=",
  180. ] + removedopts
  181. anything = 0
  182. optimize = ""
  183. target = None
  184. target_archs = []
  185. universal = False
  186. clean_build = False
  187. for pkg in PkgListGet():
  188. longopts.append("use-" + pkg.lower())
  189. longopts.append("no-" + pkg.lower())
  190. longopts.append(pkg.lower() + "-incdir=")
  191. longopts.append(pkg.lower() + "-libdir=")
  192. try:
  193. opts, extras = getopt.getopt(args, "", longopts)
  194. for option, value in opts:
  195. if (option=="--help"): raise Exception
  196. elif (option=="--optimize"): optimize=value
  197. elif (option=="--installer"): INSTALLER=1
  198. elif (option=="--tests"): RUNTESTS=1
  199. elif (option=="--wheel"): WHEEL=1
  200. elif (option=="--verbose"): SetVerbose(True)
  201. elif (option=="--distributor"): DISTRIBUTOR=value
  202. elif (option=="--genman"): GENMAN=1
  203. elif (option=="--everything"): PkgEnableAll()
  204. elif (option=="--nothing"): PkgDisableAll()
  205. elif (option=="--threads"): THREADCOUNT=int(value)
  206. elif (option=="--outputdir"): SetOutputDir(value.strip())
  207. elif (option=="--universal"): universal = True
  208. elif (option=="--target"): target = value.strip()
  209. elif (option=="--arch"): target_archs.append(value.strip())
  210. elif (option=="--nocolor"): DisableColors()
  211. elif (option=="--version"):
  212. match = re.match(r'^\d+\.\d+(\.\d+)+', value)
  213. if not match:
  214. usage("version requires three digits")
  215. WHLVERSION = value
  216. VERSION = match.group()
  217. elif (option=="--lzma"): COMPRESSOR="lzma"
  218. elif (option=="--override"): AddOverride(value.strip())
  219. elif (option=="--static"): SetLinkAllStatic(True)
  220. elif (option=="--debversion"): DEBVERSION=value
  221. elif (option=="--rpmversion"): RPMVERSION=value
  222. elif (option=="--rpmrelease"): RPMRELEASE=value
  223. elif (option=="--git-commit"): GIT_COMMIT=value
  224. # Backward compatibility, OPENGL was renamed to GL
  225. elif (option=="--use-opengl"): PkgEnable("GL")
  226. elif (option=="--no-opengl"): PkgDisable("GL")
  227. elif (option=="--directx-sdk"):
  228. STRDXSDKVERSION = value.strip().lower()
  229. if STRDXSDKVERSION == '':
  230. print("No DirectX SDK version specified. Using 'default' DirectX SDK search")
  231. STRDXSDKVERSION = 'default'
  232. elif (option=="--windows-sdk"):
  233. WINDOWS_SDK = value.strip().lower()
  234. elif (option=="--msvc-version"):
  235. MSVC_VERSION = value.strip().lower()
  236. elif (option=="--use-icl"): BOOUSEINTELCOMPILER = True
  237. elif (option=="--clean"): clean_build = True
  238. elif (option=="--no-copy-python"): COPY_PYTHON = False
  239. elif (option[2:] in removedopts or option[2:]+'=' in removedopts):
  240. Warn("Ignoring removed option %s" % (option))
  241. else:
  242. for pkg in PkgListGet() + ['CGGL']:
  243. if option == "--use-" + pkg.lower():
  244. PkgEnable(pkg)
  245. break
  246. elif option == "--no-" + pkg.lower():
  247. PkgDisable(pkg)
  248. break
  249. elif option == "--" + pkg.lower() + "-incdir":
  250. PkgSetCustomLocation(pkg)
  251. IncDirectory(pkg, value)
  252. break
  253. elif option == "--" + pkg.lower() + "-libdir":
  254. PkgSetCustomLocation(pkg)
  255. LibDirectory(pkg, value)
  256. break
  257. if (option == "--everything" or option.startswith("--use-")
  258. or option == "--nothing" or option.startswith("--no-")):
  259. anything = 1
  260. except:
  261. usage(sys.exc_info()[1])
  262. if not anything:
  263. usage("You should specify a list of packages to use or --everything to enable all packages.")
  264. if (optimize==""): optimize = "3"
  265. if target is not None or target_archs:
  266. SetTarget(target, target_archs[-1] if target_archs else None)
  267. if universal:
  268. if target_archs:
  269. exit("--universal is incompatible with --arch")
  270. OSX_ARCHS.append("x86_64")
  271. OSX_ARCHS.append("arm64")
  272. elif target_archs:
  273. OSX_ARCHS = target_archs
  274. elif GetTarget() == 'darwin':
  275. OSX_ARCHS = (GetTargetArch(),)
  276. try:
  277. SetOptimize(int(optimize))
  278. assert GetOptimize() in [1, 2, 3, 4]
  279. except:
  280. usage("Invalid setting for OPTIMIZE")
  281. if GIT_COMMIT is not None and not re.match("^[a-f0-9]{40}$", GIT_COMMIT):
  282. usage("Invalid SHA-1 hash given for --git-commit option!")
  283. if GetTarget() == 'windows':
  284. if not MSVC_VERSION:
  285. print("No MSVC version specified. Defaulting to 14.1 (Visual Studio 2017).")
  286. MSVC_VERSION = (14, 1)
  287. else:
  288. try:
  289. MSVC_VERSION = tuple(int(d) for d in MSVC_VERSION.split('.'))[:2]
  290. if (len(MSVC_VERSION) == 1):
  291. MSVC_VERSION += (0,)
  292. except:
  293. usage("Invalid setting for --msvc-version")
  294. if MSVC_VERSION < (14, 1):
  295. warn_prefix = "%sERROR:%s " % (GetColor("red"), GetColor())
  296. print("=========================================================================")
  297. print(warn_prefix + "Support for MSVC versions before 2017 has been discontinued.")
  298. print("=========================================================================")
  299. sys.stdout.flush()
  300. time.sleep(1.0)
  301. sys.exit(1)
  302. if clean_build and os.path.isdir(GetOutputDir()):
  303. print("Deleting %s" % (GetOutputDir()))
  304. shutil.rmtree(GetOutputDir())
  305. parseopts(sys.argv[1:])
  306. ########################################################################
  307. ##
  308. ## Handle environment variables.
  309. ##
  310. ########################################################################
  311. if ("CFLAGS" in os.environ):
  312. CFLAGS = os.environ["CFLAGS"].strip()
  313. if ("CXXFLAGS" in os.environ):
  314. CXXFLAGS = os.environ["CXXFLAGS"].strip()
  315. if ("RPM_OPT_FLAGS" in os.environ):
  316. CFLAGS += " " + os.environ["RPM_OPT_FLAGS"].strip()
  317. CXXFLAGS += " " + os.environ["RPM_OPT_FLAGS"].strip()
  318. if ("LDFLAGS" in os.environ):
  319. LDFLAGS = os.environ["LDFLAGS"].strip()
  320. os.environ["MAKEPANDA"] = os.path.abspath(sys.argv[0])
  321. if GetHost() == "darwin":
  322. if tuple(OSX_ARCHS) == ('arm64',):
  323. os.environ["MACOSX_DEPLOYMENT_TARGET"] = "11.0"
  324. else:
  325. os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.9"
  326. ########################################################################
  327. ##
  328. ## Configure things based on the command-line parameters.
  329. ##
  330. ########################################################################
  331. if VERSION is None:
  332. # Take the value from the setup.cfg file.
  333. VERSION = GetMetadataValue('version')
  334. match = re.match(r'^\d+\.\d+(\.\d+)+', VERSION)
  335. if not match:
  336. exit("Invalid version %s in setup.cfg, three digits are required" % (VERSION))
  337. if WHLVERSION is None:
  338. WHLVERSION = VERSION
  339. VERSION = match.group()
  340. if WHLVERSION is None:
  341. WHLVERSION = VERSION
  342. print("Version: %s" % VERSION)
  343. if DEBVERSION is None:
  344. DEBVERSION = VERSION
  345. if RPMVERSION is None:
  346. RPMVERSION = VERSION
  347. MAJOR_VERSION = '.'.join(VERSION.split('.')[:2])
  348. # Now determine the distutils-style platform tag for the target system.
  349. target = GetTarget()
  350. target_arch = GetTargetArch()
  351. if target == 'windows':
  352. if target_arch == 'x64':
  353. PLATFORM = 'win-amd64'
  354. else:
  355. PLATFORM = 'win32'
  356. elif target == 'darwin':
  357. arch_tag = None
  358. if not OSX_ARCHS:
  359. arch_tag = target_arch
  360. elif len(OSX_ARCHS) == 1:
  361. arch_tag = OSX_ARCHS[0]
  362. elif frozenset(OSX_ARCHS) == frozenset(('i386', 'ppc')):
  363. arch_tag = 'fat'
  364. elif frozenset(OSX_ARCHS) == frozenset(('x86_64', 'i386')):
  365. arch_tag = 'intel'
  366. elif frozenset(OSX_ARCHS) == frozenset(('x86_64', 'ppc64')):
  367. arch_tag = 'fat64'
  368. elif frozenset(OSX_ARCHS) == frozenset(('x86_64', 'i386', 'ppc')):
  369. arch_tag = 'fat32'
  370. elif frozenset(OSX_ARCHS) == frozenset(('x86_64', 'i386', 'ppc64', 'ppc')):
  371. arch_tag = 'universal'
  372. elif frozenset(OSX_ARCHS) == frozenset(('x86_64', 'arm64')):
  373. arch_tag = 'universal2'
  374. else:
  375. raise RuntimeError('No arch tag for arch combination %s' % OSX_ARCHS)
  376. if arch_tag == 'arm64':
  377. PLATFORM = 'macosx-11.0-' + arch_tag
  378. else:
  379. PLATFORM = 'macosx-10.9-' + arch_tag
  380. elif target == 'linux' and (os.path.isfile("/lib/libc-2.5.so") or os.path.isfile("/lib64/libc-2.5.so")) and os.path.isdir("/opt/python"):
  381. # This is manylinux1. A bit of a sloppy check, though.
  382. if target_arch in ('x86_64', 'amd64'):
  383. PLATFORM = 'manylinux1-x86_64'
  384. elif target_arch in ('arm64', 'aarch64'):
  385. PLATFORM = 'manylinux1-aarch64'
  386. else:
  387. PLATFORM = 'manylinux1-i686'
  388. elif target == 'linux' and (os.path.isfile("/lib/libc-2.12.so") or os.path.isfile("/lib64/libc-2.12.so")) and os.path.isdir("/opt/python"):
  389. # Same sloppy check for manylinux2010.
  390. if target_arch in ('x86_64', 'amd64'):
  391. PLATFORM = 'manylinux2010-x86_64'
  392. elif target_arch in ('arm64', 'aarch64'):
  393. PLATFORM = 'manylinux2010-aarch64'
  394. else:
  395. PLATFORM = 'manylinux2010-i686'
  396. elif target == 'linux' and (os.path.isfile("/lib/libc-2.17.so") or os.path.isfile("/lib64/libc-2.17.so")) and os.path.isdir("/opt/python"):
  397. # Same sloppy check for manylinux2014.
  398. if target_arch in ('x86_64', 'amd64'):
  399. PLATFORM = 'manylinux2014-x86_64'
  400. elif target_arch in ('arm64', 'aarch64'):
  401. PLATFORM = 'manylinux2014-aarch64'
  402. else:
  403. PLATFORM = 'manylinux2014-i686'
  404. elif target == 'linux' and (os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64-linux-gnu/libc-2.24.so")) and os.path.isdir("/opt/python"):
  405. # Same sloppy check for manylinux_2_24.
  406. if target_arch in ('x86_64', 'amd64'):
  407. PLATFORM = 'manylinux_2_24-x86_64'
  408. elif target_arch in ('arm64', 'aarch64'):
  409. PLATFORM = 'manylinux_2_24-aarch64'
  410. else:
  411. PLATFORM = 'manylinux_2_24-i686'
  412. elif target == 'linux' and os.path.isfile("/lib64/libc-2.28.so") and os.path.isfile('/etc/almalinux-release') and os.path.isdir("/opt/python"):
  413. # Same sloppy check for manylinux_2_28.
  414. if target_arch in ('x86_64', 'amd64'):
  415. PLATFORM = 'manylinux_2_28-x86_64'
  416. elif target_arch in ('arm64', 'aarch64'):
  417. PLATFORM = 'manylinux_2_28-aarch64'
  418. else:
  419. raise RuntimeError('Unhandled arch %s, please file a bug report!' % (target_arch))
  420. elif not CrossCompiling():
  421. if HasTargetArch():
  422. # Replace the architecture in the platform string.
  423. platform_parts = get_platform().rsplit('-', 1)
  424. if target_arch == 'amd64':
  425. target_arch = 'x86_64'
  426. PLATFORM = platform_parts[0] + '-' + target_arch
  427. else:
  428. # We're not cross-compiling; just take the host arch.
  429. PLATFORM = get_platform()
  430. else:
  431. if target_arch == 'amd64':
  432. target_arch = 'x86_64'
  433. PLATFORM = '{0}-{1}'.format(target, target_arch)
  434. print("Platform: %s" % PLATFORM)
  435. outputdir_suffix = ""
  436. if DISTRIBUTOR == "":
  437. DISTRIBUTOR = "makepanda"
  438. if not IsCustomOutputDir():
  439. if GetTarget() == "windows" and GetTargetArch() == 'x64':
  440. outputdir_suffix += '_x64'
  441. SetOutputDir("built" + outputdir_suffix)
  442. if (INSTALLER) and (PkgSkip("PYTHON")) and GetTarget() == 'windows':
  443. exit("Cannot build installer on Windows without python")
  444. if WHEEL and PkgSkip("PYTHON"):
  445. exit("Cannot build wheel without Python")
  446. if not os.path.isdir("contrib"):
  447. PkgDisable("CONTRIB")
  448. ########################################################################
  449. ##
  450. ## Load the dependency cache.
  451. ##
  452. ########################################################################
  453. LoadDependencyCache()
  454. ########################################################################
  455. ##
  456. ## Locate various SDKs.
  457. ##
  458. ########################################################################
  459. MakeBuildTree()
  460. SdkLocateDirectX(STRDXSDKVERSION)
  461. SdkLocateMacOSX(OSX_ARCHS)
  462. SdkLocatePython(False)
  463. SdkLocateWindows(WINDOWS_SDK)
  464. SdkLocateSpeedTree()
  465. SdkLocateAndroid()
  466. SdkAutoDisableDirectX()
  467. SdkAutoDisableSpeedTree()
  468. if not PkgSkip("PYTHON") and SDK["PYTHONVERSION"] == "python2.7":
  469. pref = "%sERROR:%s " % (GetColor("red"), GetColor())
  470. print("========================================================================")
  471. print(pref + "Python 2.7 has reached EOL as of January 1, 2020 and is no longer")
  472. print(pref + "supported. Please upgrade to Python 3.5 or later.")
  473. print("========================================================================")
  474. sys.stdout.flush()
  475. sys.exit(1)
  476. ########################################################################
  477. ##
  478. ## Choose a Compiler.
  479. ##
  480. ## This should also set up any environment variables needed to make
  481. ## the compiler work.
  482. ##
  483. ########################################################################
  484. if GetHost() == 'windows' and GetTarget() == 'windows':
  485. COMPILER = "MSVC"
  486. SdkLocateVisualStudio(MSVC_VERSION)
  487. else:
  488. COMPILER = "GCC"
  489. SetupBuildEnvironment(COMPILER)
  490. ########################################################################
  491. ##
  492. ## External includes, external libraries, and external defsyms.
  493. ##
  494. ########################################################################
  495. IncDirectory("ALWAYS", GetOutputDir()+"/tmp")
  496. IncDirectory("ALWAYS", GetOutputDir()+"/include")
  497. if (COMPILER == "MSVC"):
  498. PkgDisable("X11")
  499. PkgDisable("GLES")
  500. PkgDisable("GLES2")
  501. PkgDisable("EGL")
  502. PkgDisable("COCOA")
  503. DefSymbol("FLEX", "YY_NO_UNISTD_H")
  504. if not PkgSkip("PYTHON"):
  505. IncDirectory("ALWAYS", SDK["PYTHON"] + "/include")
  506. LibDirectory("ALWAYS", SDK["PYTHON"] + "/libs")
  507. SmartPkgEnable("EIGEN", "eigen3", (), ("Eigen/Dense",), target_pkg = 'ALWAYS')
  508. for pkg in PkgListGet():
  509. if not PkgSkip(pkg):
  510. if (pkg[:2]=="DX"):
  511. IncDirectory(pkg, SDK[pkg] + "/include")
  512. elif GetThirdpartyDir() is not None:
  513. IncDirectory(pkg, GetThirdpartyDir() + pkg.lower() + "/include")
  514. for pkg in DXVERSIONS:
  515. if not PkgSkip(pkg):
  516. vnum=pkg[2:]
  517. if GetTargetArch() == 'x64':
  518. LibDirectory(pkg, SDK[pkg] + '/lib/x64')
  519. else:
  520. LibDirectory(pkg, SDK[pkg] + '/lib/x86')
  521. LibDirectory(pkg, SDK[pkg] + '/lib')
  522. LibName(pkg, 'd3dVNUM.lib'.replace("VNUM", vnum))
  523. LibName(pkg, 'd3dxVNUM.lib'.replace("VNUM", vnum))
  524. LibName(pkg, 'dxerr.lib')
  525. #LibName(pkg, 'ddraw.lib')
  526. LibName(pkg, 'dxguid.lib')
  527. if SDK.get("VISUALSTUDIO_VERSION") >= (14,0):
  528. # dxerr needs this for __vsnwprintf definition.
  529. LibName(pkg, 'legacy_stdio_definitions.lib')
  530. if not PkgSkip("FREETYPE") and os.path.isdir(GetThirdpartyDir() + "freetype/include/freetype2"):
  531. IncDirectory("FREETYPE", GetThirdpartyDir() + "freetype/include/freetype2")
  532. IncDirectory("ALWAYS", GetThirdpartyDir() + "extras/include")
  533. LibName("WINSOCK", "wsock32.lib")
  534. LibName("WINSOCK2", "wsock32.lib")
  535. LibName("WINSOCK2", "ws2_32.lib")
  536. LibName("WINCOMCTL", "comctl32.lib")
  537. LibName("WINCOMDLG", "comdlg32.lib")
  538. LibName("UXTHEME", "uxtheme.lib")
  539. LibName("WINUSER", "user32.lib")
  540. LibName("WINMM", "winmm.lib")
  541. LibName("WINIMM", "imm32.lib")
  542. LibName("WINKERNEL", "kernel32.lib")
  543. LibName("WINOLE", "ole32.lib")
  544. LibName("WINOLEAUT", "oleaut32.lib")
  545. LibName("WINOLDNAMES", "oldnames.lib")
  546. LibName("WINSHELL", "shell32.lib")
  547. LibName("WINGDI", "gdi32.lib")
  548. LibName("ADVAPI", "advapi32.lib")
  549. LibName("IPHLPAPI", "iphlpapi.lib")
  550. LibName("SETUPAPI", "setupapi.lib")
  551. LibName("GL", "opengl32.lib")
  552. LibName("GLES", "libgles_cm.lib")
  553. LibName("GLES2", "libGLESv2.lib")
  554. LibName("EGL", "libEGL.lib")
  555. LibName("MSIMG", "msimg32.lib")
  556. if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "strmiids.lib")
  557. if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "quartz.lib")
  558. if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "odbc32.lib")
  559. if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "odbccp32.lib")
  560. if (PkgSkip("MIMALLOC")==0): LibName("MIMALLOC", GetThirdpartyDir() + "mimalloc/lib/mimalloc-static.lib")
  561. if (PkgSkip("OPENSSL")==0):
  562. if os.path.isfile(GetThirdpartyDir() + "openssl/lib/libpandassl.lib"):
  563. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandassl.lib")
  564. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandaeay.lib")
  565. elif os.path.isfile(GetThirdpartyDir() + "openssl/lib/ssleay32.lib"):
  566. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libeay32.lib")
  567. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/ssleay32.lib")
  568. else:
  569. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libssl.lib")
  570. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libcrypto.lib")
  571. LibName("OPENSSL", "crypt32.lib")
  572. LibName("OPENSSL", "ws2_32.lib")
  573. if (PkgSkip("PNG")==0):
  574. if os.path.isfile(GetThirdpartyDir() + "png/lib/libpng16_static.lib"):
  575. LibName("PNG", GetThirdpartyDir() + "png/lib/libpng16_static.lib")
  576. else:
  577. LibName("PNG", GetThirdpartyDir() + "png/lib/libpng_static.lib")
  578. if (PkgSkip("TIFF")==0):
  579. if os.path.isfile(GetThirdpartyDir() + "tiff/lib/libtiff.lib"):
  580. LibName("TIFF", GetThirdpartyDir() + "tiff/lib/libtiff.lib")
  581. else:
  582. LibName("TIFF", GetThirdpartyDir() + "tiff/lib/tiff.lib")
  583. if (PkgSkip("OPENEXR")==0):
  584. if os.path.isfile(GetThirdpartyDir() + "openexr/lib/OpenEXRCore-3_1.lib"):
  585. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/OpenEXR-3_1.lib")
  586. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmThread-3_1.lib")
  587. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Imath-3_1.lib")
  588. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Iex-3_1.lib")
  589. elif os.path.isfile(GetThirdpartyDir() + "openexr/lib/OpenEXR-3_0.lib"):
  590. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/OpenEXR-3_0.lib")
  591. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmThread-3_0.lib")
  592. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Imath-3_0.lib")
  593. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Iex-3_0.lib")
  594. elif os.path.isfile(GetThirdpartyDir() + "openexr/lib/OpenEXR.lib"):
  595. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/OpenEXR.lib")
  596. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmThread.lib")
  597. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Imath.lib")
  598. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Iex.lib")
  599. else:
  600. suffix = ""
  601. if os.path.isfile(GetThirdpartyDir() + "openexr/lib/IlmImf-2_2.lib"):
  602. suffix = "-2_2"
  603. elif os.path.isfile(GetThirdpartyDir() + "openexr/lib/IlmImf-2_3.lib"):
  604. suffix = "-2_3"
  605. elif os.path.isfile(GetThirdpartyDir() + "openexr/lib/IlmImf-2_4.lib"):
  606. suffix = "-2_4"
  607. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Imath" + suffix + ".lib")
  608. if os.path.isfile(GetThirdpartyDir() + "openexr/lib/IlmImf" + suffix + "_s.lib"):
  609. suffix += "_s" # _s suffix observed for OpenEXR 2.3 only so far
  610. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmImf" + suffix + ".lib")
  611. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmThread" + suffix + ".lib")
  612. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Iex" + suffix + ".lib")
  613. if suffix == "-2_2":
  614. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Half.lib")
  615. else:
  616. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Half" + suffix + ".lib")
  617. IncDirectory("OPENEXR", GetThirdpartyDir() + "openexr/include/OpenEXR")
  618. IncDirectory("OPENEXR", GetThirdpartyDir() + "openexr/include/Imath")
  619. if (PkgSkip("JPEG")==0): LibName("JPEG", GetThirdpartyDir() + "jpeg/lib/jpeg-static.lib")
  620. if (PkgSkip("ZLIB")==0): LibName("ZLIB", GetThirdpartyDir() + "zlib/lib/zlibstatic.lib")
  621. if (PkgSkip("VRPN")==0): LibName("VRPN", GetThirdpartyDir() + "vrpn/lib/vrpn.lib")
  622. if (PkgSkip("VRPN")==0): LibName("VRPN", GetThirdpartyDir() + "vrpn/lib/quat.lib")
  623. if (PkgSkip("NVIDIACG")==0): LibName("CGGL", GetThirdpartyDir() + "nvidiacg/lib/cgGL.lib")
  624. if (PkgSkip("NVIDIACG")==0): LibName("CGDX9", GetThirdpartyDir() + "nvidiacg/lib/cgD3D9.lib")
  625. if (PkgSkip("NVIDIACG")==0): LibName("NVIDIACG", GetThirdpartyDir() + "nvidiacg/lib/cg.lib")
  626. if (PkgSkip("FREETYPE")==0): LibName("FREETYPE", GetThirdpartyDir() + "freetype/lib/freetype.lib")
  627. if (PkgSkip("HARFBUZZ")==0):
  628. LibName("HARFBUZZ", GetThirdpartyDir() + "harfbuzz/lib/harfbuzz.lib")
  629. IncDirectory("HARFBUZZ", GetThirdpartyDir() + "harfbuzz/include/harfbuzz")
  630. if (PkgSkip("FFTW")==0): LibName("FFTW", GetThirdpartyDir() + "fftw/lib/fftw3.lib")
  631. if (PkgSkip("ARTOOLKIT")==0):LibName("ARTOOLKIT",GetThirdpartyDir() + "artoolkit/lib/libAR.lib")
  632. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cv.lib")
  633. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/highgui.lib")
  634. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cvaux.lib")
  635. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/ml.lib")
  636. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cxcore.lib")
  637. if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avcodec.lib")
  638. if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avformat.lib")
  639. if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avutil.lib")
  640. if (PkgSkip("SWSCALE")==0): LibName("SWSCALE", GetThirdpartyDir() + "ffmpeg/lib/swscale.lib")
  641. if (PkgSkip("SWRESAMPLE")==0):LibName("SWRESAMPLE",GetThirdpartyDir() + "ffmpeg/lib/swresample.lib")
  642. if (PkgSkip("FCOLLADA")==0):
  643. LibName("FCOLLADA", GetThirdpartyDir() + "fcollada/lib/FCollada.lib")
  644. IncDirectory("FCOLLADA", GetThirdpartyDir() + "fcollada/include/FCollada")
  645. if (PkgSkip("ASSIMP")==0):
  646. LibName("ASSIMP", GetThirdpartyDir() + "assimp/lib/assimp.lib")
  647. if os.path.isfile(GetThirdpartyDir() + "assimp/lib/IrrXML.lib"):
  648. LibName("ASSIMP", GetThirdpartyDir() + "assimp/lib/IrrXML.lib")
  649. IncDirectory("ASSIMP", GetThirdpartyDir() + "assimp/include")
  650. if (PkgSkip("SQUISH")==0):
  651. if GetOptimize() <= 2:
  652. LibName("SQUISH", GetThirdpartyDir() + "squish/lib/squishd.lib")
  653. else:
  654. LibName("SQUISH", GetThirdpartyDir() + "squish/lib/squish.lib")
  655. if (PkgSkip("OPENAL")==0):
  656. LibName("OPENAL", GetThirdpartyDir() + "openal/lib/OpenAL32.lib")
  657. if not os.path.isfile(GetThirdpartyDir() + "openal/bin/OpenAL32.dll"):
  658. # Link OpenAL Soft statically.
  659. DefSymbol("OPENAL", "AL_LIBTYPE_STATIC")
  660. if (PkgSkip("ODE")==0):
  661. LibName("ODE", GetThirdpartyDir() + "ode/lib/ode_single.lib")
  662. DefSymbol("ODE", "dSINGLE", "")
  663. if (PkgSkip("FMODEX")==0):
  664. if (GetTargetArch() == 'x64'):
  665. LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex64_vc.lib")
  666. else:
  667. LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex_vc.lib")
  668. if (PkgSkip("VORBIS")==0):
  669. for lib in ('ogg', 'vorbis', 'vorbisfile'):
  670. path = GetThirdpartyDir() + "vorbis/lib/lib{0}_static.lib".format(lib)
  671. if not os.path.isfile(path):
  672. path = GetThirdpartyDir() + "vorbis/lib/{0}.lib".format(lib)
  673. LibName("VORBIS", path)
  674. if (PkgSkip("OPUS")==0):
  675. IncDirectory("OPUS", GetThirdpartyDir() + "opus/include/opus")
  676. for lib in ('ogg', 'opus', 'opusfile'):
  677. path = GetThirdpartyDir() + "opus/lib/lib{0}_static.lib".format(lib)
  678. if not os.path.isfile(path):
  679. path = GetThirdpartyDir() + "opus/lib/{0}.lib".format(lib)
  680. LibName("OPUS", path)
  681. if not PkgSkip("SPEEDTREE"):
  682. if GetTargetArch() == 'x64':
  683. libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC10.x64/"
  684. p64ext = '64'
  685. else:
  686. libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC10/"
  687. p64ext = ''
  688. debugext = ''
  689. if (GetOptimize() <= 2): debugext = "_d"
  690. libsuffix = "_v%s_VC100MT%s_Static%s.lib" % (
  691. SDK["SPEEDTREEVERSION"], p64ext, debugext)
  692. LibName("SPEEDTREE", "%sSpeedTreeCore%s" % (libdir, libsuffix))
  693. LibName("SPEEDTREE", "%sSpeedTreeForest%s" % (libdir, libsuffix))
  694. LibName("SPEEDTREE", "%sSpeedTree%sRenderer%s" % (libdir, SDK["SPEEDTREEAPI"], libsuffix))
  695. LibName("SPEEDTREE", "%sSpeedTreeRenderInterface%s" % (libdir, libsuffix))
  696. if (SDK["SPEEDTREEAPI"] == "OpenGL"):
  697. LibName("SPEEDTREE", "%sglew32.lib" % (libdir))
  698. LibName("SPEEDTREE", "glu32.lib")
  699. IncDirectory("SPEEDTREE", SDK["SPEEDTREE"] + "/Include")
  700. if (PkgSkip("BULLET")==0):
  701. suffix = '.lib'
  702. if GetTargetArch() == 'x64' and os.path.isfile(GetThirdpartyDir() + "bullet/lib/BulletCollision_x64.lib"):
  703. suffix = '_x64.lib'
  704. LibName("BULLET", GetThirdpartyDir() + "bullet/lib/LinearMath" + suffix)
  705. LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletCollision" + suffix)
  706. LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletDynamics" + suffix)
  707. LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletSoftBody" + suffix)
  708. if (COMPILER=="GCC"):
  709. if GetTarget() != "darwin":
  710. PkgDisable("COCOA")
  711. if GetTarget() == 'darwin':
  712. if OSX_ARCHS and 'x86_64' not in OSX_ARCHS and 'i386' not in OSX_ARCHS:
  713. # These support only these archs, so don't build them if we're not
  714. # targeting any of the supported archs.
  715. PkgDisable("FMODEX")
  716. PkgDisable("NVIDIACG")
  717. elif OSX_ARCHS and 'arm64' in OSX_ARCHS:
  718. # We must be using the 11.0 SDK or higher, so can't build FMOD Ex
  719. if not PkgSkip("FMODEX"):
  720. Warn("thirdparty package fmodex is not supported when targeting arm64, excluding from build")
  721. PkgDisable("FMODEX")
  722. elif not os.path.isfile(SDK.get("MACOSX", "") + '/usr/lib/libstdc++.6.0.9.tbd') and \
  723. not os.path.isfile(SDK.get("MACOSX", "") + '/usr/lib/libstdc++.6.0.9.dylib'):
  724. # Also, we can't target FMOD Ex on 10.14 and above
  725. if not PkgSkip("FMODEX"):
  726. Warn("thirdparty package fmodex requires one of MacOSX 10.9-10.13 SDK, excluding from build")
  727. PkgDisable("FMODEX")
  728. #if not PkgSkip("PYTHON"):
  729. # IncDirectory("PYTHON", SDK["PYTHON"])
  730. if (GetHost() == "darwin"):
  731. if (PkgSkip("FREETYPE")==0 and not os.path.isdir(GetThirdpartyDir() + 'freetype')):
  732. IncDirectory("FREETYPE", "/usr/X11/include")
  733. IncDirectory("FREETYPE", "/usr/X11/include/freetype2")
  734. LibDirectory("FREETYPE", "/usr/X11/lib")
  735. if (GetHost() == "freebsd"):
  736. IncDirectory("ALWAYS", "/usr/local/include")
  737. LibDirectory("ALWAYS", "/usr/local/lib")
  738. if (os.path.isdir("/usr/PCBSD")):
  739. IncDirectory("ALWAYS", "/usr/PCBSD/local/include")
  740. LibDirectory("ALWAYS", "/usr/PCBSD/local/lib")
  741. SmartPkgEnable("INOTIFY", "libinotify", ("inotify"), "sys/inotify.h")
  742. if GetTarget() != "windows":
  743. PkgDisable("DIRECTCAM")
  744. fcollada_libs = ("FColladaD", "FColladaSD", "FColladaS")
  745. # WARNING! The order of the ffmpeg libraries matters!
  746. ffmpeg_libs = ("libavformat", "libavcodec", "libavutil")
  747. assimp_libs = ("libassimp", "libassimpd")
  748. # Name pkg-config libs, include(dir)s
  749. SmartPkgEnable("ARTOOLKIT", "", ("AR"), "AR/ar.h")
  750. SmartPkgEnable("FCOLLADA", "", ChooseLib(fcollada_libs, "FCOLLADA"), ("FCollada", "FCollada/FCollada.h"))
  751. SmartPkgEnable("ASSIMP", "assimp", ChooseLib(assimp_libs, "ASSIMP"), "assimp/Importer.hpp")
  752. SmartPkgEnable("FFMPEG", ffmpeg_libs, ffmpeg_libs, ("libavformat/avformat.h", "libavcodec/avcodec.h", "libavutil/avutil.h"))
  753. SmartPkgEnable("SWSCALE", "libswscale", "libswscale", ("libswscale/swscale.h"), target_pkg = "FFMPEG", thirdparty_dir = "ffmpeg")
  754. SmartPkgEnable("SWRESAMPLE","libswresample", "libswresample", ("libswresample/swresample.h"), target_pkg = "FFMPEG", thirdparty_dir = "ffmpeg")
  755. SmartPkgEnable("FFTW", "fftw3", ("fftw3"), ("fftw.h"))
  756. SmartPkgEnable("FMODEX", "", ("fmodex"), ("fmodex", "fmodex/fmod.h"))
  757. SmartPkgEnable("NVIDIACG", "", ("Cg"), "Cg/cg.h", framework = "Cg")
  758. SmartPkgEnable("ODE", "", ("ode"), "ode/ode.h", tool = "ode-config")
  759. SmartPkgEnable("SQUISH", "", ("squish"), "squish.h")
  760. SmartPkgEnable("TIFF", "libtiff-4", ("tiff"), "tiff.h")
  761. SmartPkgEnable("VRPN", "", ("vrpn", "quat"), ("vrpn", "quat.h", "vrpn/vrpn_Types.h"))
  762. SmartPkgEnable("OPUS", "opusfile", ("opusfile", "opus", "ogg"), ("ogg/ogg.h", "opus/opusfile.h", "opus"))
  763. SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h")
  764. SmartPkgEnable("MIMALLOC", "", ("mimalloc"), "mimalloc.h")
  765. if GetTarget() != 'emscripten':
  766. # Most of these are provided by emscripten or via emscripten-ports.
  767. SmartPkgEnable("OPENAL", "openal", ("openal"), "AL/al.h", framework = "OpenAL")
  768. SmartPkgEnable("EIGEN", "eigen3", (), ("Eigen/Dense",), target_pkg = 'ALWAYS')
  769. SmartPkgEnable("VORBIS", "vorbisfile",("vorbisfile", "vorbis", "ogg"), ("ogg/ogg.h", "vorbis/vorbisfile.h"))
  770. SmartPkgEnable("BULLET", "bullet", ("BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"), ("bullet", "bullet/btBulletDynamicsCommon.h"))
  771. SmartPkgEnable("FREETYPE", "freetype2", ("freetype"), ("freetype2", "freetype2/freetype/freetype.h"))
  772. SmartPkgEnable("HARFBUZZ", "harfbuzz", ("harfbuzz"), ("harfbuzz", "harfbuzz/hb-ft.h"))
  773. SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config")
  774. SmartPkgEnable("GL", "gl", ("GL"), ("GL/gl.h"), framework = "OpenGL")
  775. SmartPkgEnable("GLES", "glesv1_cm", ("GLESv1_CM"), ("GLES/gl.h"), framework = "OpenGLES")
  776. SmartPkgEnable("GLES2", "glesv2", ("GLESv2"), ("GLES2/gl2.h")) #framework = "OpenGLES"?
  777. SmartPkgEnable("EGL", "egl", ("EGL"), ("EGL/egl.h"))
  778. # Copy freetype libraries to be specified after harfbuzz libraries as well,
  779. # because there's a circular dependency between the two libraries.
  780. if not PkgSkip("FREETYPE") and not PkgSkip("HARFBUZZ"):
  781. for (opt, name) in LIBNAMES:
  782. if opt == "FREETYPE":
  783. LibName("HARFBUZZ", name)
  784. else:
  785. PkgDisable("EIGEN")
  786. PkgDisable("X11")
  787. PkgDisable("GL")
  788. PkgDisable("GLES")
  789. PkgDisable("TINYDISPLAY")
  790. for pkg, empkg in {
  791. 'VORBIS': 'VORBIS',
  792. 'BULLET': 'BULLET',
  793. 'ZLIB': 'ZLIB',
  794. 'FREETYPE': 'FREETYPE',
  795. 'HARFBUZZ': 'HARFBUZZ',
  796. 'PNG': 'LIBPNG',
  797. }.items():
  798. if not PkgSkip(pkg):
  799. LinkFlag(pkg, '-s USE_' + empkg + '=1')
  800. CompileFlag(pkg, '-s USE_' + empkg + '=1')
  801. if not PkgSkip("FFMPEG"):
  802. if GetTarget() == "darwin":
  803. LibName("FFMPEG", "-framework VideoDecodeAcceleration")
  804. elif os.path.isfile(GetThirdpartyDir() + "ffmpeg/lib/libavcodec.a"):
  805. # Needed when linking ffmpeg statically on Linux.
  806. LibName("FFMPEG", "-Wl,-Bsymbolic")
  807. # Don't export ffmpeg symbols from libp3ffmpeg when linking statically.
  808. if GetTarget() != "emscripten":
  809. for ffmpeg_lib in ffmpeg_libs:
  810. LibName("FFMPEG", "-Wl,--exclude-libs,%s.a" % (ffmpeg_lib))
  811. if not PkgSkip("OPENEXR"):
  812. # OpenEXR libraries have different names depending on the version.
  813. openexr_libdir = os.path.join(GetThirdpartyDir(), "openexr", "lib")
  814. openexr_incs = ("OpenEXR", "Imath", "OpenEXR/ImfOutputFile.h")
  815. if os.path.isfile(os.path.join(openexr_libdir, "libOpenEXR-3_1.a")):
  816. SmartPkgEnable("OPENEXR", "", ("OpenEXR-3_1", "IlmThread-3_1", "Imath-3_1", "Iex-3_1"), openexr_incs)
  817. if os.path.isfile(os.path.join(openexr_libdir, "libOpenEXR-3_0.a")):
  818. SmartPkgEnable("OPENEXR", "", ("OpenEXR-3_0", "IlmThread-3_0", "Imath-3_0", "Iex-3_0"), openexr_incs)
  819. elif os.path.isfile(os.path.join(openexr_libdir, "libOpenEXR.a")):
  820. SmartPkgEnable("OPENEXR", "", ("OpenEXR", "IlmThread", "Imath", "Iex"), openexr_incs)
  821. elif os.path.isfile(os.path.join(openexr_libdir, "libIlmImf.a")):
  822. SmartPkgEnable("OPENEXR", "", ("IlmImf", "Imath", "Half", "Iex", "IexMath", "IlmThread"), openexr_incs)
  823. else:
  824. # Find it in the system, preferably using pkg-config, otherwise
  825. # using the OpenEXR 3 naming scheme.
  826. SmartPkgEnable("OPENEXR", "OpenEXR", ("OpenEXR", "IlmThread", "Imath", "Iex"), openexr_incs)
  827. if GetTarget() not in ("darwin", "emscripten"):
  828. for fcollada_lib in fcollada_libs:
  829. LibName("FCOLLADA", "-Wl,--exclude-libs,lib%s.a" % (fcollada_lib))
  830. if not PkgSkip("SWSCALE"):
  831. LibName("SWSCALE", "-Wl,--exclude-libs,libswscale.a")
  832. if not PkgSkip("SWRESAMPLE"):
  833. LibName("SWRESAMPLE", "-Wl,--exclude-libs,libswresample.a")
  834. if not PkgSkip("JPEG"):
  835. LibName("JPEG", "-Wl,--exclude-libs,libjpeg.a")
  836. if not PkgSkip("TIFF"):
  837. LibName("TIFF", "-Wl,--exclude-libs,libtiff.a")
  838. if not PkgSkip("PNG"):
  839. LibName("PNG", "-Wl,--exclude-libs,libpng.a")
  840. LibName("PNG", "-Wl,--exclude-libs,libpng16.a")
  841. if not PkgSkip("SQUISH"):
  842. LibName("SQUISH", "-Wl,--exclude-libs,libsquish.a")
  843. if not PkgSkip("OPENEXR"):
  844. LibName("OPENEXR", "-Wl,--exclude-libs,libHalf.a")
  845. LibName("OPENEXR", "-Wl,--exclude-libs,libIex.a")
  846. LibName("OPENEXR", "-Wl,--exclude-libs,libIexMath.a")
  847. LibName("OPENEXR", "-Wl,--exclude-libs,libIlmImf.a")
  848. LibName("OPENEXR", "-Wl,--exclude-libs,libIlmImfUtil.a")
  849. LibName("OPENEXR", "-Wl,--exclude-libs,libIlmThread.a")
  850. LibName("OPENEXR", "-Wl,--exclude-libs,libImath.a")
  851. LibName("OPENEXR", "-Wl,--exclude-libs,libOpenEXR.a")
  852. LibName("OPENEXR", "-Wl,--exclude-libs,libOpenEXRCore.a")
  853. LibName("OPENEXR", "-Wl,--exclude-libs,libOpenEXRUtil.a")
  854. if not PkgSkip("VORBIS"):
  855. LibName("VORBIS", "-Wl,--exclude-libs,libogg.a")
  856. LibName("VORBIS", "-Wl,--exclude-libs,libvorbis.a")
  857. LibName("VORBIS", "-Wl,--exclude-libs,libvorbisenc.a")
  858. LibName("VORBIS", "-Wl,--exclude-libs,libvorbisfile.a")
  859. if not PkgSkip("OPUS"):
  860. LibName("OPUS", "-Wl,--exclude-libs,libogg.a")
  861. LibName("OPUS", "-Wl,--exclude-libs,libopus.a")
  862. LibName("OPUS", "-Wl,--exclude-libs,libopusfile.a")
  863. if not PkgSkip("VRPN"):
  864. LibName("VRPN", "-Wl,--exclude-libs,libvrpn.a")
  865. LibName("VRPN", "-Wl,--exclude-libs,libquat.a")
  866. if not PkgSkip("ARTOOLKIT"):
  867. LibName("ARTOOLKIT", "-Wl,--exclude-libs,libAR.a")
  868. LibName("ARTOOLKIT", "-Wl,--exclude-libs,libARMulti.a")
  869. if not PkgSkip("HARFBUZZ"):
  870. LibName("HARFBUZZ", "-Wl,--exclude-libs,libharfbuzz.a")
  871. if not PkgSkip("MIMALLOC"):
  872. LibName("MIMALLOC", "-Wl,--exclude-libs,libmimalloc.a")
  873. if PkgSkip("FFMPEG") or GetTarget() == "darwin":
  874. cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV")
  875. if cv_lib == "opencv_core":
  876. OPENCV_VER_23 = True
  877. SmartPkgEnable("OPENCV", "opencv", ("opencv_core", "opencv_highgui"), ("opencv2/core/core.hpp"))
  878. else:
  879. SmartPkgEnable("OPENCV", "opencv", ("cv", "highgui", "cvaux", "ml", "cxcore"),
  880. ("opencv", "opencv/cv.h", "opencv/cxcore.h", "opencv/highgui.h"))
  881. else:
  882. PkgDisable("OPENCV")
  883. if not PkgSkip("OPENAL"):
  884. if GetTarget() == "darwin":
  885. LibName("OPENAL", "-framework AudioUnit")
  886. LibName("OPENAL", "-framework AudioToolbox")
  887. LibName("OPENAL", "-framework CoreAudio")
  888. elif GetTarget() != "emscripten":
  889. LibName("OPENAL", "-Wl,--exclude-libs,libopenal.a")
  890. if not PkgSkip("ASSIMP") and \
  891. os.path.isfile(GetThirdpartyDir() + "assimp/lib/libassimp.a"):
  892. # Also pick up IrrXML, which is needed when linking statically.
  893. irrxml = GetThirdpartyDir() + "assimp/lib/libIrrXML.a"
  894. if os.path.isfile(irrxml):
  895. LibName("ASSIMP", irrxml)
  896. if GetTarget() not in ("darwin", "emscripten"):
  897. LibName("ASSIMP", "-Wl,--exclude-libs,libassimp.a")
  898. LibName("ASSIMP", "-Wl,--exclude-libs,libIrrXML.a")
  899. if not PkgSkip("PYTHON"):
  900. python_lib = SDK["PYTHONVERSION"]
  901. SmartPkgEnable("PYTHON", "", python_lib, (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"))
  902. if not PkgSkip("PYTHON") and GetTarget() == "emscripten":
  903. # Python may have been compiled with these requirements.
  904. # Is there a cleaner way to check this?
  905. LinkFlag("PYTHON", "-s USE_BZIP2=1 -s USE_SQLITE3=1")
  906. if not PkgHasCustomLocation("PYTHON"):
  907. python_libdir = GetThirdpartyDir() + "python/lib"
  908. if os.path.isfile(python_libdir + "/libmpdec.a"):
  909. LibName("PYTHON", python_libdir + "/libmpdec.a")
  910. if os.path.isfile(python_libdir + "/libexpat.a"):
  911. LibName("PYTHON", python_libdir + "/libexpat.a")
  912. if GetTarget() == "linux":
  913. LibName("PYTHON", "-lutil")
  914. LibName("PYTHON", "-lrt")
  915. SmartPkgEnable("OPENSSL", "openssl", ("ssl", "crypto"), ("openssl/ssl.h", "openssl/crypto.h"))
  916. SmartPkgEnable("GTK3", "gtk+-3.0")
  917. if GetTarget() != 'emscripten':
  918. SmartPkgEnable("ZLIB", "zlib", ("z"), "zlib.h")
  919. if not PkgSkip("OPENSSL") and GetTarget() not in ("darwin", "emscripten"):
  920. LibName("OPENSSL", "-Wl,--exclude-libs,libssl.a")
  921. LibName("OPENSSL", "-Wl,--exclude-libs,libcrypto.a")
  922. if GetTarget() not in ('darwin', 'emscripten'):
  923. # CgGL is covered by the Cg framework, and we don't need X11 components on OSX
  924. if not PkgSkip("NVIDIACG"):
  925. SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h", thirdparty_dir = "nvidiacg")
  926. if GetTarget() != "android":
  927. SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h", "X11/XKBlib.h"))
  928. else:
  929. PkgDisable("X11")
  930. if GetHost() != "darwin":
  931. # Workaround for an issue where pkg-config does not include this path
  932. if GetTargetArch() in ("x86_64", "amd64"):
  933. if not PkgSkip("X11"):
  934. if (os.path.isdir("/usr/X11R6/lib64")):
  935. LibDirectory("ALWAYS", "/usr/X11R6/lib64")
  936. else:
  937. LibDirectory("ALWAYS", "/usr/X11R6/lib")
  938. elif not PkgSkip("X11"):
  939. LibDirectory("ALWAYS", "/usr/X11R6/lib")
  940. if GetTarget() == 'darwin':
  941. LibName("ALWAYS", "-framework AppKit")
  942. LibName("IOKIT", "-framework IOKit")
  943. LibName("QUARTZ", "-framework Quartz")
  944. LibName("AGL", "-framework AGL")
  945. LibName("CARBON", "-framework Carbon")
  946. LibName("COCOA", "-framework Cocoa")
  947. # Fix for a bug in OSX Leopard:
  948. LibName("GL", "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
  949. # When using pre-11.0 SDKs, for PStats
  950. if os.path.basename(SDK["MACOSX"]).startswith("MacOSX10."):
  951. LibName("COCOA", "-Wl,-U,_OBJC_CLASS_$_NSTrackingSeparatorToolbarItem")
  952. # Temporary exceptions to removal of this flag
  953. if not PkgSkip("FFMPEG"):
  954. LibName("FFMPEG", "-undefined dynamic_lookup")
  955. if not PkgSkip("ASSIMP"):
  956. LibName("ASSIMP", "-undefined dynamic_lookup")
  957. if not PkgSkip("VRPN"):
  958. LibName("VRPN", "-undefined dynamic_lookup")
  959. if GetTarget() == 'android':
  960. LibName("ALWAYS", '-llog')
  961. LibName("ANDROID", '-landroid')
  962. LibName("JNIGRAPHICS", '-ljnigraphics')
  963. LibName("OPENSLES", '-lOpenSLES')
  964. DefSymbol("WITHINPANDA", "WITHIN_PANDA", "1")
  965. if GetLinkAllStatic() or GetTarget() == 'emscripten':
  966. DefSymbol("ALWAYS", "LINK_ALL_STATIC")
  967. if GetTarget() == 'android':
  968. DefSymbol("ALWAYS", "ANDROID")
  969. if not PkgSkip("EIGEN"):
  970. if GetOptimize() >= 3:
  971. if COMPILER == "MSVC":
  972. # Squeeze out a bit more performance on MSVC builds...
  973. # Only do this if EIGEN_NO_DEBUG is also set, otherwise it
  974. # will turn them into runtime assertions.
  975. DefSymbol("ALWAYS", "EIGEN_NO_STATIC_ASSERT")
  976. if not PkgSkip("EGL"):
  977. DefSymbol('EGL', 'HAVE_EGL', '')
  978. if PkgSkip("X11"):
  979. DefSymbol('EGL', 'EGL_NO_X11', '')
  980. if not PkgSkip("X11"):
  981. DefSymbol('X11', 'USE_X11', '')
  982. ########################################################################
  983. ##
  984. ## Give a Status Report on Command-Line Options
  985. ##
  986. ########################################################################
  987. def printStatus(header,warnings):
  988. if GetVerbose():
  989. print("")
  990. print("-------------------------------------------------------------------")
  991. print(header)
  992. tkeep = ""
  993. tomit = ""
  994. for x in PkgListGet():
  995. if PkgSkip(x):
  996. tomit = tomit + x + " "
  997. else:
  998. tkeep = tkeep + x + " "
  999. print("Makepanda: Compiler: %s" % (COMPILER))
  1000. print("Makepanda: Optimize: %d" % (GetOptimize()))
  1001. print("Makepanda: Keep Pkg: %s" % (tkeep))
  1002. print("Makepanda: Omit Pkg: %s" % (tomit))
  1003. if GENMAN:
  1004. print("Makepanda: Generate API reference manual")
  1005. else:
  1006. print("Makepanda: Don't generate API reference manual")
  1007. if GetHost() == "windows":
  1008. if INSTALLER:
  1009. print("Makepanda: Build installer, using %s" % (COMPRESSOR))
  1010. else:
  1011. print("Makepanda: Don't build installer")
  1012. print("Makepanda: Version ID: %s" % (VERSION))
  1013. for x in warnings:
  1014. print("Makepanda: %s" % (x))
  1015. print("-------------------------------------------------------------------")
  1016. print("")
  1017. sys.stdout.flush()
  1018. ########################################################################
  1019. ##
  1020. ## BracketNameWithQuotes
  1021. ##
  1022. ########################################################################
  1023. def BracketNameWithQuotes(name):
  1024. # Workaround for OSX bug - compiler doesn't like those flags quoted.
  1025. if (name.startswith("-framework")): return name
  1026. if (name.startswith("-dylib_file")): return name
  1027. if (name.startswith("-undefined ")): return name
  1028. # Don't add quotes when it's not necessary.
  1029. if " " not in name: return name
  1030. # Account for quoted name (leave as is) but quote everything else (e.g., to protect spaces within paths from improper parsing)
  1031. if (name.startswith('"') and name.endswith('"')): return name
  1032. else: return '"' + name + '"'
  1033. ########################################################################
  1034. ##
  1035. ## CompileCxx
  1036. ##
  1037. ########################################################################
  1038. def CompileCxx(obj,src,opts):
  1039. ipath = GetListOption(opts, "DIR:")
  1040. optlevel = GetOptimizeOption(opts)
  1041. if (COMPILER=="MSVC"):
  1042. if not BOOUSEINTELCOMPILER:
  1043. cmd = "cl "
  1044. if GetTargetArch() == 'x64':
  1045. cmd += "/favor:blend "
  1046. cmd += "/wd4996 "
  1047. # Set the minimum version to Windows Vista.
  1048. cmd += "/DWINVER=0x600 "
  1049. cmd += "/Fo" + obj + " /nologo /c"
  1050. if GetTargetArch() == 'x86':
  1051. # x86 (32 bit) MSVC 2015+ defaults to /arch:SSE2
  1052. if not PkgSkip("SSE2") or 'SSE2' in opts: # x86 with SSE2
  1053. cmd += " /arch:SSE2" # let's still be explicit and pass in /arch:SSE2
  1054. else: # x86 without SSE2
  1055. cmd += " /arch:IA32"
  1056. for x in ipath: cmd += " /I" + x
  1057. for (opt,dir) in INCDIRECTORIES:
  1058. if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
  1059. for (opt,var,val) in DEFSYMBOLS:
  1060. if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
  1061. if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
  1062. if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS"
  1063. if (optlevel==2): cmd += " /MDd /Zi"
  1064. if (optlevel==3): cmd += " /MD /Zi /GS- /O2 /fp:fast"
  1065. if (optlevel==4):
  1066. cmd += " /MD /Zi /GS- /O2 /fp:fast /DFORCE_INLINING /DNDEBUG /GL"
  1067. cmd += " /Zp16" # jean-claude add /Zp16 insures correct static alignment for SSEx
  1068. cmd += " /Fd" + os.path.splitext(obj)[0] + ".pdb"
  1069. building = GetValueOption(opts, "BUILDING:")
  1070. if (building):
  1071. cmd += " /DBUILDING_" + building
  1072. if ("BIGOBJ" in opts) or GetTargetArch() == 'x64' or not PkgSkip("EIGEN"):
  1073. cmd += " /bigobj"
  1074. cmd += " /Zm300"
  1075. if 'EXCEPTIONS' in opts:
  1076. cmd += " /EHsc"
  1077. else:
  1078. cmd += " /D_HAS_EXCEPTIONS=0"
  1079. if 'RTTI' not in opts:
  1080. cmd += " /GR-"
  1081. cmd += " /W3 " + BracketNameWithQuotes(src)
  1082. oscmd(cmd)
  1083. else:
  1084. cmd = "icl "
  1085. if GetTargetArch() == 'x64':
  1086. cmd += "/favor:blend "
  1087. cmd += "/wd4996 /wd4267 /wd4101 "
  1088. cmd += "/DWINVER=0x600 "
  1089. cmd += "/Fo" + obj + " /c"
  1090. for x in ipath: cmd += " /I" + x
  1091. for (opt,dir) in INCDIRECTORIES:
  1092. if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
  1093. for (opt,var,val) in DEFSYMBOLS:
  1094. if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
  1095. if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
  1096. if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS"
  1097. if (optlevel==2): cmd += " /MDd /Zi /arch:SSE3"
  1098. # core changes from jean-claude (dec 2011)
  1099. # ----------------------------------------
  1100. # performance will be seeked at level 3 & 4
  1101. # -----------------------------------------
  1102. if (optlevel==3):
  1103. cmd += " /MD /Zi /O2 /Oi /Ot /arch:SSE3"
  1104. cmd += " /Ob0"
  1105. cmd += " /Qipo-" # beware of IPO !!!
  1106. ## Lesson learned: Don't use /GL flag -> end result is MESSY
  1107. ## ----------------------------------------------------------------
  1108. if (optlevel==4):
  1109. cmd += " /MD /Zi /O3 /Oi /Ot /Ob0 /Yc /DNDEBUG" # /Ob0 a ete rajoute en cours de route a 47%
  1110. cmd += " /Qipo" # optimization multi file
  1111. # for 3 & 4 optimization levels
  1112. # -----------------------------
  1113. if (optlevel>=3):
  1114. cmd += " /fp:fast=2"
  1115. cmd += " /Qftz"
  1116. cmd += " /Qfp-speculation:fast"
  1117. cmd += " /Qopt-matmul" # needs /O2 or /O3
  1118. cmd += " /Qprec-div-"
  1119. cmd += " /Qsimd"
  1120. cmd += " /QxHost" # compile for target host; Compiling for distribs should probably strictly enforce /arch:..
  1121. cmd += " /Quse-intel-optimized-headers" # use intel optimized headers
  1122. cmd += " /Qparallel" # enable parallelization
  1123. cmd += " /Qvc10" # for Microsoft Visual C++ 2010
  1124. ## PCH files coexistence: the /Qpchi option causes the Intel C++ Compiler to name its
  1125. ## PCH files with a .pchi filename suffix and reduce build time.
  1126. ## The /Qpchi option is on by default but interferes with Microsoft libs; so use /Qpchi- to turn it off.
  1127. ## I need to have a deeper look at this since the compile time is quite influenced by this setting !!!
  1128. cmd += " /Qpchi-" # keep it this way!
  1129. ## Inlining seems to be an issue here ! (the linker doesn't find necessary info later on)
  1130. ## ------------------------------------
  1131. ## so don't use cmd += " /DFORCE_INLINING" (need to check why with Panda developpers!)
  1132. ## Inline expansion /Ob1 : Allow functions marked inline to be inlined.
  1133. ## Inline any /Ob2 : Inline functions deemed appropriate by compiler.
  1134. ## Ctor displacement /vd0 : Disable constructor displacement.
  1135. ## Choose this option only if no class constructors or destructors call virtual functions.
  1136. ## Use /vd1 (default) to enable. Alternate: #pragma vtordisp
  1137. ## Best case ptrs /vmb : Use best case "pointer to class member" representation.
  1138. ## Use this option if you always define a class before you declare a pointer to a member of the class.
  1139. ## The compiler will issue an error if it encounters a pointer declaration before the class is defined.
  1140. ## Alternate: #pragma pointers_to_members
  1141. cmd += " /Fd" + os.path.splitext(obj)[0] + ".pdb"
  1142. building = GetValueOption(opts, "BUILDING:")
  1143. if (building): cmd += " /DBUILDING_" + building
  1144. if ("BIGOBJ" in opts) or GetTargetArch() == 'x64':
  1145. cmd += " /bigobj"
  1146. # level of warnings and optimization reports
  1147. if GetVerbose():
  1148. cmd += " /W3 " # or /W4 or /Wall
  1149. cmd += " /Qopt-report:2 /Qopt-report-phase:hlo /Qopt-report-phase:hpo" # some optimization reports
  1150. else:
  1151. cmd += " /W1 "
  1152. cmd += " /EHa /Zm300"
  1153. cmd += " " + BracketNameWithQuotes(src)
  1154. oscmd(cmd)
  1155. if (COMPILER=="GCC"):
  1156. if (src.endswith(".c")): cmd = GetCC() +' -fPIC -c -o ' + obj
  1157. else: cmd = GetCXX()+' -std=gnu++14 -ftemplate-depth-70 -fPIC -c -o ' + obj
  1158. for (opt, dir) in INCDIRECTORIES:
  1159. if (opt=="ALWAYS") or (opt in opts): cmd += ' -I' + BracketNameWithQuotes(dir)
  1160. for (opt, dir) in FRAMEWORKDIRECTORIES:
  1161. if (opt=="ALWAYS") or (opt in opts): cmd += ' -F' + BracketNameWithQuotes(dir)
  1162. for (opt,var,val) in DEFSYMBOLS:
  1163. if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val
  1164. for (opt,flag) in COMPILEFLAGS:
  1165. if (opt=="ALWAYS") or (opt in opts): cmd += ' ' + flag
  1166. for x in ipath: cmd += ' -I' + x
  1167. if not GetLinkAllStatic() and 'NOHIDDEN' not in opts:
  1168. cmd += ' -fvisibility=hidden'
  1169. # Mac-specific flags.
  1170. if GetTarget() == "darwin":
  1171. cmd += " -Wno-deprecated-declarations"
  1172. if SDK.get("MACOSX"):
  1173. cmd += " -isysroot " + SDK["MACOSX"]
  1174. if tuple(OSX_ARCHS) == ('arm64',):
  1175. cmd += " -mmacosx-version-min=11.0"
  1176. else:
  1177. cmd += " -mmacosx-version-min=10.9"
  1178. # Use libc++ to enable C++11 features.
  1179. cmd += " -stdlib=libc++"
  1180. for arch in OSX_ARCHS:
  1181. if 'NOARCH:' + arch.upper() not in opts:
  1182. cmd += " -arch %s" % arch
  1183. elif 'clang' not in GetCXX().split('/')[-1] and GetCXX() != 'em++':
  1184. # Enable interprocedural optimizations in GCC.
  1185. cmd += " -fno-semantic-interposition"
  1186. if "SYSROOT" in SDK:
  1187. if GetTarget() != "android":
  1188. cmd += ' --sysroot=%s' % (SDK["SYSROOT"])
  1189. cmd += ' -no-canonical-prefixes'
  1190. # Android-specific flags.
  1191. arch = GetTargetArch()
  1192. if GetTarget() == "android":
  1193. # Most of the specific optimization flags here were
  1194. # just copied from the default Android Makefiles.
  1195. if "ANDROID_GCC_TOOLCHAIN" in SDK:
  1196. cmd += ' -gcc-toolchain ' + SDK["ANDROID_GCC_TOOLCHAIN"].replace('\\', '/')
  1197. cmd += ' -ffunction-sections -funwind-tables'
  1198. cmd += ' -target ' + SDK["ANDROID_TRIPLE"]
  1199. if arch == 'armv7a':
  1200. cmd += ' -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16'
  1201. elif arch == 'arm':
  1202. cmd += ' -march=armv5te -mtune=xscale -msoft-float'
  1203. elif arch == 'mips':
  1204. cmd += ' -mips32'
  1205. elif arch == 'mips64':
  1206. cmd += ' -fintegrated-as'
  1207. elif arch == 'x86':
  1208. cmd += ' -march=i686 -mssse3 -mfpmath=sse -m32'
  1209. cmd += ' -mstackrealign'
  1210. elif arch == 'x86_64':
  1211. cmd += ' -march=x86-64 -msse4.2 -mpopcnt -m64'
  1212. cmd += " -Wa,--noexecstack"
  1213. # Do we want thumb or arm instructions?
  1214. if arch != 'arm64' and arch.startswith('arm'):
  1215. if optlevel >= 3:
  1216. cmd += ' -mthumb'
  1217. else:
  1218. cmd += ' -marm'
  1219. # Enable SIMD instructions if requested
  1220. if arch != 'arm64' and arch.startswith('arm') and PkgSkip("NEON") == 0:
  1221. cmd += ' -mfpu=neon'
  1222. elif GetTarget() == 'emscripten':
  1223. if GetOptimize() <= 1:
  1224. cmd += " -s ASSERTIONS=2"
  1225. elif GetOptimize() <= 2:
  1226. cmd += " -s ASSERTIONS=1"
  1227. else:
  1228. cmd += " -pthread"
  1229. if not src.endswith(".c"):
  1230. # We don't use exceptions for most modules.
  1231. if 'EXCEPTIONS' in opts:
  1232. cmd += " -fexceptions"
  1233. else:
  1234. cmd += " -fno-exceptions"
  1235. if GetTarget() == 'emscripten':
  1236. cmd += " -s DISABLE_EXCEPTION_CATCHING=1"
  1237. if src.endswith(".mm"):
  1238. # Work around Apple compiler bug.
  1239. cmd += " -U__EXCEPTIONS"
  1240. target = GetTarget()
  1241. if 'RTTI' not in opts and target != "darwin":
  1242. # We always disable RTTI on Android for memory usage reasons.
  1243. if optlevel >= 4 or target == "android":
  1244. cmd += " -fno-rtti"
  1245. if ('SSE2' in opts or not PkgSkip("SSE2")) and not arch.startswith("arm") and arch != 'aarch64':
  1246. if GetTarget() != "emscripten":
  1247. cmd += " -msse2"
  1248. # Needed by both Python, Panda, Eigen, all of which break aliasing rules.
  1249. cmd += " -fno-strict-aliasing"
  1250. # Certain clang versions crash when passing these math flags while
  1251. # compiling Objective-C++ code
  1252. if not src.endswith(".m") and not src.endswith(".mm"):
  1253. if optlevel >= 3:
  1254. cmd += " -ffast-math -fno-stack-protector"
  1255. if optlevel == 3:
  1256. # Fast math is nice, but we'd like to see NaN in dev builds.
  1257. cmd += " -fno-finite-math-only"
  1258. # Make sure this is off to avoid GCC/Eigen bug (see GitHub #228)
  1259. if GetTarget() != "emscripten":
  1260. cmd += " -fno-unsafe-math-optimizations"
  1261. if (optlevel==1):
  1262. if GetTarget() == "emscripten":
  1263. cmd += " -g -D_DEBUG"
  1264. else:
  1265. cmd += " -ggdb -D_DEBUG"
  1266. if (optlevel==2): cmd += " -O1 -D_DEBUG"
  1267. if (optlevel==3): cmd += " -O2"
  1268. if (optlevel==4): cmd += " -O3 -DNDEBUG"
  1269. # Enable more warnings.
  1270. cmd += " -Wall -Wno-unused-function -Werror=return-type"
  1271. # Ignore unused variables in NDEBUG builds, often used in asserts.
  1272. if optlevel == 4:
  1273. cmd += " -Wno-unused-variable"
  1274. if src.endswith(".c"):
  1275. cmd += ' ' + CFLAGS
  1276. else:
  1277. cmd += ' ' + CXXFLAGS
  1278. cmd = cmd.rstrip()
  1279. building = GetValueOption(opts, "BUILDING:")
  1280. if (building): cmd += " -DBUILDING_" + building
  1281. cmd += ' ' + BracketNameWithQuotes(src)
  1282. oscmd(cmd)
  1283. ########################################################################
  1284. ##
  1285. ## CompileBison
  1286. ##
  1287. ########################################################################
  1288. def CompileBison(wobj, wsrc, opts):
  1289. ifile = os.path.basename(wsrc)
  1290. wdsth = GetOutputDir() + "/include/" + ifile[:-4] + ".h"
  1291. wdsth2 = GetOutputDir() + "/tmp/" + ifile + ".h"
  1292. wdstc = GetOutputDir() + "/tmp/" + ifile + ".cxx"
  1293. pre = GetValueOption(opts, "BISONPREFIX_")
  1294. bison = GetBison()
  1295. if bison is None:
  1296. # We don't have bison. See if there is a prebuilt file.
  1297. base, ext = os.path.splitext(wsrc)
  1298. if os.path.isfile(base + '.h.prebuilt') and \
  1299. os.path.isfile(base + '.cxx.prebuilt'):
  1300. CopyFile(wdstc, base + '.cxx.prebuilt')
  1301. CopyFile(wdsth, base + '.h.prebuilt')
  1302. CopyFile(wdsth2, base + '.h.prebuilt')
  1303. else:
  1304. exit('Could not find bison!')
  1305. else:
  1306. oscmd(bison + ' -y -d -o'+GetOutputDir()+'/tmp/'+ifile[:-4]+'.c -p '+pre+' '+wsrc)
  1307. CopyFile(wdstc, GetOutputDir()+"/tmp/"+ifile[:-4]+".c")
  1308. CopyFile(wdsth, GetOutputDir()+"/tmp/"+ifile[:-4]+".h")
  1309. # Finally, compile the generated source file.
  1310. CompileCxx(wobj, wdstc, opts + ["FLEX"])
  1311. ########################################################################
  1312. ##
  1313. ## CompileFlex
  1314. ##
  1315. ########################################################################
  1316. def CompileFlex(wobj,wsrc,opts):
  1317. ifile = os.path.basename(wsrc)
  1318. wdst = GetOutputDir()+"/tmp/"+ifile+".cxx"
  1319. pre = GetValueOption(opts, "BISONPREFIX_")
  1320. dashi = opts.count("FLEXDASHI")
  1321. flex = GetFlex()
  1322. want_version = GetValueOption(opts, "FLEXVERSION:")
  1323. if flex and want_version:
  1324. # Is flex at the required version for this file?
  1325. want_version = tuple(map(int, want_version.split('.')))
  1326. have_version = GetFlexVersion()
  1327. if want_version > have_version:
  1328. Warn("Skipping flex %s for file %s, need at least %s" % (
  1329. '.'.join(map(str, have_version)),
  1330. ifile,
  1331. '.'.join(map(str, want_version)),
  1332. ))
  1333. flex = None
  1334. if flex is None:
  1335. # We don't have flex. See if there is a prebuilt file.
  1336. base, ext = os.path.splitext(wsrc)
  1337. if os.path.isfile(base + '.cxx.prebuilt'):
  1338. CopyFile(wdst, base + '.cxx.prebuilt')
  1339. else:
  1340. exit('Could not find flex!')
  1341. else:
  1342. if (dashi):
  1343. oscmd(flex + " -i -P" + pre + " -o"+wdst+" "+wsrc)
  1344. else:
  1345. oscmd(flex + " -P" + pre + " -o"+wdst+" "+wsrc)
  1346. # Finally, compile the generated source file.
  1347. CompileCxx(wobj, wdst, opts + ["FLEX"])
  1348. ########################################################################
  1349. ##
  1350. ## CompileIgate
  1351. ##
  1352. ########################################################################
  1353. def CompileIgate(woutd,wsrc,opts):
  1354. outbase = os.path.basename(woutd)[:-3]
  1355. woutc = GetOutputDir()+"/tmp/"+outbase+"_igate.cxx"
  1356. srcdir = GetValueOption(opts, "SRCDIR:")
  1357. module = GetValueOption(opts, "IMOD:")
  1358. library = GetValueOption(opts, "ILIB:")
  1359. ipath = GetListOption(opts, "DIR:")
  1360. if (PkgSkip("PYTHON")):
  1361. WriteFile(woutc, "")
  1362. WriteFile(woutd, "")
  1363. ConditionalWriteFile(woutd, "")
  1364. return
  1365. cmd = GetInterrogate()
  1366. if GetVerbose():
  1367. cmd += ' -v'
  1368. cmd += ' -srcdir %s -I%s' % (srcdir, srcdir)
  1369. cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus=201103L'
  1370. if (COMPILER=="MSVC"):
  1371. cmd += ' -D_WIN32'
  1372. if GetTargetArch() == 'x64':
  1373. cmd += ' -D_WIN64 -D_M_X64 -D_M_AMD64'
  1374. else:
  1375. cmd += ' -D_M_IX86'
  1376. # NOTE: this 1600 value is the version number for VC2010.
  1377. cmd += ' -D_MSC_VER=1600 -D"__declspec(param)=" -D__cdecl -D_near -D_far -D__near -D__far -D__stdcall'
  1378. if (COMPILER=="GCC"):
  1379. cmd += ' -D__attribute__\\(x\\)='
  1380. target_arch = GetTargetArch()
  1381. if target_arch in ("x86_64", "amd64"):
  1382. cmd += ' -D_LP64'
  1383. elif target_arch in ('aarch64', 'arm64'):
  1384. cmd += ' -D_LP64 -D__LP64__ -D__aarch64__'
  1385. else:
  1386. cmd += ' -D__i386__'
  1387. target = GetTarget()
  1388. if target == 'darwin':
  1389. cmd += ' -D__APPLE__'
  1390. elif target == 'android':
  1391. cmd += ' -D__ANDROID__'
  1392. if GetTarget() == "emscripten":
  1393. cmd += ' -D__EMSCRIPTEN__'
  1394. optlevel = GetOptimizeOption(opts)
  1395. if (optlevel==1): cmd += ' -D_DEBUG'
  1396. if (optlevel==2): cmd += ' -D_DEBUG'
  1397. if (optlevel==3): pass
  1398. if (optlevel==4): cmd += ' -DNDEBUG'
  1399. cmd += ' -oc ' + woutc + ' -od ' + woutd
  1400. cmd += ' -fnames -string -refcount -assert -python-native'
  1401. cmd += ' -S' + GetOutputDir() + '/include/parser-inc'
  1402. # Add -I, -S and -D flags
  1403. for x in ipath:
  1404. cmd += ' -I' + BracketNameWithQuotes(x)
  1405. for (opt,dir) in INCDIRECTORIES:
  1406. if (opt=="ALWAYS") or (opt in opts):
  1407. cmd += ' -S' + BracketNameWithQuotes(dir)
  1408. for (opt,var,val) in DEFSYMBOLS:
  1409. if (opt=="ALWAYS") or (opt in opts):
  1410. cmd += ' -D' + var + '=' + val
  1411. #building = GetValueOption(opts, "BUILDING:")
  1412. #if (building): cmd += " -DBUILDING_"+building
  1413. cmd += ' -module ' + module + ' -library ' + library
  1414. for x in wsrc:
  1415. if (x.startswith("/")):
  1416. cmd += ' ' + BracketNameWithQuotes(x)
  1417. else:
  1418. cmd += ' ' + BracketNameWithQuotes(os.path.basename(x))
  1419. oscmd(cmd)
  1420. ########################################################################
  1421. ##
  1422. ## CompileImod
  1423. ##
  1424. ########################################################################
  1425. def CompileImod(wobj, wsrc, opts):
  1426. module = GetValueOption(opts, "IMOD:")
  1427. library = GetValueOption(opts, "ILIB:")
  1428. woutc = os.path.splitext(wobj)[0] + ".cxx"
  1429. if (PkgSkip("PYTHON")):
  1430. WriteFile(woutc, "")
  1431. CompileCxx(wobj, woutc, opts)
  1432. return
  1433. cmd = GetInterrogateModule()
  1434. cmd += ' -oc ' + woutc + ' -module ' + module + ' -library ' + library + ' -python-native'
  1435. importmod = GetValueOption(opts, "IMPORT:")
  1436. if importmod:
  1437. cmd += ' -import ' + importmod
  1438. for x in wsrc: cmd += ' ' + BracketNameWithQuotes(x)
  1439. oscmd(cmd)
  1440. CompileCxx(wobj,woutc,opts)
  1441. return
  1442. ########################################################################
  1443. ##
  1444. ## CompileLib
  1445. ##
  1446. ########################################################################
  1447. def CompileLib(lib, obj, opts):
  1448. if (COMPILER=="MSVC"):
  1449. if not BOOUSEINTELCOMPILER:
  1450. #Use MSVC Linker
  1451. cmd = 'link /lib /nologo'
  1452. if GetOptimizeOption(opts) == 4:
  1453. cmd += " /LTCG"
  1454. if HasTargetArch():
  1455. cmd += " /MACHINE:" + GetTargetArch().upper()
  1456. cmd += ' /OUT:' + BracketNameWithQuotes(lib)
  1457. for x in obj:
  1458. if not x.endswith('.lib'):
  1459. cmd += ' ' + BracketNameWithQuotes(x)
  1460. oscmd(cmd)
  1461. else:
  1462. # Choose Intel linker; from Jean-Claude
  1463. cmd = 'xilink /verbose:lib /lib '
  1464. if HasTargetArch():
  1465. cmd += " /MACHINE:" + GetTargetArch().upper()
  1466. cmd += ' /OUT:' + BracketNameWithQuotes(lib)
  1467. for x in obj: cmd += ' ' + BracketNameWithQuotes(x)
  1468. cmd += ' /LIBPATH:"C:\\Program Files (x86)\\Intel\\Composer XE 2011 SP1\\ipp\\lib\\ia32"'
  1469. cmd += ' /LIBPATH:"C:\\Program Files (x86)\\Intel\\Composer XE 2011 SP1\\TBB\\Lib\\ia32\\vc10"'
  1470. cmd += ' /LIBPATH:"C:\\Program Files (x86)\\Intel\\Composer XE 2011 SP1\\compiler\\lib\\ia32"'
  1471. oscmd(cmd)
  1472. if (COMPILER=="GCC"):
  1473. if GetTarget() == 'darwin':
  1474. cmd = 'libtool -static -o ' + BracketNameWithQuotes(lib)
  1475. else:
  1476. cmd = GetAR() + ' cru ' + BracketNameWithQuotes(lib)
  1477. for x in obj:
  1478. if GetLinkAllStatic() and x.endswith('.a'):
  1479. continue
  1480. cmd += ' ' + BracketNameWithQuotes(x)
  1481. oscmd(cmd)
  1482. oscmd(GetRanlib() + ' ' + BracketNameWithQuotes(lib))
  1483. ########################################################################
  1484. ##
  1485. ## CompileLink
  1486. ##
  1487. ########################################################################
  1488. def CompileLink(dll, obj, opts):
  1489. if (COMPILER=="MSVC"):
  1490. if not BOOUSEINTELCOMPILER:
  1491. cmd = "link /nologo "
  1492. if HasTargetArch():
  1493. cmd += " /MACHINE:" + GetTargetArch().upper()
  1494. if ("MFC" not in opts):
  1495. cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCMT"
  1496. cmd += " /NOD:LIBCI.LIB /DEBUG"
  1497. cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls /nod:atlsd"
  1498. if (GetOrigExt(dll) != ".exe"): cmd += " /DLL"
  1499. optlevel = GetOptimizeOption(opts)
  1500. if (optlevel==1): cmd += " /MAP /MAPINFO:EXPORTS /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB"
  1501. if (optlevel==2): cmd += " /MAP:NUL /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB"
  1502. if (optlevel==3): cmd += " /MAP:NUL /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB"
  1503. if (optlevel==4): cmd += " /MAP:NUL /LTCG /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB"
  1504. if ("MFC" in opts):
  1505. if (optlevel<=2): cmd += " /NOD:MSVCRTD.LIB mfcs100d.lib MSVCRTD.lib"
  1506. else: cmd += " /NOD:MSVCRT.LIB mfcs100.lib MSVCRT.lib"
  1507. cmd += " /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO "
  1508. cmd += ' /OUT:' + BracketNameWithQuotes(dll)
  1509. if not PkgSkip("PYTHON"):
  1510. # If we're building without Python, don't pick it up implicitly.
  1511. if "PYTHON" not in opts:
  1512. pythonv = SDK["PYTHONVERSION"].replace('.', '')
  1513. if optlevel <= 2:
  1514. cmd += ' /NOD:{}d.lib'.format(pythonv)
  1515. else:
  1516. cmd += ' /NOD:{}.lib'.format(pythonv)
  1517. # Set the subsystem. Specify that we want to target Windows XP.
  1518. subsystem = GetValueOption(opts, "SUBSYSTEM:") or "CONSOLE"
  1519. cmd += " /SUBSYSTEM:" + subsystem
  1520. if GetTargetArch() == 'x64':
  1521. cmd += ",6.00"
  1522. else:
  1523. cmd += ",6.00"
  1524. if dll.endswith(".dll") or dll.endswith(".pyd"):
  1525. cmd += ' /IMPLIB:' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(dll))[0] + ".lib"
  1526. for (opt, dir) in LIBDIRECTORIES:
  1527. if (opt=="ALWAYS") or (opt in opts):
  1528. cmd += ' /LIBPATH:' + BracketNameWithQuotes(dir)
  1529. for x in obj:
  1530. if x.endswith(".dll") or x.endswith(".pyd"):
  1531. cmd += ' ' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(x))[0] + ".lib"
  1532. elif x.endswith(".lib"):
  1533. dname = os.path.splitext(os.path.basename(x))[0] + ".dll"
  1534. if (GetOrigExt(x) != ".ilb" and os.path.exists(GetOutputDir()+"/bin/" + dname)):
  1535. exit("Error: in makepanda, specify "+dname+", not "+x)
  1536. cmd += ' ' + BracketNameWithQuotes(x)
  1537. elif x.endswith(".def"):
  1538. cmd += ' /DEF:' + BracketNameWithQuotes(x)
  1539. elif x.endswith(".dat"):
  1540. pass
  1541. else:
  1542. cmd += ' ' + BracketNameWithQuotes(x)
  1543. if (GetOrigExt(dll)==".exe" and "NOICON" not in opts):
  1544. cmd += " " + GetOutputDir() + "/tmp/pandaIcon.res"
  1545. for (opt, name) in LIBNAMES:
  1546. if (opt=="ALWAYS") or (opt in opts):
  1547. cmd += " " + BracketNameWithQuotes(name)
  1548. oscmd(cmd)
  1549. else:
  1550. cmd = "xilink"
  1551. if GetVerbose(): cmd += " /verbose:lib"
  1552. if HasTargetArch():
  1553. cmd += " /MACHINE:" + GetTargetArch().upper()
  1554. if ("MFC" not in opts):
  1555. cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCMT"
  1556. cmd += " /NOD:LIBCI.LIB /DEBUG"
  1557. cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls"
  1558. cmd += ' /LIBPATH:"C:\\Program Files (x86)\\Intel\\Composer XE 2011 SP1\\ipp\\lib\\ia32"'
  1559. cmd += ' /LIBPATH:"C:\\Program Files (x86)\\Intel\\Composer XE 2011 SP1\\TBB\\Lib\\ia32\\vc10"'
  1560. cmd += ' /LIBPATH:"C:\\Program Files (x86)\\Intel\\Composer XE 2011 SP1\\compiler\\lib\\ia32"'
  1561. if (GetOrigExt(dll) != ".exe"): cmd += " /DLL"
  1562. optlevel = GetOptimizeOption(opts)
  1563. if (optlevel==1): cmd += " /MAP /MAPINFO:EXPORTS /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB"
  1564. if (optlevel==2): cmd += " /MAP:NUL /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB"
  1565. if (optlevel==3): cmd += " /MAP:NUL /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB"
  1566. if (optlevel==4): cmd += " /MAP:NUL /LTCG /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB"
  1567. if ("MFC" in opts):
  1568. if (optlevel<=2): cmd += " /NOD:MSVCRTD.LIB mfcs100d.lib MSVCRTD.lib"
  1569. else: cmd += " /NOD:MSVCRT.LIB mfcs100.lib MSVCRT.lib"
  1570. cmd += " /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO "
  1571. cmd += ' /OUT:' + BracketNameWithQuotes(dll)
  1572. subsystem = GetValueOption(opts, "SUBSYSTEM:")
  1573. if subsystem:
  1574. cmd += " /SUBSYSTEM:" + subsystem
  1575. if dll.endswith(".dll"):
  1576. cmd += ' /IMPLIB:' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(dll))[0] + ".lib"
  1577. for (opt, dir) in LIBDIRECTORIES:
  1578. if (opt=="ALWAYS") or (opt in opts):
  1579. cmd += ' /LIBPATH:' + BracketNameWithQuotes(dir)
  1580. for x in obj:
  1581. if x.endswith(".dll") or x.endswith(".pyd"):
  1582. cmd += ' ' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(x))[0] + ".lib"
  1583. elif x.endswith(".lib"):
  1584. dname = os.path.splitext(dll)[0]+".dll"
  1585. if (GetOrigExt(x) != ".ilb" and os.path.exists(GetOutputDir()+"/bin/" + os.path.splitext(os.path.basename(x))[0] + ".dll")):
  1586. exit("Error: in makepanda, specify "+dname+", not "+x)
  1587. cmd += ' ' + BracketNameWithQuotes(x)
  1588. elif x.endswith(".def"):
  1589. cmd += ' /DEF:' + BracketNameWithQuotes(x)
  1590. elif x.endswith(".dat"):
  1591. pass
  1592. else:
  1593. cmd += ' ' + BracketNameWithQuotes(x)
  1594. if (GetOrigExt(dll)==".exe" and "NOICON" not in opts):
  1595. cmd += " " + GetOutputDir() + "/tmp/pandaIcon.res"
  1596. for (opt, name) in LIBNAMES:
  1597. if (opt=="ALWAYS") or (opt in opts):
  1598. cmd += " " + BracketNameWithQuotes(name)
  1599. oscmd(cmd)
  1600. if COMPILER == "GCC":
  1601. cxx = GetCXX()
  1602. if GetOrigExt(dll) == ".exe":
  1603. cmd = cxx + ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
  1604. if GetTarget() == "android":
  1605. # Necessary to work around an issue with libandroid depending on vendor libraries
  1606. cmd += ' -Wl,--allow-shlib-undefined'
  1607. else:
  1608. if (GetTarget() == "darwin"):
  1609. cmd = cxx
  1610. if GetOrigExt(dll) == ".pyd":
  1611. cmd += ' -bundle -undefined dynamic_lookup'
  1612. elif "BUNDLE" in opts:
  1613. cmd += ' -bundle'
  1614. else:
  1615. install_name = '@loader_path/../lib/' + os.path.basename(dll)
  1616. cmd += ' -dynamiclib -install_name ' + install_name
  1617. cmd += ' -compatibility_version ' + MAJOR_VERSION + ' -current_version ' + VERSION
  1618. cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
  1619. else:
  1620. cmd = cxx + ' -shared'
  1621. # Always set soname on Android to avoid a linker warning when loading the library.
  1622. if GetTarget() == 'android' or ("MODULE" not in opts and GetTarget() != 'emscripten'):
  1623. cmd += " -Wl,-soname=" + os.path.basename(dll)
  1624. cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
  1625. if GetTarget() == 'emscripten' and GetOrigExt(dll) != ".exe":
  1626. for x in obj:
  1627. if GetOrigExt(x) not in (".dat", ".dll"):
  1628. cmd += ' ' + x
  1629. else:
  1630. for x in obj:
  1631. if GetOrigExt(x) != ".dat":
  1632. cmd += ' ' + x
  1633. if (GetOrigExt(dll) == ".exe" and GetTarget() == 'windows' and "NOICON" not in opts):
  1634. cmd += " " + GetOutputDir() + "/tmp/pandaIcon.res"
  1635. # macOS specific flags.
  1636. if GetTarget() == 'darwin':
  1637. cmd += " -headerpad_max_install_names"
  1638. if SDK.get("MACOSX"):
  1639. cmd += " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"]
  1640. if tuple(OSX_ARCHS) == ('arm64',):
  1641. cmd += " -mmacosx-version-min=11.0"
  1642. else:
  1643. cmd += " -mmacosx-version-min=10.9"
  1644. # Use libc++ to enable C++11 features.
  1645. cmd += " -stdlib=libc++"
  1646. for arch in OSX_ARCHS:
  1647. if 'NOARCH:' + arch.upper() not in opts:
  1648. cmd += " -arch %s" % arch
  1649. elif GetTarget() == 'android':
  1650. arch = GetTargetArch()
  1651. if "ANDROID_GCC_TOOLCHAIN" in SDK:
  1652. cmd += ' -gcc-toolchain ' + SDK["ANDROID_GCC_TOOLCHAIN"].replace('\\', '/')
  1653. cmd += " -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now"
  1654. cmd += ' -target ' + SDK["ANDROID_TRIPLE"]
  1655. if arch == 'armv7a':
  1656. cmd += " -march=armv7-a -Wl,--fix-cortex-a8"
  1657. elif arch == 'mips':
  1658. cmd += ' -mips32'
  1659. cmd += ' -lc -lm'
  1660. elif GetTarget() == 'emscripten':
  1661. cmd += " -s WARN_ON_UNDEFINED_SYMBOLS=1"
  1662. if GetOrigExt(dll) == ".exe":
  1663. cmd += " -s EXIT_RUNTIME=1"
  1664. else:
  1665. cmd += " -pthread"
  1666. if "SYSROOT" in SDK:
  1667. cmd += " --sysroot=%s -no-canonical-prefixes" % (SDK["SYSROOT"])
  1668. if LDFLAGS != "":
  1669. cmd += " " + LDFLAGS
  1670. # Don't link libraries with Python, except on Android.
  1671. if "PYTHON" in opts and GetOrigExt(dll) != ".exe" and GetTarget() != 'android':
  1672. opts = opts[:]
  1673. opts.remove("PYTHON")
  1674. for (opt, dir) in LIBDIRECTORIES:
  1675. if (opt=="ALWAYS") or (opt in opts):
  1676. cmd += ' -L' + BracketNameWithQuotes(dir)
  1677. for (opt, dir) in FRAMEWORKDIRECTORIES:
  1678. if (opt=="ALWAYS") or (opt in opts):
  1679. cmd += ' -F' + BracketNameWithQuotes(dir)
  1680. if GetOrigExt(dll) == ".exe" or GetTarget() != 'emscripten':
  1681. for (opt, name) in LIBNAMES:
  1682. if (opt=="ALWAYS") or (opt in opts):
  1683. cmd += ' ' + BracketNameWithQuotes(name)
  1684. for (opt, flag) in LINKFLAGS:
  1685. if (opt=="ALWAYS") or (opt in opts):
  1686. cmd += ' ' + flag
  1687. if GetTarget() not in ('freebsd', 'emscripten'):
  1688. cmd += " -ldl"
  1689. if GetTarget() == 'emscripten':
  1690. optlevel = GetOptimizeOption(opts)
  1691. if optlevel == 2: cmd += " -O1"
  1692. if optlevel == 3: cmd += " -O2"
  1693. if optlevel == 4: cmd += " -O3"
  1694. oscmd(cmd)
  1695. if GetOptimizeOption(opts) == 4 and GetTarget() in ('linux', 'android'):
  1696. oscmd(GetStrip() + " --strip-unneeded " + BracketNameWithQuotes(dll))
  1697. os.system("chmod +x " + BracketNameWithQuotes(dll))
  1698. if dll.endswith("." + MAJOR_VERSION + ".dylib"):
  1699. newdll = dll[:-6-len(MAJOR_VERSION)] + "dylib"
  1700. if os.path.isfile(newdll):
  1701. os.remove(newdll)
  1702. oscmd("ln -s " + BracketNameWithQuotes(os.path.basename(dll)) + " " + BracketNameWithQuotes(newdll))
  1703. elif dll.endswith("." + MAJOR_VERSION):
  1704. newdll = dll[:-len(MAJOR_VERSION)-1]
  1705. if os.path.isfile(newdll):
  1706. os.remove(newdll)
  1707. oscmd("ln -s " + BracketNameWithQuotes(os.path.basename(dll)) + " " + BracketNameWithQuotes(newdll))
  1708. ##########################################################################################
  1709. #
  1710. # CompileEgg
  1711. #
  1712. ##########################################################################################
  1713. def CompileEgg(eggfile, src, opts):
  1714. pz = False
  1715. if eggfile.endswith(".pz"):
  1716. pz = True
  1717. eggfile = eggfile[:-3]
  1718. # Determine the location of the pzip and flt2egg tools.
  1719. if CrossCompiling():
  1720. # We may not be able to use our generated versions of these tools,
  1721. # so we'll expect them to already be present in the PATH.
  1722. pzip = 'pzip'
  1723. flt2egg = 'flt2egg'
  1724. else:
  1725. # If we're compiling for this machine, we can use the binaries we've built.
  1726. pzip = os.path.join(GetOutputDir(), 'bin', 'pzip')
  1727. flt2egg = os.path.join(GetOutputDir(), 'bin', 'flt2egg')
  1728. if not os.path.isfile(pzip):
  1729. pzip = 'pzip'
  1730. if not os.path.isfile(flt2egg):
  1731. flt2egg = 'flt2egg'
  1732. if src.endswith(".egg"):
  1733. CopyFile(eggfile, src)
  1734. elif src.endswith(".flt"):
  1735. oscmd(flt2egg + ' -ps keep -o ' + BracketNameWithQuotes(eggfile) + ' ' + BracketNameWithQuotes(src))
  1736. if pz:
  1737. if zlib:
  1738. WriteBinaryFile(eggfile + '.pz', zlib.compress(ReadBinaryFile(eggfile)))
  1739. os.remove(eggfile)
  1740. else:
  1741. oscmd(pzip + ' ' + BracketNameWithQuotes(eggfile))
  1742. ##########################################################################################
  1743. #
  1744. # CompileRes, CompileRsrc
  1745. #
  1746. ##########################################################################################
  1747. def CompileRes(target, src, opts):
  1748. """Compiles a Windows .rc file into a .res file."""
  1749. ipath = GetListOption(opts, "DIR:")
  1750. if (COMPILER == "MSVC"):
  1751. cmd = "rc"
  1752. cmd += " /Fo" + BracketNameWithQuotes(target)
  1753. for x in ipath: cmd += " /I" + x
  1754. for (opt,dir) in INCDIRECTORIES:
  1755. if (opt=="ALWAYS") or (opt in opts):
  1756. cmd += " /I" + BracketNameWithQuotes(dir)
  1757. for (opt,var,val) in DEFSYMBOLS:
  1758. if (opt=="ALWAYS") or (opt in opts):
  1759. cmd += " /D" + var + "=" + val
  1760. cmd += " " + BracketNameWithQuotes(src)
  1761. else:
  1762. cmd = "windres"
  1763. for x in ipath: cmd += " -I" + x
  1764. for (opt,dir) in INCDIRECTORIES:
  1765. if (opt=="ALWAYS") or (opt in opts):
  1766. cmd += " -I" + BracketNameWithQuotes(dir)
  1767. for (opt,var,val) in DEFSYMBOLS:
  1768. if (opt=="ALWAYS") or (opt in opts):
  1769. cmd += " -D" + var + "=" + val
  1770. cmd += " -i " + BracketNameWithQuotes(src)
  1771. cmd += " -o " + BracketNameWithQuotes(target)
  1772. oscmd(cmd)
  1773. def CompileRsrc(target, src, opts):
  1774. """Compiles a Mac OS .r file into an .rsrc file."""
  1775. ipath = GetListOption(opts, "DIR:")
  1776. if os.path.isfile("/usr/bin/Rez"):
  1777. cmd = "Rez -useDF"
  1778. elif os.path.isfile("/Library/Developer/CommandLineTools/usr/bin/Rez"):
  1779. cmd = "/Library/Developer/CommandLineTools/usr/bin/Rez -useDF"
  1780. else:
  1781. cmd = "/Developer/Tools/Rez -useDF"
  1782. cmd += " -o " + BracketNameWithQuotes(target)
  1783. for x in ipath:
  1784. cmd += " -i " + x
  1785. for (opt,dir) in INCDIRECTORIES:
  1786. if (opt=="ALWAYS") or (opt in opts):
  1787. cmd += " -i " + BracketNameWithQuotes(dir)
  1788. for (opt,var,val) in DEFSYMBOLS:
  1789. if (opt=="ALWAYS") or (opt in opts):
  1790. if (val == ""):
  1791. cmd += " -d " + var
  1792. else:
  1793. cmd += " -d " + var + " = " + val
  1794. cmd += " " + BracketNameWithQuotes(src)
  1795. oscmd(cmd)
  1796. ##########################################################################################
  1797. #
  1798. # CompileJava (Android only)
  1799. #
  1800. ##########################################################################################
  1801. def CompileJava(target, src, opts):
  1802. """Compiles a .java file into a .class file."""
  1803. if GetHost() == 'android':
  1804. cmd = "ecj "
  1805. else:
  1806. cmd = "javac -bootclasspath " + BracketNameWithQuotes(SDK["ANDROID_JAR"]) + " "
  1807. optlevel = GetOptimizeOption(opts)
  1808. if optlevel >= 4:
  1809. cmd += "-debug:none "
  1810. cmd += "-cp " + GetOutputDir() + "/classes "
  1811. cmd += "-d " + GetOutputDir() + "/classes "
  1812. cmd += BracketNameWithQuotes(src)
  1813. oscmd(cmd)
  1814. ##########################################################################################
  1815. #
  1816. # FreezePy
  1817. #
  1818. ##########################################################################################
  1819. def FreezePy(target, inputs, opts):
  1820. assert len(inputs) > 0
  1821. cmdstr = BracketNameWithQuotes(SDK["PYTHONEXEC"].replace('\\', '/')) + " "
  1822. cmdstr += "-B "
  1823. cmdstr += os.path.join(GetOutputDir(), "direct", "dist", "pfreeze.py")
  1824. if 'FREEZE_STARTUP' in opts:
  1825. cmdstr += " -s"
  1826. if GetOrigExt(target) == '.exe':
  1827. src = inputs.pop(0)
  1828. else:
  1829. src = ""
  1830. for i in inputs:
  1831. i = os.path.splitext(i)[0]
  1832. i = i.replace('/', '.')
  1833. if i.startswith('direct.src'):
  1834. i = i.replace('.src.', '.')
  1835. cmdstr += " -i " + i
  1836. cmdstr += " -o " + target + " " + src
  1837. if ("LINK_PYTHON_STATIC" in opts):
  1838. os.environ["LINK_PYTHON_STATIC"] = "1"
  1839. oscmd(cmdstr)
  1840. if ("LINK_PYTHON_STATIC" in os.environ):
  1841. del os.environ["LINK_PYTHON_STATIC"]
  1842. if (not os.path.exists(target)):
  1843. exit("FREEZER_ERROR")
  1844. ##########################################################################################
  1845. #
  1846. # CompileBundle
  1847. #
  1848. ##########################################################################################
  1849. def CompileBundle(target, inputs, opts):
  1850. assert GetTarget() == "darwin", 'bundles can only be made for macOS'
  1851. plist = None
  1852. resources = []
  1853. objects = []
  1854. for i in inputs:
  1855. if i.endswith(".plist"):
  1856. if plist is not None:
  1857. exit("Only one plist file can be used when creating a bundle!")
  1858. plist = i
  1859. elif i.endswith(".rsrc") or i.endswith(".icns"):
  1860. resources.append(i)
  1861. elif GetOrigExt(i) == ".obj" or GetOrigExt(i) in SUFFIX_LIB or GetOrigExt(i) in SUFFIX_DLL:
  1862. objects.append(i)
  1863. else:
  1864. exit("Don't know how to bundle file %s" % i)
  1865. # Now link the object files to form the bundle.
  1866. if plist is None:
  1867. exit("One plist file must be used when creating a bundle!")
  1868. bundleName = plistlib.load(open(plist, 'rb'))["CFBundleExecutable"]
  1869. oscmd("rm -rf %s" % target)
  1870. oscmd("mkdir -p %s/Contents/MacOS/" % target)
  1871. oscmd("mkdir -p %s/Contents/Resources/" % target)
  1872. if target.endswith(".app"):
  1873. SetOrigExt("%s/Contents/MacOS/%s" % (target, bundleName), ".exe")
  1874. else:
  1875. SetOrigExt("%s/Contents/MacOS/%s" % (target, bundleName), ".dll")
  1876. CompileLink("%s/Contents/MacOS/%s" % (target, bundleName), objects, opts + ["BUNDLE"])
  1877. oscmd("cp %s %s/Contents/Info.plist" % (plist, target))
  1878. for r in resources:
  1879. oscmd("cp %s %s/Contents/Resources/" % (r, target))
  1880. ##########################################################################################
  1881. #
  1882. # CompileMIDL
  1883. #
  1884. ##########################################################################################
  1885. def CompileMIDL(target, src, opts):
  1886. ipath = GetListOption(opts, "DIR:")
  1887. if (COMPILER=="MSVC"):
  1888. cmd = "midl"
  1889. cmd += " /out" + BracketNameWithQuotes(os.path.dirname(target))
  1890. for x in ipath: cmd += " /I" + x
  1891. for (opt,dir) in INCDIRECTORIES:
  1892. if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
  1893. for (opt,var,val) in DEFSYMBOLS:
  1894. if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
  1895. cmd += " " + BracketNameWithQuotes(src)
  1896. oscmd(cmd)
  1897. ##########################################################################################
  1898. #
  1899. # CompileDalvik
  1900. #
  1901. ##########################################################################################
  1902. def CompileDalvik(target, inputs, opts):
  1903. cmd = "d8 --output " + os.path.dirname(target)
  1904. if GetOptimize() <= 2:
  1905. cmd += " --debug"
  1906. else:
  1907. cmd += " --release"
  1908. if "ANDROID_API" in SDK:
  1909. cmd += " --min-api %d" % (SDK["ANDROID_API"])
  1910. if "ANDROID_JAR" in SDK:
  1911. cmd += " --lib %s" % (SDK["ANDROID_JAR"])
  1912. for i in inputs:
  1913. cmd += " " + BracketNameWithQuotes(i)
  1914. oscmd(cmd)
  1915. ##########################################################################################
  1916. #
  1917. # CompileAnything
  1918. #
  1919. ##########################################################################################
  1920. def CompileAnything(target, inputs, opts, progress = None):
  1921. if opts.count("DEPENDENCYONLY"):
  1922. return
  1923. if len(inputs) == 0:
  1924. exit("No input files for target "+target)
  1925. infile = inputs[0]
  1926. origsuffix = GetOrigExt(target)
  1927. if len(inputs) == 1 and origsuffix == GetOrigExt(infile):
  1928. # It must be a simple copy operation.
  1929. ProgressOutput(progress, "Copying file", target)
  1930. CopyFile(target, infile)
  1931. if origsuffix == ".exe" and GetHost() != "windows":
  1932. os.system("chmod +x \"%s\"" % target)
  1933. return
  1934. elif infile.endswith(".py"):
  1935. if origsuffix == ".obj":
  1936. source = os.path.splitext(target)[0] + ".c"
  1937. SetOrigExt(source, ".c")
  1938. ProgressOutput(progress, "Building frozen source", source)
  1939. FreezePy(source, inputs, opts)
  1940. ProgressOutput(progress, "Building C++ object", target)
  1941. return CompileCxx(target, source, opts)
  1942. if origsuffix == ".exe":
  1943. ProgressOutput(progress, "Building frozen executable", target)
  1944. else:
  1945. ProgressOutput(progress, "Building frozen library", target)
  1946. return FreezePy(target, inputs, opts)
  1947. elif infile.endswith(".idl"):
  1948. ProgressOutput(progress, "Compiling MIDL file", infile)
  1949. return CompileMIDL(target, infile, opts)
  1950. elif origsuffix in SUFFIX_LIB:
  1951. ProgressOutput(progress, "Linking static library", target)
  1952. return CompileLib(target, inputs, opts)
  1953. elif origsuffix in SUFFIX_DLL or (origsuffix == ".plugin" and GetTarget() != "darwin"):
  1954. if (origsuffix == ".exe"):
  1955. ProgressOutput(progress, "Linking executable", target)
  1956. else:
  1957. ProgressOutput(progress, "Linking dynamic library", target)
  1958. # Add version number to the dynamic library, on unix
  1959. if origsuffix == ".dll" and "MODULE" not in opts:
  1960. tplatform = GetTarget()
  1961. if tplatform == "darwin":
  1962. # On Mac, libraries are named like libpanda.1.2.dylib
  1963. if target.lower().endswith(".dylib"):
  1964. target = target[:-5] + MAJOR_VERSION + ".dylib"
  1965. SetOrigExt(target, origsuffix)
  1966. elif tplatform not in ("windows", "android", "emscripten"):
  1967. # On Linux, libraries are named like libpanda.so.1.2
  1968. target += "." + MAJOR_VERSION
  1969. SetOrigExt(target, origsuffix)
  1970. return CompileLink(target, inputs, opts)
  1971. elif origsuffix == ".in":
  1972. ProgressOutput(progress, "Building Interrogate database", target)
  1973. return CompileIgate(target, inputs, opts)
  1974. elif origsuffix == ".plugin" and GetTarget() == "darwin":
  1975. ProgressOutput(progress, "Building plugin bundle", target)
  1976. return CompileBundle(target, inputs, opts)
  1977. elif origsuffix == ".app":
  1978. ProgressOutput(progress, "Building application bundle", target)
  1979. return CompileBundle(target, inputs, opts)
  1980. elif origsuffix == ".pz":
  1981. ProgressOutput(progress, "Compressing", target)
  1982. return CompileEgg(target, infile, opts)
  1983. elif origsuffix == ".egg":
  1984. ProgressOutput(progress, "Converting", target)
  1985. return CompileEgg(target, infile, opts)
  1986. elif origsuffix == ".res":
  1987. ProgressOutput(progress, "Building resource object", target)
  1988. return CompileRes(target, infile, opts)
  1989. elif origsuffix == ".rsrc":
  1990. ProgressOutput(progress, "Building resource object", target)
  1991. return CompileRsrc(target, infile, opts)
  1992. elif origsuffix == ".class":
  1993. ProgressOutput(progress, "Building Java class", target)
  1994. return CompileJava(target, infile, opts)
  1995. elif origsuffix == ".obj":
  1996. if (infile.endswith(".cxx")):
  1997. ProgressOutput(progress, "Building C++ object", target)
  1998. return CompileCxx(target, infile, opts)
  1999. elif infile.endswith(".c"):
  2000. ProgressOutput(progress, "Building C object", target)
  2001. return CompileCxx(target, infile, opts)
  2002. elif infile.endswith(".mm"):
  2003. ProgressOutput(progress, "Building Objective-C++ object", target)
  2004. return CompileCxx(target, infile, opts)
  2005. elif infile.endswith(".yxx"):
  2006. ProgressOutput(progress, "Building Bison object", target)
  2007. return CompileBison(target, infile, opts)
  2008. elif infile.endswith(".lxx"):
  2009. ProgressOutput(progress, "Building Flex object", target)
  2010. return CompileFlex(target, infile, opts)
  2011. elif infile.endswith(".in"):
  2012. ProgressOutput(progress, "Building Interrogate object", target)
  2013. return CompileImod(target, inputs, opts)
  2014. elif infile.endswith(".rc"):
  2015. ProgressOutput(progress, "Building resource object", target)
  2016. return CompileRes(target, infile, opts)
  2017. elif infile.endswith(".r"):
  2018. ProgressOutput(progress, "Building resource object", target)
  2019. return CompileRsrc(target, infile, opts)
  2020. elif origsuffix == ".dex":
  2021. ProgressOutput(progress, "Building Dalvik object", target)
  2022. return CompileDalvik(target, inputs, opts)
  2023. exit("Don't know how to compile: %s from %s" % (target, inputs))
  2024. ##########################################################################################
  2025. #
  2026. # Generate dtool_config.h, prc_parameters.h, and dtool_have_xxx.dat
  2027. #
  2028. ##########################################################################################
  2029. DTOOL_CONFIG=[
  2030. #_Variable_________________________Windows___________________Unix__________
  2031. ("HAVE_PYTHON", '1', '1'),
  2032. ("USE_DEBUG_PYTHON", 'UNDEF', 'UNDEF'),
  2033. ("PYTHON_FRAMEWORK", 'UNDEF', 'UNDEF'),
  2034. ("COMPILE_IN_DEFAULT_FONT", '1', '1'),
  2035. ("STDFLOAT_DOUBLE", 'UNDEF', 'UNDEF'),
  2036. ("REPORT_OPENSSL_ERRORS", '1', '1'),
  2037. ("USE_PANDAFILESTREAM", '1', '1'),
  2038. ("USE_DELETED_CHAIN", '1', '1'),
  2039. ("HAVE_MIMALLOC", 'UNDEF', 'UNDEF'),
  2040. ("HAVE_WGL", '1', 'UNDEF'),
  2041. ("HAVE_DX9", 'UNDEF', 'UNDEF'),
  2042. ("HAVE_THREADS", '1', '1'),
  2043. ("SIMPLE_THREADS", 'UNDEF', 'UNDEF'),
  2044. ("OS_SIMPLE_THREADS", '1', '1'),
  2045. ("DEBUG_THREADS", 'UNDEF', 'UNDEF'),
  2046. ("HAVE_POSIX_THREADS", 'UNDEF', '1'),
  2047. ("MUTEX_SPINLOCK", 'UNDEF', 'UNDEF'),
  2048. ("HAVE_AUDIO", '1', '1'),
  2049. ("NOTIFY_DEBUG", 'UNDEF', 'UNDEF'),
  2050. ("DO_PSTATS", 'UNDEF', 'UNDEF'),
  2051. ("DO_DCAST", 'UNDEF', 'UNDEF'),
  2052. ("DO_COLLISION_RECORDING", 'UNDEF', 'UNDEF'),
  2053. ("SUPPORT_IMMEDIATE_MODE", 'UNDEF', 'UNDEF'),
  2054. ("SUPPORT_FIXED_FUNCTION", '1', '1'),
  2055. ("DO_MEMORY_USAGE", 'UNDEF', 'UNDEF'),
  2056. ("DO_PIPELINING", '1', '1'),
  2057. ("DEFAULT_PATHSEP", '";"', '":"'),
  2058. ("WORDS_BIGENDIAN", 'UNDEF', 'UNDEF'),
  2059. ("PHAVE_LOCKF", '1', '1'),
  2060. ("SIMPLE_STRUCT_POINTERS", '1', 'UNDEF'),
  2061. ("HAVE_DINKUM", 'UNDEF', 'UNDEF'),
  2062. ("HAVE_STL_HASH", 'UNDEF', 'UNDEF'),
  2063. ("GETTIMEOFDAY_ONE_PARAM", 'UNDEF', 'UNDEF'),
  2064. ("HAVE_GETOPT", 'UNDEF', '1'),
  2065. ("HAVE_GETOPT_LONG_ONLY", 'UNDEF', '1'),
  2066. ("PHAVE_GETOPT_H", 'UNDEF', '1'),
  2067. ("PHAVE_LINUX_INPUT_H", 'UNDEF', '1'),
  2068. ("IOCTL_TERMINAL_WIDTH", 'UNDEF', '1'),
  2069. ("HAVE_IOS_TYPEDEFS", '1', '1'),
  2070. ("HAVE_IOS_BINARY", '1', '1'),
  2071. ("STATIC_INIT_GETENV", '1', 'UNDEF'),
  2072. ("HAVE_PROC_SELF_EXE", 'UNDEF', '1'),
  2073. ("HAVE_PROC_SELF_MAPS", 'UNDEF', '1'),
  2074. ("HAVE_PROC_SELF_ENVIRON", 'UNDEF', '1'),
  2075. ("HAVE_PROC_SELF_CMDLINE", 'UNDEF', '1'),
  2076. ("HAVE_PROC_CURPROC_FILE", 'UNDEF', 'UNDEF'),
  2077. ("HAVE_PROC_CURPROC_MAP", 'UNDEF', 'UNDEF'),
  2078. ("HAVE_PROC_CURPROC_CMDLINE", 'UNDEF', 'UNDEF'),
  2079. ("HAVE_GLOBAL_ARGV", '1', 'UNDEF'),
  2080. ("PROTOTYPE_GLOBAL_ARGV", 'UNDEF', 'UNDEF'),
  2081. ("GLOBAL_ARGV", '__argv', 'UNDEF'),
  2082. ("GLOBAL_ARGC", '__argc', 'UNDEF'),
  2083. ("PHAVE_IO_H", '1', 'UNDEF'),
  2084. ("PHAVE_IOSTREAM", '1', '1'),
  2085. ("PHAVE_STRING_H", 'UNDEF', '1'),
  2086. ("PHAVE_LIMITS_H", 'UNDEF', '1'),
  2087. ("PHAVE_STDLIB_H", 'UNDEF', '1'),
  2088. ("PHAVE_MALLOC_H", '1', '1'),
  2089. ("PHAVE_SYS_MALLOC_H", 'UNDEF', 'UNDEF'),
  2090. ("PHAVE_ALLOCA_H", 'UNDEF', '1'),
  2091. ("PHAVE_LOCALE_H", 'UNDEF', '1'),
  2092. ("PHAVE_SSTREAM", '1', '1'),
  2093. ("PHAVE_NEW", '1', '1'),
  2094. ("PHAVE_SYS_TYPES_H", '1', '1'),
  2095. ("PHAVE_SYS_TIME_H", 'UNDEF', '1'),
  2096. ("PHAVE_UNISTD_H", 'UNDEF', '1'),
  2097. ("PHAVE_UTIME_H", 'UNDEF', '1'),
  2098. ("PHAVE_GLOB_H", 'UNDEF', '1'),
  2099. ("PHAVE_DIRENT_H", 'UNDEF', '1'),
  2100. ("PHAVE_UCONTEXT_H", 'UNDEF', '1'),
  2101. ("PHAVE_STDINT_H", '1', '1'),
  2102. ("HAVE_RTTI", '1', '1'),
  2103. ("HAVE_X11", 'UNDEF', '1'),
  2104. ("IS_LINUX", 'UNDEF', '1'),
  2105. ("IS_OSX", 'UNDEF', 'UNDEF'),
  2106. ("IS_FREEBSD", 'UNDEF', 'UNDEF'),
  2107. ("HAVE_EIGEN", 'UNDEF', 'UNDEF'),
  2108. ("LINMATH_ALIGN", '1', '1'),
  2109. ("HAVE_ZLIB", 'UNDEF', 'UNDEF'),
  2110. ("HAVE_PNG", 'UNDEF', 'UNDEF'),
  2111. ("HAVE_JPEG", 'UNDEF', 'UNDEF'),
  2112. ("HAVE_VIDEO4LINUX", 'UNDEF', '1'),
  2113. ("HAVE_TIFF", 'UNDEF', 'UNDEF'),
  2114. ("HAVE_OPENEXR", 'UNDEF', 'UNDEF'),
  2115. ("HAVE_SGI_RGB", '1', '1'),
  2116. ("HAVE_TGA", '1', '1'),
  2117. ("HAVE_IMG", '1', '1'),
  2118. ("HAVE_SOFTIMAGE_PIC", '1', '1'),
  2119. ("HAVE_BMP", '1', '1'),
  2120. ("HAVE_PNM", '1', '1'),
  2121. ("HAVE_STB_IMAGE", '1', '1'),
  2122. ("HAVE_VORBIS", 'UNDEF', 'UNDEF'),
  2123. ("HAVE_OPUS", 'UNDEF', 'UNDEF'),
  2124. ("HAVE_FREETYPE", 'UNDEF', 'UNDEF'),
  2125. ("HAVE_FFTW", 'UNDEF', 'UNDEF'),
  2126. ("HAVE_OPENSSL", 'UNDEF', 'UNDEF'),
  2127. ("HAVE_NET", 'UNDEF', 'UNDEF'),
  2128. ("WANT_NATIVE_NET", '1', '1'),
  2129. ("SIMULATE_NETWORK_DELAY", 'UNDEF', 'UNDEF'),
  2130. ("HAVE_CG", 'UNDEF', 'UNDEF'),
  2131. ("HAVE_CGGL", 'UNDEF', 'UNDEF'),
  2132. ("HAVE_CGDX9", 'UNDEF', 'UNDEF'),
  2133. ("HAVE_ARTOOLKIT", 'UNDEF', 'UNDEF'),
  2134. ("HAVE_DIRECTCAM", 'UNDEF', 'UNDEF'),
  2135. ("HAVE_SQUISH", 'UNDEF', 'UNDEF'),
  2136. ("HAVE_COCOA", 'UNDEF', 'UNDEF'),
  2137. ("HAVE_OPENAL_FRAMEWORK", 'UNDEF', 'UNDEF'),
  2138. ("USE_TAU", 'UNDEF', 'UNDEF'),
  2139. ("PRC_SAVE_DESCRIPTIONS", '1', '1'),
  2140. # ("_SECURE_SCL", '0', 'UNDEF'),
  2141. # ("_SECURE_SCL_THROWS", '0', 'UNDEF'),
  2142. ]
  2143. PRC_PARAMETERS=[
  2144. ("DEFAULT_PRC_DIR", '"<auto>etc"', '"<auto>etc"'),
  2145. ("PRC_DIR_ENVVARS", '"PANDA_PRC_DIR"', '"PANDA_PRC_DIR"'),
  2146. ("PRC_PATH_ENVVARS", '"PANDA_PRC_PATH"', '"PANDA_PRC_PATH"'),
  2147. ("PRC_PATH2_ENVVARS", 'UNDEF', 'UNDEF'),
  2148. ("PRC_PATTERNS", '"*.prc"', '"*.prc"'),
  2149. ("PRC_ENCRYPTED_PATTERNS", '"*.prc.pe"', '"*.prc.pe"'),
  2150. ("PRC_ENCRYPTION_KEY", '""', '""'),
  2151. ("PRC_EXECUTABLE_PATTERNS", 'UNDEF', 'UNDEF'),
  2152. ("PRC_EXECUTABLE_ARGS_ENVVAR", '"PANDA_PRC_XARGS"', '"PANDA_PRC_XARGS"'),
  2153. ("PRC_PUBLIC_KEYS_FILENAME", '""', '""'),
  2154. ("PRC_RESPECT_TRUST_LEVEL", 'UNDEF', 'UNDEF'),
  2155. ("PRC_DCONFIG_TRUST_LEVEL", '0', '0'),
  2156. ("PRC_INC_TRUST_LEVEL", '0', '0'),
  2157. ]
  2158. def WriteConfigSettings():
  2159. dtool_config={}
  2160. prc_parameters={}
  2161. speedtree_parameters={}
  2162. if (GetTarget() == 'windows'):
  2163. for key,win,unix in DTOOL_CONFIG:
  2164. dtool_config[key] = win
  2165. for key,win,unix in PRC_PARAMETERS:
  2166. prc_parameters[key] = win
  2167. else:
  2168. for key,win,unix in DTOOL_CONFIG:
  2169. dtool_config[key] = unix
  2170. for key,win,unix in PRC_PARAMETERS:
  2171. prc_parameters[key] = unix
  2172. for x in PkgListGet():
  2173. if ("HAVE_"+x in dtool_config):
  2174. if (PkgSkip(x)==0):
  2175. dtool_config["HAVE_"+x] = '1'
  2176. else:
  2177. dtool_config["HAVE_"+x] = 'UNDEF'
  2178. dtool_config["HAVE_NET"] = '1'
  2179. if GetTarget() == 'windows':
  2180. if not PkgSkip("MIMALLOC"):
  2181. # This is faster than both DeletedBufferChain and malloc,
  2182. # especially in the multi-threaded case.
  2183. dtool_config["USE_MEMORY_MIMALLOC"] = '1'
  2184. dtool_config["USE_DELETED_CHAIN"] = 'UNDEF'
  2185. else:
  2186. # If we don't have mimalloc, use DeletedBufferChain as fallback,
  2187. # which is still more efficient than malloc.
  2188. dtool_config["USE_DELETED_CHAIN"] = '1'
  2189. else:
  2190. # On other systems, the default malloc seems to be fine.
  2191. dtool_config["USE_DELETED_CHAIN"] = 'UNDEF'
  2192. if (PkgSkip("NVIDIACG")==0):
  2193. dtool_config["HAVE_CG"] = '1'
  2194. dtool_config["HAVE_CGGL"] = '1'
  2195. dtool_config["HAVE_CGDX9"] = '1'
  2196. if GetTarget() not in ("linux", "android"):
  2197. dtool_config["HAVE_PROC_SELF_EXE"] = 'UNDEF'
  2198. dtool_config["HAVE_PROC_SELF_MAPS"] = 'UNDEF'
  2199. dtool_config["HAVE_PROC_SELF_CMDLINE"] = 'UNDEF'
  2200. dtool_config["HAVE_PROC_SELF_ENVIRON"] = 'UNDEF'
  2201. if (GetTarget() == "darwin"):
  2202. dtool_config["PYTHON_FRAMEWORK"] = 'Python'
  2203. dtool_config["PHAVE_MALLOC_H"] = 'UNDEF'
  2204. dtool_config["PHAVE_SYS_MALLOC_H"] = '1'
  2205. if not os.path.isdir(GetThirdpartyDir() + "openal"):
  2206. dtool_config["HAVE_OPENAL_FRAMEWORK"] = '1'
  2207. dtool_config["HAVE_X11"] = 'UNDEF' # We might have X11, but we don't need it.
  2208. dtool_config["IS_LINUX"] = 'UNDEF'
  2209. dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
  2210. dtool_config["PHAVE_LINUX_INPUT_H"] = 'UNDEF'
  2211. dtool_config["IS_OSX"] = '1'
  2212. if (GetTarget() == "freebsd"):
  2213. dtool_config["IS_LINUX"] = 'UNDEF'
  2214. dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
  2215. dtool_config["IS_FREEBSD"] = '1'
  2216. dtool_config["PHAVE_ALLOCA_H"] = 'UNDEF'
  2217. dtool_config["PHAVE_MALLOC_H"] = 'UNDEF'
  2218. dtool_config["HAVE_PROC_CURPROC_FILE"] = '1'
  2219. dtool_config["HAVE_PROC_CURPROC_MAP"] = '1'
  2220. dtool_config["HAVE_PROC_CURPROC_CMDLINE"] = '1'
  2221. if (GetTarget() == "android"):
  2222. # Android does have RTTI, but we disable it anyway.
  2223. dtool_config["HAVE_RTTI"] = 'UNDEF'
  2224. dtool_config["PHAVE_GLOB_H"] = 'UNDEF'
  2225. dtool_config["PHAVE_LOCKF"] = 'UNDEF'
  2226. dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
  2227. if (GetTarget() == "emscripten"):
  2228. # There are no threads in JavaScript, so don't bother using them.
  2229. dtool_config["HAVE_THREADS"] = 'UNDEF'
  2230. dtool_config["DO_PIPELINING"] = 'UNDEF'
  2231. dtool_config["HAVE_POSIX_THREADS"] = 'UNDEF'
  2232. dtool_config["IS_LINUX"] = 'UNDEF'
  2233. dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
  2234. dtool_config["HAVE_NET"] = 'UNDEF'
  2235. dtool_config["PHAVE_LINUX_INPUT_H"] = 'UNDEF'
  2236. dtool_config["HAVE_X11"] = 'UNDEF'
  2237. dtool_config["HAVE_GLX"] = 'UNDEF'
  2238. # There are no environment vars either, or default prc files.
  2239. prc_parameters["DEFAULT_PRC_DIR"] = 'UNDEF'
  2240. prc_parameters["PRC_DIR_ENVVARS"] = 'UNDEF'
  2241. prc_parameters["PRC_PATH_ENVVARS"] = 'UNDEF'
  2242. prc_parameters["PRC_PATH2_ENVVARS"] = 'UNDEF'
  2243. prc_parameters["PRC_PATTERNS"] = 'UNDEF'
  2244. prc_parameters["PRC_ENCRYPTED_PATTERNS"] = 'UNDEF'
  2245. if (GetOptimize() <= 2 and GetTarget() == "windows"):
  2246. dtool_config["USE_DEBUG_PYTHON"] = '1'
  2247. if (GetOptimize() <= 3):
  2248. if (dtool_config["HAVE_NET"] != 'UNDEF'):
  2249. dtool_config["DO_PSTATS"] = '1'
  2250. if (GetOptimize() <= 3):
  2251. dtool_config["DO_DCAST"] = '1'
  2252. if (GetOptimize() <= 3):
  2253. dtool_config["DO_COLLISION_RECORDING"] = '1'
  2254. if (GetOptimize() <= 3) and GetTarget() != 'emscripten':
  2255. dtool_config["DO_MEMORY_USAGE"] = '1'
  2256. if (GetOptimize() <= 3):
  2257. dtool_config["NOTIFY_DEBUG"] = '1'
  2258. if (GetOptimize() >= 4):
  2259. dtool_config["PRC_SAVE_DESCRIPTIONS"] = 'UNDEF'
  2260. if (GetOptimize() >= 4):
  2261. # Disable RTTI on release builds.
  2262. dtool_config["HAVE_RTTI"] = 'UNDEF'
  2263. # Now that we have OS_SIMPLE_THREADS, we can support
  2264. # SIMPLE_THREADS on exotic architectures like win64, so we no
  2265. # longer need to disable it for this platform.
  2266. ## if GetTarget() == 'windows' and GetTargetArch() == 'x64':
  2267. ## dtool_config["SIMPLE_THREADS"] = 'UNDEF'
  2268. if not PkgSkip("SPEEDTREE"):
  2269. speedtree_parameters["SPEEDTREE_OPENGL"] = "UNDEF"
  2270. speedtree_parameters["SPEEDTREE_DIRECTX9"] = "UNDEF"
  2271. if SDK["SPEEDTREEAPI"] == "OpenGL":
  2272. speedtree_parameters["SPEEDTREE_OPENGL"] = "1"
  2273. elif SDK["SPEEDTREEAPI"] == "DirectX9":
  2274. speedtree_parameters["SPEEDTREE_DIRECTX9"] = "1"
  2275. speedtree_parameters["SPEEDTREE_BIN_DIR"] = (SDK["SPEEDTREE"] + "/Bin")
  2276. conf = "/* prc_parameters.h. Generated automatically by makepanda.py */\n"
  2277. for key in sorted(prc_parameters.keys()):
  2278. if ((key == "DEFAULT_PRC_DIR") or (key[:4]=="PRC_")):
  2279. val = OverrideValue(key, prc_parameters[key])
  2280. if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
  2281. else: conf = conf + "#define " + key + " " + val + "\n"
  2282. ConditionalWriteFile(GetOutputDir() + '/include/prc_parameters.h', conf)
  2283. conf = "/* dtool_config.h. Generated automatically by makepanda.py */\n"
  2284. for key in sorted(dtool_config.keys()):
  2285. val = OverrideValue(key, dtool_config[key])
  2286. if key in ('HAVE_CG', 'HAVE_CGGL', 'HAVE_CGDX9') and val != 'UNDEF':
  2287. # These are not available for ARM, period.
  2288. conf = conf + "#ifdef __aarch64__\n"
  2289. conf = conf + "#undef " + key + "\n"
  2290. conf = conf + "#else\n"
  2291. conf = conf + "#define " + key + " " + val + "\n"
  2292. conf = conf + "#endif\n"
  2293. elif val == 'UNDEF':
  2294. conf = conf + "#undef " + key + "\n"
  2295. else:
  2296. conf = conf + "#define " + key + " " + val + "\n"
  2297. ConditionalWriteFile(GetOutputDir() + '/include/dtool_config.h', conf)
  2298. if not PkgSkip("SPEEDTREE"):
  2299. conf = "/* speedtree_parameters.h. Generated automatically by makepanda.py */\n"
  2300. for key in sorted(speedtree_parameters.keys()):
  2301. val = OverrideValue(key, speedtree_parameters[key])
  2302. if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
  2303. else: conf = conf + "#define " + key + " \"" + val.replace("\\", "\\\\") + "\"\n"
  2304. ConditionalWriteFile(GetOutputDir() + '/include/speedtree_parameters.h', conf)
  2305. for x in PkgListGet():
  2306. if (PkgSkip(x)): ConditionalWriteFile(GetOutputDir() + '/tmp/dtool_have_'+x.lower()+'.dat', "0\n")
  2307. else: ConditionalWriteFile(GetOutputDir() + '/tmp/dtool_have_'+x.lower()+'.dat', "1\n")
  2308. # Finally, write a platform.dat with the platform we are compiling for.
  2309. ConditionalWriteFile(GetOutputDir() + '/tmp/platform.dat', PLATFORM)
  2310. # This is useful for tools like makepackage that need to know things about
  2311. # the build parameters.
  2312. ConditionalWriteFile(GetOutputDir() + '/tmp/optimize.dat', str(GetOptimize()))
  2313. WriteConfigSettings()
  2314. WarnConflictingFiles()
  2315. if SystemLibraryExists("dtoolbase"):
  2316. Warn("Found conflicting Panda3D libraries from other ppremake build!")
  2317. if SystemLibraryExists("p3dtoolconfig"):
  2318. Warn("Found conflicting Panda3D libraries from other makepanda build!")
  2319. ##########################################################################################
  2320. #
  2321. # Generate pandaVersion.h, pythonversion, null.cxx, etc.
  2322. #
  2323. ##########################################################################################
  2324. PANDAVERSION_H="""
  2325. #define PANDA_MAJOR_VERSION $VERSION1
  2326. #define PANDA_MINOR_VERSION $VERSION2
  2327. #define PANDA_SEQUENCE_VERSION $VERSION3
  2328. #define PANDA_VERSION $NVERSION
  2329. #define PANDA_NUMERIC_VERSION $NVERSION
  2330. #define PANDA_VERSION_STR "$VERSION"
  2331. #define PANDA_ABI_VERSION_STR "$VERSION1.$VERSION2"
  2332. #define PANDA_DISTRIBUTOR "$DISTRIBUTOR"
  2333. """
  2334. CHECKPANDAVERSION_CXX="""
  2335. # include "dtoolbase.h"
  2336. EXPCL_DTOOL_DTOOLBASE int panda_version_$VERSION1_$VERSION2 = 0;
  2337. """
  2338. CHECKPANDAVERSION_H="""
  2339. # ifndef CHECKPANDAVERSION_H
  2340. # define CHECKPANDAVERSION_H
  2341. # include "dtoolbase.h"
  2342. extern EXPCL_DTOOL_DTOOLBASE int panda_version_$VERSION1_$VERSION2;
  2343. // Hack to forcibly depend on the check
  2344. template<typename T>
  2345. class CheckPandaVersion {
  2346. public:
  2347. int check_version() { return panda_version_$VERSION1_$VERSION2; }
  2348. };
  2349. template class CheckPandaVersion<void>;
  2350. # endif
  2351. """
  2352. def CreatePandaVersionFiles():
  2353. parts = VERSION.split(".", 2)
  2354. version1 = int(parts[0])
  2355. version2 = int(parts[1])
  2356. version3 = 0
  2357. if len(parts) > 2:
  2358. for c in parts[2]:
  2359. if c.isdigit():
  2360. version3 = version3 * 10 + ord(c) - 48
  2361. else:
  2362. break
  2363. nversion = version1 * 1000000 + version2 * 1000 + version3
  2364. if DISTRIBUTOR != "cmu":
  2365. # Subtract 1 if we are not an official version.
  2366. nversion -= 1
  2367. pandaversion_h = PANDAVERSION_H
  2368. pandaversion_h = pandaversion_h.replace("$VERSION1",str(version1))
  2369. pandaversion_h = pandaversion_h.replace("$VERSION2",str(version2))
  2370. pandaversion_h = pandaversion_h.replace("$VERSION3",str(version3))
  2371. pandaversion_h = pandaversion_h.replace("$VERSION",VERSION)
  2372. pandaversion_h = pandaversion_h.replace("$NVERSION",str(nversion))
  2373. pandaversion_h = pandaversion_h.replace("$DISTRIBUTOR",DISTRIBUTOR)
  2374. if (DISTRIBUTOR == "cmu"):
  2375. pandaversion_h += "\n#define PANDA_OFFICIAL_VERSION\n"
  2376. else:
  2377. pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
  2378. if GIT_COMMIT:
  2379. pandaversion_h += "\n#define PANDA_GIT_COMMIT_STR \"%s\"\n" % (GIT_COMMIT)
  2380. # Allow creating a deterministic build by setting this.
  2381. source_date = os.environ.get("SOURCE_DATE_EPOCH")
  2382. if source_date:
  2383. # This matches the GCC / Clang format for __DATE__ __TIME__
  2384. source_date = time.gmtime(int(source_date))
  2385. try:
  2386. source_date = time.strftime('%b %e %Y %H:%M:%S', source_date)
  2387. except ValueError:
  2388. source_date = time.strftime('%b %d %Y %H:%M:%S', source_date)
  2389. if source_date[3:5] == ' 0':
  2390. source_date = source_date[:3] + ' ' + source_date[5:]
  2391. pandaversion_h += "\n#define PANDA_BUILD_DATE_STR \"%s\"\n" % (source_date)
  2392. checkpandaversion_cxx = CHECKPANDAVERSION_CXX.replace("$VERSION1",str(version1))
  2393. checkpandaversion_cxx = checkpandaversion_cxx.replace("$VERSION2",str(version2))
  2394. checkpandaversion_cxx = checkpandaversion_cxx.replace("$VERSION3",str(version3))
  2395. checkpandaversion_cxx = checkpandaversion_cxx.replace("$NVERSION",str(nversion))
  2396. checkpandaversion_h = CHECKPANDAVERSION_H.replace("$VERSION1",str(version1))
  2397. checkpandaversion_h = checkpandaversion_h.replace("$VERSION2",str(version2))
  2398. checkpandaversion_h = checkpandaversion_h.replace("$VERSION3",str(version3))
  2399. checkpandaversion_h = checkpandaversion_h.replace("$NVERSION",str(nversion))
  2400. ConditionalWriteFile(GetOutputDir()+'/include/pandaVersion.h', pandaversion_h)
  2401. ConditionalWriteFile(GetOutputDir()+'/include/checkPandaVersion.cxx', checkpandaversion_cxx)
  2402. ConditionalWriteFile(GetOutputDir()+'/include/checkPandaVersion.h', checkpandaversion_h)
  2403. ConditionalWriteFile(GetOutputDir()+"/tmp/null.cxx","")
  2404. CreatePandaVersionFiles()
  2405. ##########################################################################################
  2406. #
  2407. # Copy the "direct" tree
  2408. #
  2409. ##########################################################################################
  2410. if not PkgSkip("DIRECT"):
  2411. CopyPythonTree(GetOutputDir() + '/direct', 'direct/src', threads=THREADCOUNT)
  2412. ConditionalWriteFile(GetOutputDir() + '/direct/__init__.py', "")
  2413. # This file used to be copied, but would nowadays cause conflicts.
  2414. # Let's get it out of the way in case someone hasn't cleaned their build since.
  2415. if os.path.isfile(GetOutputDir() + '/bin/panda3d.py'):
  2416. os.remove(GetOutputDir() + '/bin/panda3d.py')
  2417. if os.path.isfile(GetOutputDir() + '/lib/panda3d.py'):
  2418. os.remove(GetOutputDir() + '/lib/panda3d.py')
  2419. # This directory doesn't exist at all any more.
  2420. if os.path.isdir(os.path.join(GetOutputDir(), 'direct', 'ffi')):
  2421. shutil.rmtree(os.path.join(GetOutputDir(), 'direct', 'ffi'))
  2422. # These files used to exist; remove them to avoid conflicts.
  2423. del_files = ['core.py', 'core.pyc', 'core.pyo',
  2424. '_core.pyd', '_core.so',
  2425. 'direct.py', 'direct.pyc', 'direct.pyo',
  2426. '_direct.pyd', '_direct.so',
  2427. 'dtoolconfig.pyd', 'dtoolconfig.so',
  2428. 'net.pyd', 'net.so']
  2429. for basename in del_files:
  2430. path = os.path.join(GetOutputDir(), 'panda3d', basename)
  2431. if os.path.isfile(path):
  2432. print("Removing %s" % (path))
  2433. os.remove(path)
  2434. # Write an appropriate panda3d/__init__.py
  2435. p3d_init = """"Python bindings for the Panda3D libraries"
  2436. __version__ = '%s'
  2437. if __debug__:
  2438. if 1 / 2 == 0:
  2439. raise ImportError("Python 2 is not supported.")
  2440. """ % (WHLVERSION)
  2441. if GetTarget() == 'windows':
  2442. p3d_init += """
  2443. if '__file__' in locals():
  2444. import os
  2445. bindir = os.path.join(os.path.dirname(__file__), '..', 'bin')
  2446. if os.path.isdir(bindir):
  2447. if hasattr(os, 'add_dll_directory'):
  2448. os.add_dll_directory(bindir)
  2449. elif not os.environ.get('PATH'):
  2450. os.environ['PATH'] = bindir
  2451. else:
  2452. os.environ['PATH'] = bindir + os.pathsep + os.environ['PATH']
  2453. del os, bindir
  2454. """
  2455. if not PkgSkip("PYTHON"):
  2456. ConditionalWriteFile(GetOutputDir() + '/panda3d/__init__.py', p3d_init)
  2457. # Also add this file, for backward compatibility.
  2458. ConditionalWriteFile(GetOutputDir() + '/panda3d/dtoolconfig.py', """\
  2459. '''Alias of :mod:`panda3d.interrogatedb`.
  2460. .. deprecated:: 1.10.0
  2461. This module has been renamed to :mod:`panda3d.interrogatedb`.
  2462. '''
  2463. if __debug__:
  2464. print("Warning: panda3d.dtoolconfig is deprecated, use panda3d.interrogatedb instead.")
  2465. from .interrogatedb import *
  2466. """)
  2467. # Add this for forward compatibility.
  2468. ConditionalWriteFile(GetOutputDir() + '/panda3d/net.py', """\
  2469. __all__ = 'BufferedDatagramConnection', 'Buffered_DatagramConnection', 'Connection', 'ConnectionListener', 'ConnectionManager', 'ConnectionReader', 'ConnectionWriter', 'DatagramGeneratorNet', 'DatagramSinkNet', 'Dtool_BorrowThisReference', 'Dtool_PyNativeInterface', 'NetAddress', 'NetDatagram', 'PointerToBaseConnection', 'PointerToBase_Connection', 'PointerToConnection', 'PointerTo_Connection', 'QueuedConnectionListener', 'QueuedConnectionManager', 'QueuedConnectionReader', 'QueuedReturnConnectionListenerData', 'QueuedReturnDatagram', 'QueuedReturnNetDatagram', 'QueuedReturnPointerToConnection', 'QueuedReturn_ConnectionListenerData', 'QueuedReturn_Datagram', 'QueuedReturn_NetDatagram', 'QueuedReturn_PointerTo_Connection', 'RecentConnectionReader', 'SocketAddress', 'SocketFdset', 'SocketIP', 'SocketTCP', 'SocketTCPListen', 'SocketUDP', 'SocketUDPIncoming', 'SocketUDPOutgoing', 'Socket_Address', 'Socket_IP', 'Socket_TCP', 'Socket_TCP_Listen', 'Socket_UDP', 'Socket_UDP_Incoming', 'Socket_UDP_Outgoing', 'Socket_fdset'
  2470. from . import core
  2471. scope = globals()
  2472. for name in __all__:
  2473. if hasattr(core, name):
  2474. scope[name] = getattr(core, name)
  2475. del core, scope, name
  2476. """)
  2477. # PandaModules is now deprecated; generate a shim for backward compatibility.
  2478. for fn in glob.glob(GetOutputDir() + '/pandac/*.py') + glob.glob(GetOutputDir() + '/pandac/*.py[co]'):
  2479. if os.path.basename(fn) not in ('PandaModules.py', '__init__.py'):
  2480. os.remove(fn)
  2481. panda_modules = ['core']
  2482. if not PkgSkip("PANDAPHYSICS"):
  2483. panda_modules.append('physics')
  2484. if not PkgSkip('PANDAFX'):
  2485. panda_modules.append('fx')
  2486. if not PkgSkip("DIRECT"):
  2487. panda_modules.append('direct')
  2488. if not PkgSkip("VISION"):
  2489. panda_modules.append('vision')
  2490. if not PkgSkip("SKEL"):
  2491. panda_modules.append('skel')
  2492. if not PkgSkip("EGG"):
  2493. panda_modules.append('egg')
  2494. if not PkgSkip("ODE"):
  2495. panda_modules.append('ode')
  2496. if not PkgSkip("VRPN"):
  2497. panda_modules.append('vrpn')
  2498. panda_modules_code = """
  2499. "This module is deprecated. Import from panda3d.core and other panda3d.* modules instead."
  2500. if __debug__:
  2501. print("Warning: pandac.PandaModules is deprecated, import from panda3d.core instead")
  2502. """
  2503. for module in panda_modules:
  2504. panda_modules_code += """
  2505. try:
  2506. from panda3d.%s import *
  2507. except ImportError as err:
  2508. if "No module named %s" not in str(err):
  2509. raise""" % (module, module)
  2510. panda_modules_code += """
  2511. from direct.showbase import DConfig
  2512. def get_config_showbase():
  2513. return DConfig
  2514. def get_config_express():
  2515. return DConfig
  2516. getConfigShowbase = get_config_showbase
  2517. getConfigExpress = get_config_express
  2518. """
  2519. exthelpers_code = """
  2520. "This module is deprecated. Import from direct.extensions_native.extension_native_helpers instead."
  2521. from direct.extensions_native.extension_native_helpers import *
  2522. """
  2523. if not PkgSkip("PYTHON"):
  2524. ConditionalWriteFile(GetOutputDir() + '/pandac/PandaModules.py', panda_modules_code)
  2525. ConditionalWriteFile(GetOutputDir() + '/pandac/extension_native_helpers.py', exthelpers_code)
  2526. ConditionalWriteFile(GetOutputDir() + '/pandac/__init__.py', '')
  2527. ##########################################################################################
  2528. #
  2529. # Write the dist-info directory.
  2530. #
  2531. ##########################################################################################
  2532. # This is just some basic stuff since setuptools just needs this file to
  2533. # exist, otherwise it will not read the entry_points.txt file. Maybe we will
  2534. # eventually want to merge this with the metadata generator in makewheel.py.
  2535. METADATA = """Metadata-Version: 2.1
  2536. Name: Panda3D
  2537. Version: {version}
  2538. License: BSD
  2539. Home-page: https://www.panda3d.org/
  2540. Author: Panda3D Team
  2541. Author-email: [email protected]
  2542. """
  2543. ENTRY_POINTS = """[distutils.commands]
  2544. build_apps = direct.dist.commands:build_apps
  2545. bdist_apps = direct.dist.commands:bdist_apps
  2546. [setuptools.finalize_distribution_options]
  2547. build_apps = direct.dist._dist_hooks:finalize_distribution_options
  2548. """
  2549. if not PkgSkip("DIRECT"):
  2550. dist_dir = os.path.join(GetOutputDir(), 'panda3d.dist-info')
  2551. MakeDirectory(dist_dir)
  2552. ConditionalWriteFile(os.path.join(dist_dir, 'METADATA'), METADATA.format(version=VERSION))
  2553. ConditionalWriteFile(os.path.join(dist_dir, 'entry_points.txt'), ENTRY_POINTS)
  2554. ##########################################################################################
  2555. #
  2556. # Generate the PRC files into the ETC directory.
  2557. #
  2558. ##########################################################################################
  2559. confautoprc = ReadFile("makepanda/confauto.in")
  2560. if not PkgSkip("SPEEDTREE"):
  2561. # If SpeedTree is available, enable it in the config file
  2562. confautoprc = confautoprc.replace('#st#', '')
  2563. else:
  2564. # otherwise, disable it.
  2565. confautoprc = confautoprc.replace('#st#', '#')
  2566. confautoprc = confautoprc.replace('\r\n', '\n')
  2567. if PkgSkip("ASSIMP") or GetLinkAllStatic():
  2568. confautoprc = confautoprc.replace("load-file-type p3assimp", "#load-file-type p3assimp")
  2569. if PkgSkip("EGG") or GetLinkAllStatic():
  2570. confautoprc = confautoprc.replace("load-file-type egg pandaegg", "#load-file-type egg pandaegg")
  2571. if PkgSkip("PANDATOOL") or PkgSkip("EGG") or GetLinkAllStatic():
  2572. confautoprc = confautoprc.replace("load-file-type p3ptloader", "#load-file-type p3ptloader")
  2573. if PkgSkip("FFMPEG") or GetLinkAllStatic():
  2574. confautoprc = confautoprc.replace("load-audio-type * p3ffmpeg", "#load-audio-type * p3ffmpeg")
  2575. confautoprc = confautoprc.replace("load-video-type * p3ffmpeg", "#load-video-type * p3ffmpeg")
  2576. if (os.path.isfile("makepanda/myconfig.in")):
  2577. configprc = ReadFile("makepanda/myconfig.in")
  2578. else:
  2579. configprc = ReadFile("makepanda/config.in")
  2580. configprc = configprc.replace('\r\n', '\n')
  2581. if (GetTarget() == 'windows'):
  2582. configprc = configprc.replace("$XDG_CACHE_HOME/panda3d", "$USER_APPDATA/Panda3D-%s" % MAJOR_VERSION)
  2583. elif not PkgSkip("X11") and not PkgSkip("GL") and not PkgSkip("EGL") and not GetLinkAllStatic():
  2584. configprc = configprc.replace("#load-display pandadx9", "aux-display p3headlessgl")
  2585. else:
  2586. configprc = configprc.replace("aux-display pandadx9", "")
  2587. if (GetTarget() == 'darwin'):
  2588. configprc = configprc.replace("$XDG_CACHE_HOME/panda3d", "$HOME/Library/Caches/Panda3D-%s" % MAJOR_VERSION)
  2589. if PkgSkip("GL") or GetLinkAllStatic():
  2590. configprc = configprc.replace("\nload-display pandagl", "\n#load-display pandagl")
  2591. if PkgSkip("GLES") or GetLinkAllStatic():
  2592. configprc = configprc.replace("\n#load-display pandagles\n", "\n")
  2593. if PkgSkip("GL") and not PkgSkip("GLES2") and not GetLinkAllStatic():
  2594. configprc = configprc.replace("\n#load-display pandagles2", "\nload-display pandagles2")
  2595. elif PkgSkip("GLES2") or GetLinkAllStatic():
  2596. configprc = configprc.replace("\n#load-display pandagles2", "")
  2597. if PkgSkip("DX9") or GetLinkAllStatic():
  2598. configprc = configprc.replace("\n#load-display pandadx9", "")
  2599. if PkgSkip("TINYDISPLAY") or GetLinkAllStatic():
  2600. configprc = configprc.replace("\n#load-display p3tinydisplay", "")
  2601. if PkgSkip("OPENAL") or GetLinkAllStatic():
  2602. configprc = configprc.replace("audio-library-name p3openal_audio", "#audio-library-name p3openal_audio")
  2603. if GetTarget() == 'windows':
  2604. # Convert to Windows newlines.
  2605. ConditionalWriteFile(GetOutputDir()+"/etc/Config.prc", configprc, newline='\r\n')
  2606. ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc, newline='\r\n')
  2607. else:
  2608. ConditionalWriteFile(GetOutputDir()+"/etc/Config.prc", configprc)
  2609. ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc)
  2610. ##########################################################################################
  2611. #
  2612. # Copy the precompiled binaries and DLLs into the build.
  2613. #
  2614. ##########################################################################################
  2615. tp_dir = GetThirdpartyDir()
  2616. if tp_dir is not None:
  2617. dylibs = {}
  2618. if GetTarget() == 'darwin':
  2619. # Make a list of all the dylibs we ship, to figure out whether we should use
  2620. # install_name_tool to correct the library reference to point to our copy.
  2621. for pkg in PkgListGet():
  2622. if PkgSkip(pkg):
  2623. continue
  2624. tp_libdir = os.path.join(tp_dir, pkg.lower(), "lib")
  2625. for lib in glob.glob(os.path.join(tp_libdir, "*.dylib")):
  2626. dylibs[os.path.basename(lib)] = os.path.basename(os.path.realpath(lib))
  2627. if not PkgSkip("PYTHON"):
  2628. for lib in glob.glob(os.path.join(tp_libdir, SDK["PYTHONVERSION"], "*.dylib")):
  2629. dylibs[os.path.basename(lib)] = os.path.basename(os.path.realpath(lib))
  2630. for pkg in PkgListGet():
  2631. if PkgSkip(pkg):
  2632. continue
  2633. tp_pkg = tp_dir + pkg.lower()
  2634. if GetTarget() == 'windows':
  2635. if os.path.exists(tp_pkg + "/bin"):
  2636. CopyAllFiles(GetOutputDir() + "/bin/", tp_pkg + "/bin/")
  2637. if (PkgSkip("PYTHON")==0 and os.path.exists(tp_pkg + "/bin/" + SDK["PYTHONVERSION"])):
  2638. CopyAllFiles(GetOutputDir() + "/bin/", tp_pkg + "/bin/" + SDK["PYTHONVERSION"] + "/")
  2639. elif GetTarget() == 'darwin':
  2640. tp_libdir = os.path.join(tp_pkg, "lib")
  2641. tp_libs = glob.glob(os.path.join(tp_libdir, "*.dylib"))
  2642. if not PkgSkip("PYTHON"):
  2643. tp_libs += glob.glob(os.path.join(tp_libdir, SDK["PYTHONVERSION"], "*.dylib"))
  2644. tp_libs += glob.glob(os.path.join(tp_libdir, SDK["PYTHONVERSION"], "*.so"))
  2645. if pkg != 'PYTHON':
  2646. tp_libs += glob.glob(os.path.join(tp_libdir, SDK["PYTHONVERSION"], "*.py"))
  2647. for tp_lib in tp_libs:
  2648. basename = os.path.basename(tp_lib)
  2649. if basename.endswith('.dylib'):
  2650. # It's a dynamic link library. Put it in the lib directory.
  2651. target = GetOutputDir() + "/lib/" + basename
  2652. dep_prefix = "@loader_path/../lib/"
  2653. lib_id = dep_prefix + basename
  2654. else:
  2655. # It's a Python module, like _rocketcore.so. Copy it to the root, because
  2656. # nowadays the 'lib' directory may no longer be on the PYTHONPATH.
  2657. target = GetOutputDir() + "/" + basename
  2658. dep_prefix = "@loader_path/lib/"
  2659. lib_id = basename
  2660. if not NeedsBuild([target], [tp_lib]):
  2661. continue
  2662. CopyFile(target, tp_lib)
  2663. if os.path.islink(target) or target.endswith('.py'):
  2664. continue
  2665. # Correct the inter-library dependencies so that the build is relocatable.
  2666. oscmd('install_name_tool -id %s %s' % (lib_id, target))
  2667. oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (target, GetOutputDir()), True)
  2668. for line in open(GetOutputDir() + "/tmp/otool-libs.txt", "r"):
  2669. line = line.strip()
  2670. if not line or line.startswith(dep_prefix) or line.endswith(":"):
  2671. continue
  2672. libdep = line.split(" ", 1)[0]
  2673. dep_basename = os.path.basename(libdep)
  2674. if dep_basename in dylibs:
  2675. dep_target = dylibs[dep_basename]
  2676. oscmd("install_name_tool -change %s %s%s %s" % (libdep, dep_prefix, dep_target, target), True)
  2677. JustBuilt([target], [tp_lib])
  2678. for fwx in glob.glob(tp_pkg + "/*.framework"):
  2679. MakeDirectory(GetOutputDir() + "/Frameworks")
  2680. CopyTree(GetOutputDir() + "/Frameworks/" + os.path.basename(fwx), fwx)
  2681. else: # Linux / FreeBSD case.
  2682. for tp_lib in glob.glob(tp_pkg + "/lib/*.so*"):
  2683. CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib)
  2684. if not PkgSkip("PYTHON"):
  2685. for tp_lib in glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.so*")):
  2686. base = os.path.basename(tp_lib)
  2687. if base.startswith('lib'):
  2688. CopyFile(GetOutputDir() + "/lib/" + base, tp_lib)
  2689. else:
  2690. # It's a Python module, like _rocketcore.so.
  2691. CopyFile(GetOutputDir() + "/" + base, tp_lib)
  2692. if GetTarget() == 'windows':
  2693. if os.path.isdir(os.path.join(tp_dir, "extras", "bin")):
  2694. CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/")
  2695. if not PkgSkip("PYTHON"):
  2696. # We need to copy the Python DLL to the bin directory for now.
  2697. pydll = "/" + SDK["PYTHONVERSION"].replace(".", "")
  2698. if GetOptimize() <= 2:
  2699. pydll += "_d.dll"
  2700. else:
  2701. pydll += ".dll"
  2702. CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll)
  2703. for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"):
  2704. CopyFile(GetOutputDir() + "/bin/", fn)
  2705. # Copy the whole Python directory.
  2706. if COPY_PYTHON:
  2707. CopyTree(GetOutputDir() + "/python", SDK["PYTHON"])
  2708. # NB: Python does not always ship with the correct manifest/dll.
  2709. # Figure out the correct one to ship, and grab it from WinSxS dir.
  2710. manifest = GetOutputDir() + '/tmp/python.manifest'
  2711. if os.path.isfile(manifest):
  2712. os.unlink(manifest)
  2713. oscmd('mt -inputresource:"%s\\python.exe";#1 -out:"%s" -nologo' % (SDK["PYTHON"], manifest), True)
  2714. if COPY_PYTHON and os.path.isfile(manifest):
  2715. import xml.etree.ElementTree as ET
  2716. tree = ET.parse(manifest)
  2717. idents = tree.findall('./{urn:schemas-microsoft-com:asm.v1}dependency/{urn:schemas-microsoft-com:asm.v1}dependentAssembly/{urn:schemas-microsoft-com:asm.v1}assemblyIdentity')
  2718. else:
  2719. idents = ()
  2720. for ident in idents:
  2721. sxs_name = '_'.join([
  2722. ident.get('processorArchitecture'),
  2723. ident.get('name').lower(),
  2724. ident.get('publicKeyToken'),
  2725. ident.get('version'),
  2726. ])
  2727. # Find the manifest matching these parameters.
  2728. pattern = os.path.join('C:' + os.sep, 'Windows', 'WinSxS', 'Manifests', sxs_name + '_*.manifest')
  2729. manifests = glob.glob(pattern)
  2730. if not manifests:
  2731. Warn("Could not locate manifest %s. You may need to reinstall the Visual C++ Redistributable." % (pattern))
  2732. continue
  2733. CopyFile(GetOutputDir() + "/python/" + ident.get('name') + ".manifest", manifests[0])
  2734. # Also copy the corresponding msvcr dll.
  2735. pattern = os.path.join('C:' + os.sep, 'Windows', 'WinSxS', sxs_name + '_*', 'msvcr*.dll')
  2736. for file in glob.glob(pattern):
  2737. CopyFile(GetOutputDir() + "/python/", file)
  2738. # Copy python.exe to ppython.exe.
  2739. if COPY_PYTHON:
  2740. if not os.path.isfile(SDK["PYTHON"] + "/ppython.exe") and os.path.isfile(SDK["PYTHON"] + "/python.exe"):
  2741. CopyFile(GetOutputDir() + "/python/ppython.exe", SDK["PYTHON"] + "/python.exe")
  2742. if not os.path.isfile(SDK["PYTHON"] + "/ppythonw.exe") and os.path.isfile(SDK["PYTHON"] + "/pythonw.exe"):
  2743. CopyFile(GetOutputDir() + "/python/ppythonw.exe", SDK["PYTHON"] + "/pythonw.exe")
  2744. ConditionalWriteFile(GetOutputDir() + "/python/panda.pth", "..\n../bin\n")
  2745. # Copy over the MSVC runtime.
  2746. if GetTarget() == 'windows' and "VISUALSTUDIO" in SDK:
  2747. vcver = "%s%s" % (SDK["MSVC_VERSION"][0], 0) # ignore minor version.
  2748. crtname = "Microsoft.VC%s.CRT" % (vcver)
  2749. if ("VCTOOLSVERSION" in SDK):
  2750. dir = os.path.join(SDK["VISUALSTUDIO"], "VC", "Redist", "MSVC", SDK["VCTOOLSVERSION"], "onecore", GetTargetArch(), crtname)
  2751. else:
  2752. dir = os.path.join(SDK["VISUALSTUDIO"], "VC", "redist", GetTargetArch(), crtname)
  2753. if os.path.isfile(os.path.join(dir, "msvcr" + vcver + ".dll")):
  2754. CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "msvcr" + vcver + ".dll"))
  2755. if os.path.isfile(os.path.join(dir, "msvcp" + vcver + ".dll")):
  2756. CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "msvcp" + vcver + ".dll"))
  2757. if os.path.isfile(os.path.join(dir, "vcruntime" + vcver + ".dll")):
  2758. CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "vcruntime" + vcver + ".dll"))
  2759. ########################################################################
  2760. ##
  2761. ## Copy various stuff into the build.
  2762. ##
  2763. ########################################################################
  2764. if GetTarget() == 'windows':
  2765. # Convert to Windows newlines so they can be opened by notepad.
  2766. WriteFile(GetOutputDir() + "/LICENSE", ReadFile("doc/LICENSE"), newline='\r\n')
  2767. WriteFile(GetOutputDir() + "/ReleaseNotes", ReadFile("doc/ReleaseNotes"), newline='\r\n')
  2768. CopyFile(GetOutputDir() + "/pandaIcon.ico", "panda/src/configfiles/pandaIcon.ico")
  2769. else:
  2770. CopyFile(GetOutputDir()+"/", "doc/LICENSE")
  2771. CopyFile(GetOutputDir()+"/", "doc/ReleaseNotes")
  2772. if not PkgSkip("PYTHON") and os.path.isdir(GetThirdpartyBase() + "/Pmw"):
  2773. CopyTree(GetOutputDir() + "/Pmw", GetThirdpartyBase() + "/Pmw", exclude=["Pmw_1_3", "Pmw_1_3_3"])
  2774. # Since Eigen is included by all sorts of core headers, as a convenience
  2775. # to C++ users on Win and Mac, we include it in the Panda include directory.
  2776. if not PkgSkip("EIGEN") and GetTarget() in ("windows", "darwin") and GetThirdpartyDir():
  2777. CopyTree(GetOutputDir()+'/include/Eigen', GetThirdpartyDir()+'eigen/include/Eigen')
  2778. ########################################################################
  2779. #
  2780. # Copy header files to the built/include/parser-inc directory.
  2781. #
  2782. ########################################################################
  2783. CopyTree(GetOutputDir()+'/include/parser-inc','dtool/src/parser-inc')
  2784. DeleteVCS(GetOutputDir()+'/include/parser-inc')
  2785. ########################################################################
  2786. #
  2787. # Transfer all header files to the built/include directory.
  2788. #
  2789. ########################################################################
  2790. CopyAllHeaders('dtool/src/dtoolbase')
  2791. CopyAllHeaders('dtool/src/dtoolutil', skip=["pandaVersion.h", "checkPandaVersion.h"])
  2792. CopyFile(GetOutputDir()+'/include/','dtool/src/dtoolutil/vector_src.cxx')
  2793. CopyAllHeaders('dtool/metalibs/dtool')
  2794. CopyAllHeaders('dtool/src/prc', skip=["prc_parameters.h"])
  2795. CopyAllHeaders('dtool/src/dconfig')
  2796. CopyAllHeaders('dtool/src/interrogatedb')
  2797. CopyAllHeaders('dtool/metalibs/dtoolconfig')
  2798. CopyAllHeaders('panda/src/putil')
  2799. CopyAllHeaders('panda/src/pandabase')
  2800. CopyAllHeaders('panda/src/express')
  2801. CopyAllHeaders('panda/src/downloader')
  2802. CopyAllHeaders('panda/metalibs/pandaexpress')
  2803. CopyAllHeaders('panda/src/pipeline')
  2804. CopyAllHeaders('panda/src/linmath')
  2805. CopyAllHeaders('panda/src/putil')
  2806. CopyAllHeaders('dtool/src/prckeys')
  2807. CopyAllHeaders('panda/src/audio')
  2808. CopyAllHeaders('panda/src/event')
  2809. CopyAllHeaders('panda/src/mathutil')
  2810. CopyAllHeaders('panda/src/gsgbase')
  2811. CopyAllHeaders('panda/src/pnmimage')
  2812. CopyAllHeaders('panda/src/nativenet')
  2813. CopyAllHeaders('panda/src/net')
  2814. CopyAllHeaders('panda/src/pstatclient')
  2815. CopyAllHeaders('panda/src/gobj')
  2816. CopyAllHeaders('panda/src/movies')
  2817. CopyAllHeaders('panda/src/pgraphnodes')
  2818. CopyAllHeaders('panda/src/pgraph')
  2819. CopyAllHeaders('panda/src/cull')
  2820. CopyAllHeaders('panda/src/display')
  2821. CopyAllHeaders('panda/src/chan')
  2822. CopyAllHeaders('panda/src/char')
  2823. CopyAllHeaders('panda/src/dgraph')
  2824. CopyAllHeaders('panda/src/device')
  2825. CopyAllHeaders('panda/src/pnmtext')
  2826. CopyAllHeaders('panda/src/text')
  2827. CopyAllHeaders('panda/src/grutil')
  2828. if not PkgSkip("VISION"):
  2829. CopyAllHeaders('panda/src/vision')
  2830. if not PkgSkip("FFMPEG"):
  2831. CopyAllHeaders('panda/src/ffmpeg')
  2832. CopyAllHeaders('panda/src/tform')
  2833. CopyAllHeaders('panda/src/collide')
  2834. CopyAllHeaders('panda/src/parametrics')
  2835. CopyAllHeaders('panda/src/pgui')
  2836. CopyAllHeaders('panda/src/pnmimagetypes')
  2837. CopyAllHeaders('panda/src/recorder')
  2838. if not PkgSkip("VRPN"):
  2839. CopyAllHeaders('panda/src/vrpn')
  2840. CopyAllHeaders('panda/src/wgldisplay')
  2841. CopyAllHeaders('panda/src/ode')
  2842. CopyAllHeaders('panda/metalibs/pandaode')
  2843. if not PkgSkip("PANDAPHYSICS"):
  2844. CopyAllHeaders('panda/src/physics')
  2845. if not PkgSkip("PANDAPARTICLESYSTEM"):
  2846. CopyAllHeaders('panda/src/particlesystem')
  2847. CopyAllHeaders('panda/metalibs/panda')
  2848. CopyAllHeaders('panda/src/audiotraits')
  2849. CopyAllHeaders('panda/src/audiotraits')
  2850. CopyAllHeaders('panda/src/distort')
  2851. CopyAllHeaders('panda/src/downloadertools')
  2852. CopyAllHeaders('panda/src/windisplay')
  2853. CopyAllHeaders('panda/src/dxgsg9')
  2854. CopyAllHeaders('panda/metalibs/pandadx9')
  2855. if not PkgSkip("EGG"):
  2856. CopyAllHeaders('panda/src/egg')
  2857. CopyAllHeaders('panda/src/egg2pg')
  2858. CopyAllHeaders('panda/src/framework')
  2859. CopyAllHeaders('panda/metalibs/pandafx')
  2860. CopyAllHeaders('panda/src/glstuff')
  2861. CopyAllHeaders('panda/src/glgsg')
  2862. CopyAllHeaders('panda/src/glesgsg')
  2863. CopyAllHeaders('panda/src/gles2gsg')
  2864. if not PkgSkip("EGG"):
  2865. CopyAllHeaders('panda/metalibs/pandaegg')
  2866. if GetTarget() == 'windows':
  2867. CopyAllHeaders('panda/src/wgldisplay')
  2868. elif GetTarget() == 'darwin':
  2869. CopyAllHeaders('panda/src/cocoadisplay')
  2870. if not PkgSkip('GL'):
  2871. CopyAllHeaders('panda/src/cocoagldisplay')
  2872. elif GetTarget() == 'android':
  2873. CopyAllHeaders('panda/src/android')
  2874. CopyAllHeaders('panda/src/androiddisplay')
  2875. if not PkgSkip('X11'):
  2876. CopyAllHeaders('panda/src/x11display')
  2877. if not PkgSkip('GL'):
  2878. CopyAllHeaders('panda/src/glxdisplay')
  2879. CopyAllHeaders('panda/src/egldisplay')
  2880. CopyAllHeaders('panda/metalibs/pandagl')
  2881. CopyAllHeaders('panda/metalibs/pandagles')
  2882. CopyAllHeaders('panda/metalibs/pandagles2')
  2883. CopyAllHeaders('panda/metalibs/pandaphysics')
  2884. CopyAllHeaders('panda/src/testbed')
  2885. if not PkgSkip("BULLET"):
  2886. CopyAllHeaders('panda/src/bullet')
  2887. CopyAllHeaders('panda/metalibs/pandabullet')
  2888. if not PkgSkip("SPEEDTREE"):
  2889. CopyAllHeaders('contrib/src/speedtree')
  2890. if not PkgSkip("DIRECT"):
  2891. CopyAllHeaders('direct/src/directbase')
  2892. CopyAllHeaders('direct/src/dcparser')
  2893. CopyAllHeaders('direct/src/deadrec')
  2894. CopyAllHeaders('direct/src/distributed')
  2895. CopyAllHeaders('direct/src/interval')
  2896. CopyAllHeaders('direct/src/showbase')
  2897. CopyAllHeaders('direct/src/motiontrail')
  2898. CopyAllHeaders('direct/src/dcparse')
  2899. if not PkgSkip("PANDATOOL"):
  2900. CopyAllHeaders('pandatool/src/pandatoolbase')
  2901. CopyAllHeaders('pandatool/src/converter')
  2902. CopyAllHeaders('pandatool/src/progbase')
  2903. CopyAllHeaders('pandatool/src/eggbase')
  2904. CopyAllHeaders('pandatool/src/bam')
  2905. CopyAllHeaders('pandatool/src/daeegg')
  2906. CopyAllHeaders('pandatool/src/daeprogs')
  2907. CopyAllHeaders('pandatool/src/dxf')
  2908. CopyAllHeaders('pandatool/src/dxfegg')
  2909. CopyAllHeaders('pandatool/src/dxfprogs')
  2910. CopyAllHeaders('pandatool/src/palettizer')
  2911. CopyAllHeaders('pandatool/src/egg-mkfont')
  2912. CopyAllHeaders('pandatool/src/eggcharbase')
  2913. CopyAllHeaders('pandatool/src/egg-optchar')
  2914. CopyAllHeaders('pandatool/src/egg-palettize')
  2915. CopyAllHeaders('pandatool/src/egg-qtess')
  2916. CopyAllHeaders('pandatool/src/eggprogs')
  2917. CopyAllHeaders('pandatool/src/flt')
  2918. CopyAllHeaders('pandatool/src/fltegg')
  2919. CopyAllHeaders('pandatool/src/fltprogs')
  2920. CopyAllHeaders('pandatool/src/imagebase')
  2921. CopyAllHeaders('pandatool/src/imageprogs')
  2922. CopyAllHeaders('pandatool/src/pfmprogs')
  2923. CopyAllHeaders('pandatool/src/lwo')
  2924. CopyAllHeaders('pandatool/src/lwoegg')
  2925. CopyAllHeaders('pandatool/src/lwoprogs')
  2926. CopyAllHeaders('pandatool/src/objegg')
  2927. CopyAllHeaders('pandatool/src/objprogs')
  2928. CopyAllHeaders('pandatool/src/vrml')
  2929. CopyAllHeaders('pandatool/src/vrmlegg')
  2930. CopyAllHeaders('pandatool/src/xfile')
  2931. CopyAllHeaders('pandatool/src/xfileegg')
  2932. CopyAllHeaders('pandatool/src/ptloader')
  2933. CopyAllHeaders('pandatool/src/miscprogs')
  2934. CopyAllHeaders('pandatool/src/pstatserver')
  2935. CopyAllHeaders('pandatool/src/text-stats')
  2936. CopyAllHeaders('pandatool/src/vrmlprogs')
  2937. CopyAllHeaders('pandatool/src/win-stats')
  2938. CopyAllHeaders('pandatool/src/xfileprogs')
  2939. if not PkgSkip("CONTRIB"):
  2940. CopyAllHeaders('contrib/src/contribbase')
  2941. CopyAllHeaders('contrib/src/ai')
  2942. ########################################################################
  2943. #
  2944. # These definitions are syntactic shorthand. They make it easy
  2945. # to link with the usual libraries without listing them all.
  2946. #
  2947. ########################################################################
  2948. COMMON_DTOOL_LIBS=[
  2949. 'libp3dtool.dll',
  2950. 'libp3dtoolconfig.dll',
  2951. ]
  2952. COMMON_PANDA_LIBS=[
  2953. 'libpanda.dll',
  2954. 'libpandaexpress.dll'
  2955. ] + COMMON_DTOOL_LIBS
  2956. COMMON_EGG2X_LIBS=[
  2957. 'libp3eggbase.lib',
  2958. 'libp3progbase.lib',
  2959. 'libp3converter.lib',
  2960. 'libp3pandatoolbase.lib',
  2961. 'libpandaegg.dll',
  2962. ] + COMMON_PANDA_LIBS
  2963. ########################################################################
  2964. #
  2965. # This section contains a list of all the files that need to be compiled.
  2966. #
  2967. ########################################################################
  2968. print("Generating dependencies...")
  2969. sys.stdout.flush()
  2970. #
  2971. # Compile Panda icon resource file.
  2972. # We do it first because we need it at
  2973. # the time we compile an executable.
  2974. #
  2975. if GetTarget() == 'windows':
  2976. OPTS=['DIR:panda/src/configfiles']
  2977. TargetAdd('pandaIcon.res', opts=OPTS, input='pandaIcon.rc')
  2978. #
  2979. # DIRECTORY: dtool/src/dtoolbase/
  2980. #
  2981. OPTS=['DIR:dtool/src/dtoolbase', 'BUILDING:DTOOL', 'MIMALLOC']
  2982. TargetAdd('p3dtoolbase_composite1.obj', opts=OPTS, input='p3dtoolbase_composite1.cxx')
  2983. TargetAdd('p3dtoolbase_composite2.obj', opts=OPTS, input='p3dtoolbase_composite2.cxx')
  2984. TargetAdd('p3dtoolbase_lookup3.obj', opts=OPTS, input='lookup3.c')
  2985. TargetAdd('p3dtoolbase_indent.obj', opts=OPTS, input='indent.cxx')
  2986. #
  2987. # DIRECTORY: dtool/src/dtoolutil/
  2988. #
  2989. OPTS=['DIR:dtool/src/dtoolutil', 'BUILDING:DTOOL']
  2990. TargetAdd('p3dtoolutil_composite1.obj', opts=OPTS, input='p3dtoolutil_composite1.cxx')
  2991. TargetAdd('p3dtoolutil_composite2.obj', opts=OPTS, input='p3dtoolutil_composite2.cxx')
  2992. if GetTarget() == 'darwin':
  2993. TargetAdd('p3dtoolutil_filename_assist.obj', opts=OPTS, input='filename_assist.mm')
  2994. #
  2995. # DIRECTORY: dtool/metalibs/dtool/
  2996. #
  2997. OPTS=['DIR:dtool/metalibs/dtool', 'BUILDING:DTOOL']
  2998. TargetAdd('p3dtool_dtool.obj', opts=OPTS, input='dtool.cxx')
  2999. TargetAdd('libp3dtool.dll', input='p3dtool_dtool.obj')
  3000. TargetAdd('libp3dtool.dll', input='p3dtoolutil_composite1.obj')
  3001. TargetAdd('libp3dtool.dll', input='p3dtoolutil_composite2.obj')
  3002. if GetTarget() == 'darwin':
  3003. TargetAdd('libp3dtool.dll', input='p3dtoolutil_filename_assist.obj')
  3004. TargetAdd('libp3dtool.dll', input='p3dtoolbase_composite1.obj')
  3005. TargetAdd('libp3dtool.dll', input='p3dtoolbase_composite2.obj')
  3006. TargetAdd('libp3dtool.dll', input='p3dtoolbase_indent.obj')
  3007. TargetAdd('libp3dtool.dll', input='p3dtoolbase_lookup3.obj')
  3008. TargetAdd('libp3dtool.dll', opts=['ADVAPI','WINSHELL','WINKERNEL','MIMALLOC'])
  3009. #
  3010. # DIRECTORY: dtool/src/prc/
  3011. #
  3012. OPTS=['DIR:dtool/src/prc', 'BUILDING:DTOOLCONFIG', 'OPENSSL']
  3013. TargetAdd('p3prc_composite1.obj', opts=OPTS, input='p3prc_composite1.cxx')
  3014. TargetAdd('p3prc_composite2.obj', opts=OPTS, input='p3prc_composite2.cxx')
  3015. #
  3016. # DIRECTORY: dtool/metalibs/dtoolconfig/
  3017. #
  3018. OPTS=['DIR:dtool/metalibs/dtoolconfig', 'BUILDING:DTOOLCONFIG']
  3019. TargetAdd('p3dtoolconfig_dtoolconfig.obj', opts=OPTS, input='dtoolconfig.cxx')
  3020. TargetAdd('libp3dtoolconfig.dll', input='p3dtoolconfig_dtoolconfig.obj')
  3021. TargetAdd('libp3dtoolconfig.dll', input='p3prc_composite1.obj')
  3022. TargetAdd('libp3dtoolconfig.dll', input='p3prc_composite2.obj')
  3023. TargetAdd('libp3dtoolconfig.dll', input='libp3dtool.dll')
  3024. TargetAdd('libp3dtoolconfig.dll', opts=['ADVAPI', 'OPENSSL', 'WINGDI', 'WINUSER'])
  3025. #
  3026. # DIRECTORY: dtool/src/interrogatedb/
  3027. #
  3028. OPTS=['DIR:dtool/src/interrogatedb', 'BUILDING:INTERROGATEDB']
  3029. TargetAdd('p3interrogatedb_composite1.obj', opts=OPTS, input='p3interrogatedb_composite1.cxx')
  3030. TargetAdd('p3interrogatedb_composite2.obj', opts=OPTS, input='p3interrogatedb_composite2.cxx')
  3031. TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite1.obj')
  3032. TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite2.obj')
  3033. TargetAdd('libp3interrogatedb.dll', input='libp3dtool.dll')
  3034. TargetAdd('libp3interrogatedb.dll', input='libp3dtoolconfig.dll')
  3035. # This used to be called dtoolconfig.pyd, but it just contains the interrogatedb
  3036. # stuff, so it has been renamed appropriately.
  3037. OPTS=['DIR:dtool/metalibs/dtoolconfig']
  3038. PyTargetAdd('interrogatedb_pydtool.obj', opts=OPTS, input="pydtool.cxx")
  3039. PyTargetAdd('interrogatedb.pyd', input='interrogatedb_pydtool.obj')
  3040. PyTargetAdd('interrogatedb.pyd', input='libp3dtool.dll')
  3041. PyTargetAdd('interrogatedb.pyd', input='libp3dtoolconfig.dll')
  3042. PyTargetAdd('interrogatedb.pyd', input='libp3interrogatedb.dll')
  3043. #
  3044. # DIRECTORY: dtool/src/prckeys/
  3045. #
  3046. if not PkgSkip("OPENSSL"):
  3047. OPTS=['DIR:dtool/src/prckeys', 'OPENSSL']
  3048. TargetAdd('make-prc-key_makePrcKey.obj', opts=OPTS, input='makePrcKey.cxx')
  3049. TargetAdd('make-prc-key.exe', input='make-prc-key_makePrcKey.obj')
  3050. TargetAdd('make-prc-key.exe', input=COMMON_DTOOL_LIBS)
  3051. TargetAdd('make-prc-key.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER'])
  3052. #
  3053. # DIRECTORY: dtool/src/dtoolbase/
  3054. #
  3055. OPTS=['DIR:dtool/src/dtoolbase']
  3056. IGATEFILES=GetDirectoryContents('dtool/src/dtoolbase', ["*_composite*.cxx"])
  3057. IGATEFILES += [
  3058. "typeHandle.h",
  3059. "typeHandle_ext.h",
  3060. "typeRegistry.h",
  3061. "typedObject.h",
  3062. "neverFreeMemory.h",
  3063. ]
  3064. TargetAdd('libp3dtoolbase.in', opts=OPTS, input=IGATEFILES)
  3065. TargetAdd('libp3dtoolbase.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dtoolbase', 'SRCDIR:dtool/src/dtoolbase'])
  3066. PyTargetAdd('p3dtoolbase_typeHandle_ext.obj', opts=OPTS, input='typeHandle_ext.cxx')
  3067. #
  3068. # DIRECTORY: dtool/src/dtoolutil/
  3069. #
  3070. OPTS=['DIR:dtool/src/dtoolutil']
  3071. IGATEFILES=GetDirectoryContents('dtool/src/dtoolutil', ["*_composite*.cxx"])
  3072. IGATEFILES += [
  3073. "config_dtoolutil.h",
  3074. "pandaSystem.h",
  3075. "dSearchPath.h",
  3076. "executionEnvironment.h",
  3077. "textEncoder.h",
  3078. "textEncoder_ext.h",
  3079. "filename.h",
  3080. "filename_ext.h",
  3081. "globPattern.h",
  3082. "globPattern_ext.h",
  3083. "pandaFileStream.h",
  3084. "lineStream.h",
  3085. "iostream_ext.h",
  3086. ]
  3087. TargetAdd('libp3dtoolutil.in', opts=OPTS, input=IGATEFILES)
  3088. TargetAdd('libp3dtoolutil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dtoolutil', 'SRCDIR:dtool/src/dtoolutil'])
  3089. PyTargetAdd('p3dtoolutil_ext_composite.obj', opts=OPTS, input='p3dtoolutil_ext_composite.cxx')
  3090. #
  3091. # DIRECTORY: dtool/src/prc/
  3092. #
  3093. OPTS=['DIR:dtool/src/prc']
  3094. IGATEFILES=GetDirectoryContents('dtool/src/prc', ["*.h", "*_composite*.cxx"])
  3095. TargetAdd('libp3prc.in', opts=OPTS, input=IGATEFILES)
  3096. TargetAdd('libp3prc.in', opts=['IMOD:panda3d.core', 'ILIB:libp3prc', 'SRCDIR:dtool/src/prc'])
  3097. PyTargetAdd('p3prc_ext_composite.obj', opts=OPTS, input='p3prc_ext_composite.cxx')
  3098. #
  3099. # DIRECTORY: panda/src/pandabase/
  3100. #
  3101. OPTS=['DIR:panda/src/pandabase', 'BUILDING:PANDAEXPRESS']
  3102. TargetAdd('p3pandabase_pandabase.obj', opts=OPTS, input='pandabase.cxx')
  3103. #
  3104. # DIRECTORY: panda/src/express/
  3105. #
  3106. OPTS=['DIR:panda/src/express', 'BUILDING:PANDAEXPRESS', 'OPENSSL', 'ZLIB']
  3107. TargetAdd('p3express_composite1.obj', opts=OPTS, input='p3express_composite1.cxx')
  3108. TargetAdd('p3express_composite2.obj', opts=OPTS, input='p3express_composite2.cxx')
  3109. OPTS=['DIR:panda/src/express', 'OPENSSL', 'ZLIB']
  3110. IGATEFILES=GetDirectoryContents('panda/src/express', ["*.h", "*_composite*.cxx"])
  3111. TargetAdd('libp3express.in', opts=OPTS, input=IGATEFILES)
  3112. TargetAdd('libp3express.in', opts=['IMOD:panda3d.core', 'ILIB:libp3express', 'SRCDIR:panda/src/express'])
  3113. PyTargetAdd('p3express_ext_composite.obj', opts=OPTS, input='p3express_ext_composite.cxx')
  3114. #
  3115. # DIRECTORY: panda/src/downloader/
  3116. #
  3117. OPTS=['DIR:panda/src/downloader', 'BUILDING:PANDAEXPRESS', 'OPENSSL', 'ZLIB']
  3118. TargetAdd('p3downloader_composite1.obj', opts=OPTS, input='p3downloader_composite1.cxx')
  3119. TargetAdd('p3downloader_composite2.obj', opts=OPTS, input='p3downloader_composite2.cxx')
  3120. OPTS=['DIR:panda/src/downloader', 'OPENSSL', 'ZLIB']
  3121. IGATEFILES=GetDirectoryContents('panda/src/downloader', ["*.h", "*_composite*.cxx"])
  3122. TargetAdd('libp3downloader.in', opts=OPTS, input=IGATEFILES)
  3123. TargetAdd('libp3downloader.in', opts=['IMOD:panda3d.core', 'ILIB:libp3downloader', 'SRCDIR:panda/src/downloader'])
  3124. #
  3125. # DIRECTORY: panda/metalibs/pandaexpress/
  3126. #
  3127. OPTS=['DIR:panda/metalibs/pandaexpress', 'BUILDING:PANDAEXPRESS', 'ZLIB']
  3128. TargetAdd('pandaexpress_pandaexpress.obj', opts=OPTS, input='pandaexpress.cxx')
  3129. TargetAdd('libpandaexpress.dll', input='pandaexpress_pandaexpress.obj')
  3130. TargetAdd('libpandaexpress.dll', input='p3downloader_composite1.obj')
  3131. TargetAdd('libpandaexpress.dll', input='p3downloader_composite2.obj')
  3132. TargetAdd('libpandaexpress.dll', input='p3express_composite1.obj')
  3133. TargetAdd('libpandaexpress.dll', input='p3express_composite2.obj')
  3134. TargetAdd('libpandaexpress.dll', input='p3pandabase_pandabase.obj')
  3135. TargetAdd('libpandaexpress.dll', input=COMMON_DTOOL_LIBS)
  3136. TargetAdd('libpandaexpress.dll', opts=['ADVAPI', 'WINSOCK2', 'OPENSSL', 'ZLIB', 'WINGDI', 'WINUSER', 'ANDROID'])
  3137. #
  3138. # DIRECTORY: panda/src/pipeline/
  3139. #
  3140. OPTS=['DIR:panda/src/pipeline', 'BUILDING:PANDA']
  3141. TargetAdd('p3pipeline_composite1.obj', opts=OPTS, input='p3pipeline_composite1.cxx')
  3142. TargetAdd('p3pipeline_composite2.obj', opts=OPTS, input='p3pipeline_composite2.cxx')
  3143. TargetAdd('p3pipeline_contextSwitch.obj', opts=OPTS, input='contextSwitch.c')
  3144. OPTS=['DIR:panda/src/pipeline']
  3145. IGATEFILES=GetDirectoryContents('panda/src/pipeline', ["*.h", "*_composite*.cxx"])
  3146. TargetAdd('libp3pipeline.in', opts=OPTS, input=IGATEFILES)
  3147. TargetAdd('libp3pipeline.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pipeline', 'SRCDIR:panda/src/pipeline'])
  3148. PyTargetAdd('p3pipeline_pythonThread.obj', opts=OPTS, input='pythonThread.cxx')
  3149. #
  3150. # DIRECTORY: panda/src/linmath/
  3151. #
  3152. OPTS=['DIR:panda/src/linmath', 'BUILDING:PANDA']
  3153. TargetAdd('p3linmath_composite1.obj', opts=OPTS, input='p3linmath_composite1.cxx')
  3154. TargetAdd('p3linmath_composite2.obj', opts=OPTS, input='p3linmath_composite2.cxx')
  3155. OPTS=['DIR:panda/src/linmath']
  3156. IGATEFILES=GetDirectoryContents('panda/src/linmath', ["*.h", "*_composite*.cxx"])
  3157. for ifile in IGATEFILES[:]:
  3158. if "_src." in ifile:
  3159. IGATEFILES.remove(ifile)
  3160. IGATEFILES.remove('cast_to_double.h')
  3161. IGATEFILES.remove('lmat_ops.h')
  3162. IGATEFILES.remove('cast_to_float.h')
  3163. TargetAdd('libp3linmath.in', opts=OPTS, input=IGATEFILES)
  3164. TargetAdd('libp3linmath.in', opts=['IMOD:panda3d.core', 'ILIB:libp3linmath', 'SRCDIR:panda/src/linmath'])
  3165. #
  3166. # DIRECTORY: panda/src/putil/
  3167. #
  3168. OPTS=['DIR:panda/src/putil', 'BUILDING:PANDA', 'ZLIB']
  3169. TargetAdd('p3putil_composite1.obj', opts=OPTS, input='p3putil_composite1.cxx')
  3170. TargetAdd('p3putil_composite2.obj', opts=OPTS, input='p3putil_composite2.cxx')
  3171. OPTS=['DIR:panda/src/putil', 'ZLIB']
  3172. IGATEFILES=GetDirectoryContents('panda/src/putil', ["*.h", "*_composite*.cxx"])
  3173. IGATEFILES.remove("test_bam.h")
  3174. TargetAdd('libp3putil.in', opts=OPTS, input=IGATEFILES)
  3175. TargetAdd('libp3putil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3putil', 'SRCDIR:panda/src/putil'])
  3176. PyTargetAdd('p3putil_ext_composite.obj', opts=OPTS, input='p3putil_ext_composite.cxx')
  3177. #
  3178. # DIRECTORY: panda/src/audio/
  3179. #
  3180. OPTS=['DIR:panda/src/audio', 'BUILDING:PANDA']
  3181. TargetAdd('p3audio_composite1.obj', opts=OPTS, input='p3audio_composite1.cxx')
  3182. OPTS=['DIR:panda/src/audio']
  3183. IGATEFILES=["audio.h"]
  3184. TargetAdd('libp3audio.in', opts=OPTS, input=IGATEFILES)
  3185. TargetAdd('libp3audio.in', opts=['IMOD:panda3d.core', 'ILIB:libp3audio', 'SRCDIR:panda/src/audio'])
  3186. #
  3187. # DIRECTORY: panda/src/event/
  3188. #
  3189. OPTS=['DIR:panda/src/event', 'BUILDING:PANDA']
  3190. TargetAdd('p3event_composite1.obj', opts=OPTS, input='p3event_composite1.cxx')
  3191. TargetAdd('p3event_composite2.obj', opts=OPTS, input='p3event_composite2.cxx')
  3192. OPTS=['DIR:panda/src/event']
  3193. PyTargetAdd('p3event_asyncFuture_ext.obj', opts=OPTS, input='asyncFuture_ext.cxx')
  3194. PyTargetAdd('p3event_pythonTask.obj', opts=OPTS, input='pythonTask.cxx')
  3195. IGATEFILES=GetDirectoryContents('panda/src/event', ["*.h", "*_composite*.cxx"])
  3196. TargetAdd('libp3event.in', opts=OPTS, input=IGATEFILES)
  3197. TargetAdd('libp3event.in', opts=['IMOD:panda3d.core', 'ILIB:libp3event', 'SRCDIR:panda/src/event'])
  3198. #
  3199. # DIRECTORY: panda/src/mathutil/
  3200. #
  3201. OPTS=['DIR:panda/src/mathutil', 'BUILDING:PANDA', 'FFTW']
  3202. TargetAdd('p3mathutil_composite1.obj', opts=OPTS, input='p3mathutil_composite1.cxx')
  3203. TargetAdd('p3mathutil_composite2.obj', opts=OPTS, input='p3mathutil_composite2.cxx')
  3204. OPTS=['DIR:panda/src/mathutil', 'FFTW']
  3205. IGATEFILES=GetDirectoryContents('panda/src/mathutil', ["*.h", "*_composite*.cxx"])
  3206. for ifile in IGATEFILES[:]:
  3207. if "_src." in ifile:
  3208. IGATEFILES.remove(ifile)
  3209. TargetAdd('libp3mathutil.in', opts=OPTS, input=IGATEFILES)
  3210. TargetAdd('libp3mathutil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3mathutil', 'SRCDIR:panda/src/mathutil'])
  3211. #
  3212. # DIRECTORY: panda/src/gsgbase/
  3213. #
  3214. OPTS=['DIR:panda/src/gsgbase', 'BUILDING:PANDA']
  3215. TargetAdd('p3gsgbase_composite1.obj', opts=OPTS, input='p3gsgbase_composite1.cxx')
  3216. OPTS=['DIR:panda/src/gsgbase']
  3217. IGATEFILES=GetDirectoryContents('panda/src/gsgbase', ["*.h", "*_composite*.cxx"])
  3218. TargetAdd('libp3gsgbase.in', opts=OPTS, input=IGATEFILES)
  3219. TargetAdd('libp3gsgbase.in', opts=['IMOD:panda3d.core', 'ILIB:libp3gsgbase', 'SRCDIR:panda/src/gsgbase'])
  3220. #
  3221. # DIRECTORY: panda/src/pnmimage/
  3222. #
  3223. OPTS=['DIR:panda/src/pnmimage', 'BUILDING:PANDA', 'ZLIB']
  3224. TargetAdd('p3pnmimage_composite1.obj', opts=OPTS, input='p3pnmimage_composite1.cxx')
  3225. TargetAdd('p3pnmimage_composite2.obj', opts=OPTS, input='p3pnmimage_composite2.cxx')
  3226. if GetTarget() != "emscripten":
  3227. TargetAdd('p3pnmimage_convert_srgb_sse2.obj', opts=OPTS+['SSE2'], input='convert_srgb_sse2.cxx')
  3228. OPTS=['DIR:panda/src/pnmimage', 'ZLIB']
  3229. IGATEFILES=GetDirectoryContents('panda/src/pnmimage', ["*.h", "*_composite*.cxx"])
  3230. TargetAdd('libp3pnmimage.in', opts=OPTS, input=IGATEFILES)
  3231. TargetAdd('libp3pnmimage.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pnmimage', 'SRCDIR:panda/src/pnmimage'])
  3232. PyTargetAdd('p3pnmimage_pfmFile_ext.obj', opts=OPTS, input='pfmFile_ext.cxx')
  3233. #
  3234. # DIRECTORY: panda/src/nativenet/
  3235. #
  3236. if GetTarget() != 'emscripten':
  3237. OPTS=['DIR:panda/src/nativenet', 'BUILDING:PANDA']
  3238. TargetAdd('p3nativenet_composite1.obj', opts=OPTS, input='p3nativenet_composite1.cxx')
  3239. OPTS=['DIR:panda/src/nativenet']
  3240. IGATEFILES=GetDirectoryContents('panda/src/nativenet', ["*.h", "*_composite*.cxx"])
  3241. TargetAdd('libp3nativenet.in', opts=OPTS, input=IGATEFILES)
  3242. TargetAdd('libp3nativenet.in', opts=['IMOD:panda3d.net', 'ILIB:libp3nativenet', 'SRCDIR:panda/src/nativenet'])
  3243. #
  3244. # DIRECTORY: panda/src/net/
  3245. #
  3246. if GetTarget() != 'emscripten':
  3247. OPTS=['DIR:panda/src/net', 'BUILDING:PANDA']
  3248. TargetAdd('p3net_composite1.obj', opts=OPTS, input='p3net_composite1.cxx')
  3249. TargetAdd('p3net_composite2.obj', opts=OPTS, input='p3net_composite2.cxx')
  3250. OPTS=['DIR:panda/src/net']
  3251. IGATEFILES=GetDirectoryContents('panda/src/net', ["*.h", "*_composite*.cxx"])
  3252. IGATEFILES.remove("datagram_ui.h")
  3253. TargetAdd('libp3net.in', opts=OPTS, input=IGATEFILES)
  3254. TargetAdd('libp3net.in', opts=['IMOD:panda3d.net', 'ILIB:libp3net', 'SRCDIR:panda/src/net'])
  3255. #
  3256. # DIRECTORY: panda/src/pstatclient/
  3257. #
  3258. OPTS=['DIR:panda/src/pstatclient', 'BUILDING:PANDA']
  3259. TargetAdd('p3pstatclient_composite1.obj', opts=OPTS, input='p3pstatclient_composite1.cxx')
  3260. TargetAdd('p3pstatclient_composite2.obj', opts=OPTS, input='p3pstatclient_composite2.cxx')
  3261. OPTS=['DIR:panda/src/pstatclient']
  3262. IGATEFILES=GetDirectoryContents('panda/src/pstatclient', ["*.h", "*_composite*.cxx"])
  3263. TargetAdd('libp3pstatclient.in', opts=OPTS, input=IGATEFILES)
  3264. TargetAdd('libp3pstatclient.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pstatclient', 'SRCDIR:panda/src/pstatclient'])
  3265. PyTargetAdd('p3pstatclient_pStatClient_ext.obj', opts=OPTS, input='pStatClient_ext.cxx')
  3266. #
  3267. # DIRECTORY: panda/src/gobj/
  3268. #
  3269. OPTS=['DIR:panda/src/gobj', 'BUILDING:PANDA', 'NVIDIACG', 'ZLIB', 'SQUISH']
  3270. TargetAdd('p3gobj_composite1.obj', opts=OPTS, input='p3gobj_composite1.cxx')
  3271. TargetAdd('p3gobj_composite2.obj', opts=OPTS+['BIGOBJ'], input='p3gobj_composite2.cxx')
  3272. OPTS=['DIR:panda/src/gobj', 'NVIDIACG', 'ZLIB', 'SQUISH']
  3273. IGATEFILES=GetDirectoryContents('panda/src/gobj', ["*.h", "*_composite*.cxx"])
  3274. TargetAdd('libp3gobj.in', opts=OPTS, input=IGATEFILES)
  3275. TargetAdd('libp3gobj.in', opts=['IMOD:panda3d.core', 'ILIB:libp3gobj', 'SRCDIR:panda/src/gobj'])
  3276. PyTargetAdd('p3gobj_ext_composite.obj', opts=OPTS, input='p3gobj_ext_composite.cxx')
  3277. #
  3278. # DIRECTORY: panda/src/pgraphnodes/
  3279. #
  3280. OPTS=['DIR:panda/src/pgraphnodes', 'BUILDING:PANDA']
  3281. TargetAdd('p3pgraphnodes_composite1.obj', opts=OPTS, input='p3pgraphnodes_composite1.cxx')
  3282. TargetAdd('p3pgraphnodes_composite2.obj', opts=OPTS, input='p3pgraphnodes_composite2.cxx')
  3283. OPTS=['DIR:panda/src/pgraphnodes']
  3284. IGATEFILES=GetDirectoryContents('panda/src/pgraphnodes', ["*.h", "*_composite*.cxx"])
  3285. TargetAdd('libp3pgraphnodes.in', opts=OPTS, input=IGATEFILES)
  3286. TargetAdd('libp3pgraphnodes.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgraphnodes', 'SRCDIR:panda/src/pgraphnodes'])
  3287. #
  3288. # DIRECTORY: panda/src/pgraph/
  3289. #
  3290. OPTS=['DIR:panda/src/pgraph', 'BUILDING:PANDA']
  3291. TargetAdd('p3pgraph_nodePath.obj', opts=OPTS, input='nodePath.cxx')
  3292. TargetAdd('p3pgraph_composite1.obj', opts=OPTS, input='p3pgraph_composite1.cxx')
  3293. TargetAdd('p3pgraph_composite2.obj', opts=OPTS, input='p3pgraph_composite2.cxx')
  3294. TargetAdd('p3pgraph_composite3.obj', opts=OPTS, input='p3pgraph_composite3.cxx')
  3295. TargetAdd('p3pgraph_composite4.obj', opts=OPTS, input='p3pgraph_composite4.cxx')
  3296. OPTS=['DIR:panda/src/pgraph']
  3297. IGATEFILES=GetDirectoryContents('panda/src/pgraph', ["*.h", "nodePath.cxx", "*_composite*.cxx"])
  3298. TargetAdd('libp3pgraph.in', opts=OPTS, input=IGATEFILES)
  3299. TargetAdd('libp3pgraph.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgraph', 'SRCDIR:panda/src/pgraph'])
  3300. PyTargetAdd('p3pgraph_ext_composite.obj', opts=OPTS, input='p3pgraph_ext_composite.cxx')
  3301. #
  3302. # DIRECTORY: panda/src/cull/
  3303. #
  3304. OPTS=['DIR:panda/src/cull', 'BUILDING:PANDA']
  3305. TargetAdd('p3cull_composite1.obj', opts=OPTS, input='p3cull_composite1.cxx')
  3306. TargetAdd('p3cull_composite2.obj', opts=OPTS, input='p3cull_composite2.cxx')
  3307. OPTS=['DIR:panda/src/cull']
  3308. IGATEFILES=GetDirectoryContents('panda/src/cull', ["*.h", "*_composite*.cxx"])
  3309. TargetAdd('libp3cull.in', opts=OPTS, input=IGATEFILES)
  3310. TargetAdd('libp3cull.in', opts=['IMOD:panda3d.core', 'ILIB:libp3cull', 'SRCDIR:panda/src/cull'])
  3311. #
  3312. # DIRECTORY: panda/src/dgraph/
  3313. #
  3314. OPTS=['DIR:panda/src/dgraph', 'BUILDING:PANDA']
  3315. TargetAdd('p3dgraph_composite1.obj', opts=OPTS, input='p3dgraph_composite1.cxx')
  3316. TargetAdd('p3dgraph_composite2.obj', opts=OPTS, input='p3dgraph_composite2.cxx')
  3317. OPTS=['DIR:panda/src/dgraph']
  3318. IGATEFILES=GetDirectoryContents('panda/src/dgraph', ["*.h", "*_composite*.cxx"])
  3319. TargetAdd('libp3dgraph.in', opts=OPTS, input=IGATEFILES)
  3320. TargetAdd('libp3dgraph.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dgraph', 'SRCDIR:panda/src/dgraph'])
  3321. #
  3322. # DIRECTORY: panda/src/device/
  3323. #
  3324. OPTS=['DIR:panda/src/device', 'BUILDING:PANDA']
  3325. TargetAdd('p3device_composite1.obj', opts=OPTS, input='p3device_composite1.cxx')
  3326. TargetAdd('p3device_composite2.obj', opts=OPTS, input='p3device_composite2.cxx')
  3327. OPTS=['DIR:panda/src/device']
  3328. IGATEFILES=GetDirectoryContents('panda/src/device', ["*.h", "*_composite*.cxx"])
  3329. TargetAdd('libp3device.in', opts=OPTS, input=IGATEFILES)
  3330. TargetAdd('libp3device.in', opts=['IMOD:panda3d.core', 'ILIB:libp3device', 'SRCDIR:panda/src/device'])
  3331. #
  3332. # DIRECTORY: panda/src/display/
  3333. #
  3334. OPTS=['DIR:panda/src/display', 'BUILDING:PANDA', 'X11']
  3335. TargetAdd('p3display_graphicsStateGuardian.obj', opts=OPTS, input='graphicsStateGuardian.cxx')
  3336. TargetAdd('p3display_composite1.obj', opts=OPTS, input='p3display_composite1.cxx')
  3337. TargetAdd('p3display_composite2.obj', opts=OPTS, input='p3display_composite2.cxx')
  3338. OPTS=['DIR:panda/src/display', 'X11']
  3339. IGATEFILES=GetDirectoryContents('panda/src/display', ["*.h", "*_composite*.cxx"])
  3340. IGATEFILES.remove("renderBuffer.h")
  3341. TargetAdd('libp3display.in', opts=OPTS, input=IGATEFILES)
  3342. TargetAdd('libp3display.in', opts=['IMOD:panda3d.core', 'ILIB:libp3display', 'SRCDIR:panda/src/display'])
  3343. PyTargetAdd('p3display_ext_composite.obj', opts=OPTS, input='p3display_ext_composite.cxx')
  3344. #
  3345. # DIRECTORY: panda/src/chan/
  3346. #
  3347. OPTS=['DIR:panda/src/chan', 'BUILDING:PANDA']
  3348. TargetAdd('p3chan_composite1.obj', opts=OPTS, input='p3chan_composite1.cxx')
  3349. TargetAdd('p3chan_composite2.obj', opts=OPTS, input='p3chan_composite2.cxx')
  3350. OPTS=['DIR:panda/src/chan']
  3351. IGATEFILES=GetDirectoryContents('panda/src/chan', ["*.h", "*_composite*.cxx"])
  3352. IGATEFILES.remove('movingPart.h')
  3353. IGATEFILES.remove('animChannelFixed.h')
  3354. TargetAdd('libp3chan.in', opts=OPTS, input=IGATEFILES)
  3355. TargetAdd('libp3chan.in', opts=['IMOD:panda3d.core', 'ILIB:libp3chan', 'SRCDIR:panda/src/chan'])
  3356. # DIRECTORY: panda/src/char/
  3357. #
  3358. OPTS=['DIR:panda/src/char', 'BUILDING:PANDA']
  3359. TargetAdd('p3char_composite1.obj', opts=OPTS, input='p3char_composite1.cxx')
  3360. TargetAdd('p3char_composite2.obj', opts=OPTS, input='p3char_composite2.cxx')
  3361. OPTS=['DIR:panda/src/char']
  3362. IGATEFILES=GetDirectoryContents('panda/src/char', ["*.h", "*_composite*.cxx"])
  3363. TargetAdd('libp3char.in', opts=OPTS, input=IGATEFILES)
  3364. TargetAdd('libp3char.in', opts=['IMOD:panda3d.core', 'ILIB:libp3char', 'SRCDIR:panda/src/char'])
  3365. #
  3366. # DIRECTORY: panda/src/pnmtext/
  3367. #
  3368. if not PkgSkip("FREETYPE"):
  3369. OPTS=['DIR:panda/src/pnmtext', 'BUILDING:PANDA', 'FREETYPE']
  3370. TargetAdd('p3pnmtext_composite1.obj', opts=OPTS, input='p3pnmtext_composite1.cxx')
  3371. OPTS=['DIR:panda/src/pnmtext', 'FREETYPE']
  3372. IGATEFILES=GetDirectoryContents('panda/src/pnmtext', ["*.h", "*_composite*.cxx"])
  3373. TargetAdd('libp3pnmtext.in', opts=OPTS, input=IGATEFILES)
  3374. TargetAdd('libp3pnmtext.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pnmtext', 'SRCDIR:panda/src/pnmtext'])
  3375. #
  3376. # DIRECTORY: panda/src/text/
  3377. #
  3378. if not PkgSkip("HARFBUZZ"):
  3379. DefSymbol("HARFBUZZ", "HAVE_HARFBUZZ")
  3380. OPTS=['DIR:panda/src/text', 'BUILDING:PANDA', 'ZLIB', 'FREETYPE', 'HARFBUZZ']
  3381. TargetAdd('p3text_composite1.obj', opts=OPTS, input='p3text_composite1.cxx')
  3382. TargetAdd('p3text_composite2.obj', opts=OPTS, input='p3text_composite2.cxx')
  3383. OPTS=['DIR:panda/src/text', 'ZLIB', 'FREETYPE']
  3384. IGATEFILES=GetDirectoryContents('panda/src/text', ["*.h", "*_composite*.cxx"])
  3385. TargetAdd('libp3text.in', opts=OPTS, input=IGATEFILES)
  3386. TargetAdd('libp3text.in', opts=['IMOD:panda3d.core', 'ILIB:libp3text', 'SRCDIR:panda/src/text'])
  3387. #
  3388. # DIRECTORY: panda/src/movies/
  3389. #
  3390. OPTS=['DIR:panda/src/movies', 'BUILDING:PANDA', 'VORBIS', 'OPUS']
  3391. TargetAdd('p3movies_composite1.obj', opts=OPTS, input='p3movies_composite1.cxx')
  3392. OPTS=['DIR:panda/src/movies', 'VORBIS', 'OPUS']
  3393. IGATEFILES=GetDirectoryContents('panda/src/movies', ["*.h", "*_composite*.cxx"])
  3394. TargetAdd('libp3movies.in', opts=OPTS, input=IGATEFILES)
  3395. TargetAdd('libp3movies.in', opts=['IMOD:panda3d.core', 'ILIB:libp3movies', 'SRCDIR:panda/src/movies'])
  3396. #
  3397. # DIRECTORY: panda/src/grutil/
  3398. #
  3399. OPTS=['DIR:panda/src/grutil', 'BUILDING:PANDA']
  3400. TargetAdd('p3grutil_multitexReducer.obj', opts=OPTS, input='multitexReducer.cxx')
  3401. TargetAdd('p3grutil_composite1.obj', opts=OPTS, input='p3grutil_composite1.cxx')
  3402. TargetAdd('p3grutil_composite2.obj', opts=OPTS, input='p3grutil_composite2.cxx')
  3403. OPTS=['DIR:panda/src/grutil']
  3404. IGATEFILES=GetDirectoryContents('panda/src/grutil', ["*.h", "*_composite*.cxx"])
  3405. TargetAdd('libp3grutil.in', opts=OPTS, input=IGATEFILES)
  3406. TargetAdd('libp3grutil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3grutil', 'SRCDIR:panda/src/grutil'])
  3407. #
  3408. # DIRECTORY: panda/src/tform/
  3409. #
  3410. OPTS=['DIR:panda/src/tform', 'BUILDING:PANDA']
  3411. TargetAdd('p3tform_composite1.obj', opts=OPTS, input='p3tform_composite1.cxx')
  3412. TargetAdd('p3tform_composite2.obj', opts=OPTS, input='p3tform_composite2.cxx')
  3413. OPTS=['DIR:panda/src/tform']
  3414. IGATEFILES=GetDirectoryContents('panda/src/tform', ["*.h", "*_composite*.cxx"])
  3415. TargetAdd('libp3tform.in', opts=OPTS, input=IGATEFILES)
  3416. TargetAdd('libp3tform.in', opts=['IMOD:panda3d.core', 'ILIB:libp3tform', 'SRCDIR:panda/src/tform'])
  3417. #
  3418. # DIRECTORY: panda/src/collide/
  3419. #
  3420. OPTS=['DIR:panda/src/collide', 'BUILDING:PANDA']
  3421. TargetAdd('p3collide_composite1.obj', opts=OPTS, input='p3collide_composite1.cxx')
  3422. TargetAdd('p3collide_composite2.obj', opts=OPTS, input='p3collide_composite2.cxx')
  3423. OPTS=['DIR:panda/src/collide']
  3424. IGATEFILES=GetDirectoryContents('panda/src/collide', ["*.h", "*_composite*.cxx"])
  3425. TargetAdd('libp3collide.in', opts=OPTS, input=IGATEFILES)
  3426. TargetAdd('libp3collide.in', opts=['IMOD:panda3d.core', 'ILIB:libp3collide', 'SRCDIR:panda/src/collide'])
  3427. PyTargetAdd('p3collide_ext_composite.obj', opts=OPTS, input='p3collide_ext_composite.cxx')
  3428. #
  3429. # DIRECTORY: panda/src/parametrics/
  3430. #
  3431. OPTS=['DIR:panda/src/parametrics', 'BUILDING:PANDA']
  3432. TargetAdd('p3parametrics_composite1.obj', opts=OPTS, input='p3parametrics_composite1.cxx')
  3433. TargetAdd('p3parametrics_composite2.obj', opts=OPTS, input='p3parametrics_composite2.cxx')
  3434. OPTS=['DIR:panda/src/parametrics']
  3435. IGATEFILES=GetDirectoryContents('panda/src/parametrics', ["*.h", "*_composite*.cxx"])
  3436. TargetAdd('libp3parametrics.in', opts=OPTS, input=IGATEFILES)
  3437. TargetAdd('libp3parametrics.in', opts=['IMOD:panda3d.core', 'ILIB:libp3parametrics', 'SRCDIR:panda/src/parametrics'])
  3438. #
  3439. # DIRECTORY: panda/src/pgui/
  3440. #
  3441. OPTS=['DIR:panda/src/pgui', 'BUILDING:PANDA']
  3442. TargetAdd('p3pgui_composite1.obj', opts=OPTS, input='p3pgui_composite1.cxx')
  3443. TargetAdd('p3pgui_composite2.obj', opts=OPTS, input='p3pgui_composite2.cxx')
  3444. OPTS=['DIR:panda/src/pgui']
  3445. IGATEFILES=GetDirectoryContents('panda/src/pgui', ["*.h", "*_composite*.cxx"])
  3446. TargetAdd('libp3pgui.in', opts=OPTS, input=IGATEFILES)
  3447. TargetAdd('libp3pgui.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgui', 'SRCDIR:panda/src/pgui'])
  3448. #
  3449. # DIRECTORY: panda/src/pnmimagetypes/
  3450. #
  3451. OPTS=['DIR:panda/src/pnmimagetypes', 'DIR:panda/src/pnmimage', 'BUILDING:PANDA', 'PNG', 'ZLIB', 'JPEG', 'TIFF', 'OPENEXR', 'EXCEPTIONS']
  3452. TargetAdd('p3pnmimagetypes_composite1.obj', opts=OPTS, input='p3pnmimagetypes_composite1.cxx')
  3453. TargetAdd('p3pnmimagetypes_composite2.obj', opts=OPTS, input='p3pnmimagetypes_composite2.cxx')
  3454. #
  3455. # DIRECTORY: panda/src/recorder/
  3456. #
  3457. OPTS=['DIR:panda/src/recorder', 'BUILDING:PANDA']
  3458. TargetAdd('p3recorder_composite1.obj', opts=OPTS, input='p3recorder_composite1.cxx')
  3459. TargetAdd('p3recorder_composite2.obj', opts=OPTS, input='p3recorder_composite2.cxx')
  3460. OPTS=['DIR:panda/src/recorder']
  3461. IGATEFILES=GetDirectoryContents('panda/src/recorder', ["*.h", "*_composite*.cxx"])
  3462. TargetAdd('libp3recorder.in', opts=OPTS, input=IGATEFILES)
  3463. TargetAdd('libp3recorder.in', opts=['IMOD:panda3d.core', 'ILIB:libp3recorder', 'SRCDIR:panda/src/recorder'])
  3464. #
  3465. # DIRECTORY: panda/metalibs/panda/
  3466. #
  3467. OPTS=['DIR:panda/metalibs/panda', 'BUILDING:PANDA', 'JPEG', 'PNG', 'HARFBUZZ',
  3468. 'TIFF', 'OPENEXR', 'ZLIB', 'FREETYPE', 'FFTW', 'ADVAPI', 'WINSOCK2',
  3469. 'SQUISH', 'NVIDIACG', 'VORBIS', 'OPUS', 'WINUSER', 'WINMM', 'WINGDI', 'IPHLPAPI',
  3470. 'SETUPAPI', 'INOTIFY', 'IOKIT']
  3471. TargetAdd('panda_panda.obj', opts=OPTS, input='panda.cxx')
  3472. TargetAdd('libpanda.dll', input='panda_panda.obj')
  3473. TargetAdd('libpanda.dll', input='p3recorder_composite1.obj')
  3474. TargetAdd('libpanda.dll', input='p3recorder_composite2.obj')
  3475. TargetAdd('libpanda.dll', input='p3pgraphnodes_composite1.obj')
  3476. TargetAdd('libpanda.dll', input='p3pgraphnodes_composite2.obj')
  3477. TargetAdd('libpanda.dll', input='p3pgraph_nodePath.obj')
  3478. TargetAdd('libpanda.dll', input='p3pgraph_composite1.obj')
  3479. TargetAdd('libpanda.dll', input='p3pgraph_composite2.obj')
  3480. TargetAdd('libpanda.dll', input='p3pgraph_composite3.obj')
  3481. TargetAdd('libpanda.dll', input='p3pgraph_composite4.obj')
  3482. TargetAdd('libpanda.dll', input='p3cull_composite1.obj')
  3483. TargetAdd('libpanda.dll', input='p3cull_composite2.obj')
  3484. TargetAdd('libpanda.dll', input='p3movies_composite1.obj')
  3485. TargetAdd('libpanda.dll', input='p3grutil_multitexReducer.obj')
  3486. TargetAdd('libpanda.dll', input='p3grutil_composite1.obj')
  3487. TargetAdd('libpanda.dll', input='p3grutil_composite2.obj')
  3488. TargetAdd('libpanda.dll', input='p3chan_composite1.obj')
  3489. TargetAdd('libpanda.dll', input='p3chan_composite2.obj')
  3490. TargetAdd('libpanda.dll', input='p3pstatclient_composite1.obj')
  3491. TargetAdd('libpanda.dll', input='p3pstatclient_composite2.obj')
  3492. TargetAdd('libpanda.dll', input='p3char_composite1.obj')
  3493. TargetAdd('libpanda.dll', input='p3char_composite2.obj')
  3494. TargetAdd('libpanda.dll', input='p3collide_composite1.obj')
  3495. TargetAdd('libpanda.dll', input='p3collide_composite2.obj')
  3496. TargetAdd('libpanda.dll', input='p3device_composite1.obj')
  3497. TargetAdd('libpanda.dll', input='p3device_composite2.obj')
  3498. TargetAdd('libpanda.dll', input='p3dgraph_composite1.obj')
  3499. TargetAdd('libpanda.dll', input='p3dgraph_composite2.obj')
  3500. TargetAdd('libpanda.dll', input='p3display_graphicsStateGuardian.obj')
  3501. TargetAdd('libpanda.dll', input='p3display_composite1.obj')
  3502. TargetAdd('libpanda.dll', input='p3display_composite2.obj')
  3503. TargetAdd('libpanda.dll', input='p3pipeline_composite1.obj')
  3504. TargetAdd('libpanda.dll', input='p3pipeline_composite2.obj')
  3505. TargetAdd('libpanda.dll', input='p3pipeline_contextSwitch.obj')
  3506. TargetAdd('libpanda.dll', input='p3event_composite1.obj')
  3507. TargetAdd('libpanda.dll', input='p3event_composite2.obj')
  3508. TargetAdd('libpanda.dll', input='p3gobj_composite1.obj')
  3509. TargetAdd('libpanda.dll', input='p3gobj_composite2.obj')
  3510. TargetAdd('libpanda.dll', input='p3gsgbase_composite1.obj')
  3511. TargetAdd('libpanda.dll', input='p3linmath_composite1.obj')
  3512. TargetAdd('libpanda.dll', input='p3linmath_composite2.obj')
  3513. TargetAdd('libpanda.dll', input='p3mathutil_composite1.obj')
  3514. TargetAdd('libpanda.dll', input='p3mathutil_composite2.obj')
  3515. TargetAdd('libpanda.dll', input='p3parametrics_composite1.obj')
  3516. TargetAdd('libpanda.dll', input='p3parametrics_composite2.obj')
  3517. TargetAdd('libpanda.dll', input='p3pnmimagetypes_composite1.obj')
  3518. TargetAdd('libpanda.dll', input='p3pnmimagetypes_composite2.obj')
  3519. TargetAdd('libpanda.dll', input='p3pnmimage_composite1.obj')
  3520. TargetAdd('libpanda.dll', input='p3pnmimage_composite2.obj')
  3521. TargetAdd('libpanda.dll', input='p3text_composite1.obj')
  3522. TargetAdd('libpanda.dll', input='p3text_composite2.obj')
  3523. TargetAdd('libpanda.dll', input='p3tform_composite1.obj')
  3524. TargetAdd('libpanda.dll', input='p3tform_composite2.obj')
  3525. TargetAdd('libpanda.dll', input='p3putil_composite1.obj')
  3526. TargetAdd('libpanda.dll', input='p3putil_composite2.obj')
  3527. TargetAdd('libpanda.dll', input='p3audio_composite1.obj')
  3528. TargetAdd('libpanda.dll', input='p3pgui_composite1.obj')
  3529. TargetAdd('libpanda.dll', input='p3pgui_composite2.obj')
  3530. TargetAdd('libpanda.dll', input='p3pandabase_pandabase.obj')
  3531. TargetAdd('libpanda.dll', input='libpandaexpress.dll')
  3532. TargetAdd('libpanda.dll', input='libp3dtoolconfig.dll')
  3533. TargetAdd('libpanda.dll', input='libp3dtool.dll')
  3534. if GetTarget() != "emscripten":
  3535. TargetAdd('libpanda.dll', input='p3net_composite1.obj')
  3536. TargetAdd('libpanda.dll', input='p3net_composite2.obj')
  3537. TargetAdd('libpanda.dll', input='p3nativenet_composite1.obj')
  3538. TargetAdd('libpanda.dll', input='p3pnmimage_convert_srgb_sse2.obj')
  3539. if PkgSkip("FREETYPE")==0:
  3540. TargetAdd('libpanda.dll', input="p3pnmtext_composite1.obj")
  3541. TargetAdd('libpanda.dll', dep='dtool_have_freetype.dat')
  3542. TargetAdd('libpanda.dll', opts=OPTS)
  3543. PyTargetAdd('core_module.obj', input='libp3dtoolbase.in')
  3544. PyTargetAdd('core_module.obj', input='libp3dtoolutil.in')
  3545. PyTargetAdd('core_module.obj', input='libp3prc.in')
  3546. PyTargetAdd('core_module.obj', input='libp3downloader.in')
  3547. PyTargetAdd('core_module.obj', input='libp3express.in')
  3548. PyTargetAdd('core_module.obj', input='libp3recorder.in')
  3549. PyTargetAdd('core_module.obj', input='libp3pgraphnodes.in')
  3550. PyTargetAdd('core_module.obj', input='libp3pgraph.in')
  3551. PyTargetAdd('core_module.obj', input='libp3cull.in')
  3552. PyTargetAdd('core_module.obj', input='libp3grutil.in')
  3553. PyTargetAdd('core_module.obj', input='libp3chan.in')
  3554. PyTargetAdd('core_module.obj', input='libp3pstatclient.in')
  3555. PyTargetAdd('core_module.obj', input='libp3char.in')
  3556. PyTargetAdd('core_module.obj', input='libp3collide.in')
  3557. PyTargetAdd('core_module.obj', input='libp3device.in')
  3558. PyTargetAdd('core_module.obj', input='libp3dgraph.in')
  3559. PyTargetAdd('core_module.obj', input='libp3display.in')
  3560. PyTargetAdd('core_module.obj', input='libp3pipeline.in')
  3561. PyTargetAdd('core_module.obj', input='libp3event.in')
  3562. PyTargetAdd('core_module.obj', input='libp3gobj.in')
  3563. PyTargetAdd('core_module.obj', input='libp3gsgbase.in')
  3564. PyTargetAdd('core_module.obj', input='libp3linmath.in')
  3565. PyTargetAdd('core_module.obj', input='libp3mathutil.in')
  3566. PyTargetAdd('core_module.obj', input='libp3parametrics.in')
  3567. PyTargetAdd('core_module.obj', input='libp3pnmimage.in')
  3568. PyTargetAdd('core_module.obj', input='libp3text.in')
  3569. PyTargetAdd('core_module.obj', input='libp3tform.in')
  3570. PyTargetAdd('core_module.obj', input='libp3putil.in')
  3571. PyTargetAdd('core_module.obj', input='libp3audio.in')
  3572. PyTargetAdd('core_module.obj', input='libp3pgui.in')
  3573. PyTargetAdd('core_module.obj', input='libp3movies.in')
  3574. if GetTarget() != "emscripten":
  3575. PyTargetAdd('core_module.obj', input='libp3nativenet.in')
  3576. PyTargetAdd('core_module.obj', input='libp3net.in')
  3577. if PkgSkip("FREETYPE")==0:
  3578. PyTargetAdd('core_module.obj', input='libp3pnmtext.in')
  3579. PyTargetAdd('core_module.obj', opts=['IMOD:panda3d.core', 'ILIB:core'])
  3580. PyTargetAdd('core.pyd', input='libp3dtoolbase_igate.obj')
  3581. PyTargetAdd('core.pyd', input='p3dtoolbase_typeHandle_ext.obj')
  3582. PyTargetAdd('core.pyd', input='libp3dtoolutil_igate.obj')
  3583. PyTargetAdd('core.pyd', input='p3dtoolutil_ext_composite.obj')
  3584. PyTargetAdd('core.pyd', input='libp3prc_igate.obj')
  3585. PyTargetAdd('core.pyd', input='p3prc_ext_composite.obj')
  3586. PyTargetAdd('core.pyd', input='libp3downloader_igate.obj')
  3587. PyTargetAdd('core.pyd', input='p3express_ext_composite.obj')
  3588. PyTargetAdd('core.pyd', input='libp3express_igate.obj')
  3589. PyTargetAdd('core.pyd', input='libp3recorder_igate.obj')
  3590. PyTargetAdd('core.pyd', input='libp3pgraphnodes_igate.obj')
  3591. PyTargetAdd('core.pyd', input='libp3pgraph_igate.obj')
  3592. PyTargetAdd('core.pyd', input='libp3movies_igate.obj')
  3593. PyTargetAdd('core.pyd', input='libp3grutil_igate.obj')
  3594. PyTargetAdd('core.pyd', input='libp3chan_igate.obj')
  3595. PyTargetAdd('core.pyd', input='libp3pstatclient_igate.obj')
  3596. PyTargetAdd('core.pyd', input='libp3char_igate.obj')
  3597. PyTargetAdd('core.pyd', input='libp3collide_igate.obj')
  3598. PyTargetAdd('core.pyd', input='libp3device_igate.obj')
  3599. PyTargetAdd('core.pyd', input='libp3dgraph_igate.obj')
  3600. PyTargetAdd('core.pyd', input='libp3display_igate.obj')
  3601. PyTargetAdd('core.pyd', input='libp3pipeline_igate.obj')
  3602. PyTargetAdd('core.pyd', input='libp3event_igate.obj')
  3603. PyTargetAdd('core.pyd', input='libp3gobj_igate.obj')
  3604. PyTargetAdd('core.pyd', input='libp3gsgbase_igate.obj')
  3605. PyTargetAdd('core.pyd', input='libp3linmath_igate.obj')
  3606. PyTargetAdd('core.pyd', input='libp3mathutil_igate.obj')
  3607. PyTargetAdd('core.pyd', input='libp3parametrics_igate.obj')
  3608. PyTargetAdd('core.pyd', input='libp3pnmimage_igate.obj')
  3609. PyTargetAdd('core.pyd', input='libp3text_igate.obj')
  3610. PyTargetAdd('core.pyd', input='libp3tform_igate.obj')
  3611. PyTargetAdd('core.pyd', input='libp3putil_igate.obj')
  3612. PyTargetAdd('core.pyd', input='libp3audio_igate.obj')
  3613. PyTargetAdd('core.pyd', input='libp3pgui_igate.obj')
  3614. if GetTarget() != "emscripten":
  3615. PyTargetAdd('core.pyd', input='libp3net_igate.obj')
  3616. PyTargetAdd('core.pyd', input='libp3nativenet_igate.obj')
  3617. if PkgSkip("FREETYPE")==0:
  3618. PyTargetAdd('core.pyd', input="libp3pnmtext_igate.obj")
  3619. PyTargetAdd('core.pyd', input='p3pipeline_pythonThread.obj')
  3620. PyTargetAdd('core.pyd', input='p3putil_ext_composite.obj')
  3621. PyTargetAdd('core.pyd', input='p3pnmimage_pfmFile_ext.obj')
  3622. PyTargetAdd('core.pyd', input='p3event_asyncFuture_ext.obj')
  3623. PyTargetAdd('core.pyd', input='p3event_pythonTask.obj')
  3624. PyTargetAdd('core.pyd', input='p3pstatclient_pStatClient_ext.obj')
  3625. PyTargetAdd('core.pyd', input='p3gobj_ext_composite.obj')
  3626. PyTargetAdd('core.pyd', input='p3pgraph_ext_composite.obj')
  3627. PyTargetAdd('core.pyd', input='p3display_ext_composite.obj')
  3628. PyTargetAdd('core.pyd', input='p3collide_ext_composite.obj')
  3629. PyTargetAdd('core.pyd', input='core_module.obj')
  3630. PyTargetAdd('core.pyd', input='libp3interrogatedb.dll')
  3631. PyTargetAdd('core.pyd', input=COMMON_PANDA_LIBS)
  3632. PyTargetAdd('core.pyd', opts=['WINSOCK2'])
  3633. #
  3634. # DIRECTORY: panda/src/vision/
  3635. #
  3636. if not PkgSkip("VISION"):
  3637. # We want to know whether we have ffmpeg so that we can override the .avi association.
  3638. if not PkgSkip("FFMPEG"):
  3639. DefSymbol("OPENCV", "HAVE_FFMPEG")
  3640. if not PkgSkip("OPENCV"):
  3641. DefSymbol("OPENCV", "HAVE_OPENCV")
  3642. if OPENCV_VER_23:
  3643. DefSymbol("OPENCV", "OPENCV_VER_23")
  3644. OPTS=['DIR:panda/src/vision', 'BUILDING:VISION', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS']
  3645. TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx', dep=[
  3646. 'dtool_have_ffmpeg.dat',
  3647. 'dtool_have_opencv.dat',
  3648. 'dtool_have_directcam.dat',
  3649. ])
  3650. TargetAdd('libp3vision.dll', input='p3vision_composite1.obj')
  3651. TargetAdd('libp3vision.dll', input=COMMON_PANDA_LIBS)
  3652. TargetAdd('libp3vision.dll', opts=OPTS)
  3653. OPTS=['DIR:panda/src/vision', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS']
  3654. IGATEFILES=GetDirectoryContents('panda/src/vision', ["*.h", "*_composite*.cxx"])
  3655. TargetAdd('libp3vision.in', opts=OPTS, input=IGATEFILES)
  3656. TargetAdd('libp3vision.in', opts=['IMOD:panda3d.vision', 'ILIB:libp3vision', 'SRCDIR:panda/src/vision'])
  3657. PyTargetAdd('vision_module.obj', input='libp3vision.in')
  3658. PyTargetAdd('vision_module.obj', opts=OPTS)
  3659. PyTargetAdd('vision_module.obj', opts=['IMOD:panda3d.vision', 'ILIB:vision', 'IMPORT:panda3d.core'])
  3660. PyTargetAdd('vision.pyd', input='vision_module.obj')
  3661. PyTargetAdd('vision.pyd', input='libp3vision_igate.obj')
  3662. PyTargetAdd('vision.pyd', input='libp3vision.dll')
  3663. PyTargetAdd('vision.pyd', input='libp3interrogatedb.dll')
  3664. PyTargetAdd('vision.pyd', input=COMMON_PANDA_LIBS)
  3665. #
  3666. # DIRECTORY: panda/src/p3skel
  3667. #
  3668. if not PkgSkip('SKEL'):
  3669. OPTS=['DIR:panda/src/skel', 'BUILDING:PANDASKEL', 'ADVAPI']
  3670. TargetAdd('p3skel_composite1.obj', opts=OPTS, input='p3skel_composite1.cxx')
  3671. OPTS=['DIR:panda/src/skel', 'ADVAPI']
  3672. IGATEFILES=GetDirectoryContents("panda/src/skel", ["*.h", "*_composite*.cxx"])
  3673. TargetAdd('libp3skel.in', opts=OPTS, input=IGATEFILES)
  3674. TargetAdd('libp3skel.in', opts=['IMOD:panda3d.skel', 'ILIB:libp3skel', 'SRCDIR:panda/src/skel'])
  3675. #
  3676. # DIRECTORY: panda/src/p3skel
  3677. #
  3678. if not PkgSkip('SKEL'):
  3679. OPTS=['BUILDING:PANDASKEL', 'ADVAPI']
  3680. TargetAdd('libpandaskel.dll', input='p3skel_composite1.obj')
  3681. TargetAdd('libpandaskel.dll', input=COMMON_PANDA_LIBS)
  3682. TargetAdd('libpandaskel.dll', opts=OPTS)
  3683. PyTargetAdd('skel_module.obj', input='libp3skel.in')
  3684. PyTargetAdd('skel_module.obj', opts=['IMOD:panda3d.skel', 'ILIB:skel', 'IMPORT:panda3d.core'])
  3685. PyTargetAdd('skel.pyd', input='skel_module.obj')
  3686. PyTargetAdd('skel.pyd', input='libp3skel_igate.obj')
  3687. PyTargetAdd('skel.pyd', input='libpandaskel.dll')
  3688. PyTargetAdd('skel.pyd', input='libp3interrogatedb.dll')
  3689. PyTargetAdd('skel.pyd', input=COMMON_PANDA_LIBS)
  3690. #
  3691. # DIRECTORY: panda/src/distort/
  3692. #
  3693. if not PkgSkip('PANDAFX'):
  3694. OPTS=['DIR:panda/src/distort', 'BUILDING:PANDAFX']
  3695. TargetAdd('p3distort_composite1.obj', opts=OPTS, input='p3distort_composite1.cxx')
  3696. OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG']
  3697. IGATEFILES=GetDirectoryContents('panda/src/distort', ["*.h", "*_composite*.cxx"])
  3698. TargetAdd('libp3distort.in', opts=OPTS, input=IGATEFILES)
  3699. TargetAdd('libp3distort.in', opts=['IMOD:panda3d.fx', 'ILIB:libp3distort', 'SRCDIR:panda/src/distort'])
  3700. #
  3701. # DIRECTORY: panda/metalibs/pandafx/
  3702. #
  3703. if not PkgSkip('PANDAFX'):
  3704. OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'BUILDING:PANDAFX', 'NVIDIACG']
  3705. TargetAdd('pandafx_pandafx.obj', opts=OPTS, input='pandafx.cxx')
  3706. TargetAdd('libpandafx.dll', input='pandafx_pandafx.obj')
  3707. TargetAdd('libpandafx.dll', input='p3distort_composite1.obj')
  3708. TargetAdd('libpandafx.dll', input=COMMON_PANDA_LIBS)
  3709. TargetAdd('libpandafx.dll', opts=['ADVAPI', 'NVIDIACG'])
  3710. OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG']
  3711. PyTargetAdd('fx_module.obj', input='libp3distort.in')
  3712. PyTargetAdd('fx_module.obj', opts=OPTS)
  3713. PyTargetAdd('fx_module.obj', opts=['IMOD:panda3d.fx', 'ILIB:fx', 'IMPORT:panda3d.core'])
  3714. PyTargetAdd('fx.pyd', input='fx_module.obj')
  3715. PyTargetAdd('fx.pyd', input='libp3distort_igate.obj')
  3716. PyTargetAdd('fx.pyd', input='libpandafx.dll')
  3717. PyTargetAdd('fx.pyd', input='libp3interrogatedb.dll')
  3718. PyTargetAdd('fx.pyd', input=COMMON_PANDA_LIBS)
  3719. #
  3720. # DIRECTORY: panda/src/vrpn/
  3721. #
  3722. if not PkgSkip("VRPN"):
  3723. OPTS=['DIR:panda/src/vrpn', 'BUILDING:VRPN', 'VRPN']
  3724. TargetAdd('p3vrpn_composite1.obj', opts=OPTS, input='p3vrpn_composite1.cxx')
  3725. TargetAdd('libp3vrpn.dll', input='p3vrpn_composite1.obj')
  3726. TargetAdd('libp3vrpn.dll', input=COMMON_PANDA_LIBS)
  3727. TargetAdd('libp3vrpn.dll', opts=['VRPN'])
  3728. OPTS=['DIR:panda/src/vrpn', 'VRPN']
  3729. IGATEFILES=GetDirectoryContents('panda/src/vrpn', ["*.h", "*_composite*.cxx"])
  3730. TargetAdd('libp3vrpn.in', opts=OPTS, input=IGATEFILES)
  3731. TargetAdd('libp3vrpn.in', opts=['IMOD:panda3d.vrpn', 'ILIB:libp3vrpn', 'SRCDIR:panda/src/vrpn'])
  3732. PyTargetAdd('vrpn_module.obj', input='libp3vrpn.in')
  3733. PyTargetAdd('vrpn_module.obj', opts=OPTS)
  3734. PyTargetAdd('vrpn_module.obj', opts=['IMOD:panda3d.vrpn', 'ILIB:vrpn', 'IMPORT:panda3d.core'])
  3735. PyTargetAdd('vrpn.pyd', input='vrpn_module.obj')
  3736. PyTargetAdd('vrpn.pyd', input='libp3vrpn_igate.obj')
  3737. PyTargetAdd('vrpn.pyd', input='libp3vrpn.dll')
  3738. PyTargetAdd('vrpn.pyd', input='libp3interrogatedb.dll')
  3739. PyTargetAdd('vrpn.pyd', input=COMMON_PANDA_LIBS)
  3740. #
  3741. # DIRECTORY: panda/src/ffmpeg
  3742. #
  3743. if PkgSkip("FFMPEG") == 0:
  3744. if not PkgSkip("SWSCALE"):
  3745. DefSymbol("FFMPEG", "HAVE_SWSCALE")
  3746. if not PkgSkip("SWRESAMPLE"):
  3747. DefSymbol("FFMPEG", "HAVE_SWRESAMPLE")
  3748. OPTS=['DIR:panda/src/ffmpeg', 'BUILDING:FFMPEG', 'FFMPEG', 'SWSCALE', 'SWRESAMPLE']
  3749. TargetAdd('p3ffmpeg_composite1.obj', opts=OPTS, input='p3ffmpeg_composite1.cxx', dep=[
  3750. 'dtool_have_swscale.dat', 'dtool_have_swresample.dat'])
  3751. TargetAdd('libp3ffmpeg.dll', input='p3ffmpeg_composite1.obj')
  3752. TargetAdd('libp3ffmpeg.dll', input=COMMON_PANDA_LIBS)
  3753. TargetAdd('libp3ffmpeg.dll', opts=OPTS)
  3754. #
  3755. # DIRECTORY: panda/src/audiotraits/
  3756. #
  3757. if PkgSkip("FMODEX") == 0:
  3758. OPTS=['DIR:panda/src/audiotraits', 'BUILDING:FMOD_AUDIO', 'FMODEX']
  3759. TargetAdd('fmod_audio_fmod_audio_composite1.obj', opts=OPTS, input='fmod_audio_composite1.cxx')
  3760. TargetAdd('libp3fmod_audio.dll', input='fmod_audio_fmod_audio_composite1.obj')
  3761. TargetAdd('libp3fmod_audio.dll', input=COMMON_PANDA_LIBS)
  3762. TargetAdd('libp3fmod_audio.dll', opts=['MODULE', 'ADVAPI', 'WINUSER', 'WINMM', 'FMODEX'])
  3763. if PkgSkip("OPENAL") == 0:
  3764. OPTS=['DIR:panda/src/audiotraits', 'BUILDING:OPENAL_AUDIO', 'OPENAL']
  3765. TargetAdd('openal_audio_openal_audio_composite1.obj', opts=OPTS, input='openal_audio_composite1.cxx')
  3766. TargetAdd('libp3openal_audio.dll', input='openal_audio_openal_audio_composite1.obj')
  3767. TargetAdd('libp3openal_audio.dll', input=COMMON_PANDA_LIBS)
  3768. TargetAdd('libp3openal_audio.dll', opts=['MODULE', 'ADVAPI', 'WINUSER', 'WINMM', 'WINSHELL', 'WINOLE', 'OPENAL', 'OPENSLES'])
  3769. #
  3770. # DIRECTORY: panda/src/downloadertools/
  3771. #
  3772. if not PkgSkip("OPENSSL") and not PkgSkip("DEPLOYTOOLS"):
  3773. OPTS=['DIR:panda/src/downloadertools', 'ADVAPI', 'WINSOCK2', 'WINSHELL', 'WINGDI', 'WINUSER']
  3774. TargetAdd('pdecrypt_pdecrypt.obj', opts=OPTS, input='pdecrypt.cxx')
  3775. TargetAdd('pdecrypt.exe', input=['pdecrypt_pdecrypt.obj'])
  3776. TargetAdd('pdecrypt.exe', input=COMMON_PANDA_LIBS)
  3777. TargetAdd('pdecrypt.exe', opts=OPTS)
  3778. TargetAdd('pencrypt_pencrypt.obj', opts=OPTS, input='pencrypt.cxx')
  3779. TargetAdd('pencrypt.exe', input=['pencrypt_pencrypt.obj'])
  3780. TargetAdd('pencrypt.exe', input=COMMON_PANDA_LIBS)
  3781. TargetAdd('pencrypt.exe', opts=OPTS)
  3782. #
  3783. # DIRECTORY: panda/src/downloadertools/
  3784. #
  3785. if not PkgSkip("ZLIB") and not PkgSkip("DEPLOYTOOLS"):
  3786. OPTS=['DIR:panda/src/downloadertools', 'ZLIB', 'ADVAPI', 'WINSOCK2', 'WINSHELL', 'WINGDI', 'WINUSER']
  3787. TargetAdd('multify_multify.obj', opts=OPTS, input='multify.cxx')
  3788. TargetAdd('multify.exe', input=['multify_multify.obj'])
  3789. TargetAdd('multify.exe', input=COMMON_PANDA_LIBS)
  3790. TargetAdd('multify.exe', opts=OPTS)
  3791. TargetAdd('pzip_pzip.obj', opts=OPTS, input='pzip.cxx')
  3792. TargetAdd('pzip.exe', input=['pzip_pzip.obj'])
  3793. TargetAdd('pzip.exe', input=COMMON_PANDA_LIBS)
  3794. TargetAdd('pzip.exe', opts=OPTS)
  3795. TargetAdd('punzip_punzip.obj', opts=OPTS, input='punzip.cxx')
  3796. TargetAdd('punzip.exe', input=['punzip_punzip.obj'])
  3797. TargetAdd('punzip.exe', input=COMMON_PANDA_LIBS)
  3798. TargetAdd('punzip.exe', opts=OPTS)
  3799. #
  3800. # DIRECTORY: panda/src/windisplay/
  3801. #
  3802. if GetTarget() == 'windows':
  3803. OPTS=['DIR:panda/src/windisplay', 'BUILDING:PANDAWIN']
  3804. TargetAdd('p3windisplay_composite1.obj', opts=OPTS+["BIGOBJ"], input='p3windisplay_composite1.cxx')
  3805. TargetAdd('p3windisplay_windetectdx9.obj', opts=OPTS + ["DX9"], input='winDetectDx9.cxx')
  3806. TargetAdd('libp3windisplay.dll', input='p3windisplay_composite1.obj')
  3807. TargetAdd('libp3windisplay.dll', input='p3windisplay_windetectdx9.obj')
  3808. TargetAdd('libp3windisplay.dll', input=COMMON_PANDA_LIBS)
  3809. TargetAdd('libp3windisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM',"BIGOBJ"])
  3810. #
  3811. # DIRECTORY: panda/metalibs/pandadx9/
  3812. #
  3813. if GetTarget() == 'windows' and not PkgSkip("DX9"):
  3814. OPTS=['DIR:panda/src/dxgsg9', 'BUILDING:PANDADX', 'DX9', 'NVIDIACG', 'CGDX9']
  3815. TargetAdd('p3dxgsg9_dxGraphicsStateGuardian9.obj', opts=OPTS, input='dxGraphicsStateGuardian9.cxx')
  3816. TargetAdd('p3dxgsg9_composite1.obj', opts=OPTS, input='p3dxgsg9_composite1.cxx')
  3817. OPTS=['DIR:panda/metalibs/pandadx9', 'BUILDING:PANDADX', 'DX9', 'NVIDIACG', 'CGDX9']
  3818. TargetAdd('pandadx9_pandadx9.obj', opts=OPTS, input='pandadx9.cxx')
  3819. TargetAdd('libpandadx9.dll', input='pandadx9_pandadx9.obj')
  3820. TargetAdd('libpandadx9.dll', input='p3dxgsg9_dxGraphicsStateGuardian9.obj')
  3821. TargetAdd('libpandadx9.dll', input='p3dxgsg9_composite1.obj')
  3822. TargetAdd('libpandadx9.dll', input='libp3windisplay.dll')
  3823. TargetAdd('libpandadx9.dll', input=COMMON_PANDA_LIBS)
  3824. TargetAdd('libpandadx9.dll', opts=['MODULE', 'ADVAPI', 'WINGDI', 'WINKERNEL', 'WINUSER', 'WINMM', 'DX9', 'NVIDIACG', 'CGDX9'])
  3825. #
  3826. # DIRECTORY: panda/src/egg/
  3827. #
  3828. if not PkgSkip("EGG"):
  3829. OPTS=['DIR:panda/src/egg', 'BUILDING:PANDAEGG', 'ZLIB', 'BISONPREFIX_eggyy', 'FLEXDASHI', 'FLEXVERSION:2.5.6']
  3830. CreateFile(GetOutputDir()+"/include/parser.h")
  3831. TargetAdd('p3egg_parser.obj', opts=OPTS, input='parser.yxx')
  3832. TargetAdd('parser.h', input='p3egg_parser.obj', opts=['DEPENDENCYONLY'])
  3833. TargetAdd('p3egg_lexer.obj', opts=OPTS, input='lexer.lxx')
  3834. TargetAdd('p3egg_composite1.obj', opts=OPTS, input='p3egg_composite1.cxx')
  3835. TargetAdd('p3egg_composite2.obj', opts=OPTS, input='p3egg_composite2.cxx')
  3836. OPTS=['DIR:panda/src/egg', 'ZLIB']
  3837. IGATEFILES=GetDirectoryContents('panda/src/egg', ["*.h", "*_composite*.cxx"])
  3838. if "parser.h" in IGATEFILES:
  3839. IGATEFILES.remove("parser.h")
  3840. TargetAdd('libp3egg.in', opts=OPTS, input=IGATEFILES)
  3841. TargetAdd('libp3egg.in', opts=['IMOD:panda3d.egg', 'ILIB:libp3egg', 'SRCDIR:panda/src/egg'])
  3842. PyTargetAdd('p3egg_ext_composite.obj', opts=OPTS, input='p3egg_ext_composite.cxx')
  3843. #
  3844. # DIRECTORY: panda/src/egg2pg/
  3845. #
  3846. if not PkgSkip("EGG"):
  3847. OPTS=['DIR:panda/src/egg2pg', 'BUILDING:PANDAEGG']
  3848. TargetAdd('p3egg2pg_composite1.obj', opts=OPTS, input='p3egg2pg_composite1.cxx')
  3849. TargetAdd('p3egg2pg_composite2.obj', opts=OPTS, input='p3egg2pg_composite2.cxx')
  3850. OPTS=['DIR:panda/src/egg2pg']
  3851. IGATEFILES=['load_egg_file.h', 'save_egg_file.h']
  3852. TargetAdd('libp3egg2pg.in', opts=OPTS, input=IGATEFILES)
  3853. TargetAdd('libp3egg2pg.in', opts=['IMOD:panda3d.egg', 'ILIB:libp3egg2pg', 'SRCDIR:panda/src/egg2pg'])
  3854. #
  3855. # DIRECTORY: panda/src/framework/
  3856. #
  3857. deps = []
  3858. # Framework wants to link in a renderer when building statically, so tell it what is available.
  3859. if GetLinkAllStatic():
  3860. deps = ['dtool_have_gl.dat', 'dtool_have_tinydisplay.dat', 'dtool_have_egg.dat']
  3861. if not PkgSkip("GL"):
  3862. DefSymbol("FRAMEWORK", "HAVE_GL")
  3863. if not PkgSkip("TINYDISPLAY"):
  3864. DefSymbol("FRAMEWORK", "HAVE_TINYDISPLAY")
  3865. if not PkgSkip("EGG"):
  3866. DefSymbol("FRAMEWORK", "HAVE_EGG")
  3867. OPTS=['DIR:panda/src/framework', 'BUILDING:FRAMEWORK', 'FRAMEWORK']
  3868. TargetAdd('p3framework_composite1.obj', opts=OPTS, input='p3framework_composite1.cxx', dep=deps)
  3869. TargetAdd('libp3framework.dll', input='p3framework_composite1.obj')
  3870. TargetAdd('libp3framework.dll', input=COMMON_PANDA_LIBS)
  3871. TargetAdd('libp3framework.dll', opts=['ADVAPI'])
  3872. #
  3873. # DIRECTORY: panda/src/glgsg/
  3874. #
  3875. if not PkgSkip("GL"):
  3876. OPTS=['DIR:panda/src/glgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG']
  3877. TargetAdd('p3glgsg_config_glgsg.obj', opts=OPTS, input='config_glgsg.cxx')
  3878. TargetAdd('p3glgsg_glgsg.obj', opts=OPTS, input='glgsg.cxx')
  3879. #
  3880. # DIRECTORY: panda/src/glesgsg/
  3881. #
  3882. if not PkgSkip("GLES"):
  3883. OPTS=['DIR:panda/src/glesgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES']
  3884. TargetAdd('p3glesgsg_config_glesgsg.obj', opts=OPTS, input='config_glesgsg.cxx')
  3885. TargetAdd('p3glesgsg_glesgsg.obj', opts=OPTS, input='glesgsg.cxx')
  3886. #
  3887. # DIRECTORY: panda/src/gles2gsg/
  3888. #
  3889. if not PkgSkip("GLES2"):
  3890. OPTS=['DIR:panda/src/gles2gsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2']
  3891. TargetAdd('p3gles2gsg_config_gles2gsg.obj', opts=OPTS, input='config_gles2gsg.cxx')
  3892. TargetAdd('p3gles2gsg_gles2gsg.obj', opts=OPTS, input='gles2gsg.cxx')
  3893. #
  3894. # DIRECTORY: panda/metalibs/pandaegg/
  3895. #
  3896. if not PkgSkip("EGG"):
  3897. OPTS=['DIR:panda/metalibs/pandaegg', 'DIR:panda/src/egg', 'BUILDING:PANDAEGG']
  3898. TargetAdd('pandaegg_pandaegg.obj', opts=OPTS, input='pandaegg.cxx')
  3899. TargetAdd('libpandaegg.dll', input='pandaegg_pandaegg.obj')
  3900. TargetAdd('libpandaegg.dll', input='p3egg2pg_composite1.obj')
  3901. TargetAdd('libpandaegg.dll', input='p3egg2pg_composite2.obj')
  3902. TargetAdd('libpandaegg.dll', input='p3egg_composite1.obj')
  3903. TargetAdd('libpandaegg.dll', input='p3egg_composite2.obj')
  3904. TargetAdd('libpandaegg.dll', input='p3egg_parser.obj')
  3905. TargetAdd('libpandaegg.dll', input='p3egg_lexer.obj')
  3906. TargetAdd('libpandaegg.dll', input=COMMON_PANDA_LIBS)
  3907. TargetAdd('libpandaegg.dll', opts=['ADVAPI'])
  3908. OPTS=['DIR:panda/metalibs/pandaegg', 'DIR:panda/src/egg']
  3909. PyTargetAdd('egg_module.obj', input='libp3egg2pg.in')
  3910. PyTargetAdd('egg_module.obj', input='libp3egg.in')
  3911. PyTargetAdd('egg_module.obj', opts=OPTS)
  3912. PyTargetAdd('egg_module.obj', opts=['IMOD:panda3d.egg', 'ILIB:egg', 'IMPORT:panda3d.core'])
  3913. PyTargetAdd('egg.pyd', input='egg_module.obj')
  3914. PyTargetAdd('egg.pyd', input='p3egg_ext_composite.obj')
  3915. PyTargetAdd('egg.pyd', input='libp3egg_igate.obj')
  3916. PyTargetAdd('egg.pyd', input='libp3egg2pg_igate.obj')
  3917. PyTargetAdd('egg.pyd', input='libpandaegg.dll')
  3918. PyTargetAdd('egg.pyd', input='libp3interrogatedb.dll')
  3919. PyTargetAdd('egg.pyd', input=COMMON_PANDA_LIBS)
  3920. #
  3921. # DIRECTORY: panda/src/x11display/
  3922. #
  3923. if GetTarget() not in ['windows', 'darwin', 'emscripten'] and not PkgSkip("X11"):
  3924. OPTS=['DIR:panda/src/x11display', 'BUILDING:PANDAX11', 'X11']
  3925. TargetAdd('p3x11display_composite1.obj', opts=OPTS, input='p3x11display_composite1.cxx')
  3926. #
  3927. # DIRECTORY: panda/src/glxdisplay/
  3928. #
  3929. if GetTarget() not in ['windows', 'darwin', 'emscripten'] and not PkgSkip("GL") and not PkgSkip("X11"):
  3930. DefSymbol('GLX', 'HAVE_GLX', '')
  3931. OPTS=['DIR:panda/src/glxdisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL', 'GLX']
  3932. TargetAdd('p3glxdisplay_composite1.obj', opts=OPTS, input='p3glxdisplay_composite1.cxx')
  3933. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL', 'GLX']
  3934. TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  3935. TargetAdd('libpandagl.dll', input='p3x11display_composite1.obj')
  3936. TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')
  3937. TargetAdd('libpandagl.dll', input='p3glgsg_config_glgsg.obj')
  3938. TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj')
  3939. TargetAdd('libpandagl.dll', input='p3glxdisplay_composite1.obj')
  3940. TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
  3941. TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'X11'])
  3942. #
  3943. # DIRECTORY: panda/src/cocoadisplay/
  3944. #
  3945. if GetTarget() == 'darwin' and not PkgSkip("COCOA"):
  3946. OPTS=['DIR:panda/src/cocoadisplay', 'BUILDING:PANDAGL', 'COCOA']
  3947. TargetAdd('p3cocoadisplay_composite1.obj', opts=OPTS, input='p3cocoadisplay_composite1.mm')
  3948. #
  3949. # DIRECTORY: panda/src/cocoagldisplay/
  3950. #
  3951. if GetTarget() == 'darwin' and not PkgSkip("COCOA") and not PkgSkip("GL"):
  3952. OPTS=['DIR:panda/src/cocoagldisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL']
  3953. TargetAdd('p3cocoagldisplay_composite1.obj', opts=OPTS, input='p3cocoagldisplay_composite1.mm')
  3954. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL']
  3955. TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  3956. TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')
  3957. TargetAdd('libpandagl.dll', input='p3glgsg_config_glgsg.obj')
  3958. TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj')
  3959. TargetAdd('libpandagl.dll', input='p3cocoadisplay_composite1.obj')
  3960. TargetAdd('libpandagl.dll', input='p3cocoagldisplay_composite1.obj')
  3961. if not PkgSkip('PANDAFX'):
  3962. TargetAdd('libpandagl.dll', input='libpandafx.dll')
  3963. TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
  3964. TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'COCOA', 'CARBON', 'QUARTZ'])
  3965. #
  3966. # DIRECTORY: panda/src/wgldisplay/
  3967. #
  3968. if GetTarget() == 'windows' and not PkgSkip("GL"):
  3969. OPTS=['DIR:panda/src/wgldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'NVIDIACG', 'CGGL']
  3970. TargetAdd('p3wgldisplay_composite1.obj', opts=OPTS, input='p3wgldisplay_composite1.cxx')
  3971. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'NVIDIACG', 'CGGL']
  3972. TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  3973. TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')
  3974. TargetAdd('libpandagl.dll', input='p3glgsg_config_glgsg.obj')
  3975. TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj')
  3976. TargetAdd('libpandagl.dll', input='p3wgldisplay_composite1.obj')
  3977. TargetAdd('libpandagl.dll', input='libp3windisplay.dll')
  3978. if not PkgSkip('PANDAFX'):
  3979. TargetAdd('libpandagl.dll', input='libpandafx.dll')
  3980. TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
  3981. TargetAdd('libpandagl.dll', opts=['MODULE', 'WINGDI', 'GL', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM', 'NVIDIACG', 'CGGL'])
  3982. #
  3983. # DIRECTORY: panda/src/egldisplay/
  3984. #
  3985. # If we're not compiling with any windowing system at all, but we do have EGL,
  3986. # we can use that to create a headless libpandagl instead.
  3987. if not PkgSkip("EGL") and not PkgSkip("GL") and PkgSkip("X11") and GetTarget() not in ('windows', 'darwin'):
  3988. OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'GL', 'EGL']
  3989. TargetAdd('pandagl_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
  3990. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'EGL']
  3991. TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  3992. TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')
  3993. TargetAdd('libpandagl.dll', input='p3glgsg_config_glgsg.obj')
  3994. TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj')
  3995. TargetAdd('libpandagl.dll', input='pandagl_egldisplay_composite1.obj')
  3996. TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
  3997. TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'EGL', 'CGGL'])
  3998. elif not PkgSkip("EGL") and not PkgSkip("GL") and GetTarget() not in ('windows', 'darwin'):
  3999. # As a temporary solution for #1086, build this module, which we can use as a
  4000. # fallback to OpenGL for headless systems.
  4001. OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'GL', 'EGL']
  4002. TargetAdd('p3headlessgl_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
  4003. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'EGL']
  4004. TargetAdd('p3headlessgl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  4005. TargetAdd('libp3headlessgl.dll', input='p3headlessgl_pandagl.obj')
  4006. TargetAdd('libp3headlessgl.dll', input='p3glgsg_config_glgsg.obj')
  4007. TargetAdd('libp3headlessgl.dll', input='p3glgsg_glgsg.obj')
  4008. TargetAdd('libp3headlessgl.dll', input='p3headlessgl_egldisplay_composite1.obj')
  4009. TargetAdd('libp3headlessgl.dll', input=COMMON_PANDA_LIBS)
  4010. TargetAdd('libp3headlessgl.dll', opts=['MODULE', 'GL', 'EGL', 'CGGL'])
  4011. #
  4012. # DIRECTORY: panda/src/egldisplay/
  4013. #
  4014. if GetTarget() != 'android' and not PkgSkip("EGL") and not PkgSkip("GLES"):
  4015. DefSymbol('GLES', 'OPENGLES_1', '')
  4016. OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES', 'EGL', 'X11']
  4017. TargetAdd('pandagles_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
  4018. OPTS=['DIR:panda/metalibs/pandagles', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
  4019. TargetAdd('pandagles_pandagles.obj', opts=OPTS, input='pandagles.cxx')
  4020. if not PkgSkip("X11"):
  4021. TargetAdd('libpandagles.dll', input='p3x11display_composite1.obj')
  4022. TargetAdd('libpandagles.dll', input='pandagles_pandagles.obj')
  4023. TargetAdd('libpandagles.dll', input='p3glesgsg_config_glesgsg.obj')
  4024. TargetAdd('libpandagles.dll', input='p3glesgsg_glesgsg.obj')
  4025. TargetAdd('libpandagles.dll', input='pandagles_egldisplay_composite1.obj')
  4026. TargetAdd('libpandagles.dll', input=COMMON_PANDA_LIBS)
  4027. TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL', 'X11'])
  4028. #
  4029. # DIRECTORY: panda/src/egldisplay/
  4030. #
  4031. if GetTarget() != 'android' and not PkgSkip("EGL") and not PkgSkip("GLES2"):
  4032. DefSymbol('GLES2', 'OPENGLES_2', '')
  4033. OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL', 'X11']
  4034. TargetAdd('pandagles2_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
  4035. OPTS=['DIR:panda/metalibs/pandagles2', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL']
  4036. TargetAdd('pandagles2_pandagles2.obj', opts=OPTS, input='pandagles2.cxx')
  4037. if not PkgSkip("X11"):
  4038. TargetAdd('libpandagles2.dll', input='p3x11display_composite1.obj')
  4039. TargetAdd('libpandagles2.dll', input='pandagles2_pandagles2.obj')
  4040. TargetAdd('libpandagles2.dll', input='p3gles2gsg_config_gles2gsg.obj')
  4041. TargetAdd('libpandagles2.dll', input='p3gles2gsg_gles2gsg.obj')
  4042. TargetAdd('libpandagles2.dll', input='pandagles2_egldisplay_composite1.obj')
  4043. TargetAdd('libpandagles2.dll', input=COMMON_PANDA_LIBS)
  4044. TargetAdd('libpandagles2.dll', opts=['MODULE', 'GLES2', 'EGL', 'X11'])
  4045. #
  4046. # DIRECTORY: panda/src/webgldisplay/
  4047. #
  4048. if GetTarget() == 'emscripten' and not PkgSkip("GLES2"):
  4049. DefSymbol('GLES2', 'OPENGLES_2', '')
  4050. LinkFlag('GLES2', '-s GL_ENABLE_GET_PROC_ADDRESS=1')
  4051. OPTS=['DIR:panda/src/webgldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2', 'WEBGL']
  4052. TargetAdd('p3webgldisplay_webgldisplay_composite1.obj', opts=OPTS, input='p3webgldisplay_composite1.cxx')
  4053. TargetAdd('libp3webgldisplay.dll', input='p3gles2gsg_config_gles2gsg.obj')
  4054. TargetAdd('libp3webgldisplay.dll', input='p3gles2gsg_gles2gsg.obj')
  4055. TargetAdd('libp3webgldisplay.dll', input='p3webgldisplay_webgldisplay_composite1.obj')
  4056. TargetAdd('libp3webgldisplay.dll', input=COMMON_PANDA_LIBS)
  4057. TargetAdd('libp3webgldisplay.dll', opts=['MODULE', 'GLES2', 'WEBGL'])
  4058. #
  4059. # DIRECTORY: panda/src/ode/
  4060. #
  4061. if not PkgSkip("ODE"):
  4062. OPTS=['DIR:panda/src/ode', 'BUILDING:PANDAODE', 'ODE']
  4063. TargetAdd('p3ode_composite1.obj', opts=OPTS, input='p3ode_composite1.cxx')
  4064. TargetAdd('p3ode_composite2.obj', opts=OPTS, input='p3ode_composite2.cxx')
  4065. TargetAdd('p3ode_composite3.obj', opts=OPTS, input='p3ode_composite3.cxx')
  4066. OPTS=['DIR:panda/src/ode', 'ODE']
  4067. IGATEFILES=GetDirectoryContents('panda/src/ode', ["*.h", "*_composite*.cxx"])
  4068. IGATEFILES.remove("odeConvexGeom.h")
  4069. IGATEFILES.remove("odeHelperStructs.h")
  4070. TargetAdd('libpandaode.in', opts=OPTS, input=IGATEFILES)
  4071. TargetAdd('libpandaode.in', opts=['IMOD:panda3d.ode', 'ILIB:libpandaode', 'SRCDIR:panda/src/ode'])
  4072. PyTargetAdd('p3ode_ext_composite.obj', opts=OPTS, input='p3ode_ext_composite.cxx')
  4073. #
  4074. # DIRECTORY: panda/metalibs/pandaode/
  4075. #
  4076. if not PkgSkip("ODE"):
  4077. OPTS=['DIR:panda/metalibs/pandaode', 'BUILDING:PANDAODE', 'ODE']
  4078. TargetAdd('pandaode_pandaode.obj', opts=OPTS, input='pandaode.cxx')
  4079. TargetAdd('libpandaode.dll', input='pandaode_pandaode.obj')
  4080. TargetAdd('libpandaode.dll', input='p3ode_composite1.obj')
  4081. TargetAdd('libpandaode.dll', input='p3ode_composite2.obj')
  4082. TargetAdd('libpandaode.dll', input='p3ode_composite3.obj')
  4083. TargetAdd('libpandaode.dll', input=COMMON_PANDA_LIBS)
  4084. TargetAdd('libpandaode.dll', opts=['WINUSER', 'ODE'])
  4085. OPTS=['DIR:panda/metalibs/pandaode', 'ODE']
  4086. PyTargetAdd('ode_module.obj', input='libpandaode.in')
  4087. PyTargetAdd('ode_module.obj', opts=OPTS)
  4088. PyTargetAdd('ode_module.obj', opts=['IMOD:panda3d.ode', 'ILIB:ode', 'IMPORT:panda3d.core'])
  4089. PyTargetAdd('ode.pyd', input='ode_module.obj')
  4090. PyTargetAdd('ode.pyd', input='libpandaode_igate.obj')
  4091. PyTargetAdd('ode.pyd', input='p3ode_ext_composite.obj')
  4092. PyTargetAdd('ode.pyd', input='libpandaode.dll')
  4093. PyTargetAdd('ode.pyd', input='libp3interrogatedb.dll')
  4094. PyTargetAdd('ode.pyd', input=COMMON_PANDA_LIBS)
  4095. PyTargetAdd('ode.pyd', opts=['WINUSER', 'ODE'])
  4096. #
  4097. # DIRECTORY: panda/src/bullet/
  4098. #
  4099. if not PkgSkip("BULLET"):
  4100. OPTS=['DIR:panda/src/bullet', 'BUILDING:PANDABULLET', 'BULLET']
  4101. TargetAdd('p3bullet_composite.obj', opts=OPTS, input='p3bullet_composite.cxx')
  4102. OPTS=['DIR:panda/src/bullet', 'BULLET']
  4103. IGATEFILES=GetDirectoryContents('panda/src/bullet', ["*.h", "*_composite*.cxx"])
  4104. TargetAdd('libpandabullet.in', opts=OPTS, input=IGATEFILES)
  4105. TargetAdd('libpandabullet.in', opts=['IMOD:panda3d.bullet', 'ILIB:libpandabullet', 'SRCDIR:panda/src/bullet'])
  4106. #
  4107. # DIRECTORY: panda/metalibs/pandabullet/
  4108. #
  4109. if not PkgSkip("BULLET"):
  4110. OPTS=['DIR:panda/metalibs/pandabullet', 'BUILDING:PANDABULLET', 'BULLET']
  4111. TargetAdd('pandabullet_pandabullet.obj', opts=OPTS, input='pandabullet.cxx')
  4112. TargetAdd('libpandabullet.dll', input='pandabullet_pandabullet.obj')
  4113. TargetAdd('libpandabullet.dll', input='p3bullet_composite.obj')
  4114. TargetAdd('libpandabullet.dll', input=COMMON_PANDA_LIBS)
  4115. TargetAdd('libpandabullet.dll', opts=['WINUSER', 'BULLET'])
  4116. OPTS=['DIR:panda/metalibs/pandabullet', 'BULLET']
  4117. PyTargetAdd('bullet_module.obj', input='libpandabullet.in')
  4118. PyTargetAdd('bullet_module.obj', opts=OPTS)
  4119. PyTargetAdd('bullet_module.obj', opts=['IMOD:panda3d.bullet', 'ILIB:bullet', 'IMPORT:panda3d.core'])
  4120. PyTargetAdd('bullet.pyd', input='bullet_module.obj')
  4121. PyTargetAdd('bullet.pyd', input='libpandabullet_igate.obj')
  4122. PyTargetAdd('bullet.pyd', input='libpandabullet.dll')
  4123. PyTargetAdd('bullet.pyd', input='libp3interrogatedb.dll')
  4124. PyTargetAdd('bullet.pyd', input=COMMON_PANDA_LIBS)
  4125. PyTargetAdd('bullet.pyd', opts=['WINUSER', 'BULLET'])
  4126. #
  4127. # DIRECTORY: panda/src/physics/
  4128. #
  4129. if not PkgSkip("PANDAPHYSICS"):
  4130. OPTS=['DIR:panda/src/physics', 'BUILDING:PANDAPHYSICS']
  4131. TargetAdd('p3physics_composite1.obj', opts=OPTS, input='p3physics_composite1.cxx')
  4132. TargetAdd('p3physics_composite2.obj', opts=OPTS, input='p3physics_composite2.cxx')
  4133. OPTS=['DIR:panda/src/physics']
  4134. IGATEFILES=GetDirectoryContents('panda/src/physics', ["*.h", "*_composite*.cxx"])
  4135. IGATEFILES.remove("forces.h")
  4136. TargetAdd('libp3physics.in', opts=OPTS, input=IGATEFILES)
  4137. TargetAdd('libp3physics.in', opts=['IMOD:panda3d.physics', 'ILIB:libp3physics', 'SRCDIR:panda/src/physics'])
  4138. #
  4139. # DIRECTORY: panda/src/particlesystem/
  4140. #
  4141. if not PkgSkip("PANDAPHYSICS") and not PkgSkip("PANDAPARTICLESYSTEM"):
  4142. OPTS=['DIR:panda/src/particlesystem', 'BUILDING:PANDAPHYSICS']
  4143. TargetAdd('p3particlesystem_composite1.obj', opts=OPTS, input='p3particlesystem_composite1.cxx')
  4144. TargetAdd('p3particlesystem_composite2.obj', opts=OPTS, input='p3particlesystem_composite2.cxx')
  4145. OPTS=['DIR:panda/src/particlesystem']
  4146. IGATEFILES=GetDirectoryContents('panda/src/particlesystem', ["*.h", "*_composite*.cxx"])
  4147. IGATEFILES.remove('orientedParticle.h')
  4148. IGATEFILES.remove('orientedParticleFactory.h')
  4149. IGATEFILES.remove('particlefactories.h')
  4150. IGATEFILES.remove('emitters.h')
  4151. IGATEFILES.remove('particles.h')
  4152. TargetAdd('libp3particlesystem.in', opts=OPTS, input=IGATEFILES)
  4153. TargetAdd('libp3particlesystem.in', opts=['IMOD:panda3d.physics', 'ILIB:libp3particlesystem', 'SRCDIR:panda/src/particlesystem'])
  4154. #
  4155. # DIRECTORY: panda/metalibs/pandaphysics/
  4156. #
  4157. if not PkgSkip("PANDAPHYSICS"):
  4158. OPTS=['DIR:panda/metalibs/pandaphysics', 'BUILDING:PANDAPHYSICS']
  4159. TargetAdd('pandaphysics_pandaphysics.obj', opts=OPTS, input='pandaphysics.cxx')
  4160. TargetAdd('libpandaphysics.dll', input='pandaphysics_pandaphysics.obj')
  4161. TargetAdd('libpandaphysics.dll', input='p3physics_composite1.obj')
  4162. TargetAdd('libpandaphysics.dll', input='p3physics_composite2.obj')
  4163. TargetAdd('libpandaphysics.dll', input='p3particlesystem_composite1.obj')
  4164. TargetAdd('libpandaphysics.dll', input='p3particlesystem_composite2.obj')
  4165. TargetAdd('libpandaphysics.dll', input=COMMON_PANDA_LIBS)
  4166. TargetAdd('libpandaphysics.dll', opts=['ADVAPI'])
  4167. OPTS=['DIR:panda/metalibs/pandaphysics']
  4168. PyTargetAdd('physics_module.obj', input='libp3physics.in')
  4169. if not PkgSkip("PANDAPARTICLESYSTEM"):
  4170. PyTargetAdd('physics_module.obj', input='libp3particlesystem.in')
  4171. PyTargetAdd('physics_module.obj', opts=OPTS)
  4172. PyTargetAdd('physics_module.obj', opts=['IMOD:panda3d.physics', 'ILIB:physics', 'IMPORT:panda3d.core'])
  4173. PyTargetAdd('physics.pyd', input='physics_module.obj')
  4174. PyTargetAdd('physics.pyd', input='libp3physics_igate.obj')
  4175. if not PkgSkip("PANDAPARTICLESYSTEM"):
  4176. PyTargetAdd('physics.pyd', input='libp3particlesystem_igate.obj')
  4177. PyTargetAdd('physics.pyd', input='libpandaphysics.dll')
  4178. PyTargetAdd('physics.pyd', input='libp3interrogatedb.dll')
  4179. PyTargetAdd('physics.pyd', input=COMMON_PANDA_LIBS)
  4180. #
  4181. # DIRECTORY: contrib/src/speedtree/
  4182. #
  4183. if not PkgSkip("SPEEDTREE"):
  4184. OPTS=['DIR:contrib/src/speedtree', 'BUILDING:PANDASPEEDTREE', 'SPEEDTREE']
  4185. TargetAdd('pandaspeedtree_composite1.obj', opts=OPTS, input='pandaspeedtree_composite1.cxx')
  4186. IGATEFILES=GetDirectoryContents('contrib/src/speedtree', ["*.h", "*_composite*.cxx"])
  4187. TargetAdd('libpandaspeedtree.in', opts=OPTS, input=IGATEFILES)
  4188. TargetAdd('libpandaspeedtree.in', opts=['IMOD:libpandaspeedtree', 'ILIB:libpandaspeedtree', 'SRCDIR:contrib/src/speedtree'])
  4189. PyTargetAdd('libpandaspeedtree_module.obj', input='libpandaspeedtree.in')
  4190. PyTargetAdd('libpandaspeedtree_module.obj', opts=OPTS)
  4191. PyTargetAdd('libpandaspeedtree_module.obj', opts=['IMOD:libpandaspeedtree', 'ILIB:libpandaspeedtree'])
  4192. TargetAdd('libpandaspeedtree.dll', input='pandaspeedtree_composite1.obj')
  4193. PyTargetAdd('libpandaspeedtree.dll', input='libpandaspeedtree_igate.obj')
  4194. TargetAdd('libpandaspeedtree.dll', input='libpandaspeedtree_module.obj')
  4195. TargetAdd('libpandaspeedtree.dll', input=COMMON_PANDA_LIBS)
  4196. TargetAdd('libpandaspeedtree.dll', opts=['SPEEDTREE'])
  4197. if SDK["SPEEDTREEAPI"] == 'OpenGL':
  4198. TargetAdd('libpandaspeedtree.dll', opts=['GL', 'NVIDIACG', 'CGGL'])
  4199. elif SDK["SPEEDTREEAPI"] == 'DirectX9':
  4200. TargetAdd('libpandaspeedtree.dll', opts=['DX9', 'NVIDIACG', 'CGDX9'])
  4201. #
  4202. # DIRECTORY: panda/src/testbed/
  4203. #
  4204. if not PkgSkip("PVIEW"):
  4205. OPTS=['DIR:panda/src/testbed']
  4206. TargetAdd('pview_pview.obj', opts=OPTS, input='pview.cxx')
  4207. TargetAdd('pview.exe', input='pview_pview.obj')
  4208. TargetAdd('pview.exe', input='libp3framework.dll')
  4209. if not PkgSkip("EGG"):
  4210. TargetAdd('pview.exe', input='libpandaegg.dll')
  4211. TargetAdd('pview.exe', input=COMMON_PANDA_LIBS)
  4212. TargetAdd('pview.exe', opts=['ADVAPI', 'WINSOCK2', 'WINSHELL'])
  4213. if GetLinkAllStatic() and not PkgSkip("GL"):
  4214. TargetAdd('pview.exe', input='libpandagl.dll')
  4215. if GetTarget() == "emscripten" and not PkgSkip("GLES2"):
  4216. TargetAdd('pview.exe', input='libp3webgldisplay.dll')
  4217. #
  4218. # DIRECTORY: panda/src/android/
  4219. #
  4220. if GetTarget() == 'android':
  4221. OPTS=['DIR:panda/src/android', 'PNG']
  4222. TargetAdd('org/panda3d/android/NativeIStream.class', opts=OPTS, input='NativeIStream.java')
  4223. TargetAdd('org/panda3d/android/NativeOStream.class', opts=OPTS, input='NativeOStream.java')
  4224. TargetAdd('org/panda3d/android/PandaActivity.class', opts=OPTS, input='PandaActivity.java')
  4225. TargetAdd('org/panda3d/android/PythonActivity.class', opts=OPTS, input='PythonActivity.java')
  4226. TargetAdd('classes.dex', input='org/panda3d/android/NativeIStream.class')
  4227. TargetAdd('classes.dex', input='org/panda3d/android/NativeOStream.class')
  4228. TargetAdd('classes.dex', input='org/panda3d/android/PandaActivity.class')
  4229. TargetAdd('classes.dex', input='org/panda3d/android/PythonActivity.class')
  4230. TargetAdd('p3android_composite1.obj', opts=OPTS, input='p3android_composite1.cxx')
  4231. TargetAdd('libp3android.dll', input='p3android_composite1.obj')
  4232. TargetAdd('libp3android.dll', input=COMMON_PANDA_LIBS)
  4233. TargetAdd('libp3android.dll', opts=['JNIGRAPHICS'])
  4234. TargetAdd('android_native_app_glue.obj', opts=OPTS + ['NOHIDDEN'], input='android_native_app_glue.c')
  4235. TargetAdd('android_main.obj', opts=OPTS, input='android_main.cxx')
  4236. if not PkgSkip("PVIEW"):
  4237. TargetAdd('libpview_pview.obj', opts=OPTS, input='pview.cxx')
  4238. TargetAdd('libpview.dll', input='android_native_app_glue.obj')
  4239. TargetAdd('libpview.dll', input='android_main.obj')
  4240. TargetAdd('libpview.dll', input='libpview_pview.obj')
  4241. TargetAdd('libpview.dll', input='libp3framework.dll')
  4242. if not PkgSkip("EGG"):
  4243. TargetAdd('libpview.dll', input='libpandaegg.dll')
  4244. TargetAdd('libpview.dll', input='libp3android.dll')
  4245. TargetAdd('libpview.dll', input=COMMON_PANDA_LIBS)
  4246. TargetAdd('libpview.dll', opts=['MODULE', 'ANDROID'])
  4247. if not PkgSkip("PYTHON"):
  4248. OPTS += ['PYTHON']
  4249. TargetAdd('ppython_ppython.obj', opts=OPTS, input='python_main.cxx')
  4250. TargetAdd('libppython.dll', input='android_native_app_glue.obj')
  4251. TargetAdd('libppython.dll', input='android_main.obj')
  4252. TargetAdd('libppython.dll', input='ppython_ppython.obj')
  4253. TargetAdd('libppython.dll', input='libp3framework.dll')
  4254. TargetAdd('libppython.dll', input='libp3android.dll')
  4255. TargetAdd('libppython.dll', input=COMMON_PANDA_LIBS)
  4256. TargetAdd('libppython.dll', opts=['MODULE', 'ANDROID', 'PYTHON'])
  4257. #
  4258. # DIRECTORY: panda/src/androiddisplay/
  4259. #
  4260. if GetTarget() == 'android' and not PkgSkip("EGL") and not PkgSkip("GLES"):
  4261. DefSymbol('GLES', 'OPENGLES_1', '')
  4262. OPTS=['DIR:panda/src/androiddisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
  4263. TargetAdd('pandagles_androiddisplay_composite1.obj', opts=OPTS, input='p3androiddisplay_composite1.cxx')
  4264. OPTS=['DIR:panda/metalibs/pandagles', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
  4265. TargetAdd('pandagles_pandagles.obj', opts=OPTS, input='pandagles.cxx')
  4266. TargetAdd('libpandagles.dll', input='pandagles_pandagles.obj')
  4267. TargetAdd('libpandagles.dll', input='p3glesgsg_config_glesgsg.obj')
  4268. TargetAdd('libpandagles.dll', input='p3glesgsg_glesgsg.obj')
  4269. TargetAdd('libpandagles.dll', input='pandagles_androiddisplay_composite1.obj')
  4270. TargetAdd('libpandagles.dll', input='libp3android.dll')
  4271. TargetAdd('libpandagles.dll', input=COMMON_PANDA_LIBS)
  4272. TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL'])
  4273. if GetTarget() == 'android' and not PkgSkip("EGL") and not PkgSkip("GLES2"):
  4274. DefSymbol('GLES2', 'OPENGLES_2', '')
  4275. OPTS=['DIR:panda/src/androiddisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL']
  4276. TargetAdd('pandagles2_androiddisplay_composite1.obj', opts=OPTS, input='p3androiddisplay_composite1.cxx')
  4277. OPTS=['DIR:panda/metalibs/pandagles2', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL']
  4278. TargetAdd('pandagles2_pandagles2.obj', opts=OPTS, input='pandagles2.cxx')
  4279. TargetAdd('libpandagles2.dll', input='pandagles2_pandagles2.obj')
  4280. TargetAdd('libpandagles2.dll', input='p3gles2gsg_config_gles2gsg.obj')
  4281. TargetAdd('libpandagles2.dll', input='p3gles2gsg_gles2gsg.obj')
  4282. TargetAdd('libpandagles2.dll', input='pandagles2_androiddisplay_composite1.obj')
  4283. TargetAdd('libpandagles2.dll', input='libp3android.dll')
  4284. TargetAdd('libpandagles2.dll', input=COMMON_PANDA_LIBS)
  4285. TargetAdd('libpandagles2.dll', opts=['MODULE', 'GLES2', 'EGL'])
  4286. #
  4287. # DIRECTORY: panda/src/tinydisplay/
  4288. #
  4289. if not PkgSkip("TINYDISPLAY"):
  4290. OPTS=['DIR:panda/src/tinydisplay', 'BUILDING:TINYDISPLAY', 'X11']
  4291. if not PkgSkip("X11"):
  4292. OPTS += ['X11']
  4293. if not PkgSkip("COCOA"):
  4294. OPTS += ['COCOA']
  4295. TargetAdd('p3tinydisplay_composite1.obj', opts=OPTS, input='p3tinydisplay_composite1.cxx')
  4296. TargetAdd('p3tinydisplay_composite2.obj', opts=OPTS, input='p3tinydisplay_composite2.cxx')
  4297. TargetAdd('p3tinydisplay_ztriangle_1.obj', opts=OPTS, input='ztriangle_1.cxx')
  4298. TargetAdd('p3tinydisplay_ztriangle_2.obj', opts=OPTS, input='ztriangle_2.cxx')
  4299. TargetAdd('p3tinydisplay_ztriangle_3.obj', opts=OPTS, input='ztriangle_3.cxx')
  4300. TargetAdd('p3tinydisplay_ztriangle_4.obj', opts=OPTS, input='ztriangle_4.cxx')
  4301. TargetAdd('p3tinydisplay_ztriangle_table.obj', opts=OPTS, input='ztriangle_table.cxx')
  4302. if GetTarget() == 'windows':
  4303. TargetAdd('libp3tinydisplay.dll', input='libp3windisplay.dll')
  4304. TargetAdd('libp3tinydisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM'])
  4305. elif GetTarget() == 'darwin':
  4306. if not PkgSkip("COCOA"):
  4307. TargetAdd('libp3tinydisplay_tinyCocoaGraphicsWindow.obj', opts=OPTS, input='tinyCocoaGraphicsWindow.mm')
  4308. TargetAdd('libp3tinydisplay.dll', input='libp3tinydisplay_tinyCocoaGraphicsWindow.obj')
  4309. TargetAdd('libp3tinydisplay.dll', input='p3cocoadisplay_composite1.obj')
  4310. TargetAdd('libp3tinydisplay.dll', opts=['COCOA', 'CARBON', 'QUARTZ'])
  4311. elif not PkgSkip("X11"):
  4312. TargetAdd('libp3tinydisplay.dll', input='p3x11display_composite1.obj')
  4313. TargetAdd('libp3tinydisplay.dll', opts=['X11'])
  4314. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_composite1.obj')
  4315. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_composite2.obj')
  4316. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_1.obj')
  4317. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_2.obj')
  4318. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_3.obj')
  4319. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_4.obj')
  4320. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_table.obj')
  4321. TargetAdd('libp3tinydisplay.dll', input=COMMON_PANDA_LIBS)
  4322. #
  4323. # DIRECTORY: direct/src/directbase/
  4324. #
  4325. if not PkgSkip("DIRECT"):
  4326. OPTS=['DIR:direct/src/directbase']
  4327. TargetAdd('p3directbase_directbase.obj', opts=OPTS+['BUILDING:DIRECT'], input='directbase.cxx')
  4328. #
  4329. # DIRECTORY: direct/src/dcparser/
  4330. #
  4331. if not PkgSkip("DIRECT"):
  4332. OPTS=['DIR:direct/src/dcparser', 'BUILDING:DIRECT_DCPARSER', 'WITHINPANDA', 'BISONPREFIX_dcyy']
  4333. CreateFile(GetOutputDir()+"/include/dcParser.h")
  4334. TargetAdd('p3dcparser_dcParser.obj', opts=OPTS, input='dcParser.yxx')
  4335. TargetAdd('dcParser.h', input='p3dcparser_dcParser.obj', opts=['DEPENDENCYONLY'])
  4336. TargetAdd('p3dcparser_dcLexer.obj', opts=OPTS, input='dcLexer.lxx')
  4337. TargetAdd('p3dcparser_composite1.obj', opts=OPTS, input='p3dcparser_composite1.cxx')
  4338. TargetAdd('p3dcparser_composite2.obj', opts=OPTS, input='p3dcparser_composite2.cxx')
  4339. OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA']
  4340. IGATEFILES=GetDirectoryContents('direct/src/dcparser', ["*.h", "*_composite*.cxx"])
  4341. if "dcParser.h" in IGATEFILES:
  4342. IGATEFILES.remove("dcParser.h")
  4343. if "dcmsgtypes.h" in IGATEFILES:
  4344. IGATEFILES.remove('dcmsgtypes.h')
  4345. TargetAdd('libp3dcparser.in', opts=OPTS, input=IGATEFILES)
  4346. TargetAdd('libp3dcparser.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3dcparser', 'SRCDIR:direct/src/dcparser'])
  4347. PyTargetAdd('p3dcparser_ext_composite.obj', opts=OPTS, input='p3dcparser_ext_composite.cxx')
  4348. #
  4349. # DIRECTORY: direct/src/deadrec/
  4350. #
  4351. if not PkgSkip("DIRECT"):
  4352. OPTS=['DIR:direct/src/deadrec', 'BUILDING:DIRECT']
  4353. TargetAdd('p3deadrec_composite1.obj', opts=OPTS, input='p3deadrec_composite1.cxx')
  4354. OPTS=['DIR:direct/src/deadrec']
  4355. IGATEFILES=GetDirectoryContents('direct/src/deadrec', ["*.h", "*_composite*.cxx"])
  4356. TargetAdd('libp3deadrec.in', opts=OPTS, input=IGATEFILES)
  4357. TargetAdd('libp3deadrec.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3deadrec', 'SRCDIR:direct/src/deadrec'])
  4358. #
  4359. # DIRECTORY: direct/src/distributed/
  4360. #
  4361. if not PkgSkip("DIRECT") and GetTarget() != 'emscripten':
  4362. OPTS=['DIR:direct/src/distributed', 'DIR:direct/src/dcparser', 'WITHINPANDA', 'BUILDING:DIRECT']
  4363. TargetAdd('p3distributed_config_distributed.obj', opts=OPTS, input='config_distributed.cxx')
  4364. OPTS=['DIR:direct/src/distributed', 'WITHINPANDA']
  4365. IGATEFILES=GetDirectoryContents('direct/src/distributed', ["*.h", "*.cxx"])
  4366. TargetAdd('libp3distributed.in', opts=OPTS, input=IGATEFILES)
  4367. TargetAdd('libp3distributed.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3distributed', 'SRCDIR:direct/src/distributed'])
  4368. PyTargetAdd('p3distributed_cConnectionRepository.obj', opts=OPTS, input='cConnectionRepository.cxx')
  4369. PyTargetAdd('p3distributed_cDistributedSmoothNodeBase.obj', opts=OPTS, input='cDistributedSmoothNodeBase.cxx')
  4370. #
  4371. # DIRECTORY: direct/src/interval/
  4372. #
  4373. if not PkgSkip("DIRECT"):
  4374. OPTS=['DIR:direct/src/interval', 'BUILDING:DIRECT']
  4375. TargetAdd('p3interval_composite1.obj', opts=OPTS, input='p3interval_composite1.cxx')
  4376. OPTS=['DIR:direct/src/interval']
  4377. IGATEFILES=GetDirectoryContents('direct/src/interval', ["*.h", "*_composite*.cxx"])
  4378. TargetAdd('libp3interval.in', opts=OPTS, input=IGATEFILES)
  4379. TargetAdd('libp3interval.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3interval', 'SRCDIR:direct/src/interval'])
  4380. PyTargetAdd('p3interval_cInterval_ext.obj', opts=OPTS, input='cInterval_ext.cxx')
  4381. #
  4382. # DIRECTORY: direct/src/showbase/
  4383. #
  4384. if not PkgSkip("DIRECT"):
  4385. OPTS=['DIR:direct/src/showbase', 'BUILDING:DIRECT']
  4386. TargetAdd('p3showbase_showBase.obj', opts=OPTS, input='showBase.cxx')
  4387. if GetTarget() == 'darwin':
  4388. TargetAdd('p3showbase_showBase_assist.obj', opts=OPTS, input='showBase_assist.mm')
  4389. OPTS=['DIR:direct/src/showbase']
  4390. IGATEFILES=GetDirectoryContents('direct/src/showbase', ["*.h", "showBase.cxx"])
  4391. TargetAdd('libp3showbase.in', opts=OPTS, input=IGATEFILES)
  4392. TargetAdd('libp3showbase.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3showbase', 'SRCDIR:direct/src/showbase'])
  4393. #
  4394. # DIRECTORY: direct/src/motiontrail/
  4395. #
  4396. if not PkgSkip("DIRECT"):
  4397. OPTS=['DIR:direct/src/motiontrail', 'BUILDING:DIRECT']
  4398. TargetAdd('p3motiontrail_cMotionTrail.obj', opts=OPTS, input='cMotionTrail.cxx')
  4399. TargetAdd('p3motiontrail_config_motiontrail.obj', opts=OPTS, input='config_motiontrail.cxx')
  4400. OPTS=['DIR:direct/src/motiontrail']
  4401. IGATEFILES=GetDirectoryContents('direct/src/motiontrail', ["*.h", "cMotionTrail.cxx"])
  4402. TargetAdd('libp3motiontrail.in', opts=OPTS, input=IGATEFILES)
  4403. TargetAdd('libp3motiontrail.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3motiontrail', 'SRCDIR:direct/src/motiontrail'])
  4404. #
  4405. # DIRECTORY: direct/metalibs/direct/
  4406. #
  4407. if not PkgSkip("DIRECT"):
  4408. TargetAdd('libp3direct.dll', input='p3directbase_directbase.obj')
  4409. TargetAdd('libp3direct.dll', input='p3dcparser_composite1.obj')
  4410. TargetAdd('libp3direct.dll', input='p3dcparser_composite2.obj')
  4411. TargetAdd('libp3direct.dll', input='p3dcparser_dcParser.obj')
  4412. TargetAdd('libp3direct.dll', input='p3dcparser_dcLexer.obj')
  4413. TargetAdd('libp3direct.dll', input='p3showbase_showBase.obj')
  4414. if GetTarget() == 'darwin':
  4415. TargetAdd('libp3direct.dll', input='p3showbase_showBase_assist.obj')
  4416. TargetAdd('libp3direct.dll', input='p3deadrec_composite1.obj')
  4417. if GetTarget() != 'emscripten':
  4418. TargetAdd('libp3direct.dll', input='p3distributed_config_distributed.obj')
  4419. TargetAdd('libp3direct.dll', input='p3interval_composite1.obj')
  4420. TargetAdd('libp3direct.dll', input='p3motiontrail_config_motiontrail.obj')
  4421. TargetAdd('libp3direct.dll', input='p3motiontrail_cMotionTrail.obj')
  4422. TargetAdd('libp3direct.dll', input=COMMON_PANDA_LIBS)
  4423. TargetAdd('libp3direct.dll', opts=['ADVAPI', 'WINUSER', 'WINGDI'])
  4424. PyTargetAdd('direct_module.obj', input='libp3dcparser.in')
  4425. PyTargetAdd('direct_module.obj', input='libp3showbase.in')
  4426. PyTargetAdd('direct_module.obj', input='libp3deadrec.in')
  4427. PyTargetAdd('direct_module.obj', input='libp3interval.in')
  4428. if GetTarget() != 'emscripten':
  4429. PyTargetAdd('direct_module.obj', input='libp3distributed.in')
  4430. PyTargetAdd('direct_module.obj', input='libp3motiontrail.in')
  4431. PyTargetAdd('direct_module.obj', opts=['IMOD:panda3d.direct', 'ILIB:direct', 'IMPORT:panda3d.core'])
  4432. PyTargetAdd('direct.pyd', input='libp3dcparser_igate.obj')
  4433. PyTargetAdd('direct.pyd', input='libp3showbase_igate.obj')
  4434. PyTargetAdd('direct.pyd', input='libp3deadrec_igate.obj')
  4435. PyTargetAdd('direct.pyd', input='libp3interval_igate.obj')
  4436. PyTargetAdd('direct.pyd', input='p3interval_cInterval_ext.obj')
  4437. if GetTarget() != 'emscripten':
  4438. PyTargetAdd('direct.pyd', input='libp3distributed_igate.obj')
  4439. PyTargetAdd('direct.pyd', input='libp3motiontrail_igate.obj')
  4440. # These are part of direct.pyd, not libp3direct.dll, because they rely on
  4441. # the Python libraries. If a C++ user needs these modules, we can move them
  4442. # back and filter out the Python-specific code.
  4443. PyTargetAdd('direct.pyd', input='p3dcparser_ext_composite.obj')
  4444. if GetTarget() != 'emscripten':
  4445. PyTargetAdd('direct.pyd', input='p3distributed_cConnectionRepository.obj')
  4446. PyTargetAdd('direct.pyd', input='p3distributed_cDistributedSmoothNodeBase.obj')
  4447. PyTargetAdd('direct.pyd', input='direct_module.obj')
  4448. PyTargetAdd('direct.pyd', input='libp3direct.dll')
  4449. PyTargetAdd('direct.pyd', input='libp3interrogatedb.dll')
  4450. PyTargetAdd('direct.pyd', input=COMMON_PANDA_LIBS)
  4451. PyTargetAdd('direct.pyd', opts=['WINUSER', 'WINGDI', 'WINSOCK2'])
  4452. #
  4453. # DIRECTORY: direct/src/dcparse/
  4454. #
  4455. if not PkgSkip("DIRECT"):
  4456. OPTS=['DIR:direct/src/dcparse', 'DIR:direct/src/dcparser', 'WITHINPANDA', 'ADVAPI']
  4457. TargetAdd('dcparse_dcparse.obj', opts=OPTS, input='dcparse.cxx')
  4458. TargetAdd('p3dcparse.exe', input='dcparse_dcparse.obj')
  4459. TargetAdd('p3dcparse.exe', input='libp3direct.dll')
  4460. TargetAdd('p3dcparse.exe', input=COMMON_PANDA_LIBS)
  4461. TargetAdd('p3dcparse.exe', opts=['ADVAPI'])
  4462. #
  4463. # DIRECTORY: pandatool/src/pandatoolbase/
  4464. #
  4465. if not PkgSkip("PANDATOOL"):
  4466. OPTS=['DIR:pandatool/src/pandatoolbase']
  4467. TargetAdd('p3pandatoolbase_composite1.obj', opts=OPTS, input='p3pandatoolbase_composite1.cxx')
  4468. TargetAdd('libp3pandatoolbase.lib', input='p3pandatoolbase_composite1.obj')
  4469. #
  4470. # DIRECTORY: pandatool/src/converter/
  4471. #
  4472. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4473. OPTS=['DIR:pandatool/src/converter']
  4474. TargetAdd('p3converter_somethingToEggConverter.obj', opts=OPTS, input='somethingToEggConverter.cxx')
  4475. TargetAdd('p3converter_eggToSomethingConverter.obj', opts=OPTS, input='eggToSomethingConverter.cxx')
  4476. TargetAdd('libp3converter.lib', input='p3converter_somethingToEggConverter.obj')
  4477. TargetAdd('libp3converter.lib', input='p3converter_eggToSomethingConverter.obj')
  4478. #
  4479. # DIRECTORY: pandatool/src/progbase/
  4480. #
  4481. if not PkgSkip("PANDATOOL"):
  4482. OPTS=['DIR:pandatool/src/progbase', 'ZLIB']
  4483. TargetAdd('p3progbase_composite1.obj', opts=OPTS, input='p3progbase_composite1.cxx')
  4484. TargetAdd('libp3progbase.lib', input='p3progbase_composite1.obj')
  4485. #
  4486. # DIRECTORY: pandatool/src/eggbase/
  4487. #
  4488. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4489. OPTS=['DIR:pandatool/src/eggbase']
  4490. TargetAdd('p3eggbase_composite1.obj', opts=OPTS, input='p3eggbase_composite1.cxx')
  4491. TargetAdd('libp3eggbase.lib', input='p3eggbase_composite1.obj')
  4492. #
  4493. # DIRECTORY: pandatool/src/bam/
  4494. #
  4495. if not PkgSkip("PANDATOOL"):
  4496. OPTS=['DIR:pandatool/src/bam']
  4497. TargetAdd('bam-info_bamInfo.obj', opts=OPTS, input='bamInfo.cxx')
  4498. TargetAdd('bam-info.exe', input='bam-info_bamInfo.obj')
  4499. TargetAdd('bam-info.exe', input='libp3progbase.lib')
  4500. TargetAdd('bam-info.exe', input='libp3pandatoolbase.lib')
  4501. TargetAdd('bam-info.exe', input=COMMON_PANDA_LIBS)
  4502. TargetAdd('bam-info.exe', opts=['ADVAPI', 'FFTW'])
  4503. if not PkgSkip("EGG"):
  4504. TargetAdd('bam2egg_bamToEgg.obj', opts=OPTS, input='bamToEgg.cxx')
  4505. TargetAdd('bam2egg.exe', input='bam2egg_bamToEgg.obj')
  4506. TargetAdd('bam2egg.exe', input=COMMON_EGG2X_LIBS)
  4507. TargetAdd('bam2egg.exe', opts=['ADVAPI', 'FFTW'])
  4508. TargetAdd('egg2bam_eggToBam.obj', opts=OPTS, input='eggToBam.cxx')
  4509. TargetAdd('egg2bam.exe', input='egg2bam_eggToBam.obj')
  4510. TargetAdd('egg2bam.exe', input=COMMON_EGG2X_LIBS)
  4511. TargetAdd('egg2bam.exe', opts=['ADVAPI', 'FFTW'])
  4512. #
  4513. # DIRECTORY: pandatool/src/daeegg/
  4514. #
  4515. if not PkgSkip("PANDATOOL") and not PkgSkip("FCOLLADA") and not PkgSkip("EGG"):
  4516. OPTS=['DIR:pandatool/src/daeegg', 'FCOLLADA']
  4517. TargetAdd('p3daeegg_composite1.obj', opts=OPTS, input='p3daeegg_composite1.cxx')
  4518. TargetAdd('libp3daeegg.lib', input='p3daeegg_composite1.obj')
  4519. TargetAdd('libp3daeegg.lib', opts=['FCOLLADA', 'CARBON'])
  4520. #
  4521. # DIRECTORY: pandatool/src/assimp
  4522. #
  4523. if not PkgSkip("PANDATOOL") and not PkgSkip("ASSIMP"):
  4524. OPTS=['DIR:pandatool/src/assimp', 'BUILDING:ASSIMP', 'ASSIMP', 'MODULE']
  4525. TargetAdd('p3assimp_composite1.obj', opts=OPTS, input='p3assimp_composite1.cxx')
  4526. TargetAdd('libp3assimp.dll', input='p3assimp_composite1.obj')
  4527. TargetAdd('libp3assimp.dll', input=COMMON_PANDA_LIBS)
  4528. TargetAdd('libp3assimp.dll', opts=OPTS+['ZLIB', 'ADVAPI'])
  4529. #
  4530. # DIRECTORY: pandatool/src/daeprogs/
  4531. #
  4532. if not PkgSkip("PANDATOOL") and not PkgSkip("FCOLLADA") and not PkgSkip("EGG"):
  4533. OPTS=['DIR:pandatool/src/daeprogs', 'FCOLLADA']
  4534. TargetAdd('dae2egg_daeToEgg.obj', opts=OPTS, input='daeToEgg.cxx')
  4535. TargetAdd('dae2egg.exe', input='dae2egg_daeToEgg.obj')
  4536. TargetAdd('dae2egg.exe', input='libp3daeegg.lib')
  4537. TargetAdd('dae2egg.exe', input=COMMON_EGG2X_LIBS)
  4538. TargetAdd('dae2egg.exe', opts=['WINUSER', 'FCOLLADA', 'CARBON'])
  4539. #
  4540. # DIRECTORY: pandatool/src/dxf/
  4541. #
  4542. if not PkgSkip("PANDATOOL"):
  4543. OPTS=['DIR:pandatool/src/dxf']
  4544. TargetAdd('p3dxf_composite1.obj', opts=OPTS, input='p3dxf_composite1.cxx')
  4545. TargetAdd('libp3dxf.lib', input='p3dxf_composite1.obj')
  4546. #
  4547. # DIRECTORY: pandatool/src/dxfegg/
  4548. #
  4549. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4550. OPTS=['DIR:pandatool/src/dxfegg']
  4551. TargetAdd('p3dxfegg_dxfToEggConverter.obj', opts=OPTS, input='dxfToEggConverter.cxx')
  4552. TargetAdd('p3dxfegg_dxfToEggLayer.obj', opts=OPTS, input='dxfToEggLayer.cxx')
  4553. TargetAdd('libp3dxfegg.lib', input='p3dxfegg_dxfToEggConverter.obj')
  4554. TargetAdd('libp3dxfegg.lib', input='p3dxfegg_dxfToEggLayer.obj')
  4555. #
  4556. # DIRECTORY: pandatool/src/dxfprogs/
  4557. #
  4558. if not PkgSkip("PANDATOOL"):
  4559. OPTS=['DIR:pandatool/src/dxfprogs']
  4560. TargetAdd('dxf-points_dxfPoints.obj', opts=OPTS, input='dxfPoints.cxx')
  4561. TargetAdd('dxf-points.exe', input='dxf-points_dxfPoints.obj')
  4562. TargetAdd('dxf-points.exe', input='libp3progbase.lib')
  4563. TargetAdd('dxf-points.exe', input='libp3dxf.lib')
  4564. TargetAdd('dxf-points.exe', input='libp3pandatoolbase.lib')
  4565. TargetAdd('dxf-points.exe', input=COMMON_PANDA_LIBS)
  4566. TargetAdd('dxf-points.exe', opts=['ADVAPI', 'FFTW'])
  4567. if not PkgSkip("EGG"):
  4568. TargetAdd('dxf2egg_dxfToEgg.obj', opts=OPTS, input='dxfToEgg.cxx')
  4569. TargetAdd('dxf2egg.exe', input='dxf2egg_dxfToEgg.obj')
  4570. TargetAdd('dxf2egg.exe', input='libp3dxfegg.lib')
  4571. TargetAdd('dxf2egg.exe', input='libp3dxf.lib')
  4572. TargetAdd('dxf2egg.exe', input=COMMON_EGG2X_LIBS)
  4573. TargetAdd('dxf2egg.exe', opts=['ADVAPI', 'FFTW'])
  4574. TargetAdd('egg2dxf_eggToDXF.obj', opts=OPTS, input='eggToDXF.cxx')
  4575. TargetAdd('egg2dxf_eggToDXFLayer.obj', opts=OPTS, input='eggToDXFLayer.cxx')
  4576. TargetAdd('egg2dxf.exe', input='egg2dxf_eggToDXF.obj')
  4577. TargetAdd('egg2dxf.exe', input='egg2dxf_eggToDXFLayer.obj')
  4578. TargetAdd('egg2dxf.exe', input='libp3dxf.lib')
  4579. TargetAdd('egg2dxf.exe', input=COMMON_EGG2X_LIBS)
  4580. TargetAdd('egg2dxf.exe', opts=['ADVAPI', 'FFTW'])
  4581. #
  4582. # DIRECTORY: pandatool/src/objegg/
  4583. #
  4584. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4585. OPTS=['DIR:pandatool/src/objegg']
  4586. TargetAdd('p3objegg_objToEggConverter.obj', opts=OPTS, input='objToEggConverter.cxx')
  4587. TargetAdd('p3objegg_eggToObjConverter.obj', opts=OPTS, input='eggToObjConverter.cxx')
  4588. TargetAdd('p3objegg_config_objegg.obj', opts=OPTS, input='config_objegg.cxx')
  4589. TargetAdd('libp3objegg.lib', input='p3objegg_objToEggConverter.obj')
  4590. TargetAdd('libp3objegg.lib', input='p3objegg_eggToObjConverter.obj')
  4591. TargetAdd('libp3objegg.lib', input='p3objegg_config_objegg.obj')
  4592. #
  4593. # DIRECTORY: pandatool/src/objprogs/
  4594. #
  4595. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4596. OPTS=['DIR:pandatool/src/objprogs']
  4597. TargetAdd('obj2egg_objToEgg.obj', opts=OPTS, input='objToEgg.cxx')
  4598. TargetAdd('obj2egg.exe', input='obj2egg_objToEgg.obj')
  4599. TargetAdd('obj2egg.exe', input='libp3objegg.lib')
  4600. TargetAdd('obj2egg.exe', input=COMMON_EGG2X_LIBS)
  4601. TargetAdd('egg2obj_eggToObj.obj', opts=OPTS, input='eggToObj.cxx')
  4602. TargetAdd('egg2obj.exe', input='egg2obj_eggToObj.obj')
  4603. TargetAdd('egg2obj.exe', input='libp3objegg.lib')
  4604. TargetAdd('egg2obj.exe', input=COMMON_EGG2X_LIBS)
  4605. #
  4606. # DIRECTORY: pandatool/src/palettizer/
  4607. #
  4608. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4609. OPTS=['DIR:pandatool/src/palettizer']
  4610. TargetAdd('p3palettizer_composite1.obj', opts=OPTS, input='p3palettizer_composite1.cxx')
  4611. TargetAdd('libp3palettizer.lib', input='p3palettizer_composite1.obj')
  4612. #
  4613. # DIRECTORY: pandatool/src/egg-mkfont/
  4614. #
  4615. if not PkgSkip("FREETYPE") and not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4616. OPTS=['DIR:pandatool/src/egg-mkfont', 'DIR:pandatool/src/palettizer', 'FREETYPE']
  4617. TargetAdd('egg-mkfont_eggMakeFont.obj', opts=OPTS, input='eggMakeFont.cxx')
  4618. TargetAdd('egg-mkfont_rangeDescription.obj', opts=OPTS, input='rangeDescription.cxx')
  4619. TargetAdd('egg-mkfont_rangeIterator.obj', opts=OPTS, input='rangeIterator.cxx')
  4620. TargetAdd('egg-mkfont.exe', input='egg-mkfont_eggMakeFont.obj')
  4621. TargetAdd('egg-mkfont.exe', input='egg-mkfont_rangeDescription.obj')
  4622. TargetAdd('egg-mkfont.exe', input='egg-mkfont_rangeIterator.obj')
  4623. TargetAdd('egg-mkfont.exe', input='libp3palettizer.lib')
  4624. TargetAdd('egg-mkfont.exe', input=COMMON_EGG2X_LIBS)
  4625. TargetAdd('egg-mkfont.exe', opts=['ADVAPI', 'FREETYPE'])
  4626. #
  4627. # DIRECTORY: pandatool/src/eggcharbase/
  4628. #
  4629. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4630. OPTS=['DIR:pandatool/src/eggcharbase', 'ZLIB']
  4631. TargetAdd('p3eggcharbase_composite1.obj', opts=OPTS, input='p3eggcharbase_composite1.cxx')
  4632. TargetAdd('libp3eggcharbase.lib', input='p3eggcharbase_composite1.obj')
  4633. #
  4634. # DIRECTORY: pandatool/src/egg-optchar/
  4635. #
  4636. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4637. OPTS=['DIR:pandatool/src/egg-optchar']
  4638. TargetAdd('egg-optchar_config_egg_optchar.obj', opts=OPTS, input='config_egg_optchar.cxx')
  4639. TargetAdd('egg-optchar_eggOptchar.obj', opts=OPTS, input='eggOptchar.cxx')
  4640. TargetAdd('egg-optchar_eggOptcharUserData.obj', opts=OPTS, input='eggOptcharUserData.cxx')
  4641. TargetAdd('egg-optchar_vertexMembership.obj', opts=OPTS, input='vertexMembership.cxx')
  4642. TargetAdd('egg-optchar.exe', input='egg-optchar_config_egg_optchar.obj')
  4643. TargetAdd('egg-optchar.exe', input='egg-optchar_eggOptchar.obj')
  4644. TargetAdd('egg-optchar.exe', input='egg-optchar_eggOptcharUserData.obj')
  4645. TargetAdd('egg-optchar.exe', input='egg-optchar_vertexMembership.obj')
  4646. TargetAdd('egg-optchar.exe', input='libp3eggcharbase.lib')
  4647. TargetAdd('egg-optchar.exe', input=COMMON_EGG2X_LIBS)
  4648. TargetAdd('egg-optchar.exe', opts=['ADVAPI', 'FREETYPE'])
  4649. #
  4650. # DIRECTORY: pandatool/src/egg-palettize/
  4651. #
  4652. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4653. OPTS=['DIR:pandatool/src/egg-palettize', 'DIR:pandatool/src/palettizer']
  4654. TargetAdd('egg-palettize_eggPalettize.obj', opts=OPTS, input='eggPalettize.cxx')
  4655. TargetAdd('egg-palettize.exe', input='egg-palettize_eggPalettize.obj')
  4656. TargetAdd('egg-palettize.exe', input='libp3palettizer.lib')
  4657. TargetAdd('egg-palettize.exe', input=COMMON_EGG2X_LIBS)
  4658. TargetAdd('egg-palettize.exe', opts=['ADVAPI'])
  4659. #
  4660. # DIRECTORY: pandatool/src/egg-qtess/
  4661. #
  4662. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4663. OPTS=['DIR:pandatool/src/egg-qtess']
  4664. TargetAdd('egg-qtess_composite1.obj', opts=OPTS, input='egg-qtess_composite1.cxx')
  4665. TargetAdd('egg-qtess.exe', input='egg-qtess_composite1.obj')
  4666. TargetAdd('egg-qtess.exe', input='libp3eggbase.lib')
  4667. TargetAdd('egg-qtess.exe', input='libp3progbase.lib')
  4668. TargetAdd('egg-qtess.exe', input='libp3converter.lib')
  4669. TargetAdd('egg-qtess.exe', input=COMMON_EGG2X_LIBS)
  4670. TargetAdd('egg-qtess.exe', opts=['ADVAPI'])
  4671. #
  4672. # DIRECTORY: pandatool/src/eggprogs/
  4673. #
  4674. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4675. OPTS=['DIR:pandatool/src/eggprogs']
  4676. TargetAdd('egg-crop_eggCrop.obj', opts=OPTS, input='eggCrop.cxx')
  4677. TargetAdd('egg-crop.exe', input='egg-crop_eggCrop.obj')
  4678. TargetAdd('egg-crop.exe', input=COMMON_EGG2X_LIBS)
  4679. TargetAdd('egg-crop.exe', opts=['ADVAPI'])
  4680. TargetAdd('egg-make-tube_eggMakeTube.obj', opts=OPTS, input='eggMakeTube.cxx')
  4681. TargetAdd('egg-make-tube.exe', input='egg-make-tube_eggMakeTube.obj')
  4682. TargetAdd('egg-make-tube.exe', input=COMMON_EGG2X_LIBS)
  4683. TargetAdd('egg-make-tube.exe', opts=['ADVAPI'])
  4684. TargetAdd('egg-texture-cards_eggTextureCards.obj', opts=OPTS, input='eggTextureCards.cxx')
  4685. TargetAdd('egg-texture-cards.exe', input='egg-texture-cards_eggTextureCards.obj')
  4686. TargetAdd('egg-texture-cards.exe', input=COMMON_EGG2X_LIBS)
  4687. TargetAdd('egg-texture-cards.exe', opts=['ADVAPI'])
  4688. TargetAdd('egg-topstrip_eggTopstrip.obj', opts=OPTS, input='eggTopstrip.cxx')
  4689. TargetAdd('egg-topstrip.exe', input='egg-topstrip_eggTopstrip.obj')
  4690. TargetAdd('egg-topstrip.exe', input='libp3eggcharbase.lib')
  4691. TargetAdd('egg-topstrip.exe', input=COMMON_EGG2X_LIBS)
  4692. TargetAdd('egg-topstrip.exe', opts=['ADVAPI'])
  4693. TargetAdd('egg-trans_eggTrans.obj', opts=OPTS, input='eggTrans.cxx')
  4694. TargetAdd('egg-trans.exe', input='egg-trans_eggTrans.obj')
  4695. TargetAdd('egg-trans.exe', input=COMMON_EGG2X_LIBS)
  4696. TargetAdd('egg-trans.exe', opts=['ADVAPI'])
  4697. TargetAdd('egg2c_eggToC.obj', opts=OPTS, input='eggToC.cxx')
  4698. TargetAdd('egg2c.exe', input='egg2c_eggToC.obj')
  4699. TargetAdd('egg2c.exe', input=COMMON_EGG2X_LIBS)
  4700. TargetAdd('egg2c.exe', opts=['ADVAPI'])
  4701. TargetAdd('egg-rename_eggRename.obj', opts=OPTS, input='eggRename.cxx')
  4702. TargetAdd('egg-rename.exe', input='egg-rename_eggRename.obj')
  4703. TargetAdd('egg-rename.exe', input=COMMON_EGG2X_LIBS)
  4704. TargetAdd('egg-rename.exe', opts=['ADVAPI'])
  4705. TargetAdd('egg-retarget-anim_eggRetargetAnim.obj', opts=OPTS, input='eggRetargetAnim.cxx')
  4706. TargetAdd('egg-retarget-anim.exe', input='egg-retarget-anim_eggRetargetAnim.obj')
  4707. TargetAdd('egg-retarget-anim.exe', input='libp3eggcharbase.lib')
  4708. TargetAdd('egg-retarget-anim.exe', input=COMMON_EGG2X_LIBS)
  4709. TargetAdd('egg-retarget-anim.exe', opts=['ADVAPI'])
  4710. TargetAdd('egg-list-textures_eggListTextures.obj', opts=OPTS, input='eggListTextures.cxx')
  4711. TargetAdd('egg-list-textures.exe', input='egg-list-textures_eggListTextures.obj')
  4712. TargetAdd('egg-list-textures.exe', input=COMMON_EGG2X_LIBS)
  4713. TargetAdd('egg-list-textures.exe', opts=['ADVAPI'])
  4714. #
  4715. # DIRECTORY: pandatool/src/flt/
  4716. #
  4717. if not PkgSkip("PANDATOOL"):
  4718. OPTS=['DIR:pandatool/src/flt', 'ZLIB']
  4719. TargetAdd('p3flt_composite1.obj', opts=OPTS, input='p3flt_composite1.cxx')
  4720. TargetAdd('libp3flt.lib', input=['p3flt_composite1.obj'])
  4721. #
  4722. # DIRECTORY: pandatool/src/fltegg/
  4723. #
  4724. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4725. OPTS=['DIR:pandatool/src/fltegg']
  4726. TargetAdd('p3fltegg_fltToEggConverter.obj', opts=OPTS, input='fltToEggConverter.cxx')
  4727. TargetAdd('p3fltegg_fltToEggLevelState.obj', opts=OPTS, input='fltToEggLevelState.cxx')
  4728. TargetAdd('libp3fltegg.lib', input=['p3fltegg_fltToEggConverter.obj', 'p3fltegg_fltToEggLevelState.obj'])
  4729. #
  4730. # DIRECTORY: pandatool/src/fltprogs/
  4731. #
  4732. if not PkgSkip("PANDATOOL"):
  4733. OPTS=['DIR:pandatool/src/fltprogs', 'DIR:pandatool/src/flt']
  4734. TargetAdd('flt-info_fltInfo.obj', opts=OPTS, input='fltInfo.cxx')
  4735. TargetAdd('flt-info.exe', input='flt-info_fltInfo.obj')
  4736. TargetAdd('flt-info.exe', input='libp3flt.lib')
  4737. TargetAdd('flt-info.exe', input='libp3progbase.lib')
  4738. TargetAdd('flt-info.exe', input='libp3pandatoolbase.lib')
  4739. TargetAdd('flt-info.exe', input=COMMON_PANDA_LIBS)
  4740. TargetAdd('flt-info.exe', opts=['ADVAPI'])
  4741. TargetAdd('flt-trans_fltTrans.obj', opts=OPTS, input='fltTrans.cxx')
  4742. TargetAdd('flt-trans.exe', input='flt-trans_fltTrans.obj')
  4743. TargetAdd('flt-trans.exe', input='libp3flt.lib')
  4744. TargetAdd('flt-trans.exe', input='libp3progbase.lib')
  4745. TargetAdd('flt-trans.exe', input='libp3pandatoolbase.lib')
  4746. TargetAdd('flt-trans.exe', input=COMMON_PANDA_LIBS)
  4747. TargetAdd('flt-trans.exe', opts=['ADVAPI'])
  4748. if not PkgSkip("EGG"):
  4749. TargetAdd('egg2flt_eggToFlt.obj', opts=OPTS, input='eggToFlt.cxx')
  4750. TargetAdd('egg2flt.exe', input='egg2flt_eggToFlt.obj')
  4751. TargetAdd('egg2flt.exe', input='libp3flt.lib')
  4752. TargetAdd('egg2flt.exe', input=COMMON_EGG2X_LIBS)
  4753. TargetAdd('egg2flt.exe', opts=['ADVAPI'])
  4754. TargetAdd('flt2egg_fltToEgg.obj', opts=OPTS, input='fltToEgg.cxx')
  4755. TargetAdd('flt2egg.exe', input='flt2egg_fltToEgg.obj')
  4756. TargetAdd('flt2egg.exe', input='libp3flt.lib')
  4757. TargetAdd('flt2egg.exe', input='libp3fltegg.lib')
  4758. TargetAdd('flt2egg.exe', input=COMMON_EGG2X_LIBS)
  4759. TargetAdd('flt2egg.exe', opts=['ADVAPI'])
  4760. #
  4761. # DIRECTORY: pandatool/src/imagebase/
  4762. #
  4763. if not PkgSkip("PANDATOOL"):
  4764. OPTS=['DIR:pandatool/src/imagebase']
  4765. TargetAdd('p3imagebase_composite1.obj', opts=OPTS, input='p3imagebase_composite1.cxx')
  4766. TargetAdd('libp3imagebase.lib', input='p3imagebase_composite1.obj')
  4767. #
  4768. # DIRECTORY: pandatool/src/imageprogs/
  4769. #
  4770. if not PkgSkip("PANDATOOL"):
  4771. OPTS=['DIR:pandatool/src/imageprogs']
  4772. TargetAdd('image-info_imageInfo.obj', opts=OPTS, input='imageInfo.cxx')
  4773. TargetAdd('image-info.exe', input='image-info_imageInfo.obj')
  4774. TargetAdd('image-info.exe', input='libp3imagebase.lib')
  4775. TargetAdd('image-info.exe', input='libp3progbase.lib')
  4776. TargetAdd('image-info.exe', input='libp3pandatoolbase.lib')
  4777. TargetAdd('image-info.exe', input=COMMON_PANDA_LIBS)
  4778. TargetAdd('image-info.exe', opts=['ADVAPI'])
  4779. TargetAdd('image-resize_imageResize.obj', opts=OPTS, input='imageResize.cxx')
  4780. TargetAdd('image-resize.exe', input='image-resize_imageResize.obj')
  4781. TargetAdd('image-resize.exe', input='libp3imagebase.lib')
  4782. TargetAdd('image-resize.exe', input='libp3progbase.lib')
  4783. TargetAdd('image-resize.exe', input='libp3pandatoolbase.lib')
  4784. TargetAdd('image-resize.exe', input=COMMON_PANDA_LIBS)
  4785. TargetAdd('image-resize.exe', opts=['ADVAPI'])
  4786. TargetAdd('image-trans_imageTrans.obj', opts=OPTS, input='imageTrans.cxx')
  4787. TargetAdd('image-trans.exe', input='image-trans_imageTrans.obj')
  4788. TargetAdd('image-trans.exe', input='libp3imagebase.lib')
  4789. TargetAdd('image-trans.exe', input='libp3progbase.lib')
  4790. TargetAdd('image-trans.exe', input='libp3pandatoolbase.lib')
  4791. TargetAdd('image-trans.exe', input=COMMON_PANDA_LIBS)
  4792. TargetAdd('image-trans.exe', opts=['ADVAPI'])
  4793. #
  4794. # DIRECTORY: pandatool/src/pfmprogs/
  4795. #
  4796. if not PkgSkip("PANDATOOL"):
  4797. OPTS=['DIR:pandatool/src/pfmprogs']
  4798. TargetAdd('pfm-trans_pfmTrans.obj', opts=OPTS, input='pfmTrans.cxx')
  4799. TargetAdd('pfm-trans.exe', input='pfm-trans_pfmTrans.obj')
  4800. TargetAdd('pfm-trans.exe', input='libp3progbase.lib')
  4801. TargetAdd('pfm-trans.exe', input='libp3pandatoolbase.lib')
  4802. TargetAdd('pfm-trans.exe', input=COMMON_PANDA_LIBS)
  4803. TargetAdd('pfm-trans.exe', opts=['ADVAPI'])
  4804. TargetAdd('pfm-bba_pfmBba.obj', opts=OPTS, input='pfmBba.cxx')
  4805. TargetAdd('pfm-bba_config_pfmprogs.obj', opts=OPTS, input='config_pfmprogs.cxx')
  4806. TargetAdd('pfm-bba.exe', input='pfm-bba_pfmBba.obj')
  4807. TargetAdd('pfm-bba.exe', input='pfm-bba_config_pfmprogs.obj')
  4808. TargetAdd('pfm-bba.exe', input='libp3progbase.lib')
  4809. TargetAdd('pfm-bba.exe', input='libp3pandatoolbase.lib')
  4810. TargetAdd('pfm-bba.exe', input=COMMON_PANDA_LIBS)
  4811. TargetAdd('pfm-bba.exe', opts=['ADVAPI'])
  4812. #
  4813. # DIRECTORY: pandatool/src/lwo/
  4814. #
  4815. if not PkgSkip("PANDATOOL"):
  4816. OPTS=['DIR:pandatool/src/lwo']
  4817. TargetAdd('p3lwo_composite1.obj', opts=OPTS, input='p3lwo_composite1.cxx')
  4818. TargetAdd('libp3lwo.lib', input='p3lwo_composite1.obj')
  4819. #
  4820. # DIRECTORY: pandatool/src/lwoegg/
  4821. #
  4822. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4823. OPTS=['DIR:pandatool/src/lwoegg']
  4824. TargetAdd('p3lwoegg_composite1.obj', opts=OPTS, input='p3lwoegg_composite1.cxx')
  4825. TargetAdd('libp3lwoegg.lib', input='p3lwoegg_composite1.obj')
  4826. #
  4827. # DIRECTORY: pandatool/src/lwoprogs/
  4828. #
  4829. if not PkgSkip("PANDATOOL"):
  4830. OPTS=['DIR:pandatool/src/lwoprogs', 'DIR:pandatool/src/lwo']
  4831. TargetAdd('lwo-scan_lwoScan.obj', opts=OPTS, input='lwoScan.cxx')
  4832. TargetAdd('lwo-scan.exe', input='lwo-scan_lwoScan.obj')
  4833. TargetAdd('lwo-scan.exe', input='libp3lwo.lib')
  4834. TargetAdd('lwo-scan.exe', input='libp3progbase.lib')
  4835. TargetAdd('lwo-scan.exe', input='libp3pandatoolbase.lib')
  4836. TargetAdd('lwo-scan.exe', input=COMMON_PANDA_LIBS)
  4837. TargetAdd('lwo-scan.exe', opts=['ADVAPI'])
  4838. if not PkgSkip("EGG"):
  4839. TargetAdd('lwo2egg_lwoToEgg.obj', opts=OPTS, input='lwoToEgg.cxx')
  4840. TargetAdd('lwo2egg.exe', input='lwo2egg_lwoToEgg.obj')
  4841. TargetAdd('lwo2egg.exe', input='libp3lwo.lib')
  4842. TargetAdd('lwo2egg.exe', input='libp3lwoegg.lib')
  4843. TargetAdd('lwo2egg.exe', input=COMMON_EGG2X_LIBS)
  4844. TargetAdd('lwo2egg.exe', opts=['ADVAPI'])
  4845. #
  4846. # DIRECTORY: pandatool/src/vrml/
  4847. #
  4848. if not PkgSkip("PANDATOOL"):
  4849. OPTS=['DIR:pandatool/src/vrml', 'ZLIB', 'BISONPREFIX_vrmlyy']
  4850. CreateFile(GetOutputDir() + "/include/vrmlParser.h")
  4851. TargetAdd('p3vrml_vrmlParser.obj', opts=OPTS, input='vrmlParser.yxx')
  4852. TargetAdd('vrmlParser.h', input='p3vrml_vrmlParser.obj', opts=['DEPENDENCYONLY'])
  4853. TargetAdd('p3vrml_vrmlLexer.obj', opts=OPTS, input='vrmlLexer.lxx')
  4854. TargetAdd('p3vrml_parse_vrml.obj', opts=OPTS, input='parse_vrml.cxx')
  4855. TargetAdd('p3vrml_standard_nodes.obj', opts=OPTS, input='standard_nodes.cxx')
  4856. TargetAdd('p3vrml_vrmlNode.obj', opts=OPTS, input='vrmlNode.cxx')
  4857. TargetAdd('p3vrml_vrmlNodeType.obj', opts=OPTS, input='vrmlNodeType.cxx')
  4858. TargetAdd('libp3vrml.lib', input='p3vrml_parse_vrml.obj')
  4859. TargetAdd('libp3vrml.lib', input='p3vrml_standard_nodes.obj')
  4860. TargetAdd('libp3vrml.lib', input='p3vrml_vrmlNode.obj')
  4861. TargetAdd('libp3vrml.lib', input='p3vrml_vrmlNodeType.obj')
  4862. TargetAdd('libp3vrml.lib', input='p3vrml_vrmlParser.obj')
  4863. TargetAdd('libp3vrml.lib', input='p3vrml_vrmlLexer.obj')
  4864. #
  4865. # DIRECTORY: pandatool/src/vrmlegg/
  4866. #
  4867. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4868. OPTS=['DIR:pandatool/src/vrmlegg', 'DIR:pandatool/src/vrml']
  4869. TargetAdd('p3vrmlegg_indexedFaceSet.obj', opts=OPTS, input='indexedFaceSet.cxx')
  4870. TargetAdd('p3vrmlegg_vrmlAppearance.obj', opts=OPTS, input='vrmlAppearance.cxx')
  4871. TargetAdd('p3vrmlegg_vrmlToEggConverter.obj', opts=OPTS, input='vrmlToEggConverter.cxx')
  4872. TargetAdd('libp3vrmlegg.lib', input='p3vrmlegg_indexedFaceSet.obj')
  4873. TargetAdd('libp3vrmlegg.lib', input='p3vrmlegg_vrmlAppearance.obj')
  4874. TargetAdd('libp3vrmlegg.lib', input='p3vrmlegg_vrmlToEggConverter.obj')
  4875. #
  4876. # DIRECTORY: pandatool/src/xfile/
  4877. #
  4878. if not PkgSkip("PANDATOOL"):
  4879. OPTS=['DIR:pandatool/src/xfile', 'ZLIB', 'BISONPREFIX_xyy', 'FLEXDASHI']
  4880. CreateFile(GetOutputDir() + "/include/xParser.h")
  4881. TargetAdd('p3xfile_xParser.obj', opts=OPTS, input='xParser.yxx')
  4882. TargetAdd('xParser.h', input='p3xfile_xParser.obj', opts=['DEPENDENCYONLY'])
  4883. TargetAdd('p3xfile_xLexer.obj', opts=OPTS, input='xLexer.lxx')
  4884. TargetAdd('p3xfile_composite1.obj', opts=OPTS, input='p3xfile_composite1.cxx')
  4885. TargetAdd('libp3xfile.lib', input='p3xfile_composite1.obj')
  4886. TargetAdd('libp3xfile.lib', input='p3xfile_xParser.obj')
  4887. TargetAdd('libp3xfile.lib', input='p3xfile_xLexer.obj')
  4888. #
  4889. # DIRECTORY: pandatool/src/xfileegg/
  4890. #
  4891. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4892. OPTS=['DIR:pandatool/src/xfileegg', 'DIR:pandatool/src/xfile']
  4893. TargetAdd('p3xfileegg_composite1.obj', opts=OPTS, input='p3xfileegg_composite1.cxx')
  4894. TargetAdd('libp3xfileegg.lib', input='p3xfileegg_composite1.obj')
  4895. #
  4896. # DIRECTORY: pandatool/src/ptloader/
  4897. #
  4898. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4899. if not PkgSkip("FCOLLADA"):
  4900. DefSymbol("FCOLLADA", "HAVE_FCOLLADA")
  4901. OPTS=['DIR:pandatool/src/ptloader', 'DIR:pandatool/src/flt', 'DIR:pandatool/src/lwo', 'DIR:pandatool/src/xfile', 'DIR:pandatool/src/xfileegg', 'DIR:pandatool/src/daeegg', 'BUILDING:PTLOADER', 'FCOLLADA']
  4902. TargetAdd('p3ptloader_config_ptloader.obj', opts=OPTS, input='config_ptloader.cxx', dep='dtool_have_fcollada.dat')
  4903. TargetAdd('p3ptloader_loaderFileTypePandatool.obj', opts=OPTS, input='loaderFileTypePandatool.cxx')
  4904. TargetAdd('libp3ptloader.dll', input='p3ptloader_config_ptloader.obj')
  4905. TargetAdd('libp3ptloader.dll', input='p3ptloader_loaderFileTypePandatool.obj')
  4906. TargetAdd('libp3ptloader.dll', input='libp3fltegg.lib')
  4907. TargetAdd('libp3ptloader.dll', input='libp3flt.lib')
  4908. TargetAdd('libp3ptloader.dll', input='libp3lwoegg.lib')
  4909. TargetAdd('libp3ptloader.dll', input='libp3lwo.lib')
  4910. TargetAdd('libp3ptloader.dll', input='libp3dxfegg.lib')
  4911. TargetAdd('libp3ptloader.dll', input='libp3dxf.lib')
  4912. #TargetAdd('libp3ptloader.dll', input='libp3objegg.lib')
  4913. TargetAdd('libp3ptloader.dll', input='libp3vrmlegg.lib')
  4914. TargetAdd('libp3ptloader.dll', input='libp3vrml.lib')
  4915. TargetAdd('libp3ptloader.dll', input='libp3xfileegg.lib')
  4916. TargetAdd('libp3ptloader.dll', input='libp3xfile.lib')
  4917. if not PkgSkip("FCOLLADA"): TargetAdd('libp3ptloader.dll', input='libp3daeegg.lib')
  4918. TargetAdd('libp3ptloader.dll', input='libp3eggbase.lib')
  4919. TargetAdd('libp3ptloader.dll', input='libp3progbase.lib')
  4920. TargetAdd('libp3ptloader.dll', input='libp3converter.lib')
  4921. TargetAdd('libp3ptloader.dll', input='libp3pandatoolbase.lib')
  4922. TargetAdd('libp3ptloader.dll', input='libpandaegg.dll')
  4923. TargetAdd('libp3ptloader.dll', input=COMMON_PANDA_LIBS)
  4924. TargetAdd('libp3ptloader.dll', opts=['MODULE', 'ADVAPI', 'FCOLLADA', 'WINUSER'])
  4925. #
  4926. # DIRECTORY: pandatool/src/miscprogs/
  4927. #
  4928. # This is a bit of an esoteric tool, and it causes issues because
  4929. # it conflicts with tools of the same name in different packages.
  4930. #if not PkgSkip("PANDATOOL"):
  4931. # OPTS=['DIR:pandatool/src/miscprogs']
  4932. # TargetAdd('bin2c_binToC.obj', opts=OPTS, input='binToC.cxx')
  4933. # TargetAdd('bin2c.exe', input='bin2c_binToC.obj')
  4934. # TargetAdd('bin2c.exe', input='libp3progbase.lib')
  4935. # TargetAdd('bin2c.exe', input='libp3pandatoolbase.lib')
  4936. # TargetAdd('bin2c.exe', input=COMMON_PANDA_LIBS)
  4937. # TargetAdd('bin2c.exe', opts=['ADVAPI'])
  4938. #
  4939. # DIRECTORY: pandatool/src/pstatserver/
  4940. #
  4941. if not PkgSkip("PANDATOOL"):
  4942. OPTS=['DIR:pandatool/src/pstatserver']
  4943. TargetAdd('p3pstatserver_composite1.obj', opts=OPTS, input='p3pstatserver_composite1.cxx')
  4944. TargetAdd('libp3pstatserver.lib', input='p3pstatserver_composite1.obj')
  4945. #
  4946. # DIRECTORY: pandatool/src/text-stats/
  4947. #
  4948. if not PkgSkip("PANDATOOL") and GetTarget() != 'emscripten':
  4949. OPTS=['DIR:pandatool/src/text-stats']
  4950. TargetAdd('text-stats_textMonitor.obj', opts=OPTS, input='textMonitor.cxx')
  4951. TargetAdd('text-stats_textStats.obj', opts=OPTS, input='textStats.cxx')
  4952. TargetAdd('text-stats.exe', input='text-stats_textMonitor.obj')
  4953. TargetAdd('text-stats.exe', input='text-stats_textStats.obj')
  4954. TargetAdd('text-stats.exe', input='libp3progbase.lib')
  4955. TargetAdd('text-stats.exe', input='libp3pstatserver.lib')
  4956. TargetAdd('text-stats.exe', input='libp3pandatoolbase.lib')
  4957. TargetAdd('text-stats.exe', input=COMMON_PANDA_LIBS)
  4958. TargetAdd('text-stats.exe', opts=['ADVAPI'])
  4959. #
  4960. # DIRECTORY: pandatool/src/vrmlprogs/
  4961. #
  4962. if not PkgSkip("PANDATOOL"):
  4963. OPTS=['DIR:pandatool/src/vrmlprogs', 'DIR:pandatool/src/vrml', 'DIR:pandatool/src/vrmlegg']
  4964. TargetAdd('vrml-trans_vrmlTrans.obj', opts=OPTS, input='vrmlTrans.cxx')
  4965. TargetAdd('vrml-trans.exe', input='vrml-trans_vrmlTrans.obj')
  4966. TargetAdd('vrml-trans.exe', input='libp3vrml.lib')
  4967. TargetAdd('vrml-trans.exe', input='libp3progbase.lib')
  4968. TargetAdd('vrml-trans.exe', input='libp3pandatoolbase.lib')
  4969. TargetAdd('vrml-trans.exe', input=COMMON_PANDA_LIBS)
  4970. TargetAdd('vrml-trans.exe', opts=['ADVAPI'])
  4971. if not PkgSkip("EGG"):
  4972. TargetAdd('vrml2egg_vrmlToEgg.obj', opts=OPTS, input='vrmlToEgg.cxx')
  4973. TargetAdd('vrml2egg.exe', input='vrml2egg_vrmlToEgg.obj')
  4974. TargetAdd('vrml2egg.exe', input='libp3vrmlegg.lib')
  4975. TargetAdd('vrml2egg.exe', input='libp3vrml.lib')
  4976. TargetAdd('vrml2egg.exe', input=COMMON_EGG2X_LIBS)
  4977. TargetAdd('vrml2egg.exe', opts=['ADVAPI'])
  4978. #
  4979. # DIRECTORY: pandatool/src/win-stats/
  4980. # DIRECTORY: pandatool/src/gtk-stats/
  4981. #
  4982. if not PkgSkip("PANDATOOL") and (GetTarget() in ('windows', 'darwin') or not PkgSkip("GTK3")):
  4983. if GetTarget() == 'windows':
  4984. OPTS=['DIR:pandatool/src/win-stats']
  4985. TargetAdd('pstats_composite1.obj', opts=OPTS, input='winstats_composite1.cxx')
  4986. elif GetTarget() == 'darwin':
  4987. OPTS=['DIR:pandatool/src/mac-stats']
  4988. TargetAdd('pstats_composite1.obj', opts=OPTS, input='macstats_composite1.mm')
  4989. else:
  4990. OPTS=['DIR:pandatool/src/gtk-stats', 'GTK3']
  4991. TargetAdd('pstats_composite1.obj', opts=OPTS, input='gtkstats_composite1.cxx')
  4992. TargetAdd('pstats.exe', input='pstats_composite1.obj')
  4993. TargetAdd('pstats.exe', input='libp3pstatserver.lib')
  4994. TargetAdd('pstats.exe', input='libp3progbase.lib')
  4995. TargetAdd('pstats.exe', input='libp3pandatoolbase.lib')
  4996. TargetAdd('pstats.exe', input=COMMON_PANDA_LIBS)
  4997. TargetAdd('pstats.exe', opts=['SUBSYSTEM:WINDOWS', 'WINCOMCTL', 'WINCOMDLG', 'WINSOCK', 'WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM', 'UXTHEME', 'GTK3', 'COCOA', 'CARBON', 'QUARTZ'])
  4998. #
  4999. # DIRECTORY: pandatool/src/xfileprogs/
  5000. #
  5001. if not PkgSkip("PANDATOOL"):
  5002. OPTS=['DIR:pandatool/src/xfileprogs', 'DIR:pandatool/src/xfile', 'DIR:pandatool/src/xfileegg']
  5003. TargetAdd('x-trans_xFileTrans.obj', opts=OPTS, input='xFileTrans.cxx')
  5004. TargetAdd('x-trans.exe', input='x-trans_xFileTrans.obj')
  5005. TargetAdd('x-trans.exe', input='libp3progbase.lib')
  5006. TargetAdd('x-trans.exe', input='libp3xfile.lib')
  5007. TargetAdd('x-trans.exe', input='libp3pandatoolbase.lib')
  5008. TargetAdd('x-trans.exe', input=COMMON_PANDA_LIBS)
  5009. TargetAdd('x-trans.exe', opts=['ADVAPI'])
  5010. if not PkgSkip("EGG"):
  5011. TargetAdd('egg2x_eggToX.obj', opts=OPTS, input='eggToX.cxx')
  5012. TargetAdd('egg2x.exe', input='egg2x_eggToX.obj')
  5013. TargetAdd('egg2x.exe', input='libp3xfileegg.lib')
  5014. TargetAdd('egg2x.exe', input='libp3xfile.lib')
  5015. TargetAdd('egg2x.exe', input=COMMON_EGG2X_LIBS)
  5016. TargetAdd('egg2x.exe', opts=['ADVAPI'])
  5017. TargetAdd('x2egg_xFileToEgg.obj', opts=OPTS, input='xFileToEgg.cxx')
  5018. TargetAdd('x2egg.exe', input='x2egg_xFileToEgg.obj')
  5019. TargetAdd('x2egg.exe', input='libp3xfileegg.lib')
  5020. TargetAdd('x2egg.exe', input='libp3xfile.lib')
  5021. TargetAdd('x2egg.exe', input=COMMON_EGG2X_LIBS)
  5022. TargetAdd('x2egg.exe', opts=['ADVAPI'])
  5023. #
  5024. # DIRECTORY: contrib/src/ai/
  5025. #
  5026. if not PkgSkip("CONTRIB"):
  5027. OPTS=['DIR:contrib/src/ai', 'BUILDING:PANDAAI']
  5028. TargetAdd('p3ai_composite1.obj', opts=OPTS, input='p3ai_composite1.cxx')
  5029. TargetAdd('libpandaai.dll', input='p3ai_composite1.obj')
  5030. TargetAdd('libpandaai.dll', input=COMMON_PANDA_LIBS)
  5031. OPTS=['DIR:contrib/src/ai']
  5032. IGATEFILES=GetDirectoryContents('contrib/src/ai', ["*.h", "*_composite*.cxx"])
  5033. TargetAdd('libpandaai.in', opts=OPTS, input=IGATEFILES)
  5034. TargetAdd('libpandaai.in', opts=['IMOD:panda3d.ai', 'ILIB:libpandaai', 'SRCDIR:contrib/src/ai'])
  5035. PyTargetAdd('ai_module.obj', input='libpandaai.in')
  5036. PyTargetAdd('ai_module.obj', opts=OPTS)
  5037. PyTargetAdd('ai_module.obj', opts=['IMOD:panda3d.ai', 'ILIB:ai', 'IMPORT:panda3d.core'])
  5038. PyTargetAdd('ai.pyd', input='ai_module.obj')
  5039. PyTargetAdd('ai.pyd', input='libpandaai_igate.obj')
  5040. PyTargetAdd('ai.pyd', input='libpandaai.dll')
  5041. PyTargetAdd('ai.pyd', input='libp3interrogatedb.dll')
  5042. PyTargetAdd('ai.pyd', input=COMMON_PANDA_LIBS)
  5043. #
  5044. # DIRECTORY: contrib/src/rplight/
  5045. #
  5046. if not PkgSkip("CONTRIB") and not PkgSkip("PYTHON"):
  5047. OPTS=['DIR:contrib/src/rplight', 'BUILDING:RPLIGHT']
  5048. TargetAdd('p3rplight_composite1.obj', opts=OPTS, input='p3rplight_composite1.cxx')
  5049. IGATEFILES=GetDirectoryContents('contrib/src/rplight', ["*.h", "*_composite*.cxx"])
  5050. TargetAdd('libp3rplight.in', opts=OPTS, input=IGATEFILES)
  5051. TargetAdd('libp3rplight.in', opts=['IMOD:panda3d._rplight', 'ILIB:libp3rplight', 'SRCDIR:contrib/src/rplight'])
  5052. PyTargetAdd('rplight_module.obj', input='libp3rplight.in')
  5053. PyTargetAdd('rplight_module.obj', opts=OPTS)
  5054. PyTargetAdd('rplight_module.obj', opts=['IMOD:panda3d._rplight', 'ILIB:_rplight', 'IMPORT:panda3d.core'])
  5055. PyTargetAdd('_rplight.pyd', input='rplight_module.obj')
  5056. PyTargetAdd('_rplight.pyd', input='libp3rplight_igate.obj')
  5057. PyTargetAdd('_rplight.pyd', input='p3rplight_composite1.obj')
  5058. PyTargetAdd('_rplight.pyd', input='libp3interrogatedb.dll')
  5059. PyTargetAdd('_rplight.pyd', input=COMMON_PANDA_LIBS)
  5060. #
  5061. # DIRECTORY: pandatool/src/deploy-stub
  5062. #
  5063. if PkgSkip("PYTHON") == 0:
  5064. OPTS=['DIR:pandatool/src/deploy-stub', 'BUILDING:DEPLOYSTUB']
  5065. PyTargetAdd('deploy-stub.obj', opts=OPTS, input='deploy-stub.c')
  5066. if GetTarget() == 'windows':
  5067. PyTargetAdd('frozen_dllmain.obj', opts=OPTS, input='frozen_dllmain.c')
  5068. if GetTarget() == 'linux' or GetTarget() == 'freebsd':
  5069. # Setup rpath so libs can be found in the same directory as the deployed game
  5070. LibName('DEPLOYSTUB', "-Wl,--disable-new-dtags,-rpath,\\$ORIGIN")
  5071. LibName('DEPLOYSTUB', "-Wl,-z,origin")
  5072. LibName('DEPLOYSTUB', "-rdynamic")
  5073. elif GetTarget() == 'darwin':
  5074. LibName('DEPLOYSTUB', "-Wl,-sectcreate,__PANDA,__panda,/dev/null")
  5075. PyTargetAdd('deploy-stub.exe', input='deploy-stub.obj')
  5076. if GetTarget() == 'windows':
  5077. PyTargetAdd('deploy-stub.exe', input='frozen_dllmain.obj')
  5078. PyTargetAdd('deploy-stub.exe', opts=['WINSHELL', 'DEPLOYSTUB', 'NOICON', 'ANDROID'])
  5079. if GetTarget() == 'emscripten':
  5080. PyTargetAdd('deploy-stub.exe', opts=['ZLIB'])
  5081. if GetTarget() == 'windows':
  5082. PyTargetAdd('deploy-stubw.exe', input='deploy-stub.obj')
  5083. PyTargetAdd('deploy-stubw.exe', input='frozen_dllmain.obj')
  5084. PyTargetAdd('deploy-stubw.exe', opts=['SUBSYSTEM:WINDOWS', 'WINSHELL', 'DEPLOYSTUB', 'NOICON'])
  5085. elif GetTarget() == 'darwin':
  5086. DefSymbol('MACOS_APP_BUNDLE', 'MACOS_APP_BUNDLE')
  5087. OPTS = OPTS + ['MACOS_APP_BUNDLE']
  5088. PyTargetAdd('deploy-stubw.obj', opts=OPTS, input='deploy-stub.c')
  5089. PyTargetAdd('deploy-stubw.exe', input='deploy-stubw.obj')
  5090. PyTargetAdd('deploy-stubw.exe', opts=['MACOS_APP_BUNDLE', 'DEPLOYSTUB', 'NOICON'])
  5091. elif GetTarget() == 'android':
  5092. TargetAdd('org/jnius/NativeInvocationHandler.class', opts=OPTS, input='NativeInvocationHandler.java')
  5093. TargetAdd('classes.dex', input='org/jnius/NativeInvocationHandler.class')
  5094. PyTargetAdd('deploy-stubw_android_main.obj', opts=OPTS, input='android_main.cxx')
  5095. PyTargetAdd('deploy-stubw_android_log.obj', opts=OPTS, input='android_log.c')
  5096. PyTargetAdd('libdeploy-stubw.dll', input='android_native_app_glue.obj')
  5097. PyTargetAdd('libdeploy-stubw.dll', input='deploy-stubw_android_main.obj')
  5098. PyTargetAdd('libdeploy-stubw.dll', input='deploy-stubw_android_log.obj')
  5099. PyTargetAdd('libdeploy-stubw.dll', input=COMMON_PANDA_LIBS)
  5100. PyTargetAdd('libdeploy-stubw.dll', input='libp3android.dll')
  5101. PyTargetAdd('libdeploy-stubw.dll', opts=['DEPLOYSTUB', 'ANDROID'])
  5102. #
  5103. # Generate the models directory and samples directory
  5104. #
  5105. if not PkgSkip("DIRECT") and not PkgSkip("EGG"):
  5106. model_extensions = ["*.egg"]
  5107. for model in GetDirectoryContents("models/misc", model_extensions):
  5108. if not PkgSkip("ZLIB") and not PkgSkip("DEPLOYTOOLS"):
  5109. newname = model[:-4] + ".egg.pz"
  5110. else:
  5111. newname = model[:-4] + ".egg"
  5112. TargetAdd(GetOutputDir()+"/models/misc/"+newname, input="models/misc/"+model)
  5113. for model in GetDirectoryContents("models/gui", model_extensions):
  5114. if not PkgSkip("ZLIB") and not PkgSkip("DEPLOYTOOLS"):
  5115. newname = model[:-4] + ".egg.pz"
  5116. else:
  5117. newname = model[:-4] + ".egg"
  5118. TargetAdd(GetOutputDir()+"/models/gui/"+newname, input="models/gui/"+model)
  5119. for model in GetDirectoryContents("models", model_extensions):
  5120. if not PkgSkip("ZLIB") and not PkgSkip("DEPLOYTOOLS"):
  5121. newname = model[:-4] + ".egg.pz"
  5122. else:
  5123. newname = model[:-4] + ".egg"
  5124. TargetAdd(GetOutputDir()+"/models/"+newname, input="models/"+model)
  5125. if not PkgSkip("DIRECT"):
  5126. CopyAllFiles(GetOutputDir()+"/models/audio/sfx/", "models/audio/sfx/", ".wav")
  5127. CopyAllFiles(GetOutputDir()+"/models/icons/", "models/icons/", ".gif")
  5128. CopyAllFiles(GetOutputDir()+"/models/maps/", "models/maps/", ".jpg")
  5129. CopyAllFiles(GetOutputDir()+"/models/maps/", "models/maps/", ".png")
  5130. CopyAllFiles(GetOutputDir()+"/models/maps/", "models/maps/", ".rgb")
  5131. CopyAllFiles(GetOutputDir()+"/models/maps/", "models/maps/", ".rgba")
  5132. ##########################################################################################
  5133. #
  5134. # Dependency-Based Distributed Build System.
  5135. #
  5136. ##########################################################################################
  5137. DEPENDENCYQUEUE=[]
  5138. for target in TARGET_LIST:
  5139. name = target.name
  5140. inputs = target.inputs
  5141. opts = target.opts
  5142. deps = target.deps
  5143. DEPENDENCYQUEUE.append([CompileAnything, [name, inputs, opts], [name], deps, []])
  5144. def BuildWorker(taskqueue, donequeue):
  5145. while True:
  5146. try:
  5147. task = taskqueue.get(timeout=1)
  5148. except:
  5149. ProgressOutput(None, "Waiting for tasks...")
  5150. task = taskqueue.get()
  5151. sys.stdout.flush()
  5152. if task == 0:
  5153. return
  5154. try:
  5155. task[0](*task[1])
  5156. donequeue.put(task)
  5157. except:
  5158. donequeue.put(0)
  5159. def AllSourcesReady(task, pending):
  5160. sources = task[3]
  5161. for x in sources:
  5162. if x in pending:
  5163. return False
  5164. sources = task[1][1]
  5165. for x in sources:
  5166. if x in pending:
  5167. return False
  5168. altsources = task[4]
  5169. for x in altsources:
  5170. if x in pending:
  5171. return False
  5172. return True
  5173. def ParallelMake(tasklist):
  5174. # Create the communication queues.
  5175. donequeue = queue.Queue()
  5176. taskqueue = queue.Queue()
  5177. # Build up a table listing all the pending targets
  5178. #task = [CompileAnything, [name, inputs, opts], [name], deps, []]
  5179. # task[2] = [name]
  5180. # task[3] = deps
  5181. pending = {}
  5182. for task in tasklist:
  5183. for target in task[2]:
  5184. pending[target] = 1
  5185. # Create the workers
  5186. for slave in range(THREADCOUNT):
  5187. th = threading.Thread(target=BuildWorker, args=[taskqueue, donequeue])
  5188. th.daemon = True
  5189. th.start()
  5190. # Feed tasks to the workers.
  5191. tasksqueued = 0
  5192. while True:
  5193. if tasksqueued < THREADCOUNT:
  5194. extras = []
  5195. for task in tasklist:
  5196. if tasksqueued < THREADCOUNT and AllSourcesReady(task, pending):
  5197. if NeedsBuild(task[2], task[3]):
  5198. tasksqueued += 1
  5199. taskqueue.put(task)
  5200. else:
  5201. for target in task[2]:
  5202. del pending[target]
  5203. else:
  5204. extras.append(task)
  5205. tasklist = extras
  5206. sys.stdout.flush()
  5207. if tasksqueued == 0:
  5208. if len(tasklist) > 0:
  5209. continue
  5210. break
  5211. donetask = donequeue.get()
  5212. if donetask == 0:
  5213. exit("Build process aborting.")
  5214. sys.stdout.flush()
  5215. tasksqueued -= 1
  5216. JustBuilt(donetask[2], donetask[3])
  5217. for target in donetask[2]:
  5218. del pending[target]
  5219. # Kill the workers.
  5220. for slave in range(THREADCOUNT):
  5221. taskqueue.put(0)
  5222. # Make sure there aren't any unsatisfied tasks
  5223. if len(tasklist) > 0:
  5224. exit("Dependency problems: {0} tasks not finished. First task unsatisfied: {1}".format(len(tasklist), tasklist[0][2]))
  5225. def SequentialMake(tasklist):
  5226. i = 0
  5227. for task in tasklist:
  5228. if NeedsBuild(task[2], task[3]):
  5229. task[0](*task[1] + [(i * 100.0) / len(tasklist)])
  5230. JustBuilt(task[2], task[3])
  5231. i += 1
  5232. def RunDependencyQueue(tasklist):
  5233. if THREADCOUNT != 0:
  5234. ParallelMake(tasklist)
  5235. else:
  5236. SequentialMake(tasklist)
  5237. try:
  5238. RunDependencyQueue(DEPENDENCYQUEUE)
  5239. finally:
  5240. SaveDependencyCache()
  5241. # Run the test suite.
  5242. if RUNTESTS:
  5243. cmdstr = BracketNameWithQuotes(SDK["PYTHONEXEC"].replace('\\', '/'))
  5244. cmdstr += " -B -m pytest tests"
  5245. if GetVerbose():
  5246. cmdstr += " --verbose"
  5247. oscmd(cmdstr)
  5248. # Write out information about the Python versions in the built dir.
  5249. python_version_info = GetCurrentPythonVersionInfo()
  5250. UpdatePythonVersionInfoFile(python_version_info)
  5251. ##########################################################################################
  5252. #
  5253. # The Installers
  5254. #
  5255. # Under windows, we can build an 'exe' package using NSIS
  5256. # Under linux, we can build a 'deb' package or an 'rpm' package.
  5257. # Under OSX, we can make a 'dmg' package.
  5258. #
  5259. ##########################################################################################
  5260. if INSTALLER:
  5261. ProgressOutput(100.0, "Building installer")
  5262. from makepackage import MakeInstaller
  5263. # When using the --installer flag, only install for the current version.
  5264. python_versions = []
  5265. if python_version_info:
  5266. python_versions.append(python_version_info)
  5267. MakeInstaller(version=VERSION, outputdir=GetOutputDir(),
  5268. optimize=GetOptimize(), compressor=COMPRESSOR,
  5269. debversion=DEBVERSION, rpmversion=RPMVERSION,
  5270. rpmrelease=RPMRELEASE, python_versions=python_versions)
  5271. if WHEEL:
  5272. ProgressOutput(100.0, "Building wheel")
  5273. from makewheel import makewheel
  5274. makewheel(WHLVERSION, GetOutputDir())
  5275. ##########################################################################################
  5276. #
  5277. # Print final status report.
  5278. #
  5279. ##########################################################################################
  5280. WARNINGS.append("Elapsed Time: "+PrettyTime(time.time() - STARTTIME))
  5281. printStatus("Makepanda Final Status Report", WARNINGS)
  5282. print(GetColor("green") + "Build successfully finished, elapsed time: " + PrettyTime(time.time() - STARTTIME) + GetColor())