makepanda.py 272 KB

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