makepanda.py 271 KB

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