makepanda.py 336 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638
  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. try:
  11. import sys, os, platform, time, stat, re, getopt, threading, signal, shutil
  12. if sys.platform == "darwin" or sys.version_info >= (2, 6):
  13. import plistlib
  14. if sys.version_info >= (3, 0):
  15. import queue
  16. else:
  17. import Queue as queue
  18. except KeyboardInterrupt:
  19. raise
  20. except:
  21. print("You are either using an incomplete or an old version of Python!")
  22. print("Please install the development package of Python and try again.")
  23. exit(1)
  24. from makepandacore import *
  25. from installpanda import *
  26. import time
  27. import os
  28. import sys
  29. ########################################################################
  30. ##
  31. ## PARSING THE COMMAND LINE OPTIONS
  32. ##
  33. ## You might be tempted to change the defaults by editing them
  34. ## here. Don't do it. Instead, create a script that compiles
  35. ## panda with your preferred options. Or, create
  36. ## a 'makepandaPreferences' file and put it into your python path.
  37. ##
  38. ########################################################################
  39. COMPILER=0
  40. INSTALLER=0
  41. WHEEL=0
  42. RUNTESTS=0
  43. GENMAN=0
  44. COMPRESSOR="zlib"
  45. THREADCOUNT=0
  46. CFLAGS=""
  47. CXXFLAGS=""
  48. LDFLAGS=""
  49. RTDIST=0
  50. RTDIST_VERSION=None
  51. RUNTIME=0
  52. DISTRIBUTOR=""
  53. VERSION=None
  54. DEBVERSION=None
  55. WHLVERSION=None
  56. RPMRELEASE="1"
  57. GIT_COMMIT=None
  58. P3DSUFFIX=None
  59. MAJOR_VERSION=None
  60. COREAPI_VERSION=None
  61. PLUGIN_VERSION=None
  62. OSXTARGET=None
  63. OSX_ARCHS=[]
  64. HOST_URL=None
  65. global STRDXSDKVERSION, BOOUSEINTELCOMPILER
  66. STRDXSDKVERSION = 'default'
  67. WINDOWS_SDK = None
  68. MSVC_VERSION = None
  69. BOOUSEINTELCOMPILER = False
  70. OPENCV_VER_23 = False
  71. if "MACOSX_DEPLOYMENT_TARGET" in os.environ:
  72. OSXTARGET=os.environ["MACOSX_DEPLOYMENT_TARGET"]
  73. PkgListSet(["PYTHON", "DIRECT", # Python support
  74. "GL", "GLES", "GLES2"] + DXVERSIONS + ["TINYDISPLAY", "NVIDIACG", # 3D graphics
  75. "EGL", # OpenGL (ES) integration
  76. "EIGEN", # Linear algebra acceleration
  77. "OPENAL", "FMODEX", # Audio playback
  78. "VORBIS", "OPUS", "FFMPEG", "SWSCALE", "SWRESAMPLE", # Audio decoding
  79. "ODE", "PHYSX", "BULLET", "PANDAPHYSICS", # Physics
  80. "SPEEDTREE", # SpeedTree
  81. "ZLIB", "PNG", "JPEG", "TIFF", "OPENEXR", "SQUISH", # 2D Formats support
  82. ] + MAYAVERSIONS + MAXVERSIONS + [ "FCOLLADA", "ASSIMP", "EGG", # 3D Formats support
  83. "FREETYPE", "HARFBUZZ", # Text rendering
  84. "VRPN", "OPENSSL", # Transport
  85. "FFTW", # Algorithm helpers
  86. "ARTOOLKIT", "OPENCV", "DIRECTCAM", "VISION", # Augmented Reality
  87. "GTK2", # GTK2 is used for PStats on Unix
  88. "MFC", "WX", "FLTK", # Used for web plug-in only
  89. "ROCKET", "AWESOMIUM", # GUI libraries
  90. "CARBON", "COCOA", # Mac OS X toolkits
  91. "X11", # Unix platform support
  92. "PANDATOOL", "PVIEW", "DEPLOYTOOLS", # Toolchain
  93. "SKEL", # Example SKEL project
  94. "PANDAFX", # Some distortion special lenses
  95. "PANDAPARTICLESYSTEM", # Built in particle system
  96. "CONTRIB", # Experimental
  97. "SSE2", "NEON", # Compiler features
  98. ])
  99. CheckPandaSourceTree()
  100. def keyboardInterruptHandler(x,y):
  101. exit("keyboard interrupt")
  102. signal.signal(signal.SIGINT, keyboardInterruptHandler)
  103. ########################################################################
  104. ##
  105. ## Command-line parser.
  106. ##
  107. ## You can type "makepanda --help" to see all the options.
  108. ##
  109. ########################################################################
  110. def usage(problem):
  111. if (problem):
  112. print("")
  113. print("Error parsing command-line input: %s" % (problem))
  114. print("")
  115. print("Makepanda generates a 'built' subdirectory containing a")
  116. print("compiled copy of Panda3D. Command-line arguments are:")
  117. print("")
  118. print(" --help (print the help message you're reading now)")
  119. print(" --verbose (print out more information)")
  120. print(" --runtime (build a runtime build instead of an SDK build)")
  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(" --host URL (set the host url (runtime build only))")
  130. print(" --threads N (use the multithreaded build system. see manual)")
  131. print(" --osxtarget N (the OS X version number to build for (OS X only))")
  132. print(" --universal (build universal binaries (OS X only))")
  133. print(" --override \"O=V\" (override dtool_config/prc option value)")
  134. print(" --static (builds libraries for static linking)")
  135. print(" --target X (experimental cross-compilation (android only))")
  136. print(" --arch X (target architecture for cross-compilation)")
  137. print("")
  138. for pkg in PkgListGet():
  139. p = pkg.lower()
  140. print(" --use-%-9s --no-%-9s (enable/disable use of %s)"%(p, p, pkg))
  141. if sys.platform != 'win32':
  142. print(" --<PKG>-incdir (custom location for header files of thirdparty package)")
  143. print(" --<PKG>-libdir (custom location for library files of thirdparty package)")
  144. print("")
  145. print(" --nothing (disable every third-party lib)")
  146. print(" --everything (enable every third-party lib)")
  147. print(" --directx-sdk=X (specify version of DirectX SDK to use: jun2010, aug2009, mar2009, aug2006)")
  148. print(" --windows-sdk=X (specify Windows SDK version, eg. 7.0, 7.1 or 10. Default is 7.1)")
  149. print(" --msvc-version=X (specify Visual C++ version, eg. 10, 11, 12, 14. Default is 14)")
  150. print(" --use-icl (experimental setting to use an intel compiler instead of MSVC on Windows)")
  151. print("")
  152. print("The simplest way to compile panda is to just type:")
  153. print("")
  154. print(" makepanda --everything")
  155. print("")
  156. os._exit(1)
  157. def parseopts(args):
  158. global INSTALLER,WHEEL,RUNTESTS,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION
  159. global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL
  160. global DEBVERSION,WHLVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION
  161. global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER
  162. longopts = [
  163. "help","distributor=","verbose","runtime","osxtarget=","tests",
  164. "optimize=","everything","nothing","installer","wheel","rtdist","nocolor",
  165. "version=","lzma","no-python","threads=","outputdir=","override=",
  166. "static","host=","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=",
  167. "directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl",
  168. "universal", "target=", "arch=", "git-commit=", "no-directscripts",
  169. "use-touchinput", "no-touchinput"]
  170. anything = 0
  171. optimize = ""
  172. target = None
  173. target_arch = None
  174. universal = False
  175. clean_build = False
  176. for pkg in PkgListGet():
  177. longopts.append("use-" + pkg.lower())
  178. longopts.append("no-" + pkg.lower())
  179. longopts.append(pkg.lower() + "-incdir=")
  180. longopts.append(pkg.lower() + "-libdir=")
  181. try:
  182. opts, extras = getopt.getopt(args, "", longopts)
  183. for option, value in opts:
  184. if (option=="--help"): raise Exception
  185. elif (option=="--optimize"): optimize=value
  186. elif (option=="--installer"): INSTALLER=1
  187. elif (option=="--tests"): RUNTESTS=1
  188. elif (option=="--wheel"): WHEEL=1
  189. elif (option=="--verbose"): SetVerbose(True)
  190. elif (option=="--distributor"): DISTRIBUTOR=value
  191. elif (option=="--rtdist"): RTDIST=1
  192. elif (option=="--runtime"): RUNTIME=1
  193. elif (option=="--genman"): GENMAN=1
  194. elif (option=="--everything"): PkgEnableAll()
  195. elif (option=="--nothing"): PkgDisableAll()
  196. elif (option=="--threads"): THREADCOUNT=int(value)
  197. elif (option=="--outputdir"): SetOutputDir(value.strip())
  198. elif (option=="--osxtarget"): OSXTARGET=value.strip()
  199. elif (option=="--universal"): universal = True
  200. elif (option=="--target"): target = value.strip()
  201. elif (option=="--arch"): target_arch = value.strip()
  202. elif (option=="--nocolor"): DisableColors()
  203. elif (option=="--version"):
  204. match = re.match(r'^\d+\.\d+\.\d+', value)
  205. if not match:
  206. usage("version requires three digits")
  207. WHLVERSION = value
  208. VERSION = match.group()
  209. elif (option=="--lzma"): COMPRESSOR="lzma"
  210. elif (option=="--override"): AddOverride(value.strip())
  211. elif (option=="--static"): SetLinkAllStatic(True)
  212. elif (option=="--host"): HOST_URL=value
  213. elif (option=="--debversion"): DEBVERSION=value
  214. elif (option=="--rpmrelease"): RPMRELEASE=value
  215. elif (option=="--git-commit"): GIT_COMMIT=value
  216. elif (option=="--p3dsuffix"): P3DSUFFIX=value
  217. elif (option=="--rtdist-version"): RTDIST_VERSION=value
  218. # Backward compatibility, OPENGL was renamed to GL
  219. elif (option=="--use-opengl"): PkgEnable("GL")
  220. elif (option=="--no-opengl"): PkgDisable("GL")
  221. elif (option=="--no-directscripts"): pass
  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. else:
  234. for pkg in PkgListGet():
  235. if option == "--use-" + pkg.lower():
  236. PkgEnable(pkg)
  237. break
  238. elif option == "--no-" + pkg.lower():
  239. PkgDisable(pkg)
  240. break
  241. elif option == "--" + pkg.lower() + "-incdir":
  242. PkgSetCustomLocation(pkg)
  243. IncDirectory(pkg, value)
  244. break
  245. elif option == "--" + pkg.lower() + "-libdir":
  246. PkgSetCustomLocation(pkg)
  247. LibDirectory(pkg, value)
  248. break
  249. if (option == "--everything" or option.startswith("--use-")
  250. or option == "--nothing" or option.startswith("--no-")):
  251. anything = 1
  252. except:
  253. usage(sys.exc_info()[1])
  254. if not anything:
  255. if RUNTIME:
  256. PkgEnableAll()
  257. else:
  258. usage("You should specify a list of packages to use or --everything to enable all packages.")
  259. if (RTDIST and RUNTIME):
  260. usage("Options --runtime and --rtdist cannot be specified at the same time!")
  261. if (optimize=="" and (RTDIST or RUNTIME)): optimize = "4"
  262. elif (optimize==""): optimize = "3"
  263. if OSXTARGET:
  264. try:
  265. maj, min = OSXTARGET.strip().split('.')
  266. OSXTARGET = int(maj), int(min)
  267. assert OSXTARGET[0] == 10
  268. except:
  269. usage("Invalid setting for OSXTARGET")
  270. else:
  271. OSXTARGET = None
  272. if target is not None or target_arch is not None:
  273. SetTarget(target, target_arch)
  274. if universal:
  275. if target_arch:
  276. exit("--universal is incompatible with --arch")
  277. OSX_ARCHS.append("i386")
  278. if OSXTARGET:
  279. osxver = OSXTARGET
  280. else:
  281. maj, min = platform.mac_ver()[0].split('.')[:2]
  282. osxver = int(maj), int(min)
  283. if osxver[1] < 6:
  284. OSX_ARCHS.append("ppc")
  285. else:
  286. OSX_ARCHS.append("x86_64")
  287. elif HasTargetArch():
  288. OSX_ARCHS.append(GetTargetArch())
  289. try:
  290. SetOptimize(int(optimize))
  291. assert GetOptimize() in [1, 2, 3, 4]
  292. except:
  293. usage("Invalid setting for OPTIMIZE")
  294. if GIT_COMMIT is not None and not re.match("^[a-f0-9]{40}$", GIT_COMMIT):
  295. usage("Invalid SHA-1 hash given for --git-commit option!")
  296. if GetTarget() == 'windows':
  297. if not MSVC_VERSION:
  298. print("No MSVC version specified. Defaulting to 14 (Visual Studio 2015).")
  299. MSVC_VERSION = (14, 0)
  300. else:
  301. try:
  302. MSVC_VERSION = tuple(int(d) for d in MSVC_VERSION.split('.'))[:2]
  303. if (len(MSVC_VERSION) == 1):
  304. MSVC_VERSION += (0,)
  305. except:
  306. usage("Invalid setting for --msvc-version")
  307. if MSVC_VERSION < (14, 0):
  308. warn_prefix = "%sERROR:%s " % (GetColor("red"), GetColor())
  309. print("=========================================================================")
  310. print(warn_prefix + "Support for MSVC versions before 2015 has been discontinued.")
  311. print(warn_prefix + "For more information, or any questions, please visit:")
  312. print(warn_prefix + " https://github.com/panda3d/panda3d/issues/288")
  313. print("=========================================================================")
  314. sys.stdout.flush()
  315. time.sleep(1.0)
  316. sys.exit(1)
  317. if not WINDOWS_SDK:
  318. print("No Windows SDK version specified. Defaulting to '7.1'.")
  319. WINDOWS_SDK = '7.1'
  320. if clean_build and os.path.isdir(GetOutputDir()):
  321. print("Deleting %s" % (GetOutputDir()))
  322. shutil.rmtree(GetOutputDir())
  323. parseopts(sys.argv[1:])
  324. ########################################################################
  325. ##
  326. ## Handle environment variables.
  327. ##
  328. ########################################################################
  329. if ("CFLAGS" in os.environ):
  330. CFLAGS = os.environ["CFLAGS"].strip()
  331. if ("CXXFLAGS" in os.environ):
  332. CXXFLAGS = os.environ["CXXFLAGS"].strip()
  333. if ("RPM_OPT_FLAGS" in os.environ):
  334. CFLAGS += " " + os.environ["RPM_OPT_FLAGS"].strip()
  335. CXXFLAGS += " " + os.environ["RPM_OPT_FLAGS"].strip()
  336. if ("LDFLAGS" in os.environ):
  337. LDFLAGS = os.environ["LDFLAGS"].strip()
  338. os.environ["MAKEPANDA"] = os.path.abspath(sys.argv[0])
  339. if GetHost() == "darwin" and OSXTARGET is not None:
  340. os.environ["MACOSX_DEPLOYMENT_TARGET"] = "%d.%d" % OSXTARGET
  341. ########################################################################
  342. ##
  343. ## Configure things based on the command-line parameters.
  344. ##
  345. ########################################################################
  346. PLUGIN_VERSION = ParsePluginVersion("dtool/PandaVersion.pp")
  347. COREAPI_VERSION = PLUGIN_VERSION + "." + ParseCoreapiVersion("dtool/PandaVersion.pp")
  348. if VERSION is None:
  349. if RUNTIME:
  350. VERSION = PLUGIN_VERSION
  351. else:
  352. # Take the value from the setup.cfg file.
  353. VERSION = GetMetadataValue('version')
  354. if WHLVERSION is None:
  355. WHLVERSION = VERSION
  356. print("Version: %s" % VERSION)
  357. if RUNTIME or RTDIST:
  358. print("Core API Version: %s" % COREAPI_VERSION)
  359. if DEBVERSION is None:
  360. DEBVERSION = VERSION
  361. MAJOR_VERSION = '.'.join(VERSION.split('.')[:2])
  362. if P3DSUFFIX is None:
  363. P3DSUFFIX = MAJOR_VERSION
  364. outputdir_suffix = ""
  365. if (RUNTIME or RTDIST):
  366. # Compiling Maya/Max is pointless in rtdist build
  367. for ver in MAYAVERSIONS + MAXVERSIONS:
  368. PkgDisable(ver)
  369. if (DISTRIBUTOR.strip() == ""):
  370. exit("You must provide a valid distributor name when making a runtime or rtdist build!")
  371. outputdir_suffix += "_" + DISTRIBUTOR.strip()
  372. if (RUNTIME):
  373. outputdir_suffix += "_rt"
  374. if DISTRIBUTOR == "":
  375. DISTRIBUTOR = "makepanda"
  376. elif not RTDIST_VERSION:
  377. RTDIST_VERSION = DISTRIBUTOR.strip() + "_" + MAJOR_VERSION
  378. if not RTDIST_VERSION:
  379. RTDIST_VERSION = "dev"
  380. if not IsCustomOutputDir():
  381. if GetTarget() == "windows" and GetTargetArch() == 'x64':
  382. outputdir_suffix += '_x64'
  383. SetOutputDir("built" + outputdir_suffix)
  384. if (RUNTIME):
  385. for pkg in PkgListGet():
  386. if pkg in ["GTK2", "MFC"]:
  387. # Optional package(s) for runtime.
  388. pass
  389. elif pkg in ["OPENSSL", "ZLIB"]:
  390. # Required packages for runtime.
  391. if (PkgSkip(pkg)==1):
  392. exit("Runtime must be compiled with OpenSSL and ZLib support!")
  393. else:
  394. # Unused packages for runtime.
  395. PkgDisable(pkg)
  396. if (INSTALLER and RTDIST):
  397. exit("Cannot build an installer for the rtdist build!")
  398. if (WHEEL and RUNTIME):
  399. exit("Cannot build a wheel for the runtime build!")
  400. if (WHEEL and RTDIST):
  401. exit("Cannot build a wheel for the rtdist build!")
  402. if (INSTALLER) and (PkgSkip("PYTHON")) and (not RUNTIME) and GetTarget() == 'windows':
  403. exit("Cannot build installer on Windows without python")
  404. if WHEEL and PkgSkip("PYTHON"):
  405. exit("Cannot build wheel without Python")
  406. if (RTDIST) and (PkgSkip("WX") and PkgSkip("FLTK")):
  407. exit("Cannot build rtdist without wx or fltk")
  408. if (RUNTIME):
  409. SetLinkAllStatic(True)
  410. if not os.path.isdir("contrib"):
  411. PkgDisable("CONTRIB")
  412. ########################################################################
  413. ##
  414. ## Load the dependency cache.
  415. ##
  416. ########################################################################
  417. LoadDependencyCache()
  418. ########################################################################
  419. ##
  420. ## Locate various SDKs.
  421. ##
  422. ########################################################################
  423. MakeBuildTree()
  424. SdkLocateDirectX(STRDXSDKVERSION)
  425. SdkLocateMaya()
  426. SdkLocateMax()
  427. SdkLocateMacOSX(OSXTARGET)
  428. SdkLocatePython(RTDIST)
  429. SdkLocateWindows(WINDOWS_SDK)
  430. SdkLocatePhysX()
  431. SdkLocateSpeedTree()
  432. SdkLocateAndroid()
  433. SdkAutoDisableDirectX()
  434. SdkAutoDisableMaya()
  435. SdkAutoDisableMax()
  436. SdkAutoDisablePhysX()
  437. SdkAutoDisableSpeedTree()
  438. if RTDIST and DISTRIBUTOR == "cmu":
  439. # Some validation checks for the CMU builds.
  440. if (RTDIST_VERSION == "cmu_1.7" and SDK["PYTHONVERSION"] != "python2.6"):
  441. exit("The CMU 1.7 runtime distribution must be built against Python 2.6!")
  442. elif (RTDIST_VERSION == "cmu_1.8" and SDK["PYTHONVERSION"] != "python2.7"):
  443. exit("The CMU 1.8 runtime distribution must be built against Python 2.7!")
  444. elif (RTDIST_VERSION == "cmu_1.9" and SDK["PYTHONVERSION"] != "python2.7"):
  445. exit("The CMU 1.9 runtime distribution must be built against Python 2.7!")
  446. if RTDIST and not HOST_URL:
  447. exit("You must specify a host URL when building the rtdist!")
  448. if RUNTIME and not HOST_URL:
  449. # Set this to a nice default.
  450. HOST_URL = "https://runtime.panda3d.org/"
  451. ########################################################################
  452. ##
  453. ## Choose a Compiler.
  454. ##
  455. ## This should also set up any environment variables needed to make
  456. ## the compiler work.
  457. ##
  458. ########################################################################
  459. if GetHost() == 'windows' and GetTarget() == 'windows':
  460. COMPILER = "MSVC"
  461. SdkLocateVisualStudio(MSVC_VERSION)
  462. else:
  463. COMPILER = "GCC"
  464. SetupBuildEnvironment(COMPILER)
  465. ########################################################################
  466. ##
  467. ## External includes, external libraries, and external defsyms.
  468. ##
  469. ########################################################################
  470. IncDirectory("ALWAYS", GetOutputDir()+"/tmp")
  471. IncDirectory("ALWAYS", GetOutputDir()+"/include")
  472. if (COMPILER == "MSVC"):
  473. PkgDisable("X11")
  474. PkgDisable("GLES")
  475. PkgDisable("GLES2")
  476. PkgDisable("EGL")
  477. PkgDisable("CARBON")
  478. PkgDisable("COCOA")
  479. DefSymbol("FLEX", "YY_NO_UNISTD_H")
  480. if (PkgSkip("PYTHON")==0):
  481. IncDirectory("ALWAYS", SDK["PYTHON"] + "/include")
  482. LibDirectory("ALWAYS", SDK["PYTHON"] + "/libs")
  483. SmartPkgEnable("EIGEN", "eigen3", (), ("Eigen/Dense",), target_pkg = 'ALWAYS')
  484. for pkg in PkgListGet():
  485. if (PkgSkip(pkg)==0):
  486. if (pkg[:4]=="MAYA"):
  487. IncDirectory(pkg, SDK[pkg] + "/include")
  488. DefSymbol(pkg, "MAYAVERSION", pkg)
  489. DefSymbol(pkg, "MLIBRARY_DONTUSE_MFC_MANIFEST", "")
  490. elif (pkg[:3]=="MAX"):
  491. IncDirectory(pkg, SDK[pkg] + "/include")
  492. IncDirectory(pkg, SDK[pkg] + "/include/CS")
  493. IncDirectory(pkg, SDK[pkg+"CS"] + "/include")
  494. IncDirectory(pkg, SDK[pkg+"CS"] + "/include/CS")
  495. DefSymbol(pkg, "MAX", pkg)
  496. if (int(pkg[3:]) >= 2013):
  497. DefSymbol(pkg, "UNICODE", "")
  498. DefSymbol(pkg, "_UNICODE", "")
  499. elif (pkg[:2]=="DX"):
  500. IncDirectory(pkg, SDK[pkg] + "/include")
  501. elif GetThirdpartyDir() is not None:
  502. IncDirectory(pkg, GetThirdpartyDir() + pkg.lower() + "/include")
  503. for pkg in DXVERSIONS:
  504. if (PkgSkip(pkg)==0):
  505. vnum=pkg[2:]
  506. if GetTargetArch() == 'x64':
  507. LibDirectory(pkg, SDK[pkg] + '/lib/x64')
  508. else:
  509. LibDirectory(pkg, SDK[pkg] + '/lib/x86')
  510. LibDirectory(pkg, SDK[pkg] + '/lib')
  511. LibName(pkg, 'd3dVNUM.lib'.replace("VNUM", vnum))
  512. LibName(pkg, 'd3dxVNUM.lib'.replace("VNUM", vnum))
  513. if int(vnum) >= 9 and "GENERIC_DXERR_LIBRARY" in SDK:
  514. LibName(pkg, 'dxerr.lib')
  515. else:
  516. LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
  517. #LibName(pkg, 'ddraw.lib')
  518. LibName(pkg, 'dxguid.lib')
  519. if SDK.get("VISUALSTUDIO_VERSION") >= (14,0):
  520. # dxerr needs this for __vsnwprintf definition.
  521. LibName(pkg, 'legacy_stdio_definitions.lib')
  522. if not PkgSkip("FREETYPE") and os.path.isdir(GetThirdpartyDir() + "freetype/include/freetype2"):
  523. IncDirectory("FREETYPE", GetThirdpartyDir() + "freetype/include/freetype2")
  524. IncDirectory("ALWAYS", GetThirdpartyDir() + "extras/include")
  525. LibName("WINSOCK", "wsock32.lib")
  526. LibName("WINSOCK2", "wsock32.lib")
  527. LibName("WINSOCK2", "ws2_32.lib")
  528. LibName("WINCOMCTL", "comctl32.lib")
  529. LibName("WINCOMDLG", "comdlg32.lib")
  530. LibName("WINUSER", "user32.lib")
  531. LibName("WINMM", "winmm.lib")
  532. LibName("WINIMM", "imm32.lib")
  533. LibName("WINKERNEL", "kernel32.lib")
  534. LibName("WINOLE", "ole32.lib")
  535. LibName("WINOLEAUT", "oleaut32.lib")
  536. LibName("WINOLDNAMES", "oldnames.lib")
  537. LibName("WINSHELL", "shell32.lib")
  538. LibName("WINGDI", "gdi32.lib")
  539. LibName("ADVAPI", "advapi32.lib")
  540. LibName("IPHLPAPI", "iphlpapi.lib")
  541. LibName("GL", "opengl32.lib")
  542. LibName("GLES", "libgles_cm.lib")
  543. LibName("GLES2", "libGLESv2.lib")
  544. LibName("EGL", "libEGL.lib")
  545. LibName("MSIMG", "msimg32.lib")
  546. if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "strmiids.lib")
  547. if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "quartz.lib")
  548. if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "odbc32.lib")
  549. if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "odbccp32.lib")
  550. if (PkgSkip("OPENSSL")==0):
  551. if os.path.isfile(GetThirdpartyDir() + "openssl/lib/libpandassl.lib"):
  552. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandassl.lib")
  553. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandaeay.lib")
  554. else:
  555. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libeay32.lib")
  556. LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/ssleay32.lib")
  557. if (PkgSkip("PNG")==0):
  558. if os.path.isfile(GetThirdpartyDir() + "png/lib/libpng16_static.lib"):
  559. LibName("PNG", GetThirdpartyDir() + "png/lib/libpng16_static.lib")
  560. else:
  561. LibName("PNG", GetThirdpartyDir() + "png/lib/libpng_static.lib")
  562. if (PkgSkip("TIFF")==0):
  563. if os.path.isfile(GetThirdpartyDir() + "tiff/lib/libtiff.lib"):
  564. LibName("TIFF", GetThirdpartyDir() + "tiff/lib/libtiff.lib")
  565. else:
  566. LibName("TIFF", GetThirdpartyDir() + "tiff/lib/tiff.lib")
  567. if (PkgSkip("OPENEXR")==0):
  568. suffix = ""
  569. if os.path.isfile(GetThirdpartyDir() + "openexr/lib/IlmImf-2_2.lib"):
  570. suffix = "-2_2"
  571. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmImf" + suffix + ".lib")
  572. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmThread" + suffix + ".lib")
  573. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Iex" + suffix + ".lib")
  574. LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Half.lib")
  575. IncDirectory("OPENEXR", GetThirdpartyDir() + "openexr/include/OpenEXR")
  576. if (PkgSkip("JPEG")==0): LibName("JPEG", GetThirdpartyDir() + "jpeg/lib/jpeg-static.lib")
  577. if (PkgSkip("ZLIB")==0): LibName("ZLIB", GetThirdpartyDir() + "zlib/lib/zlibstatic.lib")
  578. if (PkgSkip("VRPN")==0): LibName("VRPN", GetThirdpartyDir() + "vrpn/lib/vrpn.lib")
  579. if (PkgSkip("VRPN")==0): LibName("VRPN", GetThirdpartyDir() + "vrpn/lib/quat.lib")
  580. if (PkgSkip("NVIDIACG")==0): LibName("CGGL", GetThirdpartyDir() + "nvidiacg/lib/cgGL.lib")
  581. if (PkgSkip("NVIDIACG")==0): LibName("CGDX9", GetThirdpartyDir() + "nvidiacg/lib/cgD3D9.lib")
  582. if (PkgSkip("NVIDIACG")==0): LibName("NVIDIACG", GetThirdpartyDir() + "nvidiacg/lib/cg.lib")
  583. if (PkgSkip("FREETYPE")==0): LibName("FREETYPE", GetThirdpartyDir() + "freetype/lib/freetype.lib")
  584. if (PkgSkip("HARFBUZZ")==0):
  585. LibName("HARFBUZZ", GetThirdpartyDir() + "harfbuzz/lib/harfbuzz.lib")
  586. IncDirectory("HARFBUZZ", GetThirdpartyDir() + "harfbuzz/include/harfbuzz")
  587. if (PkgSkip("FFTW")==0): LibName("FFTW", GetThirdpartyDir() + "fftw/lib/fftw3.lib")
  588. if (PkgSkip("ARTOOLKIT")==0):LibName("ARTOOLKIT",GetThirdpartyDir() + "artoolkit/lib/libAR.lib")
  589. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cv.lib")
  590. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/highgui.lib")
  591. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cvaux.lib")
  592. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/ml.lib")
  593. if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cxcore.lib")
  594. if (PkgSkip("AWESOMIUM")==0):LibName("AWESOMIUM",GetThirdpartyDir() + "awesomium/lib/Awesomium.lib")
  595. if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avcodec.lib")
  596. if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avformat.lib")
  597. if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avutil.lib")
  598. if (PkgSkip("SWSCALE")==0): LibName("SWSCALE", GetThirdpartyDir() + "ffmpeg/lib/swscale.lib")
  599. if (PkgSkip("SWRESAMPLE")==0):LibName("SWRESAMPLE",GetThirdpartyDir() + "ffmpeg/lib/swresample.lib")
  600. if (PkgSkip("FCOLLADA")==0):
  601. LibName("FCOLLADA", GetThirdpartyDir() + "fcollada/lib/FCollada.lib")
  602. IncDirectory("FCOLLADA", GetThirdpartyDir() + "fcollada/include/FCollada")
  603. if (PkgSkip("ASSIMP")==0):
  604. LibName("ASSIMP", GetThirdpartyDir() + "assimp/lib/assimp.lib")
  605. path = GetThirdpartyDir() + "assimp/lib/IrrXML.lib"
  606. if os.path.isfile(path):
  607. LibName("ASSIMP", GetThirdpartyDir() + "assimp/lib/IrrXML.lib")
  608. IncDirectory("ASSIMP", GetThirdpartyDir() + "assimp/include")
  609. if (PkgSkip("SQUISH")==0):
  610. if GetOptimize() <= 2:
  611. LibName("SQUISH", GetThirdpartyDir() + "squish/lib/squishd.lib")
  612. else:
  613. LibName("SQUISH", GetThirdpartyDir() + "squish/lib/squish.lib")
  614. if (PkgSkip("ROCKET")==0):
  615. LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketCore.lib")
  616. LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketControls.lib")
  617. if (PkgSkip("PYTHON")==0):
  618. LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/" + SDK["PYTHONVERSION"] + "/boost_python-vc100-mt-1_54.lib")
  619. if (GetOptimize() <= 3):
  620. LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketDebugger.lib")
  621. if (PkgSkip("OPENAL")==0):
  622. LibName("OPENAL", GetThirdpartyDir() + "openal/lib/OpenAL32.lib")
  623. if not os.path.isfile(GetThirdpartyDir() + "openal/bin/OpenAL32.dll"):
  624. # Link OpenAL Soft statically.
  625. DefSymbol("OPENAL", "AL_LIBTYPE_STATIC")
  626. if (PkgSkip("ODE")==0):
  627. LibName("ODE", GetThirdpartyDir() + "ode/lib/ode_single.lib")
  628. DefSymbol("ODE", "dSINGLE", "")
  629. if (PkgSkip("FMODEX")==0):
  630. if (GetTargetArch() == 'x64'):
  631. LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex64_vc.lib")
  632. else:
  633. LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex_vc.lib")
  634. if (PkgSkip("FLTK")==0 and RTDIST):
  635. LibName("FLTK", GetThirdpartyDir() + "fltk/lib/fltk.lib")
  636. if not PkgSkip("FLTK"):
  637. # If we have fltk, we don't need wx
  638. PkgDisable("WX")
  639. if (PkgSkip("WX")==0 and RTDIST):
  640. LibName("WX", GetThirdpartyDir() + "wx/lib/wxbase28u.lib")
  641. LibName("WX", GetThirdpartyDir() + "wx/lib/wxmsw28u_core.lib")
  642. DefSymbol("WX", "__WXMSW__", "")
  643. DefSymbol("WX", "_UNICODE", "")
  644. DefSymbol("WX", "UNICODE", "")
  645. if (PkgSkip("VORBIS")==0):
  646. for lib in ('ogg', 'vorbis', 'vorbisfile'):
  647. path = GetThirdpartyDir() + "vorbis/lib/lib{0}_static.lib".format(lib)
  648. if not os.path.isfile(path):
  649. path = GetThirdpartyDir() + "vorbis/lib/{0}.lib".format(lib)
  650. LibName("VORBIS", path)
  651. if (PkgSkip("OPUS")==0):
  652. LibName("OPUS", GetThirdpartyDir() + "opus/lib/libogg_static.lib")
  653. LibName("OPUS", GetThirdpartyDir() + "opus/lib/libopus_static.lib")
  654. LibName("OPUS", GetThirdpartyDir() + "opus/lib/libopusfile_static.lib")
  655. for pkg in MAYAVERSIONS:
  656. if (PkgSkip(pkg)==0):
  657. LibName(pkg, '"' + SDK[pkg] + '/lib/Foundation.lib"')
  658. LibName(pkg, '"' + SDK[pkg] + '/lib/OpenMaya.lib"')
  659. LibName(pkg, '"' + SDK[pkg] + '/lib/OpenMayaAnim.lib"')
  660. LibName(pkg, '"' + SDK[pkg] + '/lib/OpenMayaUI.lib"')
  661. for pkg in MAXVERSIONS:
  662. if (PkgSkip(pkg)==0):
  663. LibName(pkg, SDK[pkg] + '/lib/core.lib')
  664. LibName(pkg, SDK[pkg] + '/lib/edmodel.lib')
  665. LibName(pkg, SDK[pkg] + '/lib/gfx.lib')
  666. LibName(pkg, SDK[pkg] + '/lib/geom.lib')
  667. LibName(pkg, SDK[pkg] + '/lib/mesh.lib')
  668. LibName(pkg, SDK[pkg] + '/lib/maxutil.lib')
  669. LibName(pkg, SDK[pkg] + '/lib/paramblk2.lib')
  670. if (PkgSkip("PHYSX")==0):
  671. if GetTargetArch() == 'x64':
  672. LibName("PHYSX", SDK["PHYSXLIBS"] + "/PhysXLoader64.lib")
  673. LibName("PHYSX", SDK["PHYSXLIBS"] + "/NxCharacter64.lib")
  674. else:
  675. LibName("PHYSX", SDK["PHYSXLIBS"] + "/PhysXLoader.lib")
  676. LibName("PHYSX", SDK["PHYSXLIBS"] + "/NxCharacter.lib")
  677. IncDirectory("PHYSX", SDK["PHYSX"] + "/Physics/include")
  678. IncDirectory("PHYSX", SDK["PHYSX"] + "/PhysXLoader/include")
  679. IncDirectory("PHYSX", SDK["PHYSX"] + "/NxCharacter/include")
  680. IncDirectory("PHYSX", SDK["PHYSX"] + "/NxExtensions/include")
  681. IncDirectory("PHYSX", SDK["PHYSX"] + "/Foundation/include")
  682. IncDirectory("PHYSX", SDK["PHYSX"] + "/Cooking/include")
  683. if (PkgSkip("SPEEDTREE")==0):
  684. if GetTargetArch() == 'x64':
  685. libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC10.x64/"
  686. p64ext = '64'
  687. else:
  688. libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC10/"
  689. p64ext = ''
  690. debugext = ''
  691. if (GetOptimize() <= 2): debugext = "_d"
  692. libsuffix = "_v%s_VC100MT%s_Static%s.lib" % (
  693. SDK["SPEEDTREEVERSION"], p64ext, debugext)
  694. LibName("SPEEDTREE", "%sSpeedTreeCore%s" % (libdir, libsuffix))
  695. LibName("SPEEDTREE", "%sSpeedTreeForest%s" % (libdir, libsuffix))
  696. LibName("SPEEDTREE", "%sSpeedTree%sRenderer%s" % (libdir, SDK["SPEEDTREEAPI"], libsuffix))
  697. LibName("SPEEDTREE", "%sSpeedTreeRenderInterface%s" % (libdir, libsuffix))
  698. if (SDK["SPEEDTREEAPI"] == "OpenGL"):
  699. LibName("SPEEDTREE", "%sglew32.lib" % (libdir))
  700. LibName("SPEEDTREE", "glu32.lib")
  701. IncDirectory("SPEEDTREE", SDK["SPEEDTREE"] + "/Include")
  702. if (PkgSkip("BULLET")==0):
  703. suffix = '.lib'
  704. if GetTargetArch() == 'x64' and os.path.isfile(GetThirdpartyDir() + "bullet/lib/BulletCollision_x64.lib"):
  705. suffix = '_x64.lib'
  706. LibName("BULLET", GetThirdpartyDir() + "bullet/lib/LinearMath" + suffix)
  707. LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletCollision" + suffix)
  708. LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletDynamics" + suffix)
  709. LibName("BULLET", GetThirdpartyDir() + "bullet/lib/BulletSoftBody" + suffix)
  710. if (COMPILER=="GCC"):
  711. PkgDisable("AWESOMIUM")
  712. if GetTarget() != "darwin":
  713. PkgDisable("CARBON")
  714. PkgDisable("COCOA")
  715. elif RUNTIME:
  716. # We don't support Cocoa in the runtime yet.
  717. PkgDisable("COCOA")
  718. if 'x86_64' in OSX_ARCHS:
  719. # 64-bits OS X doesn't have Carbon.
  720. PkgDisable("CARBON")
  721. #if (PkgSkip("PYTHON")==0):
  722. # IncDirectory("PYTHON", SDK["PYTHON"])
  723. if (GetHost() == "darwin"):
  724. if (PkgSkip("FREETYPE")==0 and not os.path.isdir(GetThirdpartyDir() + 'freetype')):
  725. IncDirectory("FREETYPE", "/usr/X11/include")
  726. IncDirectory("FREETYPE", "/usr/X11/include/freetype2")
  727. LibDirectory("FREETYPE", "/usr/X11/lib")
  728. if (GetHost() == "freebsd"):
  729. IncDirectory("ALWAYS", "/usr/local/include")
  730. LibDirectory("ALWAYS", "/usr/local/lib")
  731. if (os.path.isdir("/usr/PCBSD")):
  732. IncDirectory("ALWAYS", "/usr/PCBSD/local/include")
  733. LibDirectory("ALWAYS", "/usr/PCBSD/local/lib")
  734. if GetTarget() != "windows":
  735. PkgDisable("DIRECTCAM")
  736. fcollada_libs = ("FColladaD", "FColladaSD", "FColladaS")
  737. # WARNING! The order of the ffmpeg libraries matters!
  738. ffmpeg_libs = ("libavformat", "libavcodec", "libavutil")
  739. # Name pkg-config libs, include(dir)s
  740. if (not RUNTIME):
  741. SmartPkgEnable("EIGEN", "eigen3", (), ("Eigen/Dense",), target_pkg = 'ALWAYS')
  742. SmartPkgEnable("ARTOOLKIT", "", ("AR"), "AR/ar.h")
  743. SmartPkgEnable("FCOLLADA", "", ChooseLib(fcollada_libs, "FCOLLADA"), ("FCollada", "FCollada/FCollada.h"))
  744. SmartPkgEnable("ASSIMP", "", ("assimp"), "assimp/Importer.hpp")
  745. SmartPkgEnable("FFMPEG", ffmpeg_libs, ffmpeg_libs, ("libavformat/avformat.h", "libavcodec/avcodec.h", "libavutil/avutil.h"))
  746. SmartPkgEnable("SWSCALE", "libswscale", "libswscale", ("libswscale/swscale.h"), target_pkg = "FFMPEG", thirdparty_dir = "ffmpeg")
  747. SmartPkgEnable("SWRESAMPLE","libswresample", "libswresample", ("libswresample/swresample.h"), target_pkg = "FFMPEG", thirdparty_dir = "ffmpeg")
  748. SmartPkgEnable("FFTW", "", ("fftw3"), ("fftw.h"))
  749. SmartPkgEnable("FMODEX", "", ("fmodex"), ("fmodex", "fmodex/fmod.h"))
  750. SmartPkgEnable("FREETYPE", "freetype2", ("freetype"), ("freetype2", "freetype2/freetype/freetype.h"))
  751. SmartPkgEnable("HARFBUZZ", "harfbuzz", ("harfbuzz"), ("harfbuzz", "harfbuzz/hb-ft.h"))
  752. SmartPkgEnable("GL", "gl", ("GL"), ("GL/gl.h"), framework = "OpenGL")
  753. SmartPkgEnable("GLES", "glesv1_cm", ("GLESv1_CM"), ("GLES/gl.h"), framework = "OpenGLES")
  754. SmartPkgEnable("GLES2", "glesv2", ("GLESv2"), ("GLES2/gl2.h")) #framework = "OpenGLES"?
  755. SmartPkgEnable("EGL", "egl", ("EGL"), ("EGL/egl.h"))
  756. SmartPkgEnable("NVIDIACG", "", ("Cg"), "Cg/cg.h", framework = "Cg")
  757. SmartPkgEnable("ODE", "", ("ode"), "ode/ode.h", tool = "ode-config")
  758. SmartPkgEnable("OPENAL", "openal", ("openal"), "AL/al.h", framework = "OpenAL")
  759. SmartPkgEnable("SQUISH", "", ("squish"), "squish.h")
  760. SmartPkgEnable("TIFF", "libtiff-4", ("tiff"), "tiff.h")
  761. SmartPkgEnable("OPENEXR", "OpenEXR", ("IlmImf", "Imath", "Half", "Iex", "IexMath", "IlmThread"), ("OpenEXR", "OpenEXR/ImfOutputFile.h"))
  762. SmartPkgEnable("VRPN", "", ("vrpn", "quat"), ("vrpn", "quat.h", "vrpn/vrpn_Types.h"))
  763. SmartPkgEnable("BULLET", "bullet", ("BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"), ("bullet", "bullet/btBulletDynamicsCommon.h"))
  764. SmartPkgEnable("VORBIS", "vorbisfile",("vorbisfile", "vorbis", "ogg"), ("ogg/ogg.h", "vorbis/vorbisfile.h"))
  765. SmartPkgEnable("OPUS", "opusfile", ("opusfile", "opus", "ogg"), ("ogg/ogg.h", "opus/opusfile.h", "opus"))
  766. SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h")
  767. SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config")
  768. if not PkgSkip("FFMPEG"):
  769. if GetTarget() == "darwin":
  770. LibName("FFMPEG", "-Wl,-read_only_relocs,suppress")
  771. LibName("FFMPEG", "-framework VideoDecodeAcceleration")
  772. elif os.path.isfile(GetThirdpartyDir() + "ffmpeg/lib/libavcodec.a"):
  773. # Needed when linking ffmpeg statically on Linux.
  774. LibName("FFMPEG", "-Wl,-Bsymbolic")
  775. if PkgSkip("FFMPEG") or GetTarget() == "darwin":
  776. cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV")
  777. if cv_lib == "opencv_core":
  778. OPENCV_VER_23 = True
  779. SmartPkgEnable("OPENCV", "opencv", ("opencv_core", "opencv_highgui"), ("opencv2/core/core.hpp"))
  780. else:
  781. SmartPkgEnable("OPENCV", "opencv", ("cv", "highgui", "cvaux", "ml", "cxcore"),
  782. ("opencv", "opencv/cv.h", "opencv/cxcore.h", "opencv/highgui.h"))
  783. else:
  784. PkgDisable("OPENCV")
  785. rocket_libs = ("RocketCore", "RocketControls")
  786. if (GetOptimize() <= 3):
  787. rocket_libs += ("RocketDebugger",)
  788. rocket_libs += ("boost_python",)
  789. SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h")
  790. if not PkgSkip("PYTHON"):
  791. python_lib = SDK["PYTHONVERSION"]
  792. if not RTDIST and GetTarget() != 'android':
  793. # We don't link anything in the SDK with libpython.
  794. python_lib = ""
  795. SmartPkgEnable("PYTHON", "", python_lib, (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"))
  796. SmartPkgEnable("OPENSSL", "openssl", ("ssl", "crypto"), ("openssl/ssl.h", "openssl/crypto.h"))
  797. SmartPkgEnable("ZLIB", "zlib", ("z"), "zlib.h")
  798. SmartPkgEnable("GTK2", "gtk+-2.0")
  799. if (RTDIST):
  800. SmartPkgEnable("WX", tool = "wx-config")
  801. SmartPkgEnable("FLTK", "", ("fltk"), ("FL/Fl.H"), tool = "fltk-config")
  802. if GetTarget() != 'darwin':
  803. # CgGL is covered by the Cg framework, and we don't need X11 components on OSX
  804. if not PkgSkip("NVIDIACG") and not RUNTIME:
  805. SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h", thirdparty_dir = "nvidiacg")
  806. if not RUNTIME:
  807. SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h", "X11/XKBlib.h"))
  808. if GetHost() != "darwin":
  809. # Workaround for an issue where pkg-config does not include this path
  810. if GetTargetArch() in ("x86_64", "amd64"):
  811. if (os.path.isdir("/usr/lib64/glib-2.0/include")):
  812. IncDirectory("GTK2", "/usr/lib64/glib-2.0/include")
  813. if (os.path.isdir("/usr/lib64/gtk-2.0/include")):
  814. IncDirectory("GTK2", "/usr/lib64/gtk-2.0/include")
  815. if not PkgSkip("X11"):
  816. if (os.path.isdir("/usr/X11R6/lib64")):
  817. LibDirectory("ALWAYS", "/usr/X11R6/lib64")
  818. else:
  819. LibDirectory("ALWAYS", "/usr/X11R6/lib")
  820. elif not PkgSkip("X11"):
  821. LibDirectory("ALWAYS", "/usr/X11R6/lib")
  822. if RUNTIME:
  823. # For the runtime, these packages are required
  824. for pkg in ["OPENSSL", "ZLIB"]:
  825. skips = []
  826. if (pkg in PkgListGet() and PkgSkip(pkg)==1):
  827. skips.append(pkg)
  828. if skips:
  829. exit("Runtime must be compiled with OpenSSL and ZLib support (missing %s)" % (', '.join(skips)))
  830. for pkg in MAYAVERSIONS:
  831. if (PkgSkip(pkg)==0 and (pkg in SDK)):
  832. if (GetHost() == "darwin"):
  833. # Sheesh, Autodesk really can't make up their mind
  834. # regarding the location of the Maya devkit on OS X.
  835. if (os.path.isdir(SDK[pkg] + "/Maya.app/Contents/lib")):
  836. LibDirectory(pkg, SDK[pkg] + "/Maya.app/Contents/lib")
  837. if (os.path.isdir(SDK[pkg] + "/Maya.app/Contents/MacOS")):
  838. LibDirectory(pkg, SDK[pkg] + "/Maya.app/Contents/MacOS")
  839. if (os.path.isdir(SDK[pkg] + "/lib")):
  840. LibDirectory(pkg, SDK[pkg] + "/lib")
  841. if (os.path.isdir(SDK[pkg] + "/Maya.app/Contents/include/maya")):
  842. IncDirectory(pkg, SDK[pkg] + "/Maya.app/Contents/include")
  843. if (os.path.isdir(SDK[pkg] + "/devkit/include/maya")):
  844. IncDirectory(pkg, SDK[pkg] + "/devkit/include")
  845. if (os.path.isdir(SDK[pkg] + "/include/maya")):
  846. IncDirectory(pkg, SDK[pkg] + "/include")
  847. else:
  848. LibDirectory(pkg, SDK[pkg] + "/lib")
  849. IncDirectory(pkg, SDK[pkg] + "/include")
  850. DefSymbol(pkg, "MAYAVERSION", pkg)
  851. if GetTarget() == 'darwin':
  852. LibName("ALWAYS", "-framework AppKit")
  853. LibName("AGL", "-framework AGL")
  854. LibName("CARBON", "-framework Carbon")
  855. LibName("COCOA", "-framework Cocoa")
  856. # Fix for a bug in OSX Leopard:
  857. LibName("GL", "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
  858. if GetTarget() == 'android':
  859. LibName("ALWAYS", '-llog')
  860. LibName("ANDROID", '-landroid')
  861. LibName("JNIGRAPHICS", '-ljnigraphics')
  862. for pkg in MAYAVERSIONS:
  863. if (PkgSkip(pkg)==0 and (pkg in SDK)):
  864. if GetTarget() == 'darwin':
  865. LibName(pkg, "-Wl,-rpath," + SDK[pkg] + "/Maya.app/Contents/MacOS")
  866. else:
  867. LibName(pkg, "-Wl,-rpath," + SDK[pkg] + "/lib")
  868. LibName(pkg, "-lOpenMaya")
  869. LibName(pkg, "-lOpenMayaAnim")
  870. LibName(pkg, "-lAnimSlice")
  871. LibName(pkg, "-lDeformSlice")
  872. LibName(pkg, "-lModifiers")
  873. LibName(pkg, "-lDynSlice")
  874. LibName(pkg, "-lKinSlice")
  875. LibName(pkg, "-lModelSlice")
  876. LibName(pkg, "-lNurbsSlice")
  877. LibName(pkg, "-lPolySlice")
  878. LibName(pkg, "-lProjectSlice")
  879. LibName(pkg, "-lImage")
  880. LibName(pkg, "-lShared")
  881. LibName(pkg, "-lTranslators")
  882. LibName(pkg, "-lDataModel")
  883. LibName(pkg, "-lRenderModel")
  884. LibName(pkg, "-lNurbsEngine")
  885. LibName(pkg, "-lDependEngine")
  886. LibName(pkg, "-lCommandEngine")
  887. LibName(pkg, "-lFoundation")
  888. LibName(pkg, "-lIMFbase")
  889. if GetTarget() != 'darwin':
  890. LibName(pkg, "-lOpenMayalib")
  891. else:
  892. LibName(pkg, "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
  893. if (PkgSkip("PHYSX")==0):
  894. IncDirectory("PHYSX", SDK["PHYSX"] + "/Physics/include")
  895. IncDirectory("PHYSX", SDK["PHYSX"] + "/PhysXLoader/include")
  896. IncDirectory("PHYSX", SDK["PHYSX"] + "/NxCharacter/include")
  897. IncDirectory("PHYSX", SDK["PHYSX"] + "/NxExtensions/include")
  898. IncDirectory("PHYSX", SDK["PHYSX"] + "/Foundation/include")
  899. IncDirectory("PHYSX", SDK["PHYSX"] + "/Cooking/include")
  900. LibDirectory("PHYSX", SDK["PHYSXLIBS"])
  901. if (GetHost() == "darwin"):
  902. LibName("PHYSX", SDK["PHYSXLIBS"] + "/osxstatic/PhysXCooking.a")
  903. LibName("PHYSX", SDK["PHYSXLIBS"] + "/osxstatic/PhysXCore.a")
  904. else:
  905. LibName("PHYSX", "-lPhysXLoader")
  906. LibName("PHYSX", "-lNxCharacter")
  907. DefSymbol("WITHINPANDA", "WITHIN_PANDA", "1")
  908. if GetLinkAllStatic():
  909. DefSymbol("ALWAYS", "LINK_ALL_STATIC")
  910. if GetTarget() == 'android':
  911. DefSymbol("ALWAYS", "ANDROID")
  912. if not PkgSkip("EIGEN"):
  913. if GetOptimize() >= 3:
  914. if COMPILER == "MSVC":
  915. # Squeeze out a bit more performance on MSVC builds...
  916. # Only do this if EIGEN_NO_DEBUG is also set, otherwise it
  917. # will turn them into runtime assertions.
  918. DefSymbol("ALWAYS", "EIGEN_NO_STATIC_ASSERT")
  919. ########################################################################
  920. ##
  921. ## Give a Status Report on Command-Line Options
  922. ##
  923. ########################################################################
  924. def printStatus(header,warnings):
  925. if GetVerbose():
  926. print("")
  927. print("-------------------------------------------------------------------")
  928. print(header)
  929. tkeep = ""
  930. tomit = ""
  931. for x in PkgListGet():
  932. if PkgSkip(x):
  933. tomit = tomit + x + " "
  934. else:
  935. tkeep = tkeep + x + " "
  936. if RTDIST:
  937. print("Makepanda: Runtime distribution build")
  938. elif RUNTIME:
  939. print("Makepanda: Runtime build")
  940. else:
  941. print("Makepanda: Regular build")
  942. print("Makepanda: Compiler: %s" % (COMPILER))
  943. print("Makepanda: Optimize: %d" % (GetOptimize()))
  944. print("Makepanda: Keep Pkg: %s" % (tkeep))
  945. print("Makepanda: Omit Pkg: %s" % (tomit))
  946. if GENMAN:
  947. print("Makepanda: Generate API reference manual")
  948. else:
  949. print("Makepanda: Don't generate API reference manual")
  950. if GetHost() == "windows" and not RTDIST:
  951. if INSTALLER:
  952. print("Makepanda: Build installer, using %s" % (COMPRESSOR))
  953. else:
  954. print("Makepanda: Don't build installer")
  955. print("Makepanda: Version ID: %s" % (VERSION))
  956. for x in warnings:
  957. print("Makepanda: %s" % (x))
  958. print("-------------------------------------------------------------------")
  959. print("")
  960. sys.stdout.flush()
  961. ########################################################################
  962. ##
  963. ## BracketNameWithQuotes
  964. ##
  965. ########################################################################
  966. def BracketNameWithQuotes(name):
  967. # Workaround for OSX bug - compiler doesn't like those flags quoted.
  968. if (name.startswith("-framework")): return name
  969. if (name.startswith("-dylib_file")): return name
  970. # Don't add quotes when it's not necessary.
  971. if " " not in name: return name
  972. # Account for quoted name (leave as is) but quote everything else (e.g., to protect spaces within paths from improper parsing)
  973. if (name.startswith('"') and name.endswith('"')): return name
  974. else: return '"' + name + '"'
  975. ########################################################################
  976. ##
  977. ## CompileCxx
  978. ##
  979. ########################################################################
  980. def CompileCxx(obj,src,opts):
  981. ipath = GetListOption(opts, "DIR:")
  982. optlevel = GetOptimizeOption(opts)
  983. if (COMPILER=="MSVC"):
  984. if not BOOUSEINTELCOMPILER:
  985. cmd = "cl "
  986. if GetTargetArch() == 'x64':
  987. cmd += "/favor:blend "
  988. cmd += "/wd4996 /wd4275 /wd4273 "
  989. # We still target Windows XP.
  990. cmd += "/DWINVER=0x501 "
  991. # Work around a WinXP/2003 bug when using VS 2015+.
  992. if SDK.get("VISUALSTUDIO_VERSION") >= (14,0):
  993. cmd += "/Zc:threadSafeInit- "
  994. cmd += "/Fo" + obj + " /nologo /c"
  995. if GetTargetArch() != 'x64' and (not PkgSkip("SSE2") or 'SSE2' in opts):
  996. cmd += " /arch:SSE2"
  997. for x in ipath: cmd += " /I" + x
  998. for (opt,dir) in INCDIRECTORIES:
  999. if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
  1000. for (opt,var,val) in DEFSYMBOLS:
  1001. if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
  1002. if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
  1003. if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS"
  1004. if (optlevel==2): cmd += " /MDd /Zi"
  1005. if (optlevel==3): cmd += " /MD /Zi /GS- /O2 /Ob2 /Oi /Ot /fp:fast"
  1006. if (optlevel==4):
  1007. cmd += " /MD /Zi /GS- /Ox /Ob2 /Oi /Ot /fp:fast /DFORCE_INLINING /DNDEBUG /GL"
  1008. cmd += " /Oy /Zp16" # jean-claude add /Zp16 insures correct static alignment for SSEx
  1009. cmd += " /Fd" + os.path.splitext(obj)[0] + ".pdb"
  1010. building = GetValueOption(opts, "BUILDING:")
  1011. if (building):
  1012. cmd += " /DBUILDING_" + building
  1013. if ("BIGOBJ" in opts) or GetTargetArch() == 'x64':
  1014. cmd += " /bigobj"
  1015. cmd += " /Zm300 /DWIN32_VC /DWIN32"
  1016. if 'EXCEPTIONS' in opts:
  1017. cmd += " /EHsc"
  1018. else:
  1019. cmd += " /D_HAS_EXCEPTIONS=0"
  1020. if 'RTTI' not in opts:
  1021. cmd += " /GR-"
  1022. if GetTargetArch() == 'x64':
  1023. cmd += " /DWIN64_VC /DWIN64"
  1024. if WINDOWS_SDK.startswith('7.') and MSVC_VERSION > (10,):
  1025. # To preserve Windows XP compatibility.
  1026. cmd += " /D_USING_V110_SDK71_"
  1027. cmd += " /W3 " + BracketNameWithQuotes(src)
  1028. oscmd(cmd)
  1029. else:
  1030. cmd = "icl "
  1031. if GetTargetArch() == 'x64':
  1032. cmd += "/favor:blend "
  1033. cmd += "/wd4996 /wd4275 /wd4267 /wd4101 /wd4273 "
  1034. cmd += "/DWINVER=0x501 "
  1035. cmd += "/Fo" + obj + " /c"
  1036. for x in ipath: cmd += " /I" + x
  1037. for (opt,dir) in INCDIRECTORIES:
  1038. if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
  1039. for (opt,var,val) in DEFSYMBOLS:
  1040. if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
  1041. if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
  1042. if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS"
  1043. if (optlevel==2): cmd += " /MDd /Zi /arch:SSE3"
  1044. # core changes from jean-claude (dec 2011)
  1045. # ----------------------------------------
  1046. # performance will be seeked at level 3 & 4
  1047. # -----------------------------------------
  1048. if (optlevel==3):
  1049. cmd += " /MD /Zi /O2 /Oi /Ot /arch:SSE3"
  1050. cmd += " /Ob0"
  1051. cmd += " /Qipo-" # beware of IPO !!!
  1052. ## Lesson learned: Don't use /GL flag -> end result is MESSY
  1053. ## ----------------------------------------------------------------
  1054. if (optlevel==4):
  1055. cmd += " /MD /Zi /O3 /Oi /Ot /Ob0 /Yc /DNDEBUG" # /Ob0 a ete rajoute en cours de route a 47%
  1056. cmd += " /Qipo" # optimization multi file
  1057. # for 3 & 4 optimization levels
  1058. # -----------------------------
  1059. if (optlevel>=3):
  1060. cmd += " /fp:fast=2"
  1061. cmd += " /Qftz"
  1062. cmd += " /Qfp-speculation:fast"
  1063. cmd += " /Qopt-matmul" # needs /O2 or /O3
  1064. cmd += " /Qprec-div-"
  1065. cmd += " /Qsimd"
  1066. cmd += " /QxHost" # compile for target host; Compiling for distribs should probably strictly enforce /arch:..
  1067. cmd += " /Quse-intel-optimized-headers" # use intel optimized headers
  1068. cmd += " /Qparallel" # enable parallelization
  1069. cmd += " /Qvc10" # for Microsoft Visual C++ 2010
  1070. ## PCH files coexistence: the /Qpchi option causes the Intel C++ Compiler to name its
  1071. ## PCH files with a .pchi filename suffix and reduce build time.
  1072. ## The /Qpchi option is on by default but interferes with Microsoft libs; so use /Qpchi- to turn it off.
  1073. ## I need to have a deeper look at this since the compile time is quite influenced by this setting !!!
  1074. cmd += " /Qpchi-" # keep it this way!
  1075. ## Inlining seems to be an issue here ! (the linker doesn't find necessary info later on)
  1076. ## ------------------------------------
  1077. ## so don't use cmd += " /DFORCE_INLINING" (need to check why with Panda developpers!)
  1078. ## Inline expansion /Ob1 : Allow functions marked inline to be inlined.
  1079. ## Inline any /Ob2 : Inline functions deemed appropriate by compiler.
  1080. ## Ctor displacement /vd0 : Disable constructor displacement.
  1081. ## Choose this option only if no class constructors or destructors call virtual functions.
  1082. ## Use /vd1 (default) to enable. Alternate: #pragma vtordisp
  1083. ## Best case ptrs /vmb : Use best case "pointer to class member" representation.
  1084. ## Use this option if you always define a class before you declare a pointer to a member of the class.
  1085. ## The compiler will issue an error if it encounters a pointer declaration before the class is defined.
  1086. ## Alternate: #pragma pointers_to_members
  1087. cmd += " /Fd" + os.path.splitext(obj)[0] + ".pdb"
  1088. building = GetValueOption(opts, "BUILDING:")
  1089. if (building): cmd += " /DBUILDING_" + building
  1090. if ("BIGOBJ" in opts) or GetTargetArch() == 'x64':
  1091. cmd += " /bigobj"
  1092. # level of warnings and optimization reports
  1093. if GetVerbose():
  1094. cmd += " /W3 " # or /W4 or /Wall
  1095. cmd += " /Qopt-report:2 /Qopt-report-phase:hlo /Qopt-report-phase:hpo" # some optimization reports
  1096. else:
  1097. cmd += " /W1 "
  1098. cmd += " /EHa /Zm300 /DWIN32_VC /DWIN32"
  1099. if GetTargetArch() == 'x64':
  1100. cmd += " /DWIN64_VC /DWIN64"
  1101. cmd += " " + BracketNameWithQuotes(src)
  1102. oscmd(cmd)
  1103. if (COMPILER=="GCC"):
  1104. if (src.endswith(".c")): cmd = GetCC() +' -fPIC -c -o ' + obj
  1105. else: cmd = GetCXX()+' -std=gnu++11 -ftemplate-depth-70 -fPIC -c -o ' + obj
  1106. for (opt, dir) in INCDIRECTORIES:
  1107. if (opt=="ALWAYS") or (opt in opts): cmd += ' -I' + BracketNameWithQuotes(dir)
  1108. for (opt, dir) in FRAMEWORKDIRECTORIES:
  1109. if (opt=="ALWAYS") or (opt in opts): cmd += ' -F' + BracketNameWithQuotes(dir)
  1110. for (opt,var,val) in DEFSYMBOLS:
  1111. if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val
  1112. for x in ipath: cmd += ' -I' + x
  1113. if not GetLinkAllStatic() and 'NOHIDDEN' not in opts:
  1114. cmd += ' -fvisibility=hidden'
  1115. # Mac-specific flags.
  1116. if GetTarget() == "darwin":
  1117. cmd += " -Wno-deprecated-declarations"
  1118. if OSXTARGET is not None:
  1119. cmd += " -isysroot " + SDK["MACOSX"]
  1120. cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET)
  1121. for arch in OSX_ARCHS:
  1122. if 'NOARCH:' + arch.upper() not in opts:
  1123. cmd += " -arch %s" % arch
  1124. if "SYSROOT" in SDK:
  1125. if GetTarget() != "android":
  1126. cmd += ' --sysroot=%s' % (SDK["SYSROOT"])
  1127. else:
  1128. ndk_dir = SDK["ANDROID_NDK"].replace('\\', '/')
  1129. cmd += ' -isystem %s/sysroot/usr/include' % (ndk_dir)
  1130. cmd += ' -isystem %s/sysroot/usr/include/%s' % (ndk_dir, SDK["ANDROID_TRIPLE"])
  1131. cmd += ' -no-canonical-prefixes'
  1132. # Android-specific flags.
  1133. arch = GetTargetArch()
  1134. if GetTarget() == "android":
  1135. # Most of the specific optimization flags here were
  1136. # just copied from the default Android Makefiles.
  1137. if "ANDROID_API" in SDK:
  1138. cmd += ' -D__ANDROID_API__=' + str(SDK["ANDROID_API"])
  1139. if "ANDROID_GCC_TOOLCHAIN" in SDK:
  1140. cmd += ' -gcc-toolchain ' + SDK["ANDROID_GCC_TOOLCHAIN"].replace('\\', '/')
  1141. cmd += ' -ffunction-sections -funwind-tables'
  1142. if arch == 'armv7a':
  1143. cmd += ' -target armv7-none-linux-androideabi'
  1144. cmd += ' -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16'
  1145. cmd += ' -fno-integrated-as'
  1146. elif arch == 'arm':
  1147. cmd += ' -target armv5te-none-linux-androideabi'
  1148. cmd += ' -march=armv5te -mtune=xscale -msoft-float'
  1149. cmd += ' -fno-integrated-as'
  1150. elif arch == 'aarch64':
  1151. cmd += ' -target aarch64-none-linux-android'
  1152. elif arch == 'mips':
  1153. cmd += ' -target mipsel-none-linux-android'
  1154. cmd += ' -mips32'
  1155. elif arch == 'mips64':
  1156. cmd += ' -target mips64el-none-linux-android'
  1157. cmd += ' -fintegrated-as'
  1158. elif arch == 'x86':
  1159. cmd += ' -target i686-none-linux-android'
  1160. cmd += ' -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32'
  1161. cmd += ' -mstackrealign'
  1162. elif arch == 'x86_64':
  1163. cmd += ' -target x86_64-none-linux-android'
  1164. cmd += ' -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel'
  1165. cmd += " -Wa,--noexecstack"
  1166. # Do we want thumb or arm instructions?
  1167. if arch.startswith('arm'):
  1168. if optlevel >= 3:
  1169. cmd += ' -mthumb'
  1170. else:
  1171. cmd += ' -marm'
  1172. # Enable SIMD instructions if requested
  1173. if arch.startswith('arm') and PkgSkip("NEON") == 0:
  1174. cmd += ' -mfpu=neon'
  1175. else:
  1176. cmd += " -pthread"
  1177. if not src.endswith(".c"):
  1178. # We don't use exceptions for most modules.
  1179. if 'EXCEPTIONS' in opts:
  1180. cmd += " -fexceptions"
  1181. else:
  1182. cmd += " -fno-exceptions"
  1183. if src.endswith(".mm"):
  1184. # Work around Apple compiler bug.
  1185. cmd += " -U__EXCEPTIONS"
  1186. target = GetTarget()
  1187. if 'RTTI' not in opts and target != "darwin":
  1188. # We always disable RTTI on Android for memory usage reasons.
  1189. if optlevel >= 4 or target == "android":
  1190. cmd += " -fno-rtti"
  1191. if ('SSE2' in opts or not PkgSkip("SSE2")) and not arch.startswith("arm") and arch != 'aarch64':
  1192. cmd += " -msse2"
  1193. # Needed by both Python, Panda, Eigen, all of which break aliasing rules.
  1194. cmd += " -fno-strict-aliasing"
  1195. if optlevel >= 3:
  1196. cmd += " -ffast-math -fno-stack-protector"
  1197. if optlevel == 3:
  1198. # Fast math is nice, but we'd like to see NaN in dev builds.
  1199. cmd += " -fno-finite-math-only"
  1200. # Make sure this is off to avoid GCC/Eigen bug (see GitHub #228)
  1201. cmd += " -fno-unsafe-math-optimizations"
  1202. if (optlevel==1): cmd += " -ggdb -D_DEBUG"
  1203. if (optlevel==2): cmd += " -O1 -D_DEBUG"
  1204. if (optlevel==3): cmd += " -O2"
  1205. if (optlevel==4): cmd += " -O3 -DNDEBUG"
  1206. # Enable more warnings.
  1207. cmd += " -Wall -Wno-unused-function"
  1208. if not src.endswith(".c"):
  1209. cmd += " -Wno-reorder"
  1210. # Ignore unused variables in NDEBUG builds, often used in asserts.
  1211. if optlevel == 4:
  1212. cmd += " -Wno-unused-variable"
  1213. if src.endswith(".c"):
  1214. cmd += ' ' + CFLAGS
  1215. else:
  1216. cmd += ' ' + CXXFLAGS
  1217. cmd = cmd.rstrip()
  1218. building = GetValueOption(opts, "BUILDING:")
  1219. if (building): cmd += " -DBUILDING_" + building
  1220. cmd += ' ' + BracketNameWithQuotes(src)
  1221. oscmd(cmd)
  1222. ########################################################################
  1223. ##
  1224. ## CompileBison
  1225. ##
  1226. ########################################################################
  1227. def CompileBison(wobj, wsrc, opts):
  1228. ifile = os.path.basename(wsrc)
  1229. wdsth = GetOutputDir()+"/include/" + ifile[:-4] + ".h"
  1230. wdstc = GetOutputDir()+"/tmp/" + ifile + ".cxx"
  1231. pre = GetValueOption(opts, "BISONPREFIX_")
  1232. bison = GetBison()
  1233. if bison is None:
  1234. # We don't have bison. See if there is a prebuilt file.
  1235. base, ext = os.path.splitext(wsrc)
  1236. if os.path.isfile(base + '.h.prebuilt') and \
  1237. os.path.isfile(base + '.cxx.prebuilt'):
  1238. CopyFile(wdstc, base + '.cxx.prebuilt')
  1239. CopyFile(wdsth, base + '.h.prebuilt')
  1240. else:
  1241. exit('Could not find bison!')
  1242. else:
  1243. oscmd(bison + ' -y -d -o'+GetOutputDir()+'/tmp/'+ifile+'.c -p '+pre+' '+wsrc)
  1244. CopyFile(wdstc, GetOutputDir()+"/tmp/"+ifile+".c")
  1245. CopyFile(wdsth, GetOutputDir()+"/tmp/"+ifile+".h")
  1246. # Finally, compile the generated source file.
  1247. CompileCxx(wobj, wdstc, opts + ["FLEX"])
  1248. ########################################################################
  1249. ##
  1250. ## CompileFlex
  1251. ##
  1252. ########################################################################
  1253. def CompileFlex(wobj,wsrc,opts):
  1254. ifile = os.path.basename(wsrc)
  1255. wdst = GetOutputDir()+"/tmp/"+ifile+".cxx"
  1256. pre = GetValueOption(opts, "BISONPREFIX_")
  1257. dashi = opts.count("FLEXDASHI")
  1258. flex = GetFlex()
  1259. if flex is None:
  1260. # We don't have flex. See if there is a prebuilt file.
  1261. base, ext = os.path.splitext(wsrc)
  1262. if os.path.isfile(base + '.cxx.prebuilt'):
  1263. CopyFile(wdst, base + '.cxx.prebuilt')
  1264. else:
  1265. exit('Could not find flex!')
  1266. else:
  1267. if (dashi):
  1268. oscmd(flex + " -i -P" + pre + " -o"+wdst+" "+wsrc)
  1269. else:
  1270. oscmd(flex + " -P" + pre + " -o"+wdst+" "+wsrc)
  1271. # Finally, compile the generated source file.
  1272. CompileCxx(wobj,wdst,opts)
  1273. ########################################################################
  1274. ##
  1275. ## CompileIgate
  1276. ##
  1277. ########################################################################
  1278. def CompileIgate(woutd,wsrc,opts):
  1279. outbase = os.path.basename(woutd)[:-3]
  1280. woutc = GetOutputDir()+"/tmp/"+outbase+"_igate.cxx"
  1281. srcdir = GetValueOption(opts, "SRCDIR:")
  1282. module = GetValueOption(opts, "IMOD:")
  1283. library = GetValueOption(opts, "ILIB:")
  1284. ipath = GetListOption(opts, "DIR:")
  1285. if (PkgSkip("PYTHON")):
  1286. WriteFile(woutc, "")
  1287. WriteFile(woutd, "")
  1288. ConditionalWriteFile(woutd, "")
  1289. return
  1290. if not CrossCompiling():
  1291. # If we're compiling for this platform, we can use the one we've built.
  1292. cmd = os.path.join(GetOutputDir(), 'bin', 'interrogate')
  1293. else:
  1294. # Assume that interrogate is on the PATH somewhere.
  1295. cmd = 'interrogate'
  1296. if GetVerbose():
  1297. cmd += ' -v'
  1298. cmd += ' -srcdir %s -I%s' % (srcdir, srcdir)
  1299. cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus=201103L'
  1300. if (COMPILER=="MSVC"):
  1301. cmd += ' -DWIN32_VC -DWIN32 -D_WIN32'
  1302. if GetTargetArch() == 'x64':
  1303. cmd += ' -DWIN64_VC -DWIN64 -D_WIN64 -D_M_X64 -D_M_AMD64'
  1304. else:
  1305. cmd += ' -D_M_IX86'
  1306. # NOTE: this 1600 value is the version number for VC2010.
  1307. cmd += ' -D_MSC_VER=1600 -D"__declspec(param)=" -D__cdecl -D_near -D_far -D__near -D__far -D__stdcall'
  1308. if (COMPILER=="GCC"):
  1309. cmd += ' -D__attribute__\(x\)='
  1310. target_arch = GetTargetArch()
  1311. if target_arch in ("x86_64", "amd64"):
  1312. cmd += ' -D_LP64'
  1313. elif target_arch == 'aarch64':
  1314. cmd += ' -D_LP64 -D__LP64__ -D__aarch64__'
  1315. else:
  1316. cmd += ' -D__i386__'
  1317. target = GetTarget()
  1318. if target == 'darwin':
  1319. cmd += ' -D__APPLE__'
  1320. elif target == 'android':
  1321. cmd += ' -D__ANDROID__'
  1322. optlevel = GetOptimizeOption(opts)
  1323. if (optlevel==1): cmd += ' -D_DEBUG'
  1324. if (optlevel==2): cmd += ' -D_DEBUG'
  1325. if (optlevel==3): pass
  1326. if (optlevel==4): cmd += ' -DNDEBUG'
  1327. cmd += ' -oc ' + woutc + ' -od ' + woutd
  1328. cmd += ' -fnames -string -refcount -assert -python-native'
  1329. cmd += ' -S' + GetOutputDir() + '/include/parser-inc'
  1330. # Add -I, -S and -D flags
  1331. for x in ipath:
  1332. cmd += ' -I' + BracketNameWithQuotes(x)
  1333. for (opt,dir) in INCDIRECTORIES:
  1334. if (opt=="ALWAYS") or (opt in opts):
  1335. cmd += ' -S' + BracketNameWithQuotes(dir)
  1336. for (opt,var,val) in DEFSYMBOLS:
  1337. if (opt=="ALWAYS") or (opt in opts):
  1338. cmd += ' -D' + var + '=' + val
  1339. #building = GetValueOption(opts, "BUILDING:")
  1340. #if (building): cmd += " -DBUILDING_"+building
  1341. cmd += ' -module ' + module + ' -library ' + library
  1342. for x in wsrc:
  1343. if (x.startswith("/")):
  1344. cmd += ' ' + BracketNameWithQuotes(x)
  1345. else:
  1346. cmd += ' ' + BracketNameWithQuotes(os.path.basename(x))
  1347. oscmd(cmd)
  1348. ########################################################################
  1349. ##
  1350. ## CompileImod
  1351. ##
  1352. ########################################################################
  1353. def CompileImod(wobj, wsrc, opts):
  1354. module = GetValueOption(opts, "IMOD:")
  1355. library = GetValueOption(opts, "ILIB:")
  1356. if (COMPILER=="MSVC"):
  1357. woutc = wobj[:-4]+".cxx"
  1358. if (COMPILER=="GCC"):
  1359. woutc = wobj[:-2]+".cxx"
  1360. if (PkgSkip("PYTHON")):
  1361. WriteFile(woutc, "")
  1362. CompileCxx(wobj, woutc, opts)
  1363. return
  1364. if not CrossCompiling():
  1365. # If we're compiling for this platform, we can use the one we've built.
  1366. cmd = os.path.join(GetOutputDir(), 'bin', 'interrogate_module')
  1367. else:
  1368. # Assume that interrogate_module is on the PATH somewhere.
  1369. cmd = 'interrogate_module'
  1370. cmd += ' -oc ' + woutc + ' -module ' + module + ' -library ' + library + ' -python-native'
  1371. importmod = GetValueOption(opts, "IMPORT:")
  1372. if importmod:
  1373. cmd += ' -import ' + importmod
  1374. for x in wsrc: cmd += ' ' + BracketNameWithQuotes(x)
  1375. oscmd(cmd)
  1376. CompileCxx(wobj,woutc,opts)
  1377. return
  1378. ########################################################################
  1379. ##
  1380. ## CompileLib
  1381. ##
  1382. ########################################################################
  1383. def CompileLib(lib, obj, opts):
  1384. if (COMPILER=="MSVC"):
  1385. if not BOOUSEINTELCOMPILER:
  1386. #Use MSVC Linker
  1387. cmd = 'link /lib /nologo'
  1388. if GetOptimizeOption(opts) == 4:
  1389. cmd += " /LTCG"
  1390. if HasTargetArch():
  1391. cmd += " /MACHINE:" + GetTargetArch().upper()
  1392. cmd += ' /OUT:' + BracketNameWithQuotes(lib)
  1393. for x in obj:
  1394. if not x.endswith('.lib'):
  1395. cmd += ' ' + BracketNameWithQuotes(x)
  1396. oscmd(cmd)
  1397. else:
  1398. # Choose Intel linker; from Jean-Claude
  1399. cmd = 'xilink /verbose:lib /lib '
  1400. if HasTargetArch():
  1401. cmd += " /MACHINE:" + GetTargetArch().upper()
  1402. cmd += ' /OUT:' + BracketNameWithQuotes(lib)
  1403. for x in obj: cmd += ' ' + BracketNameWithQuotes(x)
  1404. cmd += ' /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2011 SP1\ipp\lib\ia32"'
  1405. cmd += ' /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2011 SP1\TBB\Lib\ia32\vc10"'
  1406. cmd += ' /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2011 SP1\compiler\lib\ia32"'
  1407. oscmd(cmd)
  1408. if (COMPILER=="GCC"):
  1409. if GetTarget() == 'darwin':
  1410. cmd = 'libtool -static -o ' + BracketNameWithQuotes(lib)
  1411. else:
  1412. cmd = GetAR() + ' cru ' + BracketNameWithQuotes(lib)
  1413. for x in obj:
  1414. if GetLinkAllStatic() and x.endswith('.a'):
  1415. continue
  1416. cmd += ' ' + BracketNameWithQuotes(x)
  1417. oscmd(cmd)
  1418. oscmd(GetRanlib() + ' ' + BracketNameWithQuotes(lib))
  1419. ########################################################################
  1420. ##
  1421. ## CompileLink
  1422. ##
  1423. ########################################################################
  1424. def CompileLink(dll, obj, opts):
  1425. if (COMPILER=="MSVC"):
  1426. if not BOOUSEINTELCOMPILER:
  1427. cmd = "link /nologo "
  1428. if HasTargetArch():
  1429. cmd += " /MACHINE:" + GetTargetArch().upper()
  1430. if ("MFC" not in opts):
  1431. cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCMT"
  1432. cmd += " /NOD:LIBCI.LIB /DEBUG"
  1433. cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls /nod:atlsd"
  1434. if (GetOrigExt(dll) != ".exe"): cmd += " /DLL"
  1435. optlevel = GetOptimizeOption(opts)
  1436. if (optlevel==1): cmd += " /MAP /MAPINFO:EXPORTS /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB"
  1437. if (optlevel==2): cmd += " /MAP:NUL /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB"
  1438. if (optlevel==3): cmd += " /MAP:NUL /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB"
  1439. if (optlevel==4): cmd += " /MAP:NUL /LTCG /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB"
  1440. if ("MFC" in opts):
  1441. if (optlevel<=2): cmd += " /NOD:MSVCRTD.LIB mfcs100d.lib MSVCRTD.lib"
  1442. else: cmd += " /NOD:MSVCRT.LIB mfcs100.lib MSVCRT.lib"
  1443. cmd += " /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO "
  1444. cmd += ' /OUT:' + BracketNameWithQuotes(dll)
  1445. if not PkgSkip("PYTHON"):
  1446. # If we're building without Python, don't pick it up implicitly.
  1447. if "PYTHON" not in opts:
  1448. pythonv = SDK["PYTHONVERSION"].replace('.', '')
  1449. if optlevel <= 2:
  1450. cmd += ' /NOD:{}d.lib'.format(pythonv)
  1451. else:
  1452. cmd += ' /NOD:{}.lib'.format(pythonv)
  1453. # Yes, we know we are importing "locally defined symbols".
  1454. for x in obj:
  1455. if x.endswith('libp3pystub.lib'):
  1456. cmd += ' /ignore:4049,4217'
  1457. break
  1458. # Set the subsystem. Specify that we want to target Windows XP.
  1459. subsystem = GetValueOption(opts, "SUBSYSTEM:") or "CONSOLE"
  1460. cmd += " /SUBSYSTEM:" + subsystem
  1461. if GetTargetArch() == 'x64':
  1462. cmd += ",5.02"
  1463. else:
  1464. cmd += ",5.01"
  1465. if dll.endswith(".dll") or dll.endswith(".pyd"):
  1466. cmd += ' /IMPLIB:' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(dll))[0] + ".lib"
  1467. for (opt, dir) in LIBDIRECTORIES:
  1468. if (opt=="ALWAYS") or (opt in opts):
  1469. cmd += ' /LIBPATH:' + BracketNameWithQuotes(dir)
  1470. for x in obj:
  1471. if x.endswith(".dll") or x.endswith(".pyd"):
  1472. cmd += ' ' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(x))[0] + ".lib"
  1473. elif x.endswith(".lib"):
  1474. dname = os.path.splitext(os.path.basename(x))[0] + ".dll"
  1475. if (GetOrigExt(x) != ".ilb" and os.path.exists(GetOutputDir()+"/bin/" + dname)):
  1476. exit("Error: in makepanda, specify "+dname+", not "+x)
  1477. cmd += ' ' + BracketNameWithQuotes(x)
  1478. elif x.endswith(".def"):
  1479. cmd += ' /DEF:' + BracketNameWithQuotes(x)
  1480. elif x.endswith(".dat"):
  1481. pass
  1482. else:
  1483. cmd += ' ' + BracketNameWithQuotes(x)
  1484. if (GetOrigExt(dll)==".exe" and "NOICON" not in opts):
  1485. cmd += " " + GetOutputDir() + "/tmp/pandaIcon.res"
  1486. for (opt, name) in LIBNAMES:
  1487. if (opt=="ALWAYS") or (opt in opts):
  1488. cmd += " " + BracketNameWithQuotes(name)
  1489. oscmd(cmd)
  1490. else:
  1491. cmd = "xilink"
  1492. if GetVerbose(): cmd += " /verbose:lib"
  1493. if HasTargetArch():
  1494. cmd += " /MACHINE:" + GetTargetArch().upper()
  1495. if ("MFC" not in opts):
  1496. cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCMT"
  1497. cmd += " /NOD:LIBCI.LIB /DEBUG"
  1498. cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls"
  1499. cmd += ' /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2011 SP1\ipp\lib\ia32"'
  1500. cmd += ' /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2011 SP1\TBB\Lib\ia32\vc10"'
  1501. cmd += ' /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2011 SP1\compiler\lib\ia32"'
  1502. if (GetOrigExt(dll) != ".exe"): cmd += " /DLL"
  1503. optlevel = GetOptimizeOption(opts)
  1504. if (optlevel==1): cmd += " /MAP /MAPINFO:EXPORTS /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB"
  1505. if (optlevel==2): cmd += " /MAP:NUL /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB"
  1506. if (optlevel==3): cmd += " /MAP:NUL /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB"
  1507. if (optlevel==4): cmd += " /MAP:NUL /LTCG /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB"
  1508. if ("MFC" in opts):
  1509. if (optlevel<=2): cmd += " /NOD:MSVCRTD.LIB mfcs100d.lib MSVCRTD.lib"
  1510. else: cmd += " /NOD:MSVCRT.LIB mfcs100.lib MSVCRT.lib"
  1511. cmd += " /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO "
  1512. cmd += ' /OUT:' + BracketNameWithQuotes(dll)
  1513. subsystem = GetValueOption(opts, "SUBSYSTEM:")
  1514. if subsystem:
  1515. cmd += " /SUBSYSTEM:" + subsystem
  1516. if dll.endswith(".dll"):
  1517. cmd += ' /IMPLIB:' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(dll))[0] + ".lib"
  1518. for (opt, dir) in LIBDIRECTORIES:
  1519. if (opt=="ALWAYS") or (opt in opts):
  1520. cmd += ' /LIBPATH:' + BracketNameWithQuotes(dir)
  1521. for x in obj:
  1522. if x.endswith(".dll") or x.endswith(".pyd"):
  1523. cmd += ' ' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(x))[0] + ".lib"
  1524. elif x.endswith(".lib"):
  1525. dname = os.path.splitext(dll)[0]+".dll"
  1526. if (GetOrigExt(x) != ".ilb" and os.path.exists(GetOutputDir()+"/bin/" + os.path.splitext(os.path.basename(x))[0] + ".dll")):
  1527. exit("Error: in makepanda, specify "+dname+", not "+x)
  1528. cmd += ' ' + BracketNameWithQuotes(x)
  1529. elif x.endswith(".def"):
  1530. cmd += ' /DEF:' + BracketNameWithQuotes(x)
  1531. elif x.endswith(".dat"):
  1532. pass
  1533. else:
  1534. cmd += ' ' + BracketNameWithQuotes(x)
  1535. if (GetOrigExt(dll)==".exe" and "NOICON" not in opts):
  1536. cmd += " " + GetOutputDir() + "/tmp/pandaIcon.res"
  1537. for (opt, name) in LIBNAMES:
  1538. if (opt=="ALWAYS") or (opt in opts):
  1539. cmd += " " + BracketNameWithQuotes(name)
  1540. oscmd(cmd)
  1541. if COMPILER == "GCC":
  1542. cxx = GetCXX()
  1543. if GetOrigExt(dll) == ".exe":
  1544. cmd = cxx + ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
  1545. if GetTarget() == "android":
  1546. # Necessary to work around an issue with libandroid depending on vendor libraries
  1547. cmd += ' -Wl,--allow-shlib-undefined'
  1548. else:
  1549. if (GetTarget() == "darwin"):
  1550. cmd = cxx + ' -undefined dynamic_lookup'
  1551. if ("BUNDLE" in opts or GetOrigExt(dll) == ".pyd"):
  1552. cmd += ' -bundle '
  1553. else:
  1554. install_name = '@loader_path/../lib/' + os.path.basename(dll)
  1555. cmd += ' -dynamiclib -install_name ' + install_name
  1556. cmd += ' -compatibility_version ' + MAJOR_VERSION + ' -current_version ' + VERSION
  1557. cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
  1558. else:
  1559. cmd = cxx + ' -shared'
  1560. # Always set soname on Android to avoid a linker warning when loading the library.
  1561. if "MODULE" not in opts or GetTarget() == 'android':
  1562. cmd += " -Wl,-soname=" + os.path.basename(dll)
  1563. cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
  1564. for x in obj:
  1565. if GetOrigExt(x) != ".dat":
  1566. cmd += ' ' + x
  1567. if (GetOrigExt(dll) == ".exe" and GetTarget() == 'windows' and "NOICON" not in opts):
  1568. cmd += " " + GetOutputDir() + "/tmp/pandaIcon.res"
  1569. # Mac OS X specific flags.
  1570. if GetTarget() == 'darwin':
  1571. cmd += " -headerpad_max_install_names"
  1572. if OSXTARGET is not None:
  1573. cmd += " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"]
  1574. cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET)
  1575. for arch in OSX_ARCHS:
  1576. if 'NOARCH:' + arch.upper() not in opts:
  1577. cmd += " -arch %s" % arch
  1578. elif GetTarget() == 'android':
  1579. arch = GetTargetArch()
  1580. if "ANDROID_GCC_TOOLCHAIN" in SDK:
  1581. cmd += ' -gcc-toolchain ' + SDK["ANDROID_GCC_TOOLCHAIN"].replace('\\', '/')
  1582. cmd += " -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now"
  1583. if arch == 'armv7a':
  1584. cmd += ' -target armv7-none-linux-androideabi'
  1585. cmd += " -march=armv7-a -Wl,--fix-cortex-a8"
  1586. elif arch == 'arm':
  1587. cmd += ' -target armv5te-none-linux-androideabi'
  1588. elif arch == 'aarch64':
  1589. cmd += ' -target aarch64-none-linux-android'
  1590. elif arch == 'mips':
  1591. cmd += ' -target mipsel-none-linux-android'
  1592. cmd += ' -mips32'
  1593. elif arch == 'mips64':
  1594. cmd += ' -target mips64el-none-linux-android'
  1595. elif arch == 'x86':
  1596. cmd += ' -target i686-none-linux-android'
  1597. elif arch == 'x86_64':
  1598. cmd += ' -target x86_64-none-linux-android'
  1599. cmd += ' -lc -lm'
  1600. else:
  1601. cmd += " -pthread"
  1602. if "SYSROOT" in SDK:
  1603. cmd += " --sysroot=%s -no-canonical-prefixes" % (SDK["SYSROOT"])
  1604. if LDFLAGS != "":
  1605. cmd += " " + LDFLAGS
  1606. # Don't link libraries with Python, except on Android.
  1607. if "PYTHON" in opts and GetOrigExt(dll) != ".exe" and not RTDIST and GetTarget() != 'android':
  1608. opts = opts[:]
  1609. opts.remove("PYTHON")
  1610. for (opt, dir) in LIBDIRECTORIES:
  1611. if (opt=="ALWAYS") or (opt in opts):
  1612. cmd += ' -L' + BracketNameWithQuotes(dir)
  1613. for (opt, dir) in FRAMEWORKDIRECTORIES:
  1614. if (opt=="ALWAYS") or (opt in opts):
  1615. cmd += ' -F' + BracketNameWithQuotes(dir)
  1616. for (opt, name) in LIBNAMES:
  1617. if (opt=="ALWAYS") or (opt in opts):
  1618. cmd += ' ' + BracketNameWithQuotes(name)
  1619. if GetTarget() != 'freebsd':
  1620. cmd += " -ldl"
  1621. oscmd(cmd)
  1622. if GetOptimizeOption(opts) == 4 and GetTarget() in ('linux', 'android'):
  1623. oscmd(GetStrip() + " --strip-unneeded " + BracketNameWithQuotes(dll))
  1624. os.system("chmod +x " + BracketNameWithQuotes(dll))
  1625. if dll.endswith("." + MAJOR_VERSION + ".dylib"):
  1626. newdll = dll[:-6-len(MAJOR_VERSION)] + "dylib"
  1627. if os.path.isfile(newdll):
  1628. os.remove(newdll)
  1629. oscmd("ln -s " + BracketNameWithQuotes(os.path.basename(dll)) + " " + BracketNameWithQuotes(newdll))
  1630. elif dll.endswith("." + MAJOR_VERSION):
  1631. newdll = dll[:-len(MAJOR_VERSION)-1]
  1632. if os.path.isfile(newdll):
  1633. os.remove(newdll)
  1634. oscmd("ln -s " + BracketNameWithQuotes(os.path.basename(dll)) + " " + BracketNameWithQuotes(newdll))
  1635. ##########################################################################################
  1636. #
  1637. # CompileEgg
  1638. #
  1639. ##########################################################################################
  1640. def CompileEgg(eggfile, src, opts):
  1641. pz = False
  1642. if eggfile.endswith(".pz"):
  1643. pz = True
  1644. eggfile = eggfile[:-3]
  1645. # Determine the location of the pzip and flt2egg tools.
  1646. if CrossCompiling():
  1647. # We may not be able to use our generated versions of these tools,
  1648. # so we'll expect them to already be present in the PATH.
  1649. pzip = 'pzip'
  1650. flt2egg = 'flt2egg'
  1651. else:
  1652. # If we're compiling for this machine, we can use the binaries we've built.
  1653. pzip = os.path.join(GetOutputDir(), 'bin', 'pzip')
  1654. flt2egg = os.path.join(GetOutputDir(), 'bin', 'flt2egg')
  1655. if not os.path.isfile(pzip):
  1656. pzip = 'pzip'
  1657. if not os.path.isfile(flt2egg):
  1658. flt2egg = 'flt2egg'
  1659. if src.endswith(".egg"):
  1660. CopyFile(eggfile, src)
  1661. elif src.endswith(".flt"):
  1662. oscmd(flt2egg + ' -ps keep -o ' + BracketNameWithQuotes(eggfile) + ' ' + BracketNameWithQuotes(src))
  1663. if pz:
  1664. oscmd(pzip + ' ' + BracketNameWithQuotes(eggfile))
  1665. ##########################################################################################
  1666. #
  1667. # CompileRes, CompileRsrc
  1668. #
  1669. ##########################################################################################
  1670. def CompileRes(target, src, opts):
  1671. """Compiles a Windows .rc file into a .res file."""
  1672. ipath = GetListOption(opts, "DIR:")
  1673. if (COMPILER == "MSVC"):
  1674. cmd = "rc"
  1675. cmd += " /Fo" + BracketNameWithQuotes(target)
  1676. for x in ipath: cmd += " /I" + x
  1677. for (opt,dir) in INCDIRECTORIES:
  1678. if (opt=="ALWAYS") or (opt in opts):
  1679. cmd += " /I" + BracketNameWithQuotes(dir)
  1680. for (opt,var,val) in DEFSYMBOLS:
  1681. if (opt=="ALWAYS") or (opt in opts):
  1682. cmd += " /D" + var + "=" + val
  1683. cmd += " " + BracketNameWithQuotes(src)
  1684. else:
  1685. cmd = "windres"
  1686. for x in ipath: cmd += " -I" + x
  1687. for (opt,dir) in INCDIRECTORIES:
  1688. if (opt=="ALWAYS") or (opt in opts):
  1689. cmd += " -I" + BracketNameWithQuotes(dir)
  1690. for (opt,var,val) in DEFSYMBOLS:
  1691. if (opt=="ALWAYS") or (opt in opts):
  1692. cmd += " -D" + var + "=" + val
  1693. cmd += " -i " + BracketNameWithQuotes(src)
  1694. cmd += " -o " + BracketNameWithQuotes(target)
  1695. oscmd(cmd)
  1696. def CompileRsrc(target, src, opts):
  1697. """Compiles a Mac OS .r file into an .rsrc file."""
  1698. ipath = GetListOption(opts, "DIR:")
  1699. if os.path.isfile("/usr/bin/Rez"):
  1700. cmd = "Rez -useDF"
  1701. else:
  1702. cmd = "/Developer/Tools/Rez -useDF"
  1703. cmd += " -o " + BracketNameWithQuotes(target)
  1704. for x in ipath:
  1705. cmd += " -i " + x
  1706. for (opt,dir) in INCDIRECTORIES:
  1707. if (opt=="ALWAYS") or (opt in opts):
  1708. cmd += " -i " + BracketNameWithQuotes(dir)
  1709. for (opt,var,val) in DEFSYMBOLS:
  1710. if (opt=="ALWAYS") or (opt in opts):
  1711. if (val == ""):
  1712. cmd += " -d " + var
  1713. else:
  1714. cmd += " -d " + var + " = " + val
  1715. cmd += " " + BracketNameWithQuotes(src)
  1716. oscmd(cmd)
  1717. ##########################################################################################
  1718. #
  1719. # CompileJava (Android only)
  1720. #
  1721. ##########################################################################################
  1722. def CompileJava(target, src, opts):
  1723. """Compiles a .java file into a .class file."""
  1724. cmd = "ecj "
  1725. optlevel = GetOptimizeOption(opts)
  1726. if optlevel >= 4:
  1727. cmd += "-debug:none "
  1728. cmd += "-cp " + GetOutputDir() + "/classes "
  1729. cmd += "-d " + GetOutputDir() + "/classes "
  1730. cmd += BracketNameWithQuotes(src)
  1731. oscmd(cmd)
  1732. ##########################################################################################
  1733. #
  1734. # FreezePy
  1735. #
  1736. ##########################################################################################
  1737. def FreezePy(target, inputs, opts):
  1738. assert len(inputs) > 0
  1739. cmdstr = BracketNameWithQuotes(SDK["PYTHONEXEC"].replace('\\', '/')) + " "
  1740. if sys.version_info >= (2, 6):
  1741. cmdstr += "-B "
  1742. cmdstr += os.path.join(GetOutputDir(), "direct", "showutil", "pfreeze.py")
  1743. if 'FREEZE_STARTUP' in opts:
  1744. cmdstr += " -s"
  1745. if GetOrigExt(target) == '.exe':
  1746. src = inputs.pop(0)
  1747. else:
  1748. src = ""
  1749. for i in inputs:
  1750. i = os.path.splitext(i)[0]
  1751. i = i.replace('/', '.')
  1752. if i.startswith('direct.src'):
  1753. i = i.replace('.src.', '.')
  1754. cmdstr += " -i " + i
  1755. cmdstr += " -o " + target + " " + src
  1756. if ("LINK_PYTHON_STATIC" in opts):
  1757. os.environ["LINK_PYTHON_STATIC"] = "1"
  1758. oscmd(cmdstr)
  1759. if ("LINK_PYTHON_STATIC" in os.environ):
  1760. del os.environ["LINK_PYTHON_STATIC"]
  1761. if (not os.path.exists(target)):
  1762. exit("FREEZER_ERROR")
  1763. ##########################################################################################
  1764. #
  1765. # Package
  1766. #
  1767. ##########################################################################################
  1768. def Package(target, inputs, opts):
  1769. assert len(inputs) == 1
  1770. # Invoke the ppackage script.
  1771. command = BracketNameWithQuotes(SDK["PYTHONEXEC"]) + " "
  1772. if GetOptimizeOption(opts) >= 4:
  1773. command += "-OO "
  1774. if sys.version_info >= (2, 6):
  1775. command += "-B "
  1776. command += "direct/src/p3d/ppackage.py"
  1777. if not RTDIST:
  1778. # Don't compile Python sources, because we might not running in the same
  1779. # Python version as the selected host.
  1780. command += " -N"
  1781. if GetTarget() == "darwin":
  1782. if SDK.get("MACOSX"):
  1783. command += " -R \"%s\"" % SDK["MACOSX"]
  1784. for arch in OSX_ARCHS:
  1785. if arch == "x86_64":
  1786. arch = "amd64"
  1787. command += " -P osx_%s" % arch
  1788. command += " -i \"" + GetOutputDir() + "/stage\""
  1789. if (P3DSUFFIX):
  1790. command += ' -a "' + P3DSUFFIX + '"'
  1791. command += " " + inputs[0]
  1792. if GetOrigExt(target) == '.p3d':
  1793. # Build a specific .p3d file.
  1794. basename = os.path.basename(os.path.splitext(target)[0])
  1795. command += " " + basename
  1796. oscmd(command)
  1797. if GetTarget() == 'windows':
  1798. # Make an .exe that calls this .p3d.
  1799. objfile = FindLocation('p3dWrapper_' + basename + '.obj', [])
  1800. CompileCxx(objfile, 'direct/src/p3d/p3dWrapper.c', [])
  1801. exefile = FindLocation(basename + '.exe', [])
  1802. CompileLink(exefile, [objfile], ['ADVAPI'])
  1803. # Move it to the bin directory.
  1804. os.rename(GetOutputDir() + '/stage/' + basename + P3DSUFFIX + '.p3d', target)
  1805. if sys.platform != 'win32':
  1806. oscmd('chmod +x ' + BracketNameWithQuotes(target))
  1807. else:
  1808. # This is presumably a package or set of packages.
  1809. oscmd(command)
  1810. ##########################################################################################
  1811. #
  1812. # CompileBundle
  1813. #
  1814. ##########################################################################################
  1815. def CompileBundle(target, inputs, opts):
  1816. assert GetTarget() == "darwin", 'bundles can only be made for Mac OS X'
  1817. plist = None
  1818. resources = []
  1819. objects = []
  1820. for i in inputs:
  1821. if (i.endswith(".plist")):
  1822. if (plist != None): exit("Only one plist file can be used when creating a bundle!")
  1823. plist = i
  1824. elif (i.endswith(".rsrc") or i.endswith(".icns")):
  1825. resources.append(i)
  1826. elif (GetOrigExt(i) == ".obj" or GetOrigExt(i) in SUFFIX_LIB or GetOrigExt(i) in SUFFIX_DLL):
  1827. objects.append(i)
  1828. else:
  1829. exit("Don't know how to bundle file %s" % i)
  1830. # Now link the object files to form the bundle.
  1831. if (plist == None): exit("One plist file must be used when creating a bundle!")
  1832. bundleName = plistlib.readPlist(plist)["CFBundleExecutable"]
  1833. oscmd("rm -rf %s" % target)
  1834. oscmd("mkdir -p %s/Contents/MacOS/" % target)
  1835. oscmd("mkdir -p %s/Contents/Resources/" % target)
  1836. if target.endswith(".app"):
  1837. SetOrigExt("%s/Contents/MacOS/%s" % (target, bundleName), ".exe")
  1838. else:
  1839. SetOrigExt("%s/Contents/MacOS/%s" % (target, bundleName), ".dll")
  1840. CompileLink("%s/Contents/MacOS/%s" % (target, bundleName), objects, opts + ["BUNDLE"])
  1841. oscmd("cp %s %s/Contents/Info.plist" % (plist, target))
  1842. for r in resources:
  1843. oscmd("cp %s %s/Contents/Resources/" % (r, target))
  1844. ##########################################################################################
  1845. #
  1846. # CompileMIDL
  1847. #
  1848. ##########################################################################################
  1849. def CompileMIDL(target, src, opts):
  1850. ipath = GetListOption(opts, "DIR:")
  1851. if (COMPILER=="MSVC"):
  1852. cmd = "midl"
  1853. cmd += " /out" + BracketNameWithQuotes(os.path.dirname(target))
  1854. for x in ipath: cmd += " /I" + x
  1855. for (opt,dir) in INCDIRECTORIES:
  1856. if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
  1857. for (opt,var,val) in DEFSYMBOLS:
  1858. if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
  1859. cmd += " " + BracketNameWithQuotes(src)
  1860. oscmd(cmd)
  1861. ##########################################################################################
  1862. #
  1863. # CompileAnything
  1864. #
  1865. ##########################################################################################
  1866. def CompileAnything(target, inputs, opts, progress = None):
  1867. if (opts.count("DEPENDENCYONLY")):
  1868. return
  1869. if (len(inputs)==0):
  1870. exit("No input files for target "+target)
  1871. infile = inputs[0]
  1872. origsuffix = GetOrigExt(target)
  1873. if (len(inputs) == 1 and origsuffix == GetOrigExt(infile)):
  1874. # It must be a simple copy operation.
  1875. ProgressOutput(progress, "Copying file", target)
  1876. CopyFile(target, infile)
  1877. if (origsuffix==".exe" and GetHost() != "windows"):
  1878. os.system("chmod +x \"%s\"" % target)
  1879. return
  1880. elif (infile.endswith(".py")):
  1881. if origsuffix == ".obj":
  1882. source = os.path.splitext(target)[0] + ".c"
  1883. SetOrigExt(source, ".c")
  1884. ProgressOutput(progress, "Building frozen source", source)
  1885. FreezePy(source, inputs, opts)
  1886. ProgressOutput(progress, "Building C++ object", target)
  1887. return CompileCxx(target, source, opts)
  1888. if origsuffix == ".exe":
  1889. ProgressOutput(progress, "Building frozen executable", target)
  1890. else:
  1891. ProgressOutput(progress, "Building frozen library", target)
  1892. return FreezePy(target, inputs, opts)
  1893. elif (infile.endswith(".idl")):
  1894. ProgressOutput(progress, "Compiling MIDL file", infile)
  1895. return CompileMIDL(target, infile, opts)
  1896. elif (infile.endswith(".pdef")):
  1897. if origsuffix == '.p3d':
  1898. ProgressOutput(progress, "Building package", target)
  1899. else:
  1900. ProgressOutput(progress, "Building package from pdef file", infile)
  1901. return Package(target, inputs, opts)
  1902. elif origsuffix in SUFFIX_LIB:
  1903. ProgressOutput(progress, "Linking static library", target)
  1904. return CompileLib(target, inputs, opts)
  1905. elif origsuffix in SUFFIX_DLL or (origsuffix==".plugin" and GetTarget() != "darwin"):
  1906. if (origsuffix==".exe"):
  1907. ProgressOutput(progress, "Linking executable", target)
  1908. else:
  1909. ProgressOutput(progress, "Linking dynamic library", target)
  1910. # Add version number to the dynamic library, on unix
  1911. if origsuffix == ".dll" and "MODULE" not in opts and not RTDIST:
  1912. tplatform = GetTarget()
  1913. if tplatform == "darwin":
  1914. # On Mac, libraries are named like libpanda.1.2.dylib
  1915. if target.lower().endswith(".dylib"):
  1916. target = target[:-5] + MAJOR_VERSION + ".dylib"
  1917. SetOrigExt(target, origsuffix)
  1918. elif tplatform != "windows" and tplatform != "android":
  1919. # On Linux, libraries are named like libpanda.so.1.2
  1920. target += "." + MAJOR_VERSION
  1921. SetOrigExt(target, origsuffix)
  1922. return CompileLink(target, inputs, opts)
  1923. elif (origsuffix==".in"):
  1924. ProgressOutput(progress, "Building Interrogate database", target)
  1925. return CompileIgate(target, inputs, opts)
  1926. elif (origsuffix==".plugin" and GetTarget() == "darwin"):
  1927. ProgressOutput(progress, "Building plugin bundle", target)
  1928. return CompileBundle(target, inputs, opts)
  1929. elif (origsuffix==".app"):
  1930. ProgressOutput(progress, "Building application bundle", target)
  1931. return CompileBundle(target, inputs, opts)
  1932. elif (origsuffix==".pz"):
  1933. ProgressOutput(progress, "Compressing", target)
  1934. return CompileEgg(target, infile, opts)
  1935. elif (origsuffix==".egg"):
  1936. ProgressOutput(progress, "Converting", target)
  1937. return CompileEgg(target, infile, opts)
  1938. elif (origsuffix==".res"):
  1939. ProgressOutput(progress, "Building resource object", target)
  1940. return CompileRes(target, infile, opts)
  1941. elif (origsuffix==".rsrc"):
  1942. ProgressOutput(progress, "Building resource object", target)
  1943. return CompileRsrc(target, infile, opts)
  1944. elif (origsuffix==".class"):
  1945. ProgressOutput(progress, "Building Java class", target)
  1946. return CompileJava(target, infile, opts)
  1947. elif (origsuffix==".obj"):
  1948. if (infile.endswith(".cxx")):
  1949. ProgressOutput(progress, "Building C++ object", target)
  1950. return CompileCxx(target, infile, opts)
  1951. elif (infile.endswith(".c")):
  1952. ProgressOutput(progress, "Building C object", target)
  1953. return CompileCxx(target, infile, opts)
  1954. elif (infile.endswith(".mm")):
  1955. ProgressOutput(progress, "Building Objective-C++ object", target)
  1956. return CompileCxx(target, infile, opts)
  1957. elif (infile.endswith(".yxx")):
  1958. ProgressOutput(progress, "Building Bison object", target)
  1959. return CompileBison(target, infile, opts)
  1960. elif (infile.endswith(".lxx")):
  1961. ProgressOutput(progress, "Building Flex object", target)
  1962. return CompileFlex(target, infile, opts)
  1963. elif (infile.endswith(".in")):
  1964. ProgressOutput(progress, "Building Interrogate object", target)
  1965. return CompileImod(target, inputs, opts)
  1966. elif (infile.endswith(".rc")):
  1967. ProgressOutput(progress, "Building resource object", target)
  1968. return CompileRes(target, infile, opts)
  1969. elif (infile.endswith(".r")):
  1970. ProgressOutput(progress, "Building resource object", target)
  1971. return CompileRsrc(target, infile, opts)
  1972. exit("Don't know how to compile: %s from %s" % (target, inputs))
  1973. ##########################################################################################
  1974. #
  1975. # Generate dtool_config.h, prc_parameters.h, and dtool_have_xxx.dat
  1976. #
  1977. ##########################################################################################
  1978. DTOOL_CONFIG=[
  1979. #_Variable_________________________Windows___________________Unix__________
  1980. ("HAVE_PYTHON", '1', '1'),
  1981. ("USE_DEBUG_PYTHON", 'UNDEF', 'UNDEF'),
  1982. ("PYTHON_FRAMEWORK", 'UNDEF', 'UNDEF'),
  1983. ("COMPILE_IN_DEFAULT_FONT", '1', '1'),
  1984. ("STDFLOAT_DOUBLE", 'UNDEF', 'UNDEF'),
  1985. ("HAVE_MAYA", '1', '1'),
  1986. ("HAVE_SOFTIMAGE", 'UNDEF', 'UNDEF'),
  1987. ("REPORT_OPENSSL_ERRORS", '1', '1'),
  1988. ("USE_PANDAFILESTREAM", '1', '1'),
  1989. ("USE_DELETED_CHAIN", '1', '1'),
  1990. ("HAVE_GLX", 'UNDEF', '1'),
  1991. ("HAVE_WGL", '1', 'UNDEF'),
  1992. ("HAVE_DX9", 'UNDEF', 'UNDEF'),
  1993. ("HAVE_THREADS", '1', '1'),
  1994. ("SIMPLE_THREADS", 'UNDEF', 'UNDEF'),
  1995. ("OS_SIMPLE_THREADS", '1', '1'),
  1996. ("DEBUG_THREADS", 'UNDEF', 'UNDEF'),
  1997. ("HAVE_POSIX_THREADS", 'UNDEF', '1'),
  1998. ("MUTEX_SPINLOCK", 'UNDEF', 'UNDEF'),
  1999. ("HAVE_AUDIO", '1', '1'),
  2000. ("NOTIFY_DEBUG", 'UNDEF', 'UNDEF'),
  2001. ("DO_PSTATS", 'UNDEF', 'UNDEF'),
  2002. ("DO_DCAST", 'UNDEF', 'UNDEF'),
  2003. ("DO_COLLISION_RECORDING", 'UNDEF', 'UNDEF'),
  2004. ("SUPPORT_IMMEDIATE_MODE", 'UNDEF', 'UNDEF'),
  2005. ("SUPPORT_FIXED_FUNCTION", '1', '1'),
  2006. ("DO_MEMORY_USAGE", 'UNDEF', 'UNDEF'),
  2007. ("DO_PIPELINING", '1', '1'),
  2008. ("DEFAULT_PATHSEP", '";"', '":"'),
  2009. ("WORDS_BIGENDIAN", 'UNDEF', 'UNDEF'),
  2010. ("PHAVE_LOCKF", '1', '1'),
  2011. ("SIMPLE_STRUCT_POINTERS", '1', 'UNDEF'),
  2012. ("HAVE_DINKUM", 'UNDEF', 'UNDEF'),
  2013. ("HAVE_STL_HASH", 'UNDEF', 'UNDEF'),
  2014. ("GETTIMEOFDAY_ONE_PARAM", 'UNDEF', 'UNDEF'),
  2015. ("HAVE_GETOPT", 'UNDEF', '1'),
  2016. ("HAVE_GETOPT_LONG_ONLY", 'UNDEF', '1'),
  2017. ("PHAVE_GETOPT_H", 'UNDEF', '1'),
  2018. ("PHAVE_LINUX_INPUT_H", 'UNDEF', '1'),
  2019. ("IOCTL_TERMINAL_WIDTH", 'UNDEF', '1'),
  2020. ("HAVE_IOS_TYPEDEFS", '1', '1'),
  2021. ("HAVE_IOS_BINARY", '1', '1'),
  2022. ("STATIC_INIT_GETENV", '1', 'UNDEF'),
  2023. ("HAVE_PROC_SELF_EXE", 'UNDEF', '1'),
  2024. ("HAVE_PROC_SELF_MAPS", 'UNDEF', '1'),
  2025. ("HAVE_PROC_SELF_ENVIRON", 'UNDEF', '1'),
  2026. ("HAVE_PROC_SELF_CMDLINE", 'UNDEF', '1'),
  2027. ("HAVE_PROC_CURPROC_FILE", 'UNDEF', 'UNDEF'),
  2028. ("HAVE_PROC_CURPROC_MAP", 'UNDEF', 'UNDEF'),
  2029. ("HAVE_PROC_SELF_CMDLINE", 'UNDEF', 'UNDEF'),
  2030. ("HAVE_GLOBAL_ARGV", '1', 'UNDEF'),
  2031. ("PROTOTYPE_GLOBAL_ARGV", 'UNDEF', 'UNDEF'),
  2032. ("GLOBAL_ARGV", '__argv', 'UNDEF'),
  2033. ("GLOBAL_ARGC", '__argc', 'UNDEF'),
  2034. ("PHAVE_IO_H", '1', 'UNDEF'),
  2035. ("PHAVE_IOSTREAM", '1', '1'),
  2036. ("PHAVE_STRING_H", 'UNDEF', '1'),
  2037. ("PHAVE_LIMITS_H", 'UNDEF', '1'),
  2038. ("PHAVE_STDLIB_H", 'UNDEF', '1'),
  2039. ("PHAVE_MALLOC_H", '1', '1'),
  2040. ("PHAVE_SYS_MALLOC_H", 'UNDEF', 'UNDEF'),
  2041. ("PHAVE_ALLOCA_H", 'UNDEF', '1'),
  2042. ("PHAVE_LOCALE_H", 'UNDEF', '1'),
  2043. ("PHAVE_SSTREAM", '1', '1'),
  2044. ("PHAVE_NEW", '1', '1'),
  2045. ("PHAVE_SYS_TYPES_H", '1', '1'),
  2046. ("PHAVE_SYS_TIME_H", 'UNDEF', '1'),
  2047. ("PHAVE_UNISTD_H", 'UNDEF', '1'),
  2048. ("PHAVE_UTIME_H", 'UNDEF', '1'),
  2049. ("PHAVE_GLOB_H", 'UNDEF', '1'),
  2050. ("PHAVE_DIRENT_H", 'UNDEF', '1'),
  2051. ("PHAVE_UCONTEXT_H", 'UNDEF', '1'),
  2052. ("PHAVE_STDINT_H", '1', '1'),
  2053. ("HAVE_RTTI", '1', '1'),
  2054. ("HAVE_X11", 'UNDEF', '1'),
  2055. ("IS_LINUX", 'UNDEF', '1'),
  2056. ("IS_OSX", 'UNDEF', 'UNDEF'),
  2057. ("IS_FREEBSD", 'UNDEF', 'UNDEF'),
  2058. ("HAVE_EIGEN", 'UNDEF', 'UNDEF'),
  2059. ("LINMATH_ALIGN", '1', '1'),
  2060. ("HAVE_ZLIB", 'UNDEF', 'UNDEF'),
  2061. ("HAVE_PNG", 'UNDEF', 'UNDEF'),
  2062. ("HAVE_JPEG", 'UNDEF', 'UNDEF'),
  2063. ("HAVE_VIDEO4LINUX", 'UNDEF', '1'),
  2064. ("HAVE_TIFF", 'UNDEF', 'UNDEF'),
  2065. ("HAVE_OPENEXR", 'UNDEF', 'UNDEF'),
  2066. ("HAVE_SGI_RGB", '1', '1'),
  2067. ("HAVE_TGA", '1', '1'),
  2068. ("HAVE_IMG", '1', '1'),
  2069. ("HAVE_SOFTIMAGE_PIC", '1', '1'),
  2070. ("HAVE_BMP", '1', '1'),
  2071. ("HAVE_PNM", '1', '1'),
  2072. ("HAVE_STB_IMAGE", '1', '1'),
  2073. ("HAVE_VORBIS", 'UNDEF', 'UNDEF'),
  2074. ("HAVE_OPUS", 'UNDEF', 'UNDEF'),
  2075. ("HAVE_FREETYPE", 'UNDEF', 'UNDEF'),
  2076. ("HAVE_FFTW", 'UNDEF', 'UNDEF'),
  2077. ("HAVE_OPENSSL", 'UNDEF', 'UNDEF'),
  2078. ("HAVE_NET", 'UNDEF', 'UNDEF'),
  2079. ("WANT_NATIVE_NET", '1', '1'),
  2080. ("SIMULATE_NETWORK_DELAY", 'UNDEF', 'UNDEF'),
  2081. ("HAVE_CG", 'UNDEF', 'UNDEF'),
  2082. ("HAVE_CGGL", 'UNDEF', 'UNDEF'),
  2083. ("HAVE_CGDX9", 'UNDEF', 'UNDEF'),
  2084. ("HAVE_ARTOOLKIT", 'UNDEF', 'UNDEF'),
  2085. ("HAVE_DIRECTCAM", 'UNDEF', 'UNDEF'),
  2086. ("HAVE_SQUISH", 'UNDEF', 'UNDEF'),
  2087. ("HAVE_CARBON", 'UNDEF', 'UNDEF'),
  2088. ("HAVE_COCOA", 'UNDEF', 'UNDEF'),
  2089. ("HAVE_OPENAL_FRAMEWORK", 'UNDEF', 'UNDEF'),
  2090. ("HAVE_ROCKET_PYTHON", '1', '1'),
  2091. ("HAVE_ROCKET_DEBUGGER", 'UNDEF', 'UNDEF'),
  2092. ("USE_TAU", 'UNDEF', 'UNDEF'),
  2093. ("PRC_SAVE_DESCRIPTIONS", '1', '1'),
  2094. # ("_SECURE_SCL", '0', 'UNDEF'),
  2095. # ("_SECURE_SCL_THROWS", '0', 'UNDEF'),
  2096. ("HAVE_P3D_PLUGIN", 'UNDEF', 'UNDEF'),
  2097. ]
  2098. PRC_PARAMETERS=[
  2099. ("DEFAULT_PRC_DIR", '"<auto>etc"', '"<auto>etc"'),
  2100. ("PRC_DIR_ENVVARS", '"PANDA_PRC_DIR"', '"PANDA_PRC_DIR"'),
  2101. ("PRC_PATH_ENVVARS", '"PANDA_PRC_PATH"', '"PANDA_PRC_PATH"'),
  2102. ("PRC_PATH2_ENVVARS", '""', '""'),
  2103. ("PRC_PATTERNS", '"*.prc"', '"*.prc"'),
  2104. ("PRC_ENCRYPTED_PATTERNS", '"*.prc.pe"', '"*.prc.pe"'),
  2105. ("PRC_ENCRYPTION_KEY", '""', '""'),
  2106. ("PRC_EXECUTABLE_PATTERNS", '""', '""'),
  2107. ("PRC_EXECUTABLE_ARGS_ENVVAR", '"PANDA_PRC_XARGS"', '"PANDA_PRC_XARGS"'),
  2108. ("PRC_PUBLIC_KEYS_FILENAME", '""', '""'),
  2109. ("PRC_RESPECT_TRUST_LEVEL", 'UNDEF', 'UNDEF'),
  2110. ("PRC_DCONFIG_TRUST_LEVEL", '0', '0'),
  2111. ("PRC_INC_TRUST_LEVEL", '0', '0'),
  2112. ]
  2113. def WriteConfigSettings():
  2114. dtool_config={}
  2115. prc_parameters={}
  2116. speedtree_parameters={}
  2117. plugin_config={}
  2118. if (GetTarget() == 'windows'):
  2119. for key,win,unix in DTOOL_CONFIG:
  2120. dtool_config[key] = win
  2121. for key,win,unix in PRC_PARAMETERS:
  2122. prc_parameters[key] = win
  2123. else:
  2124. for key,win,unix in DTOOL_CONFIG:
  2125. dtool_config[key] = unix
  2126. for key,win,unix in PRC_PARAMETERS:
  2127. prc_parameters[key] = unix
  2128. for x in PkgListGet():
  2129. if ("HAVE_"+x in dtool_config):
  2130. if (PkgSkip(x)==0):
  2131. dtool_config["HAVE_"+x] = '1'
  2132. else:
  2133. dtool_config["HAVE_"+x] = 'UNDEF'
  2134. dtool_config["HAVE_NET"] = '1'
  2135. if (PkgSkip("NVIDIACG")==0):
  2136. dtool_config["HAVE_CG"] = '1'
  2137. dtool_config["HAVE_CGGL"] = '1'
  2138. dtool_config["HAVE_CGDX9"] = '1'
  2139. if GetTarget() not in ("linux", "android"):
  2140. dtool_config["HAVE_PROC_SELF_EXE"] = 'UNDEF'
  2141. dtool_config["HAVE_PROC_SELF_MAPS"] = 'UNDEF'
  2142. dtool_config["HAVE_PROC_SELF_CMDLINE"] = 'UNDEF'
  2143. dtool_config["HAVE_PROC_SELF_ENVIRON"] = 'UNDEF'
  2144. if (GetTarget() == "darwin"):
  2145. dtool_config["PYTHON_FRAMEWORK"] = 'Python'
  2146. dtool_config["PHAVE_MALLOC_H"] = 'UNDEF'
  2147. dtool_config["PHAVE_SYS_MALLOC_H"] = '1'
  2148. dtool_config["HAVE_OPENAL_FRAMEWORK"] = '1'
  2149. dtool_config["HAVE_X11"] = 'UNDEF' # We might have X11, but we don't need it.
  2150. dtool_config["HAVE_GLX"] = 'UNDEF'
  2151. dtool_config["IS_LINUX"] = 'UNDEF'
  2152. dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
  2153. dtool_config["IS_OSX"] = '1'
  2154. # 10.4 had a broken ucontext implementation
  2155. if int(platform.mac_ver()[0][3]) <= 4:
  2156. dtool_config["PHAVE_UCONTEXT_H"] = 'UNDEF'
  2157. if (GetTarget() == "freebsd"):
  2158. dtool_config["IS_LINUX"] = 'UNDEF'
  2159. dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
  2160. dtool_config["IS_FREEBSD"] = '1'
  2161. dtool_config["PHAVE_ALLOCA_H"] = 'UNDEF'
  2162. dtool_config["PHAVE_MALLOC_H"] = 'UNDEF'
  2163. dtool_config["PHAVE_LINUX_INPUT_H"] = 'UNDEF'
  2164. dtool_config["HAVE_PROC_CURPROC_FILE"] = '1'
  2165. dtool_config["HAVE_PROC_CURPROC_MAP"] = '1'
  2166. dtool_config["HAVE_PROC_CURPROC_CMDLINE"] = '1'
  2167. if (GetTarget() == "android"):
  2168. # Android does have RTTI, but we disable it anyway.
  2169. dtool_config["HAVE_RTTI"] = 'UNDEF'
  2170. dtool_config["PHAVE_GLOB_H"] = 'UNDEF'
  2171. dtool_config["PHAVE_LOCKF"] = 'UNDEF'
  2172. dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
  2173. if (GetOptimize() <= 2 and GetTarget() == "windows"):
  2174. dtool_config["USE_DEBUG_PYTHON"] = '1'
  2175. # This should probably be more sophisticated, such as based
  2176. # on whether the libRocket Python modules are available.
  2177. if (PkgSkip("PYTHON") != 0):
  2178. dtool_config["HAVE_ROCKET_PYTHON"] = 'UNDEF'
  2179. if (GetOptimize() <= 3):
  2180. dtool_config["HAVE_ROCKET_DEBUGGER"] = '1'
  2181. if (GetOptimize() <= 3):
  2182. if (dtool_config["HAVE_NET"] != 'UNDEF'):
  2183. dtool_config["DO_PSTATS"] = '1'
  2184. if (GetOptimize() <= 3):
  2185. dtool_config["DO_DCAST"] = '1'
  2186. if (GetOptimize() <= 3):
  2187. dtool_config["DO_COLLISION_RECORDING"] = '1'
  2188. if (GetOptimize() <= 3):
  2189. dtool_config["DO_MEMORY_USAGE"] = '1'
  2190. if (GetOptimize() <= 3):
  2191. dtool_config["NOTIFY_DEBUG"] = '1'
  2192. if (GetOptimize() >= 4):
  2193. dtool_config["PRC_SAVE_DESCRIPTIONS"] = 'UNDEF'
  2194. if (GetOptimize() >= 4):
  2195. # Disable RTTI on release builds.
  2196. dtool_config["HAVE_RTTI"] = 'UNDEF'
  2197. # Now that we have OS_SIMPLE_THREADS, we can support
  2198. # SIMPLE_THREADS on exotic architectures like win64, so we no
  2199. # longer need to disable it for this platform.
  2200. ## if GetTarget() == 'windows' and GetTargetArch() == 'x64':
  2201. ## dtool_config["SIMPLE_THREADS"] = 'UNDEF'
  2202. if (RTDIST or RUNTIME):
  2203. prc_parameters["DEFAULT_PRC_DIR"] = '""'
  2204. if HOST_URL:
  2205. plugin_config["PANDA_PACKAGE_HOST_URL"] = HOST_URL
  2206. #plugin_config["P3D_PLUGIN_LOG_DIRECTORY"] = ""
  2207. plugin_config["P3D_PLUGIN_LOG_BASENAME1"] = ""
  2208. plugin_config["P3D_PLUGIN_LOG_BASENAME2"] = ""
  2209. plugin_config["P3D_PLUGIN_LOG_BASENAME3"] = ""
  2210. plugin_config["P3D_PLUGIN_P3D_PLUGIN"] = ""
  2211. plugin_config["P3D_PLUGIN_P3DPYTHON"] = ""
  2212. plugin_config["P3D_COREAPI_VERSION_STR"] = COREAPI_VERSION
  2213. plugin_config["P3D_PLUGIN_VERSION_STR"] = PLUGIN_VERSION
  2214. if PkgSkip("GTK2") == 0:
  2215. plugin_config["HAVE_GTK"] = '1'
  2216. if (RUNTIME):
  2217. dtool_config["HAVE_P3D_PLUGIN"] = '1'
  2218. # Whether it's present on the system doesn't matter here,
  2219. # as the runtime itself doesn't include or link with X11.
  2220. if (RUNTIME and GetTarget() == 'linux'):
  2221. dtool_config["HAVE_X11"] = '1'
  2222. if ("GENERIC_DXERR_LIBRARY" in SDK):
  2223. dtool_config["USE_GENERIC_DXERR_LIBRARY"] = "1"
  2224. else:
  2225. dtool_config["USE_GENERIC_DXERR_LIBRARY"] = "UNDEF"
  2226. if (PkgSkip("SPEEDTREE")==0):
  2227. speedtree_parameters["SPEEDTREE_OPENGL"] = "UNDEF"
  2228. speedtree_parameters["SPEEDTREE_DIRECTX9"] = "UNDEF"
  2229. if SDK["SPEEDTREEAPI"] == "OpenGL":
  2230. speedtree_parameters["SPEEDTREE_OPENGL"] = "1"
  2231. elif SDK["SPEEDTREEAPI"] == "DirectX9":
  2232. speedtree_parameters["SPEEDTREE_DIRECTX9"] = "1"
  2233. speedtree_parameters["SPEEDTREE_BIN_DIR"] = (SDK["SPEEDTREE"] + "/Bin")
  2234. conf = "/* prc_parameters.h. Generated automatically by makepanda.py */\n"
  2235. for key in sorted(prc_parameters.keys()):
  2236. if ((key == "DEFAULT_PRC_DIR") or (key[:4]=="PRC_")):
  2237. val = OverrideValue(key, prc_parameters[key])
  2238. if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
  2239. else: conf = conf + "#define " + key + " " + val + "\n"
  2240. ConditionalWriteFile(GetOutputDir() + '/include/prc_parameters.h', conf)
  2241. conf = "/* dtool_config.h. Generated automatically by makepanda.py */\n"
  2242. for key in sorted(dtool_config.keys()):
  2243. val = OverrideValue(key, dtool_config[key])
  2244. if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
  2245. else: conf = conf + "#define " + key + " " + val + "\n"
  2246. ConditionalWriteFile(GetOutputDir() + '/include/dtool_config.h', conf)
  2247. if (RTDIST or RUNTIME):
  2248. conf = "/* p3d_plugin_config.h. Generated automatically by makepanda.py */\n"
  2249. for key in sorted(plugin_config.keys()):
  2250. val = plugin_config[key]
  2251. if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
  2252. else: conf = conf + "#define " + key + " \"" + val.replace("\\", "\\\\") + "\"\n"
  2253. ConditionalWriteFile(GetOutputDir() + '/include/p3d_plugin_config.h', conf)
  2254. if (PkgSkip("SPEEDTREE")==0):
  2255. conf = "/* speedtree_parameters.h. Generated automatically by makepanda.py */\n"
  2256. for key in sorted(speedtree_parameters.keys()):
  2257. val = OverrideValue(key, speedtree_parameters[key])
  2258. if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
  2259. else: conf = conf + "#define " + key + " \"" + val.replace("\\", "\\\\") + "\"\n"
  2260. ConditionalWriteFile(GetOutputDir() + '/include/speedtree_parameters.h', conf)
  2261. for x in PkgListGet():
  2262. if (PkgSkip(x)): ConditionalWriteFile(GetOutputDir() + '/tmp/dtool_have_'+x.lower()+'.dat', "0\n")
  2263. else: ConditionalWriteFile(GetOutputDir() + '/tmp/dtool_have_'+x.lower()+'.dat', "1\n")
  2264. WriteConfigSettings()
  2265. WarnConflictingFiles()
  2266. if SystemLibraryExists("dtoolbase"):
  2267. Warn("Found conflicting Panda3D libraries from other ppremake build!")
  2268. if SystemLibraryExists("p3dtoolconfig"):
  2269. Warn("Found conflicting Panda3D libraries from other makepanda build!")
  2270. ##########################################################################################
  2271. #
  2272. # Generate pandaVersion.h, pythonversion, null.cxx, etc.
  2273. #
  2274. ##########################################################################################
  2275. PANDAVERSION_H="""
  2276. #define PANDA_MAJOR_VERSION $VERSION1
  2277. #define PANDA_MINOR_VERSION $VERSION2
  2278. #define PANDA_SEQUENCE_VERSION $VERSION3
  2279. #define PANDA_VERSION $NVERSION
  2280. #define PANDA_NUMERIC_VERSION $NVERSION
  2281. #define PANDA_VERSION_STR "$VERSION1.$VERSION2.$VERSION3"
  2282. #define PANDA_ABI_VERSION_STR "$VERSION1.$VERSION2"
  2283. #define PANDA_DISTRIBUTOR "$DISTRIBUTOR"
  2284. #define PANDA_PACKAGE_VERSION_STR "$RTDIST_VERSION"
  2285. #define PANDA_PACKAGE_HOST_URL "$HOST_URL"
  2286. """
  2287. PANDAVERSION_H_RUNTIME="""
  2288. #define PANDA_MAJOR_VERSION 0
  2289. #define PANDA_MINOR_VERSION 0
  2290. #define PANDA_SEQUENCE_VERSION 0
  2291. #define PANDA_VERSION_STR "0.0.0"
  2292. #define PANDA_ABI_VERSION_STR "0.0"
  2293. #define P3D_PLUGIN_MAJOR_VERSION $VERSION1
  2294. #define P3D_PLUGIN_MINOR_VERSION $VERSION2
  2295. #define P3D_PLUGIN_SEQUENCE_VERSION $VERSION3
  2296. #define P3D_PLUGIN_VERSION_STR "$VERSION1.$VERSION2.$VERSION3"
  2297. #define P3D_COREAPI_VERSION_STR "$COREAPI_VERSION"
  2298. #define PANDA_DISTRIBUTOR "$DISTRIBUTOR"
  2299. #define PANDA_PACKAGE_VERSION_STR ""
  2300. #define PANDA_PACKAGE_HOST_URL "$HOST_URL"
  2301. """
  2302. CHECKPANDAVERSION_CXX="""
  2303. # include "dtoolbase.h"
  2304. EXPCL_DTOOL_DTOOLBASE int panda_version_$VERSION1_$VERSION2 = 0;
  2305. """
  2306. CHECKPANDAVERSION_H="""
  2307. # ifndef CHECKPANDAVERSION_H
  2308. # define CHECKPANDAVERSION_H
  2309. # include "dtoolbase.h"
  2310. extern EXPCL_DTOOL_DTOOLBASE int panda_version_$VERSION1_$VERSION2;
  2311. // Hack to forcibly depend on the check
  2312. template<typename T>
  2313. class CheckPandaVersion {
  2314. public:
  2315. int check_version() { return panda_version_$VERSION1_$VERSION2; }
  2316. };
  2317. template class CheckPandaVersion<void>;
  2318. # endif
  2319. """
  2320. P3DACTIVEX_RC="""#include "resource.h"
  2321. #define APSTUDIO_READONLY_SYMBOLS
  2322. #include "afxres.h"
  2323. #undef APSTUDIO_READONLY_SYMBOLS
  2324. #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
  2325. #ifdef _WIN32
  2326. LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
  2327. #pragma code_page(1252)
  2328. #endif
  2329. #ifdef APSTUDIO_INVOKED
  2330. 1 TEXTINCLUDE
  2331. BEGIN
  2332. "resource.h\\0"
  2333. END
  2334. 2 TEXTINCLUDE
  2335. BEGIN
  2336. "#include ""afxres.h""\\r\\n"
  2337. "\\0"
  2338. END
  2339. 3 TEXTINCLUDE
  2340. BEGIN
  2341. "1 TYPELIB ""P3DActiveX.tlb""\\r\\n"
  2342. "\\0"
  2343. END
  2344. #endif
  2345. %s
  2346. IDB_P3DACTIVEX BITMAP "P3DActiveXCtrl.bmp"
  2347. IDD_PROPPAGE_P3DACTIVEX DIALOG 0, 0, 250, 62
  2348. STYLE DS_SETFONT | WS_CHILD
  2349. FONT 8, "MS Sans Serif"
  2350. BEGIN
  2351. LTEXT "TODO: Place controls to manipulate properties of P3DActiveX Control on this dialog.",
  2352. IDC_STATIC,7,25,229,16
  2353. END
  2354. #ifdef APSTUDIO_INVOKED
  2355. GUIDELINES DESIGNINFO
  2356. BEGIN
  2357. IDD_PROPPAGE_P3DACTIVEX, DIALOG
  2358. BEGIN
  2359. LEFTMARGIN, 7
  2360. RIGHTMARGIN, 243
  2361. TOPMARGIN, 7
  2362. BOTTOMMARGIN, 55
  2363. END
  2364. END
  2365. #endif
  2366. STRINGTABLE
  2367. BEGIN
  2368. IDS_P3DACTIVEX "P3DActiveX Control"
  2369. IDS_P3DACTIVEX_PPG "P3DActiveX Property Page"
  2370. END
  2371. STRINGTABLE
  2372. BEGIN
  2373. IDS_P3DACTIVEX_PPG_CAPTION "General"
  2374. END
  2375. #endif
  2376. #ifndef APSTUDIO_INVOKED
  2377. 1 TYPELIB "P3DActiveX.tlb"
  2378. #endif"""
  2379. def CreatePandaVersionFiles():
  2380. version1=int(VERSION.split(".")[0])
  2381. version2=int(VERSION.split(".")[1])
  2382. version3=int(VERSION.split(".")[2])
  2383. nversion=version1*1000000+version2*1000+version3
  2384. if (DISTRIBUTOR != "cmu"):
  2385. # Subtract 1 if we are not an official version.
  2386. nversion -= 1
  2387. if (RUNTIME):
  2388. pandaversion_h = PANDAVERSION_H_RUNTIME
  2389. else:
  2390. pandaversion_h = PANDAVERSION_H
  2391. pandaversion_h = pandaversion_h.replace("$VERSION1",str(version1))
  2392. pandaversion_h = pandaversion_h.replace("$VERSION2",str(version2))
  2393. pandaversion_h = pandaversion_h.replace("$VERSION3",str(version3))
  2394. pandaversion_h = pandaversion_h.replace("$NVERSION",str(nversion))
  2395. pandaversion_h = pandaversion_h.replace("$DISTRIBUTOR",DISTRIBUTOR)
  2396. pandaversion_h = pandaversion_h.replace("$RTDIST_VERSION",RTDIST_VERSION)
  2397. pandaversion_h = pandaversion_h.replace("$COREAPI_VERSION",COREAPI_VERSION)
  2398. pandaversion_h = pandaversion_h.replace("$HOST_URL",(HOST_URL or ""))
  2399. if (DISTRIBUTOR == "cmu"):
  2400. pandaversion_h += "\n#define PANDA_OFFICIAL_VERSION\n"
  2401. else:
  2402. pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
  2403. if GIT_COMMIT:
  2404. pandaversion_h += "\n#define PANDA_GIT_COMMIT_STR \"%s\"\n" % (GIT_COMMIT)
  2405. if not RUNTIME:
  2406. checkpandaversion_cxx = CHECKPANDAVERSION_CXX.replace("$VERSION1",str(version1))
  2407. checkpandaversion_cxx = checkpandaversion_cxx.replace("$VERSION2",str(version2))
  2408. checkpandaversion_cxx = checkpandaversion_cxx.replace("$VERSION3",str(version3))
  2409. checkpandaversion_cxx = checkpandaversion_cxx.replace("$NVERSION",str(nversion))
  2410. checkpandaversion_h = CHECKPANDAVERSION_H.replace("$VERSION1",str(version1))
  2411. checkpandaversion_h = checkpandaversion_h.replace("$VERSION2",str(version2))
  2412. checkpandaversion_h = checkpandaversion_h.replace("$VERSION3",str(version3))
  2413. checkpandaversion_h = checkpandaversion_h.replace("$NVERSION",str(nversion))
  2414. ConditionalWriteFile(GetOutputDir()+'/include/pandaVersion.h', pandaversion_h)
  2415. if RUNTIME:
  2416. ConditionalWriteFile(GetOutputDir()+'/include/checkPandaVersion.cxx', '')
  2417. ConditionalWriteFile(GetOutputDir()+'/include/checkPandaVersion.h', '')
  2418. else:
  2419. ConditionalWriteFile(GetOutputDir()+'/include/checkPandaVersion.cxx', checkpandaversion_cxx)
  2420. ConditionalWriteFile(GetOutputDir()+'/include/checkPandaVersion.h', checkpandaversion_h)
  2421. ConditionalWriteFile(GetOutputDir()+"/tmp/null.cxx","")
  2422. if RUNTIME:
  2423. p3dactivex_rc = {"name" : "Panda3D Game Engine Plug-in",
  2424. "version" : VERSION,
  2425. "description" : "Runs 3-D games and interactive applets",
  2426. "filename" : "p3dactivex.ocx",
  2427. "mimetype" : "application/x-panda3d",
  2428. "extension" : "p3d",
  2429. "filedesc" : "Panda3D applet"}
  2430. ConditionalWriteFile(GetOutputDir()+"/include/P3DActiveX.rc", P3DACTIVEX_RC % GenerateResourceFile(**p3dactivex_rc))
  2431. CreatePandaVersionFiles()
  2432. ##########################################################################################
  2433. #
  2434. # Copy the "direct" tree
  2435. #
  2436. ##########################################################################################
  2437. if (PkgSkip("DIRECT")==0):
  2438. CopyPythonTree(GetOutputDir() + '/direct', 'direct/src', threads=THREADCOUNT)
  2439. ConditionalWriteFile(GetOutputDir() + '/direct/__init__.py', "")
  2440. # This file used to be copied, but would nowadays cause conflicts.
  2441. # Let's get it out of the way in case someone hasn't cleaned their build since.
  2442. if os.path.isfile(GetOutputDir() + '/bin/panda3d.py'):
  2443. os.remove(GetOutputDir() + '/bin/panda3d.py')
  2444. if os.path.isfile(GetOutputDir() + '/lib/panda3d.py'):
  2445. os.remove(GetOutputDir() + '/lib/panda3d.py')
  2446. # This directory doesn't exist at all any more.
  2447. if os.path.isdir(os.path.join(GetOutputDir(), 'direct', 'ffi')):
  2448. shutil.rmtree(os.path.join(GetOutputDir(), 'direct', 'ffi'))
  2449. # These files used to exist; remove them to avoid conflicts.
  2450. del_files = ['core.py', 'core.pyc', 'core.pyo',
  2451. '_core.pyd', '_core.so',
  2452. 'direct.py', 'direct.pyc', 'direct.pyo',
  2453. '_direct.pyd', '_direct.so',
  2454. 'dtoolconfig.pyd', 'dtoolconfig.so']
  2455. for basename in del_files:
  2456. path = os.path.join(GetOutputDir(), 'panda3d', basename)
  2457. if os.path.isfile(path):
  2458. print("Removing %s" % (path))
  2459. os.remove(path)
  2460. # Write an appropriate panda3d/__init__.py
  2461. p3d_init = """"Python bindings for the Panda3D libraries"
  2462. __version__ = '%s'
  2463. """ % (WHLVERSION)
  2464. if GetTarget() == 'windows':
  2465. p3d_init += """
  2466. import os
  2467. bindir = os.path.join(os.path.dirname(__file__), '..', 'bin')
  2468. if os.path.isdir(bindir):
  2469. if not os.environ.get('PATH'):
  2470. os.environ['PATH'] = bindir
  2471. else:
  2472. os.environ['PATH'] = bindir + os.pathsep + os.environ['PATH']
  2473. del os, bindir
  2474. """
  2475. if not PkgSkip("PYTHON"):
  2476. ConditionalWriteFile(GetOutputDir() + '/panda3d/__init__.py', p3d_init)
  2477. # Also add this file, for backward compatibility.
  2478. ConditionalWriteFile(GetOutputDir() + '/panda3d/dtoolconfig.py', """
  2479. if __debug__:
  2480. print("Warning: panda3d.dtoolconfig is deprecated, use panda3d.interrogatedb instead.")
  2481. from .interrogatedb import *
  2482. """)
  2483. # PandaModules is now deprecated; generate a shim for backward compatibility.
  2484. for fn in glob.glob(GetOutputDir() + '/pandac/*.py') + glob.glob(GetOutputDir() + '/pandac/*.py[co]'):
  2485. if os.path.basename(fn) not in ('PandaModules.py', '__init__.py'):
  2486. os.remove(fn)
  2487. panda_modules = ['core']
  2488. if not PkgSkip("PANDAPHYSICS"):
  2489. panda_modules.append('physics')
  2490. if not PkgSkip('PANDAFX'):
  2491. panda_modules.append('fx')
  2492. if not PkgSkip("DIRECT"):
  2493. panda_modules.append('direct')
  2494. if not PkgSkip("VISION"):
  2495. panda_modules.append('vision')
  2496. if not PkgSkip("SKEL"):
  2497. panda_modules.append('skel')
  2498. if not PkgSkip("EGG"):
  2499. panda_modules.append('egg')
  2500. if not PkgSkip("AWESOMIUM"):
  2501. panda_modules.append('awesomium')
  2502. if not PkgSkip("ODE"):
  2503. panda_modules.append('ode')
  2504. if not PkgSkip("VRPN"):
  2505. panda_modules.append('vrpn')
  2506. panda_modules_code = """
  2507. "This module is deprecated. Import from panda3d.core and other panda3d.* modules instead."
  2508. if __debug__:
  2509. print("Warning: pandac.PandaModules is deprecated, import from panda3d.core instead")
  2510. """
  2511. for module in panda_modules:
  2512. panda_modules_code += """
  2513. try:
  2514. from panda3d.%s import *
  2515. except ImportError as err:
  2516. if "No module named %s" not in str(err):
  2517. raise""" % (module, module)
  2518. panda_modules_code += """
  2519. from direct.showbase import DConfig
  2520. def get_config_showbase():
  2521. return DConfig
  2522. def get_config_express():
  2523. return DConfig
  2524. getConfigShowbase = get_config_showbase
  2525. getConfigExpress = get_config_express
  2526. """
  2527. exthelpers_code = """
  2528. "This module is deprecated. Import from direct.extensions_native.extension_native_helpers instead."
  2529. from direct.extensions_native.extension_native_helpers import *
  2530. """
  2531. if not PkgSkip("PYTHON"):
  2532. ConditionalWriteFile(GetOutputDir() + '/pandac/PandaModules.py', panda_modules_code)
  2533. ConditionalWriteFile(GetOutputDir() + '/pandac/extension_native_helpers.py', exthelpers_code)
  2534. ConditionalWriteFile(GetOutputDir() + '/pandac/__init__.py', '')
  2535. ##########################################################################################
  2536. #
  2537. # Generate the PRC files into the ETC directory.
  2538. #
  2539. ##########################################################################################
  2540. confautoprc = ReadFile("makepanda/confauto.in")
  2541. if (PkgSkip("SPEEDTREE")==0):
  2542. # If SpeedTree is available, enable it in the config file
  2543. confautoprc = confautoprc.replace('#st#', '')
  2544. else:
  2545. # otherwise, disable it.
  2546. confautoprc = confautoprc.replace('#st#', '#')
  2547. if PkgSkip("ASSIMP"):
  2548. confautoprc = confautoprc.replace("load-file-type p3assimp", "#load-file-type p3assimp")
  2549. if (os.path.isfile("makepanda/myconfig.in")):
  2550. configprc = ReadFile("makepanda/myconfig.in")
  2551. else:
  2552. configprc = ReadFile("makepanda/config.in")
  2553. if (GetTarget() == 'windows'):
  2554. configprc = configprc.replace("$XDG_CACHE_HOME/panda3d", "$USER_APPDATA/Panda3D-%s" % MAJOR_VERSION)
  2555. else:
  2556. configprc = configprc.replace("aux-display pandadx9", "")
  2557. if (GetTarget() == 'darwin'):
  2558. configprc = configprc.replace("$XDG_CACHE_HOME/panda3d", "Library/Caches/Panda3D-%s" % MAJOR_VERSION)
  2559. # OpenAL is not yet working well on OSX for us, so let's do this for now.
  2560. configprc = configprc.replace("p3openal_audio", "p3fmod_audio")
  2561. if GetTarget() == 'windows':
  2562. # Convert to Windows newlines.
  2563. ConditionalWriteFile(GetOutputDir()+"/etc/Config.prc", configprc, newline='\r\n')
  2564. ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc, newline='\r\n')
  2565. else:
  2566. ConditionalWriteFile(GetOutputDir()+"/etc/Config.prc", configprc)
  2567. ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc)
  2568. ##########################################################################################
  2569. #
  2570. # Copy the precompiled binaries and DLLs into the build.
  2571. #
  2572. ##########################################################################################
  2573. tp_dir = GetThirdpartyDir()
  2574. if tp_dir is not None:
  2575. dylibs = {}
  2576. if GetTarget() == 'darwin':
  2577. # Make a list of all the dylibs we ship, to figure out whether we should use
  2578. # install_name_tool to correct the library reference to point to our copy.
  2579. for lib in glob.glob(tp_dir + "/*/lib/*.dylib"):
  2580. dylibs[os.path.basename(lib)] = os.path.basename(os.path.realpath(lib))
  2581. if not PkgSkip("PYTHON"):
  2582. for lib in glob.glob(tp_dir + "/*/lib/" + SDK["PYTHONVERSION"] + "/*.dylib"):
  2583. dylibs[os.path.basename(lib)] = os.path.basename(os.path.realpath(lib))
  2584. for pkg in PkgListGet():
  2585. if PkgSkip(pkg):
  2586. continue
  2587. tp_pkg = tp_dir + pkg.lower()
  2588. if GetTarget() == 'windows':
  2589. if os.path.exists(tp_pkg + "/bin"):
  2590. CopyAllFiles(GetOutputDir() + "/bin/", tp_pkg + "/bin/")
  2591. if (PkgSkip("PYTHON")==0 and os.path.exists(tp_pkg + "/bin/" + SDK["PYTHONVERSION"])):
  2592. CopyAllFiles(GetOutputDir() + "/bin/", tp_pkg + "/bin/" + SDK["PYTHONVERSION"] + "/")
  2593. elif GetTarget() == 'darwin':
  2594. tp_libs = glob.glob(tp_pkg + "/lib/*.dylib")
  2595. if not PkgSkip("PYTHON"):
  2596. tp_libs += glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.dylib"))
  2597. tp_libs += glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.so"))
  2598. if pkg != 'PYTHON':
  2599. tp_libs += glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.py"))
  2600. for tp_lib in tp_libs:
  2601. basename = os.path.basename(tp_lib)
  2602. if basename.endswith('.dylib'):
  2603. # It's a dynamic link library. Put it in the lib directory.
  2604. target = GetOutputDir() + "/lib/" + basename
  2605. dep_prefix = "@loader_path/../lib/"
  2606. lib_id = dep_prefix + basename
  2607. else:
  2608. # It's a Python module, like _rocketcore.so. Copy it to the root, because
  2609. # nowadays the 'lib' directory may no longer be on the PYTHONPATH.
  2610. target = GetOutputDir() + "/" + basename
  2611. dep_prefix = "@loader_path/lib/"
  2612. lib_id = basename
  2613. if not NeedsBuild([target], [tp_lib]):
  2614. continue
  2615. CopyFile(target, tp_lib)
  2616. if os.path.islink(target) or target.endswith('.py'):
  2617. continue
  2618. # Correct the inter-library dependencies so that the build is relocatable.
  2619. oscmd('install_name_tool -id %s %s' % (lib_id, target))
  2620. oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (target, GetOutputDir()), True)
  2621. for line in open(GetOutputDir() + "/tmp/otool-libs.txt", "r"):
  2622. line = line.strip()
  2623. if not line or line.startswith(dep_prefix) or line.endswith(":"):
  2624. continue
  2625. libdep = line.split(" ", 1)[0]
  2626. dep_basename = os.path.basename(libdep)
  2627. if dep_basename in dylibs:
  2628. dep_target = dylibs[dep_basename]
  2629. oscmd("install_name_tool -change %s %s%s %s" % (libdep, dep_prefix, dep_target, target), True)
  2630. JustBuilt([target], [tp_lib])
  2631. for fwx in glob.glob(tp_pkg + "/*.framework"):
  2632. CopyTree(GetOutputDir() + "/Frameworks/" + os.path.basename(fwx), fwx)
  2633. else: # Linux / FreeBSD case.
  2634. for tp_lib in glob.glob(tp_pkg + "/lib/*.so*"):
  2635. CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib)
  2636. if not PkgSkip("PYTHON"):
  2637. for tp_lib in glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.so*")):
  2638. base = os.path.basename(tp_lib)
  2639. if base.startswith('lib'):
  2640. CopyFile(GetOutputDir() + "/lib/" + base, tp_lib)
  2641. else:
  2642. # It's a Python module, like _rocketcore.so.
  2643. CopyFile(GetOutputDir() + "/" + base, tp_lib)
  2644. if GetTarget() == 'windows':
  2645. if os.path.isdir(os.path.join(tp_dir, "extras", "bin")):
  2646. CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/")
  2647. if not PkgSkip("PYTHON") and not RTDIST:
  2648. # We need to copy the Python DLL to the bin directory for now.
  2649. pydll = "/" + SDK["PYTHONVERSION"].replace(".", "")
  2650. if GetOptimize() <= 2:
  2651. pydll += "_d.dll"
  2652. else:
  2653. pydll += ".dll"
  2654. CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll)
  2655. for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"):
  2656. CopyFile(GetOutputDir() + "/bin/", fn)
  2657. # Copy the whole Python directory.
  2658. CopyTree(GetOutputDir() + "/python", SDK["PYTHON"])
  2659. # NB: Python does not always ship with the correct manifest/dll.
  2660. # Figure out the correct one to ship, and grab it from WinSxS dir.
  2661. manifest = GetOutputDir() + '/tmp/python.manifest'
  2662. if os.path.isfile(manifest):
  2663. os.unlink(manifest)
  2664. oscmd('mt -inputresource:"%s\\python.exe";#1 -out:"%s" -nologo' % (SDK["PYTHON"], manifest), True)
  2665. if os.path.isfile(manifest):
  2666. import xml.etree.ElementTree as ET
  2667. tree = ET.parse(manifest)
  2668. idents = tree.findall('./{urn:schemas-microsoft-com:asm.v1}dependency/{urn:schemas-microsoft-com:asm.v1}dependentAssembly/{urn:schemas-microsoft-com:asm.v1}assemblyIdentity')
  2669. else:
  2670. idents = ()
  2671. for ident in idents:
  2672. sxs_name = '_'.join([
  2673. ident.get('processorArchitecture'),
  2674. ident.get('name').lower(),
  2675. ident.get('publicKeyToken'),
  2676. ident.get('version'),
  2677. ])
  2678. # Find the manifest matching these parameters.
  2679. pattern = os.path.join('C:' + os.sep, 'Windows', 'WinSxS', 'Manifests', sxs_name + '_*.manifest')
  2680. manifests = glob.glob(pattern)
  2681. if not manifests:
  2682. Warn("Could not locate manifest %s. You may need to reinstall the Visual C++ Redistributable." % (pattern))
  2683. continue
  2684. CopyFile(GetOutputDir() + "/python/" + ident.get('name') + ".manifest", manifests[0])
  2685. # Also copy the corresponding msvcr dll.
  2686. pattern = os.path.join('C:' + os.sep, 'Windows', 'WinSxS', sxs_name + '_*', 'msvcr*.dll')
  2687. for file in glob.glob(pattern):
  2688. CopyFile(GetOutputDir() + "/python/", file)
  2689. # Copy python.exe to ppython.exe.
  2690. if not os.path.isfile(SDK["PYTHON"] + "/ppython.exe") and os.path.isfile(SDK["PYTHON"] + "/python.exe"):
  2691. CopyFile(GetOutputDir() + "/python/ppython.exe", SDK["PYTHON"] + "/python.exe")
  2692. if not os.path.isfile(SDK["PYTHON"] + "/ppythonw.exe") and os.path.isfile(SDK["PYTHON"] + "/pythonw.exe"):
  2693. CopyFile(GetOutputDir() + "/python/ppythonw.exe", SDK["PYTHON"] + "/pythonw.exe")
  2694. ConditionalWriteFile(GetOutputDir() + "/python/panda.pth", "..\n../bin\n")
  2695. # Copy over the MSVC runtime.
  2696. if GetTarget() == 'windows' and "VISUALSTUDIO" in SDK:
  2697. vsver = "%s%s" % SDK["VISUALSTUDIO_VERSION"]
  2698. vcver = "%s%s" % (SDK["MSVC_VERSION"][0], 0) # ignore minor version.
  2699. crtname = "Microsoft.VC%s.CRT" % (vsver)
  2700. if ("VCTOOLSVERSION" in SDK):
  2701. dir = os.path.join(SDK["VISUALSTUDIO"], "VC", "Redist", "MSVC", SDK["VCTOOLSVERSION"], "onecore", GetTargetArch(), crtname)
  2702. else:
  2703. dir = os.path.join(SDK["VISUALSTUDIO"], "VC", "redist", GetTargetArch(), crtname)
  2704. if os.path.isfile(os.path.join(dir, "msvcr" + vcver + ".dll")):
  2705. CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "msvcr" + vcver + ".dll"))
  2706. if os.path.isfile(os.path.join(dir, "msvcp" + vcver + ".dll")):
  2707. CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "msvcp" + vcver + ".dll"))
  2708. if os.path.isfile(os.path.join(dir, "vcruntime" + vcver + ".dll")):
  2709. CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "vcruntime" + vcver + ".dll"))
  2710. ########################################################################
  2711. ##
  2712. ## Copy various stuff into the build.
  2713. ##
  2714. ########################################################################
  2715. if GetTarget() == 'windows':
  2716. # Convert to Windows newlines so they can be opened by notepad.
  2717. WriteFile(GetOutputDir() + "/LICENSE", ReadFile("doc/LICENSE"), newline='\r\n')
  2718. WriteFile(GetOutputDir() + "/ReleaseNotes", ReadFile("doc/ReleaseNotes"), newline='\r\n')
  2719. CopyFile(GetOutputDir() + "/pandaIcon.ico", "panda/src/configfiles/pandaIcon.ico")
  2720. else:
  2721. CopyFile(GetOutputDir()+"/", "doc/LICENSE")
  2722. CopyFile(GetOutputDir()+"/", "doc/ReleaseNotes")
  2723. if (PkgSkip("PANDATOOL")==0):
  2724. CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".mel")
  2725. CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".ms")
  2726. if (PkgSkip("PYTHON")==0 and os.path.isdir(GetThirdpartyBase()+"/Pmw")):
  2727. CopyTree(GetOutputDir()+'/Pmw', GetThirdpartyBase()+'/Pmw')
  2728. ConditionalWriteFile(GetOutputDir()+'/include/ctl3d.h', '/* dummy file to make MAX happy */')
  2729. # Since Eigen is included by all sorts of core headers, as a convenience
  2730. # to C++ users on Win and Mac, we include it in the Panda include directory.
  2731. if not PkgSkip("EIGEN") and GetTarget() in ("windows", "darwin") and GetThirdpartyDir():
  2732. CopyTree(GetOutputDir()+'/include/Eigen', GetThirdpartyDir()+'eigen/include/Eigen')
  2733. ########################################################################
  2734. #
  2735. # Copy header files to the built/include/parser-inc directory.
  2736. #
  2737. ########################################################################
  2738. CopyTree(GetOutputDir()+'/include/parser-inc','dtool/src/parser-inc')
  2739. DeleteVCS(GetOutputDir()+'/include/parser-inc')
  2740. ########################################################################
  2741. #
  2742. # Transfer all header files to the built/include directory.
  2743. #
  2744. ########################################################################
  2745. CopyAllHeaders('dtool/src/dtoolbase')
  2746. CopyAllHeaders('dtool/src/dtoolutil', skip=["pandaVersion.h", "checkPandaVersion.h"])
  2747. CopyFile(GetOutputDir()+'/include/','dtool/src/dtoolutil/vector_src.cxx')
  2748. CopyAllHeaders('dtool/metalibs/dtool')
  2749. CopyAllHeaders('dtool/src/cppparser')
  2750. CopyAllHeaders('dtool/src/prc', skip=["prc_parameters.h"])
  2751. CopyAllHeaders('dtool/src/dconfig')
  2752. CopyAllHeaders('dtool/src/interrogatedb')
  2753. CopyAllHeaders('dtool/metalibs/dtoolconfig')
  2754. CopyAllHeaders('dtool/src/pystub')
  2755. CopyAllHeaders('dtool/src/interrogate')
  2756. CopyAllHeaders('dtool/src/test_interrogate')
  2757. CopyAllHeaders('panda/src/putil')
  2758. CopyAllHeaders('panda/src/pandabase')
  2759. CopyAllHeaders('panda/src/express')
  2760. CopyAllHeaders('panda/src/downloader')
  2761. CopyAllHeaders('panda/metalibs/pandaexpress')
  2762. CopyAllHeaders('panda/src/pipeline')
  2763. CopyAllHeaders('panda/src/linmath')
  2764. CopyAllHeaders('panda/src/putil')
  2765. CopyAllHeaders('dtool/src/prckeys')
  2766. CopyAllHeaders('panda/src/audio')
  2767. CopyAllHeaders('panda/src/event')
  2768. CopyAllHeaders('panda/src/mathutil')
  2769. CopyAllHeaders('panda/src/gsgbase')
  2770. CopyAllHeaders('panda/src/pnmimage')
  2771. CopyAllHeaders('panda/src/nativenet')
  2772. CopyAllHeaders('panda/src/net')
  2773. CopyAllHeaders('panda/src/pstatclient')
  2774. CopyAllHeaders('panda/src/gobj')
  2775. CopyAllHeaders('panda/src/movies')
  2776. CopyAllHeaders('panda/src/pgraphnodes')
  2777. CopyAllHeaders('panda/src/pgraph')
  2778. CopyAllHeaders('panda/src/cull')
  2779. CopyAllHeaders('panda/src/display')
  2780. CopyAllHeaders('panda/src/chan')
  2781. CopyAllHeaders('panda/src/char')
  2782. CopyAllHeaders('panda/src/dgraph')
  2783. CopyAllHeaders('panda/src/device')
  2784. CopyAllHeaders('panda/src/pnmtext')
  2785. CopyAllHeaders('panda/src/text')
  2786. CopyAllHeaders('panda/src/grutil')
  2787. if (PkgSkip("VISION")==0):
  2788. CopyAllHeaders('panda/src/vision')
  2789. CopyAllHeaders('panda/src/awesomium')
  2790. if (PkgSkip("FFMPEG")==0):
  2791. CopyAllHeaders('panda/src/ffmpeg')
  2792. CopyAllHeaders('panda/src/tform')
  2793. CopyAllHeaders('panda/src/collide')
  2794. CopyAllHeaders('panda/src/parametrics')
  2795. CopyAllHeaders('panda/src/pgui')
  2796. CopyAllHeaders('panda/src/pnmimagetypes')
  2797. CopyAllHeaders('panda/src/recorder')
  2798. if (PkgSkip("ROCKET")==0):
  2799. CopyAllHeaders('panda/src/rocket')
  2800. if (PkgSkip("VRPN")==0):
  2801. CopyAllHeaders('panda/src/vrpn')
  2802. CopyAllHeaders('panda/src/wgldisplay')
  2803. CopyAllHeaders('panda/src/ode')
  2804. CopyAllHeaders('panda/metalibs/pandaode')
  2805. if (PkgSkip("PANDAPHYSICS")==0):
  2806. CopyAllHeaders('panda/src/physics')
  2807. if (PkgSkip("PANDAPARTICLESYSTEM")==0):
  2808. CopyAllHeaders('panda/src/particlesystem')
  2809. CopyAllHeaders('panda/src/dxml')
  2810. CopyAllHeaders('panda/metalibs/panda')
  2811. CopyAllHeaders('panda/src/audiotraits')
  2812. CopyAllHeaders('panda/src/audiotraits')
  2813. CopyAllHeaders('panda/src/distort')
  2814. CopyAllHeaders('panda/src/downloadertools')
  2815. CopyAllHeaders('panda/src/windisplay')
  2816. CopyAllHeaders('panda/src/dxgsg9')
  2817. CopyAllHeaders('panda/metalibs/pandadx9')
  2818. if not PkgSkip("EGG"):
  2819. CopyAllHeaders('panda/src/egg')
  2820. CopyAllHeaders('panda/src/egg2pg')
  2821. CopyAllHeaders('panda/src/framework')
  2822. CopyAllHeaders('panda/metalibs/pandafx')
  2823. CopyAllHeaders('panda/src/glstuff')
  2824. CopyAllHeaders('panda/src/glgsg')
  2825. CopyAllHeaders('panda/src/glesgsg')
  2826. CopyAllHeaders('panda/src/gles2gsg')
  2827. if not PkgSkip("EGG"):
  2828. CopyAllHeaders('panda/metalibs/pandaegg')
  2829. if GetTarget() == 'windows':
  2830. CopyAllHeaders('panda/src/wgldisplay')
  2831. elif GetTarget() == 'darwin':
  2832. CopyAllHeaders('panda/src/osxdisplay')
  2833. CopyAllHeaders('panda/src/cocoadisplay')
  2834. elif GetTarget() == 'android':
  2835. CopyAllHeaders('panda/src/android')
  2836. CopyAllHeaders('panda/src/androiddisplay')
  2837. else:
  2838. CopyAllHeaders('panda/src/x11display')
  2839. CopyAllHeaders('panda/src/glxdisplay')
  2840. CopyAllHeaders('panda/src/egldisplay')
  2841. CopyAllHeaders('panda/metalibs/pandagl')
  2842. CopyAllHeaders('panda/metalibs/pandagles')
  2843. CopyAllHeaders('panda/metalibs/pandagles2')
  2844. CopyAllHeaders('panda/metalibs/pandaphysics')
  2845. CopyAllHeaders('panda/src/testbed')
  2846. if (PkgSkip("PHYSX")==0):
  2847. CopyAllHeaders('panda/src/physx')
  2848. CopyAllHeaders('panda/metalibs/pandaphysx')
  2849. if (PkgSkip("BULLET")==0):
  2850. CopyAllHeaders('panda/src/bullet')
  2851. CopyAllHeaders('panda/metalibs/pandabullet')
  2852. if (PkgSkip("SPEEDTREE")==0):
  2853. CopyAllHeaders('panda/src/speedtree')
  2854. if (PkgSkip("DIRECT")==0):
  2855. CopyAllHeaders('direct/src/directbase')
  2856. CopyAllHeaders('direct/src/dcparser')
  2857. CopyAllHeaders('direct/src/deadrec')
  2858. CopyAllHeaders('direct/src/distributed')
  2859. CopyAllHeaders('direct/src/interval')
  2860. CopyAllHeaders('direct/src/showbase')
  2861. CopyAllHeaders('direct/src/dcparse')
  2862. if (RUNTIME or RTDIST):
  2863. CopyAllHeaders('direct/src/plugin', skip=["p3d_plugin_config.h"])
  2864. if (RUNTIME):
  2865. CopyAllHeaders('direct/src/plugin_npapi')
  2866. CopyAllHeaders('direct/src/plugin_standalone')
  2867. if (PkgSkip("PANDATOOL")==0):
  2868. CopyAllHeaders('pandatool/src/pandatoolbase')
  2869. CopyAllHeaders('pandatool/src/converter')
  2870. CopyAllHeaders('pandatool/src/progbase')
  2871. CopyAllHeaders('pandatool/src/eggbase')
  2872. CopyAllHeaders('pandatool/src/bam')
  2873. CopyAllHeaders('pandatool/src/cvscopy')
  2874. CopyAllHeaders('pandatool/src/daeegg')
  2875. CopyAllHeaders('pandatool/src/daeprogs')
  2876. CopyAllHeaders('pandatool/src/dxf')
  2877. CopyAllHeaders('pandatool/src/dxfegg')
  2878. CopyAllHeaders('pandatool/src/dxfprogs')
  2879. CopyAllHeaders('pandatool/src/palettizer')
  2880. CopyAllHeaders('pandatool/src/egg-mkfont')
  2881. CopyAllHeaders('pandatool/src/eggcharbase')
  2882. CopyAllHeaders('pandatool/src/egg-optchar')
  2883. CopyAllHeaders('pandatool/src/egg-palettize')
  2884. CopyAllHeaders('pandatool/src/egg-qtess')
  2885. CopyAllHeaders('pandatool/src/eggprogs')
  2886. CopyAllHeaders('pandatool/src/flt')
  2887. CopyAllHeaders('pandatool/src/fltegg')
  2888. CopyAllHeaders('pandatool/src/fltprogs')
  2889. CopyAllHeaders('pandatool/src/imagebase')
  2890. CopyAllHeaders('pandatool/src/imageprogs')
  2891. CopyAllHeaders('pandatool/src/pfmprogs')
  2892. CopyAllHeaders('pandatool/src/lwo')
  2893. CopyAllHeaders('pandatool/src/lwoegg')
  2894. CopyAllHeaders('pandatool/src/lwoprogs')
  2895. CopyAllHeaders('pandatool/src/maya')
  2896. CopyAllHeaders('pandatool/src/mayaegg')
  2897. CopyAllHeaders('pandatool/src/maxegg')
  2898. CopyAllHeaders('pandatool/src/maxprogs')
  2899. CopyAllHeaders('pandatool/src/objegg')
  2900. CopyAllHeaders('pandatool/src/objprogs')
  2901. CopyAllHeaders('pandatool/src/vrml')
  2902. CopyAllHeaders('pandatool/src/vrmlegg')
  2903. CopyAllHeaders('pandatool/src/xfile')
  2904. CopyAllHeaders('pandatool/src/xfileegg')
  2905. CopyAllHeaders('pandatool/src/ptloader')
  2906. CopyAllHeaders('pandatool/src/miscprogs')
  2907. CopyAllHeaders('pandatool/src/pstatserver')
  2908. CopyAllHeaders('pandatool/src/text-stats')
  2909. CopyAllHeaders('pandatool/src/vrmlprogs')
  2910. CopyAllHeaders('pandatool/src/win-stats')
  2911. CopyAllHeaders('pandatool/src/xfileprogs')
  2912. if (PkgSkip("CONTRIB")==0):
  2913. CopyAllHeaders('contrib/src/contribbase')
  2914. CopyAllHeaders('contrib/src/ai')
  2915. ########################################################################
  2916. #
  2917. # These definitions are syntactic shorthand. They make it easy
  2918. # to link with the usual libraries without listing them all.
  2919. #
  2920. ########################################################################
  2921. COMMON_DTOOL_LIBS=[
  2922. 'libp3dtool.dll',
  2923. 'libp3dtoolconfig.dll',
  2924. ]
  2925. COMMON_PANDA_LIBS=[
  2926. 'libpanda.dll',
  2927. 'libpandaexpress.dll'
  2928. ] + COMMON_DTOOL_LIBS
  2929. COMMON_EGG2X_LIBS=[
  2930. 'libp3eggbase.lib',
  2931. 'libp3progbase.lib',
  2932. 'libp3converter.lib',
  2933. 'libp3pandatoolbase.lib',
  2934. 'libpandaegg.dll',
  2935. ] + COMMON_PANDA_LIBS
  2936. ########################################################################
  2937. #
  2938. # This section contains a list of all the files that need to be compiled.
  2939. #
  2940. ########################################################################
  2941. print("Generating dependencies...")
  2942. sys.stdout.flush()
  2943. #
  2944. # Compile Panda icon resource file.
  2945. # We do it first because we need it at
  2946. # the time we compile an executable.
  2947. #
  2948. if GetTarget() == 'windows':
  2949. OPTS=['DIR:panda/src/configfiles']
  2950. TargetAdd('pandaIcon.res', opts=OPTS, input='pandaIcon.rc')
  2951. #
  2952. # DIRECTORY: dtool/src/dtoolbase/
  2953. #
  2954. OPTS=['DIR:dtool/src/dtoolbase', 'BUILDING:DTOOL']
  2955. TargetAdd('p3dtoolbase_composite1.obj', opts=OPTS, input='p3dtoolbase_composite1.cxx')
  2956. TargetAdd('p3dtoolbase_composite2.obj', opts=OPTS, input='p3dtoolbase_composite2.cxx')
  2957. TargetAdd('p3dtoolbase_lookup3.obj', opts=OPTS, input='lookup3.c')
  2958. TargetAdd('p3dtoolbase_indent.obj', opts=OPTS, input='indent.cxx')
  2959. #
  2960. # DIRECTORY: dtool/src/dtoolutil/
  2961. #
  2962. OPTS=['DIR:dtool/src/dtoolutil', 'BUILDING:DTOOL']
  2963. TargetAdd('p3dtoolutil_composite1.obj', opts=OPTS, input='p3dtoolutil_composite1.cxx')
  2964. TargetAdd('p3dtoolutil_composite2.obj', opts=OPTS, input='p3dtoolutil_composite2.cxx')
  2965. if GetTarget() == 'darwin':
  2966. TargetAdd('p3dtoolutil_filename_assist.obj', opts=OPTS, input='filename_assist.mm')
  2967. #
  2968. # DIRECTORY: dtool/metalibs/dtool/
  2969. #
  2970. OPTS=['DIR:dtool/metalibs/dtool', 'BUILDING:DTOOL']
  2971. TargetAdd('p3dtool_dtool.obj', opts=OPTS, input='dtool.cxx')
  2972. TargetAdd('libp3dtool.dll', input='p3dtool_dtool.obj')
  2973. TargetAdd('libp3dtool.dll', input='p3dtoolutil_composite1.obj')
  2974. TargetAdd('libp3dtool.dll', input='p3dtoolutil_composite2.obj')
  2975. if GetTarget() == 'darwin':
  2976. TargetAdd('libp3dtool.dll', input='p3dtoolutil_filename_assist.obj')
  2977. TargetAdd('libp3dtool.dll', input='p3dtoolbase_composite1.obj')
  2978. TargetAdd('libp3dtool.dll', input='p3dtoolbase_composite2.obj')
  2979. TargetAdd('libp3dtool.dll', input='p3dtoolbase_indent.obj')
  2980. TargetAdd('libp3dtool.dll', input='p3dtoolbase_lookup3.obj')
  2981. TargetAdd('libp3dtool.dll', opts=['ADVAPI','WINSHELL','WINKERNEL'])
  2982. #
  2983. # DIRECTORY: dtool/src/cppparser/
  2984. #
  2985. if (not RUNTIME):
  2986. OPTS=['DIR:dtool/src/cppparser', 'BISONPREFIX_cppyy']
  2987. CreateFile(GetOutputDir()+"/include/cppBison.h")
  2988. TargetAdd('p3cppParser_cppBison.obj', opts=OPTS, input='cppBison.yxx')
  2989. TargetAdd('cppBison.h', input='p3cppParser_cppBison.obj', opts=['DEPENDENCYONLY'])
  2990. TargetAdd('p3cppParser_composite1.obj', opts=OPTS, input='p3cppParser_composite1.cxx')
  2991. TargetAdd('p3cppParser_composite2.obj', opts=OPTS, input='p3cppParser_composite2.cxx')
  2992. TargetAdd('libp3cppParser.ilb', input='p3cppParser_composite1.obj')
  2993. TargetAdd('libp3cppParser.ilb', input='p3cppParser_composite2.obj')
  2994. TargetAdd('libp3cppParser.ilb', input='p3cppParser_cppBison.obj')
  2995. #
  2996. # DIRECTORY: dtool/src/prc/
  2997. #
  2998. OPTS=['DIR:dtool/src/prc', 'BUILDING:DTOOLCONFIG', 'OPENSSL']
  2999. TargetAdd('p3prc_composite1.obj', opts=OPTS, input='p3prc_composite1.cxx')
  3000. TargetAdd('p3prc_composite2.obj', opts=OPTS, input='p3prc_composite2.cxx')
  3001. #
  3002. # DIRECTORY: dtool/metalibs/dtoolconfig/
  3003. #
  3004. OPTS=['DIR:dtool/metalibs/dtoolconfig', 'BUILDING:DTOOLCONFIG']
  3005. TargetAdd('p3dtoolconfig_dtoolconfig.obj', opts=OPTS, input='dtoolconfig.cxx')
  3006. TargetAdd('libp3dtoolconfig.dll', input='p3dtoolconfig_dtoolconfig.obj')
  3007. TargetAdd('libp3dtoolconfig.dll', input='p3prc_composite1.obj')
  3008. TargetAdd('libp3dtoolconfig.dll', input='p3prc_composite2.obj')
  3009. TargetAdd('libp3dtoolconfig.dll', input='libp3dtool.dll')
  3010. TargetAdd('libp3dtoolconfig.dll', opts=['ADVAPI', 'OPENSSL', 'WINGDI', 'WINUSER'])
  3011. #
  3012. # DIRECTORY: dtool/src/interrogatedb/
  3013. #
  3014. OPTS=['DIR:dtool/src/interrogatedb', 'BUILDING:INTERROGATEDB']
  3015. TargetAdd('p3interrogatedb_composite1.obj', opts=OPTS, input='p3interrogatedb_composite1.cxx')
  3016. TargetAdd('p3interrogatedb_composite2.obj', opts=OPTS, input='p3interrogatedb_composite2.cxx')
  3017. TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite1.obj')
  3018. TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite2.obj')
  3019. TargetAdd('libp3interrogatedb.dll', input='libp3dtool.dll')
  3020. TargetAdd('libp3interrogatedb.dll', input='libp3dtoolconfig.dll')
  3021. # This used to be called dtoolconfig.pyd, but it just contains the interrogatedb
  3022. # stuff, so it has been renamed appropriately.
  3023. OPTS=['DIR:dtool/metalibs/dtoolconfig']
  3024. PyTargetAdd('interrogatedb_pydtool.obj', opts=OPTS, input="pydtool.cxx")
  3025. PyTargetAdd('interrogatedb.pyd', input='interrogatedb_pydtool.obj')
  3026. PyTargetAdd('interrogatedb.pyd', input='libp3dtool.dll')
  3027. PyTargetAdd('interrogatedb.pyd', input='libp3dtoolconfig.dll')
  3028. PyTargetAdd('interrogatedb.pyd', input='libp3interrogatedb.dll')
  3029. #
  3030. # DIRECTORY: dtool/src/pystub/
  3031. #
  3032. if not RUNTIME and not RTDIST:
  3033. OPTS=['DIR:dtool/src/pystub']
  3034. TargetAdd('p3pystub_pystub.obj', opts=OPTS, input='pystub.cxx')
  3035. TargetAdd('libp3pystub.lib', input='p3pystub_pystub.obj')
  3036. #TargetAdd('libp3pystub.lib', input='libp3dtool.dll')
  3037. TargetAdd('libp3pystub.lib', opts=['ADVAPI'])
  3038. #
  3039. # DIRECTORY: dtool/src/interrogate/
  3040. #
  3041. if (not RUNTIME):
  3042. OPTS=['DIR:dtool/src/interrogate', 'DIR:dtool/src/cppparser', 'DIR:dtool/src/interrogatedb']
  3043. TargetAdd('interrogate_composite1.obj', opts=OPTS, input='interrogate_composite1.cxx')
  3044. TargetAdd('interrogate_composite2.obj', opts=OPTS, input='interrogate_composite2.cxx')
  3045. TargetAdd('interrogate.exe', input='interrogate_composite1.obj')
  3046. TargetAdd('interrogate.exe', input='interrogate_composite2.obj')
  3047. TargetAdd('interrogate.exe', input='libp3cppParser.ilb')
  3048. TargetAdd('interrogate.exe', input=COMMON_DTOOL_LIBS)
  3049. TargetAdd('interrogate.exe', input='libp3interrogatedb.dll')
  3050. TargetAdd('interrogate.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER'])
  3051. preamble = WriteEmbeddedStringFile('interrogate_preamble_python_native', inputs=[
  3052. 'dtool/src/interrogatedb/py_panda.cxx',
  3053. 'dtool/src/interrogatedb/py_compat.cxx',
  3054. 'dtool/src/interrogatedb/py_wrappers.cxx',
  3055. 'dtool/src/interrogatedb/dtool_super_base.cxx',
  3056. ])
  3057. TargetAdd('interrogate_module_preamble_python_native.obj', opts=OPTS, input=preamble)
  3058. TargetAdd('interrogate_module_interrogate_module.obj', opts=OPTS, input='interrogate_module.cxx')
  3059. TargetAdd('interrogate_module.exe', input='interrogate_module_interrogate_module.obj')
  3060. TargetAdd('interrogate_module.exe', input='interrogate_module_preamble_python_native.obj')
  3061. TargetAdd('interrogate_module.exe', input='libp3cppParser.ilb')
  3062. TargetAdd('interrogate_module.exe', input=COMMON_DTOOL_LIBS)
  3063. TargetAdd('interrogate_module.exe', input='libp3interrogatedb.dll')
  3064. TargetAdd('interrogate_module.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER'])
  3065. if (not RTDIST):
  3066. TargetAdd('parse_file_parse_file.obj', opts=OPTS, input='parse_file.cxx')
  3067. TargetAdd('parse_file.exe', input='parse_file_parse_file.obj')
  3068. TargetAdd('parse_file.exe', input='libp3cppParser.ilb')
  3069. TargetAdd('parse_file.exe', input=COMMON_DTOOL_LIBS)
  3070. TargetAdd('parse_file.exe', input='libp3interrogatedb.dll')
  3071. TargetAdd('parse_file.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER'])
  3072. #
  3073. # DIRECTORY: dtool/src/prckeys/
  3074. #
  3075. if (PkgSkip("OPENSSL")==0 and not RUNTIME and not RTDIST):
  3076. OPTS=['DIR:dtool/src/prckeys', 'OPENSSL']
  3077. TargetAdd('make-prc-key_makePrcKey.obj', opts=OPTS, input='makePrcKey.cxx')
  3078. TargetAdd('make-prc-key.exe', input='make-prc-key_makePrcKey.obj')
  3079. TargetAdd('make-prc-key.exe', input=COMMON_DTOOL_LIBS)
  3080. TargetAdd('make-prc-key.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER'])
  3081. #
  3082. # DIRECTORY: dtool/src/test_interrogate/
  3083. #
  3084. if (not RTDIST and not RUNTIME):
  3085. OPTS=['DIR:dtool/src/test_interrogate']
  3086. TargetAdd('test_interrogate_test_interrogate.obj', opts=OPTS, input='test_interrogate.cxx')
  3087. TargetAdd('test_interrogate.exe', input='test_interrogate_test_interrogate.obj')
  3088. TargetAdd('test_interrogate.exe', input='libp3interrogatedb.dll')
  3089. TargetAdd('test_interrogate.exe', input=COMMON_DTOOL_LIBS)
  3090. TargetAdd('test_interrogate.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER'])
  3091. #
  3092. # DIRECTORY: dtool/src/dtoolbase/
  3093. #
  3094. OPTS=['DIR:dtool/src/dtoolbase']
  3095. IGATEFILES=GetDirectoryContents('dtool/src/dtoolbase', ["*_composite*.cxx"])
  3096. IGATEFILES += [
  3097. "typeHandle.h",
  3098. "typeHandle_ext.h",
  3099. "typeRegistry.h",
  3100. "typedObject.h",
  3101. "neverFreeMemory.h",
  3102. ]
  3103. TargetAdd('libp3dtoolbase.in', opts=OPTS, input=IGATEFILES)
  3104. TargetAdd('libp3dtoolbase.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dtoolbase', 'SRCDIR:dtool/src/dtoolbase'])
  3105. PyTargetAdd('p3dtoolbase_typeHandle_ext.obj', opts=OPTS, input='typeHandle_ext.cxx')
  3106. #
  3107. # DIRECTORY: dtool/src/dtoolutil/
  3108. #
  3109. OPTS=['DIR:dtool/src/dtoolutil']
  3110. IGATEFILES=GetDirectoryContents('dtool/src/dtoolutil', ["*_composite*.cxx"])
  3111. IGATEFILES += [
  3112. "config_dtoolutil.h",
  3113. "pandaSystem.h",
  3114. "dSearchPath.h",
  3115. "executionEnvironment.h",
  3116. "textEncoder.h",
  3117. "textEncoder_ext.h",
  3118. "filename.h",
  3119. "filename_ext.h",
  3120. "globPattern.h",
  3121. "globPattern_ext.h",
  3122. "pandaFileStream.h",
  3123. "lineStream.h",
  3124. ]
  3125. TargetAdd('libp3dtoolutil.in', opts=OPTS, input=IGATEFILES)
  3126. TargetAdd('libp3dtoolutil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dtoolutil', 'SRCDIR:dtool/src/dtoolutil'])
  3127. PyTargetAdd('p3dtoolutil_ext_composite.obj', opts=OPTS, input='p3dtoolutil_ext_composite.cxx')
  3128. #
  3129. # DIRECTORY: dtool/src/prc/
  3130. #
  3131. OPTS=['DIR:dtool/src/prc']
  3132. IGATEFILES=GetDirectoryContents('dtool/src/prc', ["*.h", "*_composite*.cxx"])
  3133. TargetAdd('libp3prc.in', opts=OPTS, input=IGATEFILES)
  3134. TargetAdd('libp3prc.in', opts=['IMOD:panda3d.core', 'ILIB:libp3prc', 'SRCDIR:dtool/src/prc'])
  3135. PyTargetAdd('p3prc_ext_composite.obj', opts=OPTS, input='p3prc_ext_composite.cxx')
  3136. #
  3137. # DIRECTORY: panda/src/pandabase/
  3138. #
  3139. OPTS=['DIR:panda/src/pandabase', 'BUILDING:PANDAEXPRESS']
  3140. TargetAdd('p3pandabase_pandabase.obj', opts=OPTS, input='pandabase.cxx')
  3141. #
  3142. # DIRECTORY: panda/src/express/
  3143. #
  3144. OPTS=['DIR:panda/src/express', 'BUILDING:PANDAEXPRESS', 'OPENSSL', 'ZLIB']
  3145. TargetAdd('p3express_composite1.obj', opts=OPTS, input='p3express_composite1.cxx')
  3146. TargetAdd('p3express_composite2.obj', opts=OPTS, input='p3express_composite2.cxx')
  3147. OPTS=['DIR:panda/src/express', 'OPENSSL', 'ZLIB']
  3148. IGATEFILES=GetDirectoryContents('panda/src/express', ["*.h", "*_composite*.cxx"])
  3149. TargetAdd('libp3express.in', opts=OPTS, input=IGATEFILES)
  3150. TargetAdd('libp3express.in', opts=['IMOD:panda3d.core', 'ILIB:libp3express', 'SRCDIR:panda/src/express'])
  3151. PyTargetAdd('p3express_ext_composite.obj', opts=OPTS, input='p3express_ext_composite.cxx')
  3152. #
  3153. # DIRECTORY: panda/src/downloader/
  3154. #
  3155. OPTS=['DIR:panda/src/downloader', 'BUILDING:PANDAEXPRESS', 'OPENSSL', 'ZLIB']
  3156. TargetAdd('p3downloader_composite1.obj', opts=OPTS, input='p3downloader_composite1.cxx')
  3157. TargetAdd('p3downloader_composite2.obj', opts=OPTS, input='p3downloader_composite2.cxx')
  3158. OPTS=['DIR:panda/src/downloader', 'OPENSSL', 'ZLIB']
  3159. IGATEFILES=GetDirectoryContents('panda/src/downloader', ["*.h", "*_composite*.cxx"])
  3160. TargetAdd('libp3downloader.in', opts=OPTS, input=IGATEFILES)
  3161. TargetAdd('libp3downloader.in', opts=['IMOD:panda3d.core', 'ILIB:libp3downloader', 'SRCDIR:panda/src/downloader'])
  3162. PyTargetAdd('p3downloader_stringStream_ext.obj', opts=OPTS, input='stringStream_ext.cxx')
  3163. #
  3164. # DIRECTORY: panda/metalibs/pandaexpress/
  3165. #
  3166. OPTS=['DIR:panda/metalibs/pandaexpress', 'BUILDING:PANDAEXPRESS', 'ZLIB']
  3167. TargetAdd('pandaexpress_pandaexpress.obj', opts=OPTS, input='pandaexpress.cxx')
  3168. TargetAdd('libpandaexpress.dll', input='pandaexpress_pandaexpress.obj')
  3169. TargetAdd('libpandaexpress.dll', input='p3downloader_composite1.obj')
  3170. TargetAdd('libpandaexpress.dll', input='p3downloader_composite2.obj')
  3171. TargetAdd('libpandaexpress.dll', input='p3express_composite1.obj')
  3172. TargetAdd('libpandaexpress.dll', input='p3express_composite2.obj')
  3173. TargetAdd('libpandaexpress.dll', input='p3pandabase_pandabase.obj')
  3174. TargetAdd('libpandaexpress.dll', input=COMMON_DTOOL_LIBS)
  3175. TargetAdd('libpandaexpress.dll', opts=['ADVAPI', 'WINSOCK2', 'OPENSSL', 'ZLIB', 'WINGDI', 'WINUSER', 'ANDROID'])
  3176. #
  3177. # DIRECTORY: panda/src/pipeline/
  3178. #
  3179. if (not RUNTIME):
  3180. OPTS=['DIR:panda/src/pipeline', 'BUILDING:PANDA']
  3181. TargetAdd('p3pipeline_composite1.obj', opts=OPTS, input='p3pipeline_composite1.cxx')
  3182. TargetAdd('p3pipeline_composite2.obj', opts=OPTS, input='p3pipeline_composite2.cxx')
  3183. TargetAdd('p3pipeline_contextSwitch.obj', opts=OPTS, input='contextSwitch.c')
  3184. OPTS=['DIR:panda/src/pipeline']
  3185. IGATEFILES=GetDirectoryContents('panda/src/pipeline', ["*.h", "*_composite*.cxx"])
  3186. TargetAdd('libp3pipeline.in', opts=OPTS, input=IGATEFILES)
  3187. TargetAdd('libp3pipeline.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pipeline', 'SRCDIR:panda/src/pipeline'])
  3188. PyTargetAdd('p3pipeline_pythonThread.obj', opts=OPTS, input='pythonThread.cxx')
  3189. #
  3190. # DIRECTORY: panda/src/linmath/
  3191. #
  3192. if (not RUNTIME):
  3193. OPTS=['DIR:panda/src/linmath', 'BUILDING:PANDA']
  3194. TargetAdd('p3linmath_composite1.obj', opts=OPTS, input='p3linmath_composite1.cxx')
  3195. TargetAdd('p3linmath_composite2.obj', opts=OPTS, input='p3linmath_composite2.cxx')
  3196. OPTS=['DIR:panda/src/linmath']
  3197. IGATEFILES=GetDirectoryContents('panda/src/linmath', ["*.h", "*_composite*.cxx"])
  3198. for ifile in IGATEFILES[:]:
  3199. if "_src." in ifile:
  3200. IGATEFILES.remove(ifile)
  3201. IGATEFILES.remove('cast_to_double.h')
  3202. IGATEFILES.remove('lmat_ops.h')
  3203. IGATEFILES.remove('cast_to_float.h')
  3204. TargetAdd('libp3linmath.in', opts=OPTS, input=IGATEFILES)
  3205. TargetAdd('libp3linmath.in', opts=['IMOD:panda3d.core', 'ILIB:libp3linmath', 'SRCDIR:panda/src/linmath'])
  3206. #
  3207. # DIRECTORY: panda/src/putil/
  3208. #
  3209. if (not RUNTIME):
  3210. OPTS=['DIR:panda/src/putil', 'BUILDING:PANDA', 'ZLIB']
  3211. TargetAdd('p3putil_composite1.obj', opts=OPTS, input='p3putil_composite1.cxx')
  3212. TargetAdd('p3putil_composite2.obj', opts=OPTS, input='p3putil_composite2.cxx')
  3213. OPTS=['DIR:panda/src/putil', 'ZLIB']
  3214. IGATEFILES=GetDirectoryContents('panda/src/putil', ["*.h", "*_composite*.cxx"])
  3215. IGATEFILES.remove("test_bam.h")
  3216. IGATEFILES.remove("config_util.h")
  3217. TargetAdd('libp3putil.in', opts=OPTS, input=IGATEFILES)
  3218. TargetAdd('libp3putil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3putil', 'SRCDIR:panda/src/putil'])
  3219. PyTargetAdd('p3putil_ext_composite.obj', opts=OPTS, input='p3putil_ext_composite.cxx')
  3220. #
  3221. # DIRECTORY: panda/src/audio/
  3222. #
  3223. if (not RUNTIME):
  3224. OPTS=['DIR:panda/src/audio', 'BUILDING:PANDA']
  3225. TargetAdd('p3audio_composite1.obj', opts=OPTS, input='p3audio_composite1.cxx')
  3226. OPTS=['DIR:panda/src/audio']
  3227. IGATEFILES=["audio.h"]
  3228. TargetAdd('libp3audio.in', opts=OPTS, input=IGATEFILES)
  3229. TargetAdd('libp3audio.in', opts=['IMOD:panda3d.core', 'ILIB:libp3audio', 'SRCDIR:panda/src/audio'])
  3230. #
  3231. # DIRECTORY: panda/src/event/
  3232. #
  3233. if (not RUNTIME):
  3234. OPTS=['DIR:panda/src/event', 'BUILDING:PANDA']
  3235. TargetAdd('p3event_composite1.obj', opts=OPTS, input='p3event_composite1.cxx')
  3236. TargetAdd('p3event_composite2.obj', opts=OPTS, input='p3event_composite2.cxx')
  3237. OPTS=['DIR:panda/src/event']
  3238. PyTargetAdd('p3event_asyncFuture_ext.obj', opts=OPTS, input='asyncFuture_ext.cxx')
  3239. PyTargetAdd('p3event_pythonTask.obj', opts=OPTS, input='pythonTask.cxx')
  3240. IGATEFILES=GetDirectoryContents('panda/src/event', ["*.h", "*_composite*.cxx"])
  3241. TargetAdd('libp3event.in', opts=OPTS, input=IGATEFILES)
  3242. TargetAdd('libp3event.in', opts=['IMOD:panda3d.core', 'ILIB:libp3event', 'SRCDIR:panda/src/event'])
  3243. #
  3244. # DIRECTORY: panda/src/mathutil/
  3245. #
  3246. if (not RUNTIME):
  3247. OPTS=['DIR:panda/src/mathutil', 'BUILDING:PANDA', 'FFTW']
  3248. TargetAdd('p3mathutil_composite1.obj', opts=OPTS, input='p3mathutil_composite1.cxx')
  3249. TargetAdd('p3mathutil_composite2.obj', opts=OPTS, input='p3mathutil_composite2.cxx')
  3250. OPTS=['DIR:panda/src/mathutil', 'FFTW']
  3251. IGATEFILES=GetDirectoryContents('panda/src/mathutil', ["*.h", "*_composite*.cxx"])
  3252. for ifile in IGATEFILES[:]:
  3253. if "_src." in ifile:
  3254. IGATEFILES.remove(ifile)
  3255. TargetAdd('libp3mathutil.in', opts=OPTS, input=IGATEFILES)
  3256. TargetAdd('libp3mathutil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3mathutil', 'SRCDIR:panda/src/mathutil'])
  3257. #
  3258. # DIRECTORY: panda/src/gsgbase/
  3259. #
  3260. if (not RUNTIME):
  3261. OPTS=['DIR:panda/src/gsgbase', 'BUILDING:PANDA']
  3262. TargetAdd('p3gsgbase_composite1.obj', opts=OPTS, input='p3gsgbase_composite1.cxx')
  3263. OPTS=['DIR:panda/src/gsgbase']
  3264. IGATEFILES=GetDirectoryContents('panda/src/gsgbase', ["*.h", "*_composite*.cxx"])
  3265. TargetAdd('libp3gsgbase.in', opts=OPTS, input=IGATEFILES)
  3266. TargetAdd('libp3gsgbase.in', opts=['IMOD:panda3d.core', 'ILIB:libp3gsgbase', 'SRCDIR:panda/src/gsgbase'])
  3267. #
  3268. # DIRECTORY: panda/src/pnmimage/
  3269. #
  3270. if (not RUNTIME):
  3271. OPTS=['DIR:panda/src/pnmimage', 'BUILDING:PANDA', 'ZLIB']
  3272. TargetAdd('p3pnmimage_composite1.obj', opts=OPTS, input='p3pnmimage_composite1.cxx')
  3273. TargetAdd('p3pnmimage_composite2.obj', opts=OPTS, input='p3pnmimage_composite2.cxx')
  3274. TargetAdd('p3pnmimage_convert_srgb_sse2.obj', opts=OPTS+['SSE2'], input='convert_srgb_sse2.cxx')
  3275. OPTS=['DIR:panda/src/pnmimage', 'ZLIB']
  3276. IGATEFILES=GetDirectoryContents('panda/src/pnmimage', ["*.h", "*_composite*.cxx"])
  3277. TargetAdd('libp3pnmimage.in', opts=OPTS, input=IGATEFILES)
  3278. TargetAdd('libp3pnmimage.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pnmimage', 'SRCDIR:panda/src/pnmimage'])
  3279. PyTargetAdd('p3pnmimage_pfmFile_ext.obj', opts=OPTS, input='pfmFile_ext.cxx')
  3280. #
  3281. # DIRECTORY: panda/src/nativenet/
  3282. #
  3283. if (not RUNTIME):
  3284. OPTS=['DIR:panda/src/nativenet', 'OPENSSL', 'BUILDING:PANDA']
  3285. TargetAdd('p3nativenet_composite1.obj', opts=OPTS, input='p3nativenet_composite1.cxx')
  3286. OPTS=['DIR:panda/src/nativenet', 'OPENSSL']
  3287. IGATEFILES=GetDirectoryContents('panda/src/nativenet', ["*.h", "*_composite*.cxx"])
  3288. TargetAdd('libp3nativenet.in', opts=OPTS, input=IGATEFILES)
  3289. TargetAdd('libp3nativenet.in', opts=['IMOD:panda3d.core', 'ILIB:libp3nativenet', 'SRCDIR:panda/src/nativenet'])
  3290. #
  3291. # DIRECTORY: panda/src/net/
  3292. #
  3293. if (not RUNTIME):
  3294. OPTS=['DIR:panda/src/net', 'BUILDING:PANDA']
  3295. TargetAdd('p3net_composite1.obj', opts=OPTS, input='p3net_composite1.cxx')
  3296. TargetAdd('p3net_composite2.obj', opts=OPTS, input='p3net_composite2.cxx')
  3297. OPTS=['DIR:panda/src/net']
  3298. IGATEFILES=GetDirectoryContents('panda/src/net', ["*.h", "*_composite*.cxx"])
  3299. IGATEFILES.remove("datagram_ui.h")
  3300. TargetAdd('libp3net.in', opts=OPTS, input=IGATEFILES)
  3301. TargetAdd('libp3net.in', opts=['IMOD:panda3d.core', 'ILIB:libp3net', 'SRCDIR:panda/src/net'])
  3302. #
  3303. # DIRECTORY: panda/src/pstatclient/
  3304. #
  3305. if (not RUNTIME):
  3306. OPTS=['DIR:panda/src/pstatclient', 'BUILDING:PANDA']
  3307. TargetAdd('p3pstatclient_composite1.obj', opts=OPTS, input='p3pstatclient_composite1.cxx')
  3308. TargetAdd('p3pstatclient_composite2.obj', opts=OPTS, input='p3pstatclient_composite2.cxx')
  3309. OPTS=['DIR:panda/src/pstatclient']
  3310. IGATEFILES=GetDirectoryContents('panda/src/pstatclient', ["*.h", "*_composite*.cxx"])
  3311. IGATEFILES.remove("config_pstats.h")
  3312. TargetAdd('libp3pstatclient.in', opts=OPTS, input=IGATEFILES)
  3313. TargetAdd('libp3pstatclient.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pstatclient', 'SRCDIR:panda/src/pstatclient'])
  3314. #
  3315. # DIRECTORY: panda/src/gobj/
  3316. #
  3317. if (not RUNTIME):
  3318. OPTS=['DIR:panda/src/gobj', 'BUILDING:PANDA', 'NVIDIACG', 'ZLIB', 'SQUISH']
  3319. TargetAdd('p3gobj_composite1.obj', opts=OPTS, input='p3gobj_composite1.cxx')
  3320. TargetAdd('p3gobj_composite2.obj', opts=OPTS+['BIGOBJ'], input='p3gobj_composite2.cxx')
  3321. OPTS=['DIR:panda/src/gobj', 'NVIDIACG', 'ZLIB', 'SQUISH']
  3322. IGATEFILES=GetDirectoryContents('panda/src/gobj', ["*.h", "*_composite*.cxx"])
  3323. if ("cgfx_states.h" in IGATEFILES): IGATEFILES.remove("cgfx_states.h")
  3324. TargetAdd('libp3gobj.in', opts=OPTS, input=IGATEFILES)
  3325. TargetAdd('libp3gobj.in', opts=['IMOD:panda3d.core', 'ILIB:libp3gobj', 'SRCDIR:panda/src/gobj'])
  3326. PyTargetAdd('p3gobj_ext_composite.obj', opts=OPTS, input='p3gobj_ext_composite.cxx')
  3327. #
  3328. # DIRECTORY: panda/src/pgraphnodes/
  3329. #
  3330. if (not RUNTIME):
  3331. OPTS=['DIR:panda/src/pgraphnodes', 'BUILDING:PANDA']
  3332. TargetAdd('p3pgraphnodes_composite1.obj', opts=OPTS, input='p3pgraphnodes_composite1.cxx')
  3333. TargetAdd('p3pgraphnodes_composite2.obj', opts=OPTS, input='p3pgraphnodes_composite2.cxx')
  3334. OPTS=['DIR:panda/src/pgraphnodes']
  3335. IGATEFILES=GetDirectoryContents('panda/src/pgraphnodes', ["*.h", "*_composite*.cxx"])
  3336. TargetAdd('libp3pgraphnodes.in', opts=OPTS, input=IGATEFILES)
  3337. TargetAdd('libp3pgraphnodes.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgraphnodes', 'SRCDIR:panda/src/pgraphnodes'])
  3338. #
  3339. # DIRECTORY: panda/src/pgraph/
  3340. #
  3341. if (not RUNTIME):
  3342. OPTS=['DIR:panda/src/pgraph', 'BUILDING:PANDA']
  3343. TargetAdd('p3pgraph_nodePath.obj', opts=OPTS, input='nodePath.cxx')
  3344. TargetAdd('p3pgraph_composite1.obj', opts=OPTS, input='p3pgraph_composite1.cxx')
  3345. TargetAdd('p3pgraph_composite2.obj', opts=OPTS, input='p3pgraph_composite2.cxx')
  3346. TargetAdd('p3pgraph_composite3.obj', opts=OPTS, input='p3pgraph_composite3.cxx')
  3347. TargetAdd('p3pgraph_composite4.obj', opts=OPTS, input='p3pgraph_composite4.cxx')
  3348. OPTS=['DIR:panda/src/pgraph']
  3349. IGATEFILES=GetDirectoryContents('panda/src/pgraph', ["*.h", "nodePath.cxx", "*_composite*.cxx"])
  3350. TargetAdd('libp3pgraph.in', opts=OPTS, input=IGATEFILES)
  3351. TargetAdd('libp3pgraph.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgraph', 'SRCDIR:panda/src/pgraph'])
  3352. PyTargetAdd('p3pgraph_ext_composite.obj', opts=OPTS, input='p3pgraph_ext_composite.cxx')
  3353. #
  3354. # DIRECTORY: panda/src/cull/
  3355. #
  3356. if (not RUNTIME):
  3357. OPTS=['DIR:panda/src/cull', 'BUILDING:PANDA']
  3358. TargetAdd('p3cull_composite1.obj', opts=OPTS, input='p3cull_composite1.cxx')
  3359. TargetAdd('p3cull_composite2.obj', opts=OPTS, input='p3cull_composite2.cxx')
  3360. OPTS=['DIR:panda/src/cull']
  3361. IGATEFILES=GetDirectoryContents('panda/src/cull', ["*.h", "*_composite*.cxx"])
  3362. TargetAdd('libp3cull.in', opts=OPTS, input=IGATEFILES)
  3363. TargetAdd('libp3cull.in', opts=['IMOD:panda3d.core', 'ILIB:libp3cull', 'SRCDIR:panda/src/cull'])
  3364. #
  3365. # DIRECTORY: panda/src/display/
  3366. #
  3367. if (not RUNTIME):
  3368. OPTS=['DIR:panda/src/display', 'BUILDING:PANDA']
  3369. TargetAdd('p3display_graphicsStateGuardian.obj', opts=OPTS, input='graphicsStateGuardian.cxx')
  3370. TargetAdd('p3display_composite1.obj', opts=OPTS, input='p3display_composite1.cxx')
  3371. TargetAdd('p3display_composite2.obj', opts=OPTS, input='p3display_composite2.cxx')
  3372. OPTS=['DIR:panda/src/display']
  3373. IGATEFILES=GetDirectoryContents('panda/src/display', ["*.h", "*_composite*.cxx"])
  3374. IGATEFILES.remove("renderBuffer.h")
  3375. TargetAdd('libp3display.in', opts=OPTS, input=IGATEFILES)
  3376. TargetAdd('libp3display.in', opts=['IMOD:panda3d.core', 'ILIB:libp3display', 'SRCDIR:panda/src/display'])
  3377. PyTargetAdd('p3display_ext_composite.obj', opts=OPTS, input='p3display_ext_composite.cxx')
  3378. if RTDIST and GetTarget() == 'darwin':
  3379. OPTS=['DIR:panda/src/display']
  3380. TargetAdd('subprocessWindowBuffer.obj', opts=OPTS, input='subprocessWindowBuffer.cxx')
  3381. TargetAdd('libp3subprocbuffer.ilb', input='subprocessWindowBuffer.obj')
  3382. #
  3383. # DIRECTORY: panda/src/chan/
  3384. #
  3385. if (not RUNTIME):
  3386. OPTS=['DIR:panda/src/chan', 'BUILDING:PANDA']
  3387. TargetAdd('p3chan_composite1.obj', opts=OPTS, input='p3chan_composite1.cxx')
  3388. TargetAdd('p3chan_composite2.obj', opts=OPTS, input='p3chan_composite2.cxx')
  3389. OPTS=['DIR:panda/src/chan']
  3390. IGATEFILES=GetDirectoryContents('panda/src/chan', ["*.h", "*_composite*.cxx"])
  3391. IGATEFILES.remove('movingPart.h')
  3392. IGATEFILES.remove('animChannelFixed.h')
  3393. TargetAdd('libp3chan.in', opts=OPTS, input=IGATEFILES)
  3394. TargetAdd('libp3chan.in', opts=['IMOD:panda3d.core', 'ILIB:libp3chan', 'SRCDIR:panda/src/chan'])
  3395. # DIRECTORY: panda/src/char/
  3396. #
  3397. if (not RUNTIME):
  3398. OPTS=['DIR:panda/src/char', 'BUILDING:PANDA']
  3399. TargetAdd('p3char_composite1.obj', opts=OPTS, input='p3char_composite1.cxx')
  3400. TargetAdd('p3char_composite2.obj', opts=OPTS, input='p3char_composite2.cxx')
  3401. OPTS=['DIR:panda/src/char']
  3402. IGATEFILES=GetDirectoryContents('panda/src/char', ["*.h", "*_composite*.cxx"])
  3403. TargetAdd('libp3char.in', opts=OPTS, input=IGATEFILES)
  3404. TargetAdd('libp3char.in', opts=['IMOD:panda3d.core', 'ILIB:libp3char', 'SRCDIR:panda/src/char'])
  3405. #
  3406. # DIRECTORY: panda/src/dgraph/
  3407. #
  3408. if (not RUNTIME):
  3409. OPTS=['DIR:panda/src/dgraph', 'BUILDING:PANDA']
  3410. TargetAdd('p3dgraph_composite1.obj', opts=OPTS, input='p3dgraph_composite1.cxx')
  3411. TargetAdd('p3dgraph_composite2.obj', opts=OPTS, input='p3dgraph_composite2.cxx')
  3412. OPTS=['DIR:panda/src/dgraph']
  3413. IGATEFILES=GetDirectoryContents('panda/src/dgraph', ["*.h", "*_composite*.cxx"])
  3414. TargetAdd('libp3dgraph.in', opts=OPTS, input=IGATEFILES)
  3415. TargetAdd('libp3dgraph.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dgraph', 'SRCDIR:panda/src/dgraph'])
  3416. #
  3417. # DIRECTORY: panda/src/device/
  3418. #
  3419. if (not RUNTIME):
  3420. OPTS=['DIR:panda/src/device', 'BUILDING:PANDA']
  3421. TargetAdd('p3device_composite1.obj', opts=OPTS, input='p3device_composite1.cxx')
  3422. TargetAdd('p3device_composite2.obj', opts=OPTS, input='p3device_composite2.cxx')
  3423. OPTS=['DIR:panda/src/device']
  3424. IGATEFILES=GetDirectoryContents('panda/src/device', ["*.h", "*_composite*.cxx"])
  3425. TargetAdd('libp3device.in', opts=OPTS, input=IGATEFILES)
  3426. TargetAdd('libp3device.in', opts=['IMOD:panda3d.core', 'ILIB:libp3device', 'SRCDIR:panda/src/device'])
  3427. #
  3428. # DIRECTORY: panda/src/pnmtext/
  3429. #
  3430. if (PkgSkip("FREETYPE")==0 and not RUNTIME):
  3431. OPTS=['DIR:panda/src/pnmtext', 'BUILDING:PANDA', 'FREETYPE']
  3432. TargetAdd('p3pnmtext_composite1.obj', opts=OPTS, input='p3pnmtext_composite1.cxx')
  3433. OPTS=['DIR:panda/src/pnmtext', 'FREETYPE']
  3434. IGATEFILES=GetDirectoryContents('panda/src/pnmtext', ["*.h", "*_composite*.cxx"])
  3435. TargetAdd('libp3pnmtext.in', opts=OPTS, input=IGATEFILES)
  3436. TargetAdd('libp3pnmtext.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pnmtext', 'SRCDIR:panda/src/pnmtext'])
  3437. #
  3438. # DIRECTORY: panda/src/text/
  3439. #
  3440. if (not RUNTIME):
  3441. if not PkgSkip("HARFBUZZ"):
  3442. DefSymbol("HARFBUZZ", "HAVE_HARFBUZZ")
  3443. OPTS=['DIR:panda/src/text', 'BUILDING:PANDA', 'ZLIB', 'FREETYPE', 'HARFBUZZ']
  3444. TargetAdd('p3text_composite1.obj', opts=OPTS, input='p3text_composite1.cxx')
  3445. TargetAdd('p3text_composite2.obj', opts=OPTS, input='p3text_composite2.cxx')
  3446. OPTS=['DIR:panda/src/text', 'ZLIB', 'FREETYPE']
  3447. IGATEFILES=GetDirectoryContents('panda/src/text', ["*.h", "*_composite*.cxx"])
  3448. TargetAdd('libp3text.in', opts=OPTS, input=IGATEFILES)
  3449. TargetAdd('libp3text.in', opts=['IMOD:panda3d.core', 'ILIB:libp3text', 'SRCDIR:panda/src/text'])
  3450. #
  3451. # DIRECTORY: panda/src/movies/
  3452. #
  3453. if (not RUNTIME):
  3454. OPTS=['DIR:panda/src/movies', 'BUILDING:PANDA', 'VORBIS', 'OPUS']
  3455. TargetAdd('p3movies_composite1.obj', opts=OPTS, input='p3movies_composite1.cxx')
  3456. OPTS=['DIR:panda/src/movies', 'VORBIS', 'OPUS']
  3457. IGATEFILES=GetDirectoryContents('panda/src/movies', ["*.h", "*_composite*.cxx"])
  3458. TargetAdd('libp3movies.in', opts=OPTS, input=IGATEFILES)
  3459. TargetAdd('libp3movies.in', opts=['IMOD:panda3d.core', 'ILIB:libp3movies', 'SRCDIR:panda/src/movies'])
  3460. #
  3461. # DIRECTORY: panda/src/grutil/
  3462. #
  3463. if (not RUNTIME):
  3464. OPTS=['DIR:panda/src/grutil', 'BUILDING:PANDA']
  3465. TargetAdd('p3grutil_multitexReducer.obj', opts=OPTS, input='multitexReducer.cxx')
  3466. TargetAdd('p3grutil_composite1.obj', opts=OPTS, input='p3grutil_composite1.cxx')
  3467. TargetAdd('p3grutil_composite2.obj', opts=OPTS, input='p3grutil_composite2.cxx')
  3468. OPTS=['DIR:panda/src/grutil']
  3469. IGATEFILES=GetDirectoryContents('panda/src/grutil', ["*.h", "*_composite*.cxx"])
  3470. if 'convexHull.h' in IGATEFILES: IGATEFILES.remove('convexHull.h')
  3471. TargetAdd('libp3grutil.in', opts=OPTS, input=IGATEFILES)
  3472. TargetAdd('libp3grutil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3grutil', 'SRCDIR:panda/src/grutil'])
  3473. #
  3474. # DIRECTORY: panda/src/tform/
  3475. #
  3476. if (not RUNTIME):
  3477. OPTS=['DIR:panda/src/tform', 'BUILDING:PANDA']
  3478. TargetAdd('p3tform_composite1.obj', opts=OPTS, input='p3tform_composite1.cxx')
  3479. TargetAdd('p3tform_composite2.obj', opts=OPTS, input='p3tform_composite2.cxx')
  3480. OPTS=['DIR:panda/src/tform']
  3481. IGATEFILES=GetDirectoryContents('panda/src/tform', ["*.h", "*_composite*.cxx"])
  3482. TargetAdd('libp3tform.in', opts=OPTS, input=IGATEFILES)
  3483. TargetAdd('libp3tform.in', opts=['IMOD:panda3d.core', 'ILIB:libp3tform', 'SRCDIR:panda/src/tform'])
  3484. #
  3485. # DIRECTORY: panda/src/collide/
  3486. #
  3487. if (not RUNTIME):
  3488. OPTS=['DIR:panda/src/collide', 'BUILDING:PANDA']
  3489. TargetAdd('p3collide_composite1.obj', opts=OPTS, input='p3collide_composite1.cxx')
  3490. TargetAdd('p3collide_composite2.obj', opts=OPTS, input='p3collide_composite2.cxx')
  3491. OPTS=['DIR:panda/src/collide']
  3492. IGATEFILES=GetDirectoryContents('panda/src/collide', ["*.h", "*_composite*.cxx"])
  3493. TargetAdd('libp3collide.in', opts=OPTS, input=IGATEFILES)
  3494. TargetAdd('libp3collide.in', opts=['IMOD:panda3d.core', 'ILIB:libp3collide', 'SRCDIR:panda/src/collide'])
  3495. #
  3496. # DIRECTORY: panda/src/parametrics/
  3497. #
  3498. if (not RUNTIME):
  3499. OPTS=['DIR:panda/src/parametrics', 'BUILDING:PANDA']
  3500. TargetAdd('p3parametrics_composite1.obj', opts=OPTS, input='p3parametrics_composite1.cxx')
  3501. TargetAdd('p3parametrics_composite2.obj', opts=OPTS, input='p3parametrics_composite2.cxx')
  3502. OPTS=['DIR:panda/src/parametrics']
  3503. IGATEFILES=GetDirectoryContents('panda/src/parametrics', ["*.h", "*_composite*.cxx"])
  3504. TargetAdd('libp3parametrics.in', opts=OPTS, input=IGATEFILES)
  3505. TargetAdd('libp3parametrics.in', opts=['IMOD:panda3d.core', 'ILIB:libp3parametrics', 'SRCDIR:panda/src/parametrics'])
  3506. #
  3507. # DIRECTORY: panda/src/pgui/
  3508. #
  3509. if (not RUNTIME):
  3510. OPTS=['DIR:panda/src/pgui', 'BUILDING:PANDA']
  3511. TargetAdd('p3pgui_composite1.obj', opts=OPTS, input='p3pgui_composite1.cxx')
  3512. TargetAdd('p3pgui_composite2.obj', opts=OPTS, input='p3pgui_composite2.cxx')
  3513. OPTS=['DIR:panda/src/pgui']
  3514. IGATEFILES=GetDirectoryContents('panda/src/pgui', ["*.h", "*_composite*.cxx"])
  3515. TargetAdd('libp3pgui.in', opts=OPTS, input=IGATEFILES)
  3516. TargetAdd('libp3pgui.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgui', 'SRCDIR:panda/src/pgui'])
  3517. #
  3518. # DIRECTORY: panda/src/pnmimagetypes/
  3519. #
  3520. if (not RUNTIME):
  3521. OPTS=['DIR:panda/src/pnmimagetypes', 'DIR:panda/src/pnmimage', 'BUILDING:PANDA', 'PNG', 'ZLIB', 'JPEG', 'TIFF', 'OPENEXR', 'EXCEPTIONS']
  3522. TargetAdd('p3pnmimagetypes_composite1.obj', opts=OPTS, input='p3pnmimagetypes_composite1.cxx')
  3523. TargetAdd('p3pnmimagetypes_composite2.obj', opts=OPTS, input='p3pnmimagetypes_composite2.cxx')
  3524. #
  3525. # DIRECTORY: panda/src/recorder/
  3526. #
  3527. if (not RUNTIME):
  3528. OPTS=['DIR:panda/src/recorder', 'BUILDING:PANDA']
  3529. TargetAdd('p3recorder_composite1.obj', opts=OPTS, input='p3recorder_composite1.cxx')
  3530. TargetAdd('p3recorder_composite2.obj', opts=OPTS, input='p3recorder_composite2.cxx')
  3531. OPTS=['DIR:panda/src/recorder']
  3532. IGATEFILES=GetDirectoryContents('panda/src/recorder', ["*.h", "*_composite*.cxx"])
  3533. TargetAdd('libp3recorder.in', opts=OPTS, input=IGATEFILES)
  3534. TargetAdd('libp3recorder.in', opts=['IMOD:panda3d.core', 'ILIB:libp3recorder', 'SRCDIR:panda/src/recorder'])
  3535. #
  3536. # DIRECTORY: panda/src/dxml/
  3537. #
  3538. DefSymbol("TINYXML", "TIXML_USE_STL", "")
  3539. OPTS=['DIR:panda/src/dxml', 'TINYXML']
  3540. TargetAdd('tinyxml_composite1.obj', opts=OPTS, input='tinyxml_composite1.cxx')
  3541. TargetAdd('libp3tinyxml.ilb', input='tinyxml_composite1.obj')
  3542. if (not RUNTIME):
  3543. OPTS=['DIR:panda/src/dxml', 'BUILDING:PANDA', 'TINYXML']
  3544. TargetAdd('p3dxml_composite1.obj', opts=OPTS, input='p3dxml_composite1.cxx')
  3545. OPTS=['DIR:panda/src/dxml', 'TINYXML']
  3546. IGATEFILES=GetDirectoryContents('panda/src/dxml', ["*.h", "p3dxml_composite1.cxx"])
  3547. TargetAdd('libp3dxml.in', opts=OPTS, input=IGATEFILES)
  3548. TargetAdd('libp3dxml.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dxml', 'SRCDIR:panda/src/dxml'])
  3549. #
  3550. # DIRECTORY: panda/metalibs/panda/
  3551. #
  3552. if (not RUNTIME):
  3553. OPTS=['DIR:panda/metalibs/panda', 'BUILDING:PANDA', 'JPEG', 'PNG', 'HARFBUZZ',
  3554. 'TIFF', 'OPENEXR', 'ZLIB', 'OPENSSL', 'FREETYPE', 'FFTW', 'ADVAPI', 'WINSOCK2',
  3555. 'SQUISH', 'NVIDIACG', 'VORBIS', 'OPUS', 'WINUSER', 'WINMM', 'WINGDI', 'IPHLPAPI']
  3556. TargetAdd('panda_panda.obj', opts=OPTS, input='panda.cxx')
  3557. TargetAdd('libpanda.dll', input='panda_panda.obj')
  3558. TargetAdd('libpanda.dll', input='p3recorder_composite1.obj')
  3559. TargetAdd('libpanda.dll', input='p3recorder_composite2.obj')
  3560. TargetAdd('libpanda.dll', input='p3pgraphnodes_composite1.obj')
  3561. TargetAdd('libpanda.dll', input='p3pgraphnodes_composite2.obj')
  3562. TargetAdd('libpanda.dll', input='p3pgraph_nodePath.obj')
  3563. TargetAdd('libpanda.dll', input='p3pgraph_composite1.obj')
  3564. TargetAdd('libpanda.dll', input='p3pgraph_composite2.obj')
  3565. TargetAdd('libpanda.dll', input='p3pgraph_composite3.obj')
  3566. TargetAdd('libpanda.dll', input='p3pgraph_composite4.obj')
  3567. TargetAdd('libpanda.dll', input='p3cull_composite1.obj')
  3568. TargetAdd('libpanda.dll', input='p3cull_composite2.obj')
  3569. TargetAdd('libpanda.dll', input='p3movies_composite1.obj')
  3570. TargetAdd('libpanda.dll', input='p3grutil_multitexReducer.obj')
  3571. TargetAdd('libpanda.dll', input='p3grutil_composite1.obj')
  3572. TargetAdd('libpanda.dll', input='p3grutil_composite2.obj')
  3573. TargetAdd('libpanda.dll', input='p3chan_composite1.obj')
  3574. TargetAdd('libpanda.dll', input='p3chan_composite2.obj')
  3575. TargetAdd('libpanda.dll', input='p3pstatclient_composite1.obj')
  3576. TargetAdd('libpanda.dll', input='p3pstatclient_composite2.obj')
  3577. TargetAdd('libpanda.dll', input='p3char_composite1.obj')
  3578. TargetAdd('libpanda.dll', input='p3char_composite2.obj')
  3579. TargetAdd('libpanda.dll', input='p3collide_composite1.obj')
  3580. TargetAdd('libpanda.dll', input='p3collide_composite2.obj')
  3581. TargetAdd('libpanda.dll', input='p3device_composite1.obj')
  3582. TargetAdd('libpanda.dll', input='p3device_composite2.obj')
  3583. TargetAdd('libpanda.dll', input='p3dgraph_composite1.obj')
  3584. TargetAdd('libpanda.dll', input='p3dgraph_composite2.obj')
  3585. TargetAdd('libpanda.dll', input='p3display_graphicsStateGuardian.obj')
  3586. TargetAdd('libpanda.dll', input='p3display_composite1.obj')
  3587. TargetAdd('libpanda.dll', input='p3display_composite2.obj')
  3588. TargetAdd('libpanda.dll', input='p3pipeline_composite1.obj')
  3589. TargetAdd('libpanda.dll', input='p3pipeline_composite2.obj')
  3590. TargetAdd('libpanda.dll', input='p3pipeline_contextSwitch.obj')
  3591. TargetAdd('libpanda.dll', input='p3event_composite1.obj')
  3592. TargetAdd('libpanda.dll', input='p3event_composite2.obj')
  3593. TargetAdd('libpanda.dll', input='p3gobj_composite1.obj')
  3594. TargetAdd('libpanda.dll', input='p3gobj_composite2.obj')
  3595. TargetAdd('libpanda.dll', input='p3gsgbase_composite1.obj')
  3596. TargetAdd('libpanda.dll', input='p3linmath_composite1.obj')
  3597. TargetAdd('libpanda.dll', input='p3linmath_composite2.obj')
  3598. TargetAdd('libpanda.dll', input='p3mathutil_composite1.obj')
  3599. TargetAdd('libpanda.dll', input='p3mathutil_composite2.obj')
  3600. TargetAdd('libpanda.dll', input='p3parametrics_composite1.obj')
  3601. TargetAdd('libpanda.dll', input='p3parametrics_composite2.obj')
  3602. TargetAdd('libpanda.dll', input='p3pnmimagetypes_composite1.obj')
  3603. TargetAdd('libpanda.dll', input='p3pnmimagetypes_composite2.obj')
  3604. TargetAdd('libpanda.dll', input='p3pnmimage_composite1.obj')
  3605. TargetAdd('libpanda.dll', input='p3pnmimage_composite2.obj')
  3606. TargetAdd('libpanda.dll', input='p3pnmimage_convert_srgb_sse2.obj')
  3607. TargetAdd('libpanda.dll', input='p3text_composite1.obj')
  3608. TargetAdd('libpanda.dll', input='p3text_composite2.obj')
  3609. TargetAdd('libpanda.dll', input='p3tform_composite1.obj')
  3610. TargetAdd('libpanda.dll', input='p3tform_composite2.obj')
  3611. TargetAdd('libpanda.dll', input='p3putil_composite1.obj')
  3612. TargetAdd('libpanda.dll', input='p3putil_composite2.obj')
  3613. TargetAdd('libpanda.dll', input='p3audio_composite1.obj')
  3614. TargetAdd('libpanda.dll', input='p3pgui_composite1.obj')
  3615. TargetAdd('libpanda.dll', input='p3pgui_composite2.obj')
  3616. TargetAdd('libpanda.dll', input='p3net_composite1.obj')
  3617. TargetAdd('libpanda.dll', input='p3net_composite2.obj')
  3618. TargetAdd('libpanda.dll', input='p3nativenet_composite1.obj')
  3619. TargetAdd('libpanda.dll', input='p3pandabase_pandabase.obj')
  3620. TargetAdd('libpanda.dll', input='libpandaexpress.dll')
  3621. TargetAdd('libpanda.dll', input='p3dxml_composite1.obj')
  3622. TargetAdd('libpanda.dll', input='libp3dtoolconfig.dll')
  3623. TargetAdd('libpanda.dll', input='libp3dtool.dll')
  3624. if PkgSkip("FREETYPE")==0:
  3625. TargetAdd('libpanda.dll', input="p3pnmtext_composite1.obj")
  3626. TargetAdd('libpanda.dll', dep='dtool_have_freetype.dat')
  3627. TargetAdd('libpanda.dll', opts=OPTS)
  3628. PyTargetAdd('core_module.obj', input='libp3dtoolbase.in')
  3629. PyTargetAdd('core_module.obj', input='libp3dtoolutil.in')
  3630. PyTargetAdd('core_module.obj', input='libp3prc.in')
  3631. PyTargetAdd('core_module.obj', input='libp3downloader.in')
  3632. PyTargetAdd('core_module.obj', input='libp3express.in')
  3633. PyTargetAdd('core_module.obj', input='libp3recorder.in')
  3634. PyTargetAdd('core_module.obj', input='libp3pgraphnodes.in')
  3635. PyTargetAdd('core_module.obj', input='libp3pgraph.in')
  3636. PyTargetAdd('core_module.obj', input='libp3cull.in')
  3637. PyTargetAdd('core_module.obj', input='libp3grutil.in')
  3638. PyTargetAdd('core_module.obj', input='libp3chan.in')
  3639. PyTargetAdd('core_module.obj', input='libp3pstatclient.in')
  3640. PyTargetAdd('core_module.obj', input='libp3char.in')
  3641. PyTargetAdd('core_module.obj', input='libp3collide.in')
  3642. PyTargetAdd('core_module.obj', input='libp3device.in')
  3643. PyTargetAdd('core_module.obj', input='libp3dgraph.in')
  3644. PyTargetAdd('core_module.obj', input='libp3display.in')
  3645. PyTargetAdd('core_module.obj', input='libp3pipeline.in')
  3646. PyTargetAdd('core_module.obj', input='libp3event.in')
  3647. PyTargetAdd('core_module.obj', input='libp3gobj.in')
  3648. PyTargetAdd('core_module.obj', input='libp3gsgbase.in')
  3649. PyTargetAdd('core_module.obj', input='libp3linmath.in')
  3650. PyTargetAdd('core_module.obj', input='libp3mathutil.in')
  3651. PyTargetAdd('core_module.obj', input='libp3parametrics.in')
  3652. PyTargetAdd('core_module.obj', input='libp3pnmimage.in')
  3653. PyTargetAdd('core_module.obj', input='libp3text.in')
  3654. PyTargetAdd('core_module.obj', input='libp3tform.in')
  3655. PyTargetAdd('core_module.obj', input='libp3putil.in')
  3656. PyTargetAdd('core_module.obj', input='libp3audio.in')
  3657. PyTargetAdd('core_module.obj', input='libp3nativenet.in')
  3658. PyTargetAdd('core_module.obj', input='libp3net.in')
  3659. PyTargetAdd('core_module.obj', input='libp3pgui.in')
  3660. PyTargetAdd('core_module.obj', input='libp3movies.in')
  3661. PyTargetAdd('core_module.obj', input='libp3dxml.in')
  3662. if PkgSkip("FREETYPE")==0:
  3663. PyTargetAdd('core_module.obj', input='libp3pnmtext.in')
  3664. PyTargetAdd('core_module.obj', opts=['IMOD:panda3d.core', 'ILIB:core'])
  3665. PyTargetAdd('core.pyd', input='libp3dtoolbase_igate.obj')
  3666. PyTargetAdd('core.pyd', input='p3dtoolbase_typeHandle_ext.obj')
  3667. PyTargetAdd('core.pyd', input='libp3dtoolutil_igate.obj')
  3668. PyTargetAdd('core.pyd', input='p3dtoolutil_ext_composite.obj')
  3669. PyTargetAdd('core.pyd', input='libp3prc_igate.obj')
  3670. PyTargetAdd('core.pyd', input='p3prc_ext_composite.obj')
  3671. PyTargetAdd('core.pyd', input='libp3downloader_igate.obj')
  3672. PyTargetAdd('core.pyd', input='p3downloader_stringStream_ext.obj')
  3673. PyTargetAdd('core.pyd', input='p3express_ext_composite.obj')
  3674. PyTargetAdd('core.pyd', input='libp3express_igate.obj')
  3675. PyTargetAdd('core.pyd', input='libp3recorder_igate.obj')
  3676. PyTargetAdd('core.pyd', input='libp3pgraphnodes_igate.obj')
  3677. PyTargetAdd('core.pyd', input='libp3pgraph_igate.obj')
  3678. PyTargetAdd('core.pyd', input='libp3movies_igate.obj')
  3679. PyTargetAdd('core.pyd', input='libp3grutil_igate.obj')
  3680. PyTargetAdd('core.pyd', input='libp3chan_igate.obj')
  3681. PyTargetAdd('core.pyd', input='libp3pstatclient_igate.obj')
  3682. PyTargetAdd('core.pyd', input='libp3char_igate.obj')
  3683. PyTargetAdd('core.pyd', input='libp3collide_igate.obj')
  3684. PyTargetAdd('core.pyd', input='libp3device_igate.obj')
  3685. PyTargetAdd('core.pyd', input='libp3dgraph_igate.obj')
  3686. PyTargetAdd('core.pyd', input='libp3display_igate.obj')
  3687. PyTargetAdd('core.pyd', input='libp3pipeline_igate.obj')
  3688. PyTargetAdd('core.pyd', input='libp3event_igate.obj')
  3689. PyTargetAdd('core.pyd', input='libp3gobj_igate.obj')
  3690. PyTargetAdd('core.pyd', input='libp3gsgbase_igate.obj')
  3691. PyTargetAdd('core.pyd', input='libp3linmath_igate.obj')
  3692. PyTargetAdd('core.pyd', input='libp3mathutil_igate.obj')
  3693. PyTargetAdd('core.pyd', input='libp3parametrics_igate.obj')
  3694. PyTargetAdd('core.pyd', input='libp3pnmimage_igate.obj')
  3695. PyTargetAdd('core.pyd', input='libp3text_igate.obj')
  3696. PyTargetAdd('core.pyd', input='libp3tform_igate.obj')
  3697. PyTargetAdd('core.pyd', input='libp3putil_igate.obj')
  3698. PyTargetAdd('core.pyd', input='libp3audio_igate.obj')
  3699. PyTargetAdd('core.pyd', input='libp3pgui_igate.obj')
  3700. PyTargetAdd('core.pyd', input='libp3net_igate.obj')
  3701. PyTargetAdd('core.pyd', input='libp3nativenet_igate.obj')
  3702. PyTargetAdd('core.pyd', input='libp3dxml_igate.obj')
  3703. if PkgSkip("FREETYPE")==0:
  3704. PyTargetAdd('core.pyd', input="libp3pnmtext_igate.obj")
  3705. PyTargetAdd('core.pyd', input='p3pipeline_pythonThread.obj')
  3706. PyTargetAdd('core.pyd', input='p3putil_ext_composite.obj')
  3707. PyTargetAdd('core.pyd', input='p3pnmimage_pfmFile_ext.obj')
  3708. PyTargetAdd('core.pyd', input='p3event_asyncFuture_ext.obj')
  3709. PyTargetAdd('core.pyd', input='p3event_pythonTask.obj')
  3710. PyTargetAdd('core.pyd', input='p3gobj_ext_composite.obj')
  3711. PyTargetAdd('core.pyd', input='p3pgraph_ext_composite.obj')
  3712. PyTargetAdd('core.pyd', input='p3display_ext_composite.obj')
  3713. PyTargetAdd('core.pyd', input='core_module.obj')
  3714. if not GetLinkAllStatic() and GetTarget() != 'emscripten':
  3715. PyTargetAdd('core.pyd', input='libp3tinyxml.ilb')
  3716. PyTargetAdd('core.pyd', input='libp3interrogatedb.dll')
  3717. PyTargetAdd('core.pyd', input=COMMON_PANDA_LIBS)
  3718. PyTargetAdd('core.pyd', opts=['WINSOCK2'])
  3719. #
  3720. # DIRECTORY: panda/src/vision/
  3721. #
  3722. if (PkgSkip("VISION") == 0) and (not RUNTIME):
  3723. # We want to know whether we have ffmpeg so that we can override the .avi association.
  3724. if not PkgSkip("FFMPEG"):
  3725. DefSymbol("OPENCV", "HAVE_FFMPEG")
  3726. if not PkgSkip("OPENCV"):
  3727. DefSymbol("OPENCV", "HAVE_OPENCV")
  3728. if OPENCV_VER_23:
  3729. DefSymbol("OPENCV", "OPENCV_VER_23")
  3730. OPTS=['DIR:panda/src/vision', 'BUILDING:VISION', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS']
  3731. TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx', dep=[
  3732. 'dtool_have_ffmpeg.dat',
  3733. 'dtool_have_opencv.dat',
  3734. 'dtool_have_directcam.dat',
  3735. ])
  3736. TargetAdd('libp3vision.dll', input='p3vision_composite1.obj')
  3737. TargetAdd('libp3vision.dll', input=COMMON_PANDA_LIBS)
  3738. TargetAdd('libp3vision.dll', opts=OPTS)
  3739. OPTS=['DIR:panda/src/vision', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS']
  3740. IGATEFILES=GetDirectoryContents('panda/src/vision', ["*.h", "*_composite*.cxx"])
  3741. TargetAdd('libp3vision.in', opts=OPTS, input=IGATEFILES)
  3742. TargetAdd('libp3vision.in', opts=['IMOD:panda3d.vision', 'ILIB:libp3vision', 'SRCDIR:panda/src/vision'])
  3743. PyTargetAdd('vision_module.obj', input='libp3vision.in')
  3744. PyTargetAdd('vision_module.obj', opts=OPTS)
  3745. PyTargetAdd('vision_module.obj', opts=['IMOD:panda3d.vision', 'ILIB:vision', 'IMPORT:panda3d.core'])
  3746. PyTargetAdd('vision.pyd', input='vision_module.obj')
  3747. PyTargetAdd('vision.pyd', input='libp3vision_igate.obj')
  3748. PyTargetAdd('vision.pyd', input='libp3vision.dll')
  3749. PyTargetAdd('vision.pyd', input='libp3interrogatedb.dll')
  3750. PyTargetAdd('vision.pyd', input=COMMON_PANDA_LIBS)
  3751. #
  3752. # DIRECTORY: panda/src/rocket/
  3753. #
  3754. if (PkgSkip("ROCKET") == 0) and (not RUNTIME):
  3755. OPTS=['DIR:panda/src/rocket', 'BUILDING:ROCKET', 'ROCKET', 'PYTHON']
  3756. TargetAdd('p3rocket_composite1.obj', opts=OPTS, input='p3rocket_composite1.cxx')
  3757. TargetAdd('libp3rocket.dll', input='p3rocket_composite1.obj')
  3758. TargetAdd('libp3rocket.dll', input=COMMON_PANDA_LIBS)
  3759. TargetAdd('libp3rocket.dll', opts=OPTS)
  3760. OPTS=['DIR:panda/src/rocket', 'ROCKET', 'RTTI', 'EXCEPTIONS']
  3761. IGATEFILES=GetDirectoryContents('panda/src/rocket', ["rocketInputHandler.h",
  3762. "rocketInputHandler.cxx", "rocketRegion.h", "rocketRegion.cxx", "rocketRegion_ext.h"])
  3763. TargetAdd('libp3rocket.in', opts=OPTS, input=IGATEFILES)
  3764. TargetAdd('libp3rocket.in', opts=['IMOD:panda3d.rocket', 'ILIB:libp3rocket', 'SRCDIR:panda/src/rocket'])
  3765. PyTargetAdd('p3rocket_rocketRegion_ext.obj', opts=OPTS, input='rocketRegion_ext.cxx')
  3766. PyTargetAdd('rocket_module.obj', input='libp3rocket.in')
  3767. PyTargetAdd('rocket_module.obj', opts=OPTS)
  3768. PyTargetAdd('rocket_module.obj', opts=['IMOD:panda3d.rocket', 'ILIB:rocket', 'IMPORT:panda3d.core'])
  3769. PyTargetAdd('rocket.pyd', input='rocket_module.obj')
  3770. PyTargetAdd('rocket.pyd', input='libp3rocket_igate.obj')
  3771. PyTargetAdd('rocket.pyd', input='p3rocket_rocketRegion_ext.obj')
  3772. PyTargetAdd('rocket.pyd', input='libp3rocket.dll')
  3773. PyTargetAdd('rocket.pyd', input='libp3interrogatedb.dll')
  3774. PyTargetAdd('rocket.pyd', input=COMMON_PANDA_LIBS)
  3775. PyTargetAdd('rocket.pyd', opts=['ROCKET'])
  3776. #
  3777. # DIRECTORY: panda/src/p3awesomium
  3778. #
  3779. if PkgSkip("AWESOMIUM") == 0 and not RUNTIME:
  3780. OPTS=['DIR:panda/src/awesomium', 'BUILDING:PANDAAWESOMIUM', 'AWESOMIUM']
  3781. TargetAdd('pandaawesomium_composite1.obj', opts=OPTS, input='pandaawesomium_composite1.cxx')
  3782. TargetAdd('libp3awesomium.dll', input='pandaawesomium_composite1.obj')
  3783. TargetAdd('libp3awesomium.dll', input=COMMON_PANDA_LIBS)
  3784. TargetAdd('libp3awesomium.dll', opts=OPTS)
  3785. OPTS=['DIR:panda/src/awesomium', 'AWESOMIUM']
  3786. IGATEFILES=GetDirectoryContents('panda/src/awesomium', ["*.h", "*_composite1.cxx"])
  3787. TargetAdd('libp3awesomium.in', opts=OPTS, input=IGATEFILES)
  3788. TargetAdd('libp3awesomium.in', opts=['IMOD:panda3d.awesomium', 'ILIB:libp3awesomium', 'SRCDIR:panda/src/awesomium'])
  3789. PyTargetAdd('awesomium_module.obj', input='libp3awesomium.in')
  3790. PyTargetAdd('awesomium_module.obj', opts=OPTS)
  3791. PyTargetAdd('awesomium_module.obj', opts=['IMOD:panda3d.awesomium', 'ILIB:awesomium', 'IMPORT:panda3d.core'])
  3792. PyTargetAdd('awesomium.pyd', input='awesomium_module.obj')
  3793. PyTargetAdd('awesomium.pyd', input='libp3awesomium_igate.obj')
  3794. PyTargetAdd('awesomium.pyd', input='libp3awesomium.dll')
  3795. PyTargetAdd('awesomium.pyd', input='libp3interrogatedb.dll')
  3796. PyTargetAdd('awesomium.pyd', input=COMMON_PANDA_LIBS)
  3797. #
  3798. # DIRECTORY: panda/src/p3skel
  3799. #
  3800. if (PkgSkip('SKEL')==0) and (not RUNTIME):
  3801. OPTS=['DIR:panda/src/skel', 'BUILDING:PANDASKEL', 'ADVAPI']
  3802. TargetAdd('p3skel_composite1.obj', opts=OPTS, input='p3skel_composite1.cxx')
  3803. OPTS=['DIR:panda/src/skel', 'ADVAPI']
  3804. IGATEFILES=GetDirectoryContents("panda/src/skel", ["*.h", "*_composite*.cxx"])
  3805. TargetAdd('libp3skel.in', opts=OPTS, input=IGATEFILES)
  3806. TargetAdd('libp3skel.in', opts=['IMOD:panda3d.skel', 'ILIB:libp3skel', 'SRCDIR:panda/src/skel'])
  3807. #
  3808. # DIRECTORY: panda/src/p3skel
  3809. #
  3810. if (PkgSkip('SKEL')==0) and (not RUNTIME):
  3811. OPTS=['BUILDING:PANDASKEL', 'ADVAPI']
  3812. TargetAdd('libpandaskel.dll', input='p3skel_composite1.obj')
  3813. TargetAdd('libpandaskel.dll', input=COMMON_PANDA_LIBS)
  3814. TargetAdd('libpandaskel.dll', opts=OPTS)
  3815. PyTargetAdd('skel_module.obj', input='libp3skel.in')
  3816. PyTargetAdd('skel_module.obj', opts=['IMOD:panda3d.skel', 'ILIB:skel', 'IMPORT:panda3d.core'])
  3817. PyTargetAdd('skel.pyd', input='skel_module.obj')
  3818. PyTargetAdd('skel.pyd', input='libp3skel_igate.obj')
  3819. PyTargetAdd('skel.pyd', input='libpandaskel.dll')
  3820. PyTargetAdd('skel.pyd', input='libp3interrogatedb.dll')
  3821. PyTargetAdd('skel.pyd', input=COMMON_PANDA_LIBS)
  3822. #
  3823. # DIRECTORY: panda/src/distort/
  3824. #
  3825. if (PkgSkip('PANDAFX')==0) and (not RUNTIME):
  3826. OPTS=['DIR:panda/src/distort', 'BUILDING:PANDAFX']
  3827. TargetAdd('p3distort_composite1.obj', opts=OPTS, input='p3distort_composite1.cxx')
  3828. OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG']
  3829. IGATEFILES=GetDirectoryContents('panda/src/distort', ["*.h", "*_composite*.cxx"])
  3830. TargetAdd('libp3distort.in', opts=OPTS, input=IGATEFILES)
  3831. TargetAdd('libp3distort.in', opts=['IMOD:panda3d.fx', 'ILIB:libp3distort', 'SRCDIR:panda/src/distort'])
  3832. #
  3833. # DIRECTORY: panda/metalibs/pandafx/
  3834. #
  3835. if (PkgSkip('PANDAFX')==0) and (not RUNTIME):
  3836. OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'BUILDING:PANDAFX', 'NVIDIACG']
  3837. TargetAdd('pandafx_pandafx.obj', opts=OPTS, input='pandafx.cxx')
  3838. TargetAdd('libpandafx.dll', input='pandafx_pandafx.obj')
  3839. TargetAdd('libpandafx.dll', input='p3distort_composite1.obj')
  3840. TargetAdd('libpandafx.dll', input=COMMON_PANDA_LIBS)
  3841. TargetAdd('libpandafx.dll', opts=['ADVAPI', 'NVIDIACG'])
  3842. OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG']
  3843. PyTargetAdd('fx_module.obj', input='libp3distort.in')
  3844. PyTargetAdd('fx_module.obj', opts=OPTS)
  3845. PyTargetAdd('fx_module.obj', opts=['IMOD:panda3d.fx', 'ILIB:fx', 'IMPORT:panda3d.core'])
  3846. PyTargetAdd('fx.pyd', input='fx_module.obj')
  3847. PyTargetAdd('fx.pyd', input='libp3distort_igate.obj')
  3848. PyTargetAdd('fx.pyd', input='libpandafx.dll')
  3849. PyTargetAdd('fx.pyd', input='libp3interrogatedb.dll')
  3850. PyTargetAdd('fx.pyd', input=COMMON_PANDA_LIBS)
  3851. #
  3852. # DIRECTORY: panda/src/vrpn/
  3853. #
  3854. if (PkgSkip("VRPN")==0 and not RUNTIME):
  3855. OPTS=['DIR:panda/src/vrpn', 'BUILDING:VRPN', 'VRPN']
  3856. TargetAdd('p3vrpn_composite1.obj', opts=OPTS, input='p3vrpn_composite1.cxx')
  3857. TargetAdd('libp3vrpn.dll', input='p3vrpn_composite1.obj')
  3858. TargetAdd('libp3vrpn.dll', input=COMMON_PANDA_LIBS)
  3859. TargetAdd('libp3vrpn.dll', opts=['VRPN'])
  3860. OPTS=['DIR:panda/src/vrpn', 'VRPN']
  3861. IGATEFILES=GetDirectoryContents('panda/src/vrpn', ["*.h", "*_composite*.cxx"])
  3862. TargetAdd('libp3vrpn.in', opts=OPTS, input=IGATEFILES)
  3863. TargetAdd('libp3vrpn.in', opts=['IMOD:panda3d.vrpn', 'ILIB:libp3vrpn', 'SRCDIR:panda/src/vrpn'])
  3864. PyTargetAdd('vrpn_module.obj', input='libp3vrpn.in')
  3865. PyTargetAdd('vrpn_module.obj', opts=OPTS)
  3866. PyTargetAdd('vrpn_module.obj', opts=['IMOD:panda3d.vrpn', 'ILIB:vrpn', 'IMPORT:panda3d.core'])
  3867. PyTargetAdd('vrpn.pyd', input='vrpn_module.obj')
  3868. PyTargetAdd('vrpn.pyd', input='libp3vrpn_igate.obj')
  3869. PyTargetAdd('vrpn.pyd', input='libp3vrpn.dll')
  3870. PyTargetAdd('vrpn.pyd', input='libp3interrogatedb.dll')
  3871. PyTargetAdd('vrpn.pyd', input=COMMON_PANDA_LIBS)
  3872. #
  3873. # DIRECTORY: panda/src/ffmpeg
  3874. #
  3875. if PkgSkip("FFMPEG") == 0 and not RUNTIME:
  3876. if not PkgSkip("SWSCALE"):
  3877. DefSymbol("FFMPEG", "HAVE_SWSCALE")
  3878. if not PkgSkip("SWRESAMPLE"):
  3879. DefSymbol("FFMPEG", "HAVE_SWRESAMPLE")
  3880. OPTS=['DIR:panda/src/ffmpeg', 'BUILDING:FFMPEG', 'FFMPEG', 'SWSCALE', 'SWRESAMPLE']
  3881. TargetAdd('p3ffmpeg_composite1.obj', opts=OPTS, input='p3ffmpeg_composite1.cxx', dep=[
  3882. 'dtool_have_swscale.dat', 'dtool_have_swresample.dat'])
  3883. TargetAdd('libp3ffmpeg.dll', input='p3ffmpeg_composite1.obj')
  3884. TargetAdd('libp3ffmpeg.dll', input=COMMON_PANDA_LIBS)
  3885. TargetAdd('libp3ffmpeg.dll', opts=OPTS)
  3886. #
  3887. # DIRECTORY: panda/src/audiotraits/
  3888. #
  3889. if PkgSkip("FMODEX") == 0 and not RUNTIME:
  3890. OPTS=['DIR:panda/src/audiotraits', 'BUILDING:FMOD_AUDIO', 'FMODEX']
  3891. TargetAdd('fmod_audio_fmod_audio_composite1.obj', opts=OPTS, input='fmod_audio_composite1.cxx')
  3892. TargetAdd('libp3fmod_audio.dll', input='fmod_audio_fmod_audio_composite1.obj')
  3893. TargetAdd('libp3fmod_audio.dll', input=COMMON_PANDA_LIBS)
  3894. TargetAdd('libp3fmod_audio.dll', opts=['MODULE', 'ADVAPI', 'WINUSER', 'WINMM', 'FMODEX'])
  3895. if PkgSkip("OPENAL") == 0 and not RUNTIME:
  3896. OPTS=['DIR:panda/src/audiotraits', 'BUILDING:OPENAL_AUDIO', 'OPENAL']
  3897. TargetAdd('openal_audio_openal_audio_composite1.obj', opts=OPTS, input='openal_audio_composite1.cxx')
  3898. TargetAdd('libp3openal_audio.dll', input='openal_audio_openal_audio_composite1.obj')
  3899. TargetAdd('libp3openal_audio.dll', input=COMMON_PANDA_LIBS)
  3900. TargetAdd('libp3openal_audio.dll', opts=['MODULE', 'ADVAPI', 'WINUSER', 'WINMM', 'WINSHELL', 'WINOLE', 'OPENAL'])
  3901. #
  3902. # DIRECTORY: panda/src/downloadertools/
  3903. #
  3904. if (PkgSkip("OPENSSL")==0 and not RTDIST and not RUNTIME and PkgSkip("DEPLOYTOOLS")==0):
  3905. OPTS=['DIR:panda/src/downloadertools', 'OPENSSL', 'ZLIB', 'ADVAPI', 'WINSOCK2', 'WINSHELL', 'WINGDI', 'WINUSER']
  3906. TargetAdd('apply_patch_apply_patch.obj', opts=OPTS, input='apply_patch.cxx')
  3907. TargetAdd('apply_patch.exe', input=['apply_patch_apply_patch.obj'])
  3908. TargetAdd('apply_patch.exe', input=COMMON_PANDA_LIBS)
  3909. TargetAdd('apply_patch.exe', opts=OPTS)
  3910. TargetAdd('build_patch_build_patch.obj', opts=OPTS, input='build_patch.cxx')
  3911. TargetAdd('build_patch.exe', input=['build_patch_build_patch.obj'])
  3912. TargetAdd('build_patch.exe', input=COMMON_PANDA_LIBS)
  3913. TargetAdd('build_patch.exe', opts=OPTS)
  3914. if not PkgSkip("ZLIB"):
  3915. TargetAdd('check_adler_check_adler.obj', opts=OPTS, input='check_adler.cxx')
  3916. TargetAdd('check_adler.exe', input=['check_adler_check_adler.obj'])
  3917. TargetAdd('check_adler.exe', input=COMMON_PANDA_LIBS)
  3918. TargetAdd('check_adler.exe', opts=OPTS)
  3919. TargetAdd('check_crc_check_crc.obj', opts=OPTS, input='check_crc.cxx')
  3920. TargetAdd('check_crc.exe', input=['check_crc_check_crc.obj'])
  3921. TargetAdd('check_crc.exe', input=COMMON_PANDA_LIBS)
  3922. TargetAdd('check_crc.exe', opts=OPTS)
  3923. TargetAdd('check_md5_check_md5.obj', opts=OPTS, input='check_md5.cxx')
  3924. TargetAdd('check_md5.exe', input=['check_md5_check_md5.obj'])
  3925. TargetAdd('check_md5.exe', input=COMMON_PANDA_LIBS)
  3926. TargetAdd('check_md5.exe', opts=OPTS)
  3927. TargetAdd('pdecrypt_pdecrypt.obj', opts=OPTS, input='pdecrypt.cxx')
  3928. TargetAdd('pdecrypt.exe', input=['pdecrypt_pdecrypt.obj'])
  3929. TargetAdd('pdecrypt.exe', input=COMMON_PANDA_LIBS)
  3930. TargetAdd('pdecrypt.exe', opts=OPTS)
  3931. TargetAdd('pencrypt_pencrypt.obj', opts=OPTS, input='pencrypt.cxx')
  3932. TargetAdd('pencrypt.exe', input=['pencrypt_pencrypt.obj'])
  3933. TargetAdd('pencrypt.exe', input=COMMON_PANDA_LIBS)
  3934. TargetAdd('pencrypt.exe', opts=OPTS)
  3935. TargetAdd('show_ddb_show_ddb.obj', opts=OPTS, input='show_ddb.cxx')
  3936. TargetAdd('show_ddb.exe', input=['show_ddb_show_ddb.obj'])
  3937. TargetAdd('show_ddb.exe', input=COMMON_PANDA_LIBS)
  3938. TargetAdd('show_ddb.exe', opts=OPTS)
  3939. #
  3940. # DIRECTORY: panda/src/downloadertools/
  3941. #
  3942. if (PkgSkip("ZLIB")==0 and not RTDIST and not RUNTIME and PkgSkip("DEPLOYTOOLS")==0):
  3943. OPTS=['DIR:panda/src/downloadertools', 'ZLIB', 'OPENSSL', 'ADVAPI', 'WINSOCK2', 'WINSHELL', 'WINGDI', 'WINUSER']
  3944. TargetAdd('multify_multify.obj', opts=OPTS, input='multify.cxx')
  3945. TargetAdd('multify.exe', input=['multify_multify.obj'])
  3946. TargetAdd('multify.exe', input=COMMON_PANDA_LIBS)
  3947. TargetAdd('multify.exe', opts=OPTS)
  3948. TargetAdd('pzip_pzip.obj', opts=OPTS, input='pzip.cxx')
  3949. TargetAdd('pzip.exe', input=['pzip_pzip.obj'])
  3950. TargetAdd('pzip.exe', input=COMMON_PANDA_LIBS)
  3951. TargetAdd('pzip.exe', opts=OPTS)
  3952. TargetAdd('punzip_punzip.obj', opts=OPTS, input='punzip.cxx')
  3953. TargetAdd('punzip.exe', input=['punzip_punzip.obj'])
  3954. TargetAdd('punzip.exe', input=COMMON_PANDA_LIBS)
  3955. TargetAdd('punzip.exe', opts=OPTS)
  3956. #
  3957. # DIRECTORY: panda/src/windisplay/
  3958. #
  3959. if (GetTarget() == 'windows' and not RUNTIME):
  3960. OPTS=['DIR:panda/src/windisplay', 'BUILDING:PANDAWIN']
  3961. TargetAdd('p3windisplay_composite1.obj', opts=OPTS+["BIGOBJ"], input='p3windisplay_composite1.cxx')
  3962. TargetAdd('p3windisplay_windetectdx9.obj', opts=OPTS + ["DX9"], input='winDetectDx9.cxx')
  3963. TargetAdd('libp3windisplay.dll', input='p3windisplay_composite1.obj')
  3964. TargetAdd('libp3windisplay.dll', input='p3windisplay_windetectdx9.obj')
  3965. TargetAdd('libp3windisplay.dll', input=COMMON_PANDA_LIBS)
  3966. TargetAdd('libp3windisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM',"BIGOBJ"])
  3967. #
  3968. # DIRECTORY: panda/metalibs/pandadx9/
  3969. #
  3970. if GetTarget() == 'windows' and PkgSkip("DX9")==0 and not RUNTIME:
  3971. OPTS=['DIR:panda/src/dxgsg9', 'BUILDING:PANDADX', 'DX9', 'NVIDIACG', 'CGDX9']
  3972. TargetAdd('p3dxgsg9_dxGraphicsStateGuardian9.obj', opts=OPTS, input='dxGraphicsStateGuardian9.cxx')
  3973. TargetAdd('p3dxgsg9_composite1.obj', opts=OPTS, input='p3dxgsg9_composite1.cxx')
  3974. OPTS=['DIR:panda/metalibs/pandadx9', 'BUILDING:PANDADX', 'DX9', 'NVIDIACG', 'CGDX9']
  3975. TargetAdd('pandadx9_pandadx9.obj', opts=OPTS, input='pandadx9.cxx')
  3976. TargetAdd('libpandadx9.dll', input='pandadx9_pandadx9.obj')
  3977. TargetAdd('libpandadx9.dll', input='p3dxgsg9_dxGraphicsStateGuardian9.obj')
  3978. TargetAdd('libpandadx9.dll', input='p3dxgsg9_composite1.obj')
  3979. TargetAdd('libpandadx9.dll', input='libp3windisplay.dll')
  3980. TargetAdd('libpandadx9.dll', input=COMMON_PANDA_LIBS)
  3981. TargetAdd('libpandadx9.dll', opts=['MODULE', 'ADVAPI', 'WINGDI', 'WINKERNEL', 'WINUSER', 'WINMM', 'DX9', 'NVIDIACG', 'CGDX9'])
  3982. #
  3983. # DIRECTORY: panda/src/egg/
  3984. #
  3985. if not RUNTIME and not PkgSkip("EGG"):
  3986. OPTS=['DIR:panda/src/egg', 'BUILDING:PANDAEGG', 'ZLIB', 'BISONPREFIX_eggyy', 'FLEXDASHI']
  3987. CreateFile(GetOutputDir()+"/include/parser.h")
  3988. TargetAdd('p3egg_parser.obj', opts=OPTS, input='parser.yxx')
  3989. TargetAdd('parser.h', input='p3egg_parser.obj', opts=['DEPENDENCYONLY'])
  3990. TargetAdd('p3egg_lexer.obj', opts=OPTS, input='lexer.lxx')
  3991. TargetAdd('p3egg_composite1.obj', opts=OPTS, input='p3egg_composite1.cxx')
  3992. TargetAdd('p3egg_composite2.obj', opts=OPTS, input='p3egg_composite2.cxx')
  3993. OPTS=['DIR:panda/src/egg', 'ZLIB']
  3994. IGATEFILES=GetDirectoryContents('panda/src/egg', ["*.h", "*_composite*.cxx"])
  3995. if "parser.h" in IGATEFILES: IGATEFILES.remove("parser.h")
  3996. TargetAdd('libp3egg.in', opts=OPTS, input=IGATEFILES)
  3997. TargetAdd('libp3egg.in', opts=['IMOD:panda3d.egg', 'ILIB:libp3egg', 'SRCDIR:panda/src/egg'])
  3998. PyTargetAdd('p3egg_eggGroupNode_ext.obj', opts=OPTS, input='eggGroupNode_ext.cxx')
  3999. #
  4000. # DIRECTORY: panda/src/egg2pg/
  4001. #
  4002. if not RUNTIME and not PkgSkip("EGG"):
  4003. OPTS=['DIR:panda/src/egg2pg', 'BUILDING:PANDAEGG']
  4004. TargetAdd('p3egg2pg_composite1.obj', opts=OPTS, input='p3egg2pg_composite1.cxx')
  4005. TargetAdd('p3egg2pg_composite2.obj', opts=OPTS, input='p3egg2pg_composite2.cxx')
  4006. OPTS=['DIR:panda/src/egg2pg']
  4007. IGATEFILES=['load_egg_file.h']
  4008. TargetAdd('libp3egg2pg.in', opts=OPTS, input=IGATEFILES)
  4009. TargetAdd('libp3egg2pg.in', opts=['IMOD:panda3d.egg', 'ILIB:libp3egg2pg', 'SRCDIR:panda/src/egg2pg'])
  4010. #
  4011. # DIRECTORY: panda/src/framework/
  4012. #
  4013. if (not RUNTIME):
  4014. deps = []
  4015. # Framework wants to link in a renderer when building statically, so tell it what is available.
  4016. if GetLinkAllStatic():
  4017. deps = ['dtool_have_gl.dat', 'dtool_have_tinydisplay.dat', 'dtool_have_egg.dat']
  4018. if not PkgSkip("GL"):
  4019. DefSymbol("FRAMEWORK", "HAVE_GL")
  4020. if not PkgSkip("TINYDISPLAY"):
  4021. DefSymbol("FRAMEWORK", "HAVE_TINYDISPLAY")
  4022. if not PkgSkip("EGG"):
  4023. DefSymbol("FRAMEWORK", "HAVE_EGG")
  4024. OPTS=['DIR:panda/src/framework', 'BUILDING:FRAMEWORK', 'FRAMEWORK']
  4025. TargetAdd('p3framework_composite1.obj', opts=OPTS, input='p3framework_composite1.cxx', dep=deps)
  4026. TargetAdd('libp3framework.dll', input='p3framework_composite1.obj')
  4027. TargetAdd('libp3framework.dll', input=COMMON_PANDA_LIBS)
  4028. TargetAdd('libp3framework.dll', opts=['ADVAPI'])
  4029. #
  4030. # DIRECTORY: panda/src/glgsg/
  4031. #
  4032. if (not RUNTIME and PkgSkip("GL")==0):
  4033. OPTS=['DIR:panda/src/glgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG']
  4034. TargetAdd('p3glgsg_config_glgsg.obj', opts=OPTS, input='config_glgsg.cxx')
  4035. TargetAdd('p3glgsg_glgsg.obj', opts=OPTS, input='glgsg.cxx')
  4036. #
  4037. # DIRECTORY: panda/src/glesgsg/
  4038. #
  4039. if (not RUNTIME and PkgSkip("GLES")==0):
  4040. OPTS=['DIR:panda/src/glesgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES']
  4041. TargetAdd('p3glesgsg_config_glesgsg.obj', opts=OPTS, input='config_glesgsg.cxx')
  4042. TargetAdd('p3glesgsg_glesgsg.obj', opts=OPTS, input='glesgsg.cxx')
  4043. #
  4044. # DIRECTORY: panda/src/gles2gsg/
  4045. #
  4046. if (not RUNTIME and PkgSkip("GLES2")==0):
  4047. OPTS=['DIR:panda/src/gles2gsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2']
  4048. TargetAdd('p3gles2gsg_config_gles2gsg.obj', opts=OPTS, input='config_gles2gsg.cxx')
  4049. TargetAdd('p3gles2gsg_gles2gsg.obj', opts=OPTS, input='gles2gsg.cxx')
  4050. #
  4051. # DIRECTORY: panda/metalibs/pandaegg/
  4052. #
  4053. if not RUNTIME and not PkgSkip("EGG"):
  4054. OPTS=['DIR:panda/metalibs/pandaegg', 'DIR:panda/src/egg', 'BUILDING:PANDAEGG']
  4055. TargetAdd('pandaegg_pandaegg.obj', opts=OPTS, input='pandaegg.cxx')
  4056. TargetAdd('libpandaegg.dll', input='pandaegg_pandaegg.obj')
  4057. TargetAdd('libpandaegg.dll', input='p3egg2pg_composite1.obj')
  4058. TargetAdd('libpandaegg.dll', input='p3egg2pg_composite2.obj')
  4059. TargetAdd('libpandaegg.dll', input='p3egg_composite1.obj')
  4060. TargetAdd('libpandaegg.dll', input='p3egg_composite2.obj')
  4061. TargetAdd('libpandaegg.dll', input='p3egg_parser.obj')
  4062. TargetAdd('libpandaegg.dll', input='p3egg_lexer.obj')
  4063. TargetAdd('libpandaegg.dll', input=COMMON_PANDA_LIBS)
  4064. TargetAdd('libpandaegg.dll', opts=['ADVAPI'])
  4065. OPTS=['DIR:panda/metalibs/pandaegg', 'DIR:panda/src/egg']
  4066. PyTargetAdd('egg_module.obj', input='libp3egg2pg.in')
  4067. PyTargetAdd('egg_module.obj', input='libp3egg.in')
  4068. PyTargetAdd('egg_module.obj', opts=OPTS)
  4069. PyTargetAdd('egg_module.obj', opts=['IMOD:panda3d.egg', 'ILIB:egg', 'IMPORT:panda3d.core'])
  4070. PyTargetAdd('egg.pyd', input='egg_module.obj')
  4071. PyTargetAdd('egg.pyd', input='p3egg_eggGroupNode_ext.obj')
  4072. PyTargetAdd('egg.pyd', input='libp3egg_igate.obj')
  4073. PyTargetAdd('egg.pyd', input='libp3egg2pg_igate.obj')
  4074. PyTargetAdd('egg.pyd', input='libpandaegg.dll')
  4075. PyTargetAdd('egg.pyd', input='libp3interrogatedb.dll')
  4076. PyTargetAdd('egg.pyd', input=COMMON_PANDA_LIBS)
  4077. #
  4078. # DIRECTORY: panda/src/x11display/
  4079. #
  4080. if (GetTarget() not in ['windows', 'darwin'] and PkgSkip("X11")==0 and not RUNTIME):
  4081. OPTS=['DIR:panda/src/x11display', 'BUILDING:PANDAX11', 'X11']
  4082. TargetAdd('p3x11display_composite1.obj', opts=OPTS, input='p3x11display_composite1.cxx')
  4083. #
  4084. # DIRECTORY: panda/src/glxdisplay/
  4085. #
  4086. if (GetTarget() not in ['windows', 'darwin'] and PkgSkip("GL")==0 and PkgSkip("X11")==0 and not RUNTIME):
  4087. OPTS=['DIR:panda/src/glxdisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL']
  4088. TargetAdd('p3glxdisplay_composite1.obj', opts=OPTS, input='p3glxdisplay_composite1.cxx')
  4089. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL']
  4090. TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  4091. TargetAdd('libpandagl.dll', input='p3x11display_composite1.obj')
  4092. TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')
  4093. TargetAdd('libpandagl.dll', input='p3glgsg_config_glgsg.obj')
  4094. TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj')
  4095. TargetAdd('libpandagl.dll', input='p3glxdisplay_composite1.obj')
  4096. TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
  4097. TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'X11'])
  4098. #
  4099. # DIRECTORY: panda/src/cocoadisplay/
  4100. #
  4101. if (GetTarget() == 'darwin' and PkgSkip("COCOA")==0 and PkgSkip("GL")==0 and not RUNTIME):
  4102. OPTS=['DIR:panda/src/cocoadisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL']
  4103. TargetAdd('p3cocoadisplay_composite1.obj', opts=OPTS, input='p3cocoadisplay_composite1.mm')
  4104. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL']
  4105. TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  4106. TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')
  4107. TargetAdd('libpandagl.dll', input='p3glgsg_config_glgsg.obj')
  4108. TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj')
  4109. TargetAdd('libpandagl.dll', input='p3cocoadisplay_composite1.obj')
  4110. if (PkgSkip('PANDAFX')==0):
  4111. TargetAdd('libpandagl.dll', input='libpandafx.dll')
  4112. TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
  4113. TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'COCOA', 'CARBON'])
  4114. #
  4115. # DIRECTORY: panda/src/osxdisplay/
  4116. #
  4117. elif (GetTarget() == 'darwin' and PkgSkip("CARBON")==0 and PkgSkip("GL")==0 and not RUNTIME):
  4118. OPTS=['DIR:panda/src/osxdisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL']
  4119. TargetAdd('p3osxdisplay_composite1.obj', opts=OPTS, input='p3osxdisplay_composite1.cxx')
  4120. TargetAdd('p3osxdisplay_osxGraphicsWindow.obj', opts=OPTS, input='osxGraphicsWindow.mm')
  4121. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL']
  4122. TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  4123. TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')
  4124. TargetAdd('libpandagl.dll', input='p3glgsg_config_glgsg.obj')
  4125. TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj')
  4126. TargetAdd('libpandagl.dll', input='p3osxdisplay_composite1.obj')
  4127. TargetAdd('libpandagl.dll', input='p3osxdisplay_osxGraphicsWindow.obj')
  4128. if (PkgSkip('PANDAFX')==0):
  4129. TargetAdd('libpandagl.dll', input='libpandafx.dll')
  4130. TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
  4131. TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'CARBON', 'AGL', 'COCOA'])
  4132. #
  4133. # DIRECTORY: panda/src/wgldisplay/
  4134. #
  4135. if (GetTarget() == 'windows' and PkgSkip("GL")==0 and not RUNTIME):
  4136. OPTS=['DIR:panda/src/wgldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'NVIDIACG', 'CGGL']
  4137. TargetAdd('p3wgldisplay_composite1.obj', opts=OPTS, input='p3wgldisplay_composite1.cxx')
  4138. OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'NVIDIACG', 'CGGL']
  4139. TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
  4140. TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')
  4141. TargetAdd('libpandagl.dll', input='p3glgsg_config_glgsg.obj')
  4142. TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj')
  4143. TargetAdd('libpandagl.dll', input='p3wgldisplay_composite1.obj')
  4144. TargetAdd('libpandagl.dll', input='libp3windisplay.dll')
  4145. if (PkgSkip('PANDAFX')==0):
  4146. TargetAdd('libpandagl.dll', input='libpandafx.dll')
  4147. TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
  4148. TargetAdd('libpandagl.dll', opts=['MODULE', 'WINGDI', 'GL', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM', 'NVIDIACG', 'CGGL'])
  4149. #
  4150. # DIRECTORY: panda/src/egldisplay/
  4151. #
  4152. if (PkgSkip("EGL")==0 and PkgSkip("GLES")==0 and PkgSkip("X11")==0 and not RUNTIME):
  4153. DefSymbol('GLES', 'OPENGLES_1', '')
  4154. OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
  4155. TargetAdd('pandagles_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
  4156. OPTS=['DIR:panda/metalibs/pandagles', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
  4157. TargetAdd('pandagles_pandagles.obj', opts=OPTS, input='pandagles.cxx')
  4158. TargetAdd('libpandagles.dll', input='p3x11display_composite1.obj')
  4159. TargetAdd('libpandagles.dll', input='pandagles_pandagles.obj')
  4160. TargetAdd('libpandagles.dll', input='p3glesgsg_config_glesgsg.obj')
  4161. TargetAdd('libpandagles.dll', input='p3glesgsg_glesgsg.obj')
  4162. TargetAdd('libpandagles.dll', input='pandagles_egldisplay_composite1.obj')
  4163. TargetAdd('libpandagles.dll', input=COMMON_PANDA_LIBS)
  4164. TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL', 'X11'])
  4165. #
  4166. # DIRECTORY: panda/src/egldisplay/
  4167. #
  4168. if (PkgSkip("EGL")==0 and PkgSkip("GLES2")==0 and PkgSkip("X11")==0 and not RUNTIME):
  4169. DefSymbol('GLES2', 'OPENGLES_2', '')
  4170. OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL']
  4171. TargetAdd('pandagles2_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
  4172. OPTS=['DIR:panda/metalibs/pandagles2', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL']
  4173. TargetAdd('pandagles2_pandagles2.obj', opts=OPTS, input='pandagles2.cxx')
  4174. TargetAdd('libpandagles2.dll', input='p3x11display_composite1.obj')
  4175. TargetAdd('libpandagles2.dll', input='pandagles2_pandagles2.obj')
  4176. TargetAdd('libpandagles2.dll', input='p3gles2gsg_config_gles2gsg.obj')
  4177. TargetAdd('libpandagles2.dll', input='p3gles2gsg_gles2gsg.obj')
  4178. TargetAdd('libpandagles2.dll', input='pandagles2_egldisplay_composite1.obj')
  4179. TargetAdd('libpandagles2.dll', input=COMMON_PANDA_LIBS)
  4180. TargetAdd('libpandagles2.dll', opts=['MODULE', 'GLES2', 'EGL', 'X11'])
  4181. #
  4182. # DIRECTORY: panda/src/ode/
  4183. #
  4184. if (PkgSkip("ODE")==0 and not RUNTIME):
  4185. OPTS=['DIR:panda/src/ode', 'BUILDING:PANDAODE', 'ODE']
  4186. TargetAdd('p3ode_composite1.obj', opts=OPTS, input='p3ode_composite1.cxx')
  4187. TargetAdd('p3ode_composite2.obj', opts=OPTS, input='p3ode_composite2.cxx')
  4188. TargetAdd('p3ode_composite3.obj', opts=OPTS, input='p3ode_composite3.cxx')
  4189. OPTS=['DIR:panda/src/ode', 'ODE']
  4190. IGATEFILES=GetDirectoryContents('panda/src/ode', ["*.h", "*_composite*.cxx"])
  4191. IGATEFILES.remove("odeConvexGeom.h")
  4192. IGATEFILES.remove("odeHelperStructs.h")
  4193. TargetAdd('libpandaode.in', opts=OPTS, input=IGATEFILES)
  4194. TargetAdd('libpandaode.in', opts=['IMOD:panda3d.ode', 'ILIB:libpandaode', 'SRCDIR:panda/src/ode'])
  4195. PyTargetAdd('p3ode_ext_composite.obj', opts=OPTS, input='p3ode_ext_composite.cxx')
  4196. #
  4197. # DIRECTORY: panda/metalibs/pandaode/
  4198. #
  4199. if (PkgSkip("ODE")==0 and not RUNTIME):
  4200. OPTS=['DIR:panda/metalibs/pandaode', 'BUILDING:PANDAODE', 'ODE']
  4201. TargetAdd('pandaode_pandaode.obj', opts=OPTS, input='pandaode.cxx')
  4202. TargetAdd('libpandaode.dll', input='pandaode_pandaode.obj')
  4203. TargetAdd('libpandaode.dll', input='p3ode_composite1.obj')
  4204. TargetAdd('libpandaode.dll', input='p3ode_composite2.obj')
  4205. TargetAdd('libpandaode.dll', input='p3ode_composite3.obj')
  4206. TargetAdd('libpandaode.dll', input=COMMON_PANDA_LIBS)
  4207. TargetAdd('libpandaode.dll', opts=['WINUSER', 'ODE'])
  4208. OPTS=['DIR:panda/metalibs/pandaode', 'ODE']
  4209. PyTargetAdd('ode_module.obj', input='libpandaode.in')
  4210. PyTargetAdd('ode_module.obj', opts=OPTS)
  4211. PyTargetAdd('ode_module.obj', opts=['IMOD:panda3d.ode', 'ILIB:ode', 'IMPORT:panda3d.core'])
  4212. PyTargetAdd('ode.pyd', input='ode_module.obj')
  4213. PyTargetAdd('ode.pyd', input='libpandaode_igate.obj')
  4214. PyTargetAdd('ode.pyd', input='p3ode_ext_composite.obj')
  4215. PyTargetAdd('ode.pyd', input='libpandaode.dll')
  4216. PyTargetAdd('ode.pyd', input='libp3interrogatedb.dll')
  4217. PyTargetAdd('ode.pyd', input=COMMON_PANDA_LIBS)
  4218. PyTargetAdd('ode.pyd', opts=['WINUSER', 'ODE'])
  4219. #
  4220. # DIRECTORY: panda/src/bullet/
  4221. #
  4222. if (PkgSkip("BULLET")==0 and not RUNTIME):
  4223. OPTS=['DIR:panda/src/bullet', 'BUILDING:PANDABULLET', 'BULLET']
  4224. TargetAdd('p3bullet_composite.obj', opts=OPTS, input='p3bullet_composite.cxx')
  4225. OPTS=['DIR:panda/src/bullet', 'BULLET']
  4226. IGATEFILES=GetDirectoryContents('panda/src/bullet', ["*.h", "*_composite*.cxx"])
  4227. TargetAdd('libpandabullet.in', opts=OPTS, input=IGATEFILES)
  4228. TargetAdd('libpandabullet.in', opts=['IMOD:panda3d.bullet', 'ILIB:libpandabullet', 'SRCDIR:panda/src/bullet'])
  4229. #
  4230. # DIRECTORY: panda/metalibs/pandabullet/
  4231. #
  4232. if (PkgSkip("BULLET")==0 and not RUNTIME):
  4233. OPTS=['DIR:panda/metalibs/pandabullet', 'BUILDING:PANDABULLET', 'BULLET']
  4234. TargetAdd('pandabullet_pandabullet.obj', opts=OPTS, input='pandabullet.cxx')
  4235. TargetAdd('libpandabullet.dll', input='pandabullet_pandabullet.obj')
  4236. TargetAdd('libpandabullet.dll', input='p3bullet_composite.obj')
  4237. TargetAdd('libpandabullet.dll', input=COMMON_PANDA_LIBS)
  4238. TargetAdd('libpandabullet.dll', opts=['WINUSER', 'BULLET'])
  4239. OPTS=['DIR:panda/metalibs/pandabullet', 'BULLET']
  4240. PyTargetAdd('bullet_module.obj', input='libpandabullet.in')
  4241. PyTargetAdd('bullet_module.obj', opts=OPTS)
  4242. PyTargetAdd('bullet_module.obj', opts=['IMOD:panda3d.bullet', 'ILIB:bullet', 'IMPORT:panda3d.core'])
  4243. PyTargetAdd('bullet.pyd', input='bullet_module.obj')
  4244. PyTargetAdd('bullet.pyd', input='libpandabullet_igate.obj')
  4245. PyTargetAdd('bullet.pyd', input='libpandabullet.dll')
  4246. PyTargetAdd('bullet.pyd', input='libp3interrogatedb.dll')
  4247. PyTargetAdd('bullet.pyd', input=COMMON_PANDA_LIBS)
  4248. PyTargetAdd('bullet.pyd', opts=['WINUSER', 'BULLET'])
  4249. #
  4250. # DIRECTORY: panda/src/physx/
  4251. #
  4252. if (PkgSkip("PHYSX")==0):
  4253. OPTS=['DIR:panda/src/physx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOARCH:PPC']
  4254. TargetAdd('p3physx_composite.obj', opts=OPTS, input='p3physx_composite.cxx')
  4255. OPTS=['DIR:panda/src/physx', 'PHYSX', 'NOARCH:PPC']
  4256. IGATEFILES=GetDirectoryContents('panda/src/physx', ["*.h", "*_composite*.cxx"])
  4257. TargetAdd('libpandaphysx.in', opts=OPTS, input=IGATEFILES)
  4258. TargetAdd('libpandaphysx.in', opts=['IMOD:panda3d.physx', 'ILIB:libpandaphysx', 'SRCDIR:panda/src/physx'])
  4259. #
  4260. # DIRECTORY: panda/metalibs/pandaphysx/
  4261. #
  4262. if (PkgSkip("PHYSX")==0):
  4263. OPTS=['DIR:panda/metalibs/pandaphysx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOARCH:PPC', 'PYTHON']
  4264. TargetAdd('pandaphysx_pandaphysx.obj', opts=OPTS, input='pandaphysx.cxx')
  4265. TargetAdd('libpandaphysx.dll', input='pandaphysx_pandaphysx.obj')
  4266. TargetAdd('libpandaphysx.dll', input='p3physx_composite.obj')
  4267. TargetAdd('libpandaphysx.dll', input=COMMON_PANDA_LIBS)
  4268. TargetAdd('libpandaphysx.dll', opts=['WINUSER', 'PHYSX', 'NOARCH:PPC', 'PYTHON'])
  4269. OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC']
  4270. PyTargetAdd('physx_module.obj', input='libpandaphysx.in')
  4271. PyTargetAdd('physx_module.obj', opts=OPTS)
  4272. PyTargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d.core'])
  4273. PyTargetAdd('physx.pyd', input='physx_module.obj')
  4274. PyTargetAdd('physx.pyd', input='libpandaphysx_igate.obj')
  4275. PyTargetAdd('physx.pyd', input='libpandaphysx.dll')
  4276. PyTargetAdd('physx.pyd', input='libp3interrogatedb.dll')
  4277. PyTargetAdd('physx.pyd', input=COMMON_PANDA_LIBS)
  4278. PyTargetAdd('physx.pyd', opts=['WINUSER', 'PHYSX', 'NOARCH:PPC'])
  4279. #
  4280. # DIRECTORY: panda/src/physics/
  4281. #
  4282. if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME):
  4283. OPTS=['DIR:panda/src/physics', 'BUILDING:PANDAPHYSICS']
  4284. TargetAdd('p3physics_composite1.obj', opts=OPTS, input='p3physics_composite1.cxx')
  4285. TargetAdd('p3physics_composite2.obj', opts=OPTS, input='p3physics_composite2.cxx')
  4286. OPTS=['DIR:panda/src/physics']
  4287. IGATEFILES=GetDirectoryContents('panda/src/physics', ["*.h", "*_composite*.cxx"])
  4288. IGATEFILES.remove("forces.h")
  4289. TargetAdd('libp3physics.in', opts=OPTS, input=IGATEFILES)
  4290. TargetAdd('libp3physics.in', opts=['IMOD:panda3d.physics', 'ILIB:libp3physics', 'SRCDIR:panda/src/physics'])
  4291. #
  4292. # DIRECTORY: panda/src/particlesystem/
  4293. #
  4294. if (PkgSkip("PANDAPHYSICS")==0) and (PkgSkip("PANDAPARTICLESYSTEM")==0) and (not RUNTIME):
  4295. OPTS=['DIR:panda/src/particlesystem', 'BUILDING:PANDAPHYSICS']
  4296. TargetAdd('p3particlesystem_composite1.obj', opts=OPTS, input='p3particlesystem_composite1.cxx')
  4297. TargetAdd('p3particlesystem_composite2.obj', opts=OPTS, input='p3particlesystem_composite2.cxx')
  4298. OPTS=['DIR:panda/src/particlesystem']
  4299. IGATEFILES=GetDirectoryContents('panda/src/particlesystem', ["*.h", "*_composite*.cxx"])
  4300. IGATEFILES.remove('orientedParticle.h')
  4301. IGATEFILES.remove('orientedParticleFactory.h')
  4302. IGATEFILES.remove('particlefactories.h')
  4303. IGATEFILES.remove('emitters.h')
  4304. IGATEFILES.remove('particles.h')
  4305. TargetAdd('libp3particlesystem.in', opts=OPTS, input=IGATEFILES)
  4306. TargetAdd('libp3particlesystem.in', opts=['IMOD:panda3d.physics', 'ILIB:libp3particlesystem', 'SRCDIR:panda/src/particlesystem'])
  4307. #
  4308. # DIRECTORY: panda/metalibs/pandaphysics/
  4309. #
  4310. if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME):
  4311. OPTS=['DIR:panda/metalibs/pandaphysics', 'BUILDING:PANDAPHYSICS']
  4312. TargetAdd('pandaphysics_pandaphysics.obj', opts=OPTS, input='pandaphysics.cxx')
  4313. TargetAdd('libpandaphysics.dll', input='pandaphysics_pandaphysics.obj')
  4314. TargetAdd('libpandaphysics.dll', input='p3physics_composite1.obj')
  4315. TargetAdd('libpandaphysics.dll', input='p3physics_composite2.obj')
  4316. TargetAdd('libpandaphysics.dll', input='p3particlesystem_composite1.obj')
  4317. TargetAdd('libpandaphysics.dll', input='p3particlesystem_composite2.obj')
  4318. TargetAdd('libpandaphysics.dll', input=COMMON_PANDA_LIBS)
  4319. TargetAdd('libpandaphysics.dll', opts=['ADVAPI'])
  4320. OPTS=['DIR:panda/metalibs/pandaphysics']
  4321. PyTargetAdd('physics_module.obj', input='libp3physics.in')
  4322. if (PkgSkip("PANDAPARTICLESYSTEM")==0):
  4323. PyTargetAdd('physics_module.obj', input='libp3particlesystem.in')
  4324. PyTargetAdd('physics_module.obj', opts=OPTS)
  4325. PyTargetAdd('physics_module.obj', opts=['IMOD:panda3d.physics', 'ILIB:physics', 'IMPORT:panda3d.core'])
  4326. PyTargetAdd('physics.pyd', input='physics_module.obj')
  4327. PyTargetAdd('physics.pyd', input='libp3physics_igate.obj')
  4328. if (PkgSkip("PANDAPARTICLESYSTEM")==0):
  4329. PyTargetAdd('physics.pyd', input='libp3particlesystem_igate.obj')
  4330. PyTargetAdd('physics.pyd', input='libpandaphysics.dll')
  4331. PyTargetAdd('physics.pyd', input='libp3interrogatedb.dll')
  4332. PyTargetAdd('physics.pyd', input=COMMON_PANDA_LIBS)
  4333. #
  4334. # DIRECTORY: panda/src/speedtree/
  4335. #
  4336. if (PkgSkip("SPEEDTREE")==0):
  4337. OPTS=['DIR:panda/src/speedtree', 'BUILDING:PANDASPEEDTREE', 'SPEEDTREE']
  4338. TargetAdd('pandaspeedtree_composite1.obj', opts=OPTS, input='pandaspeedtree_composite1.cxx')
  4339. IGATEFILES=GetDirectoryContents('panda/src/speedtree', ["*.h", "*_composite*.cxx"])
  4340. TargetAdd('libpandaspeedtree.in', opts=OPTS, input=IGATEFILES)
  4341. TargetAdd('libpandaspeedtree.in', opts=['IMOD:libpandaspeedtree', 'ILIB:libpandaspeedtree', 'SRCDIR:panda/src/speedtree'])
  4342. PyTargetAdd('libpandaspeedtree_module.obj', input='libpandaspeedtree.in')
  4343. PyTargetAdd('libpandaspeedtree_module.obj', opts=OPTS)
  4344. PyTargetAdd('libpandaspeedtree_module.obj', opts=['IMOD:libpandaspeedtree', 'ILIB:libpandaspeedtree'])
  4345. TargetAdd('libpandaspeedtree.dll', input='pandaspeedtree_composite1.obj')
  4346. PyTargetAdd('libpandaspeedtree.dll', input='libpandaspeedtree_igate.obj')
  4347. TargetAdd('libpandaspeedtree.dll', input='libpandaspeedtree_module.obj')
  4348. TargetAdd('libpandaspeedtree.dll', input=COMMON_PANDA_LIBS)
  4349. TargetAdd('libpandaspeedtree.dll', opts=['SPEEDTREE'])
  4350. if SDK["SPEEDTREEAPI"] == 'OpenGL':
  4351. TargetAdd('libpandaspeedtree.dll', opts=['GL', 'NVIDIACG', 'CGGL'])
  4352. elif SDK["SPEEDTREEAPI"] == 'DirectX9':
  4353. TargetAdd('libpandaspeedtree.dll', opts=['DX9', 'NVIDIACG', 'CGDX9'])
  4354. #
  4355. # DIRECTORY: panda/src/testbed/
  4356. #
  4357. if (not RTDIST and not RUNTIME and PkgSkip("PVIEW")==0):
  4358. OPTS=['DIR:panda/src/testbed']
  4359. TargetAdd('pview_pview.obj', opts=OPTS, input='pview.cxx')
  4360. TargetAdd('pview.exe', input='pview_pview.obj')
  4361. TargetAdd('pview.exe', input='libp3framework.dll')
  4362. if not PkgSkip("EGG"):
  4363. TargetAdd('pview.exe', input='libpandaegg.dll')
  4364. TargetAdd('pview.exe', input=COMMON_PANDA_LIBS)
  4365. TargetAdd('pview.exe', opts=['ADVAPI', 'WINSOCK2', 'WINSHELL'])
  4366. if GetLinkAllStatic() and not PkgSkip("GL"):
  4367. TargetAdd('pview.exe', input='libpandagl.dll')
  4368. #
  4369. # DIRECTORY: panda/src/android/
  4370. #
  4371. if (not RUNTIME and GetTarget() == 'android'):
  4372. OPTS=['DIR:panda/src/android']
  4373. TargetAdd('org/panda3d/android/NativeIStream.class', opts=OPTS, input='NativeIStream.java')
  4374. TargetAdd('org/panda3d/android/NativeOStream.class', opts=OPTS, input='NativeOStream.java')
  4375. TargetAdd('org/panda3d/android/PandaActivity.class', opts=OPTS, input='PandaActivity.java')
  4376. TargetAdd('org/panda3d/android/PythonActivity.class', opts=OPTS, input='PythonActivity.java')
  4377. TargetAdd('p3android_composite1.obj', opts=OPTS, input='p3android_composite1.cxx')
  4378. TargetAdd('libp3android.dll', input='p3android_composite1.obj')
  4379. TargetAdd('libp3android.dll', input=COMMON_PANDA_LIBS)
  4380. TargetAdd('libp3android.dll', opts=['JNIGRAPHICS'])
  4381. TargetAdd('android_native_app_glue.obj', opts=OPTS + ['NOHIDDEN'], input='android_native_app_glue.c')
  4382. TargetAdd('android_main.obj', opts=OPTS, input='android_main.cxx')
  4383. if (not RTDIST and PkgSkip("PVIEW")==0):
  4384. TargetAdd('libpview_pview.obj', opts=OPTS, input='pview.cxx')
  4385. TargetAdd('libpview.dll', input='android_native_app_glue.obj')
  4386. TargetAdd('libpview.dll', input='android_main.obj')
  4387. TargetAdd('libpview.dll', input='libpview_pview.obj')
  4388. TargetAdd('libpview.dll', input='libp3framework.dll')
  4389. if not PkgSkip("EGG"):
  4390. TargetAdd('libpview.dll', input='libpandaegg.dll')
  4391. TargetAdd('libpview.dll', input='libp3android.dll')
  4392. TargetAdd('libpview.dll', input=COMMON_PANDA_LIBS)
  4393. TargetAdd('libpview.dll', opts=['MODULE', 'ANDROID'])
  4394. if (not RTDIST and PkgSkip("PYTHON")==0):
  4395. OPTS += ['PYTHON']
  4396. TargetAdd('ppython_ppython.obj', opts=OPTS, input='python_main.cxx')
  4397. TargetAdd('libppython.dll', input='android_native_app_glue.obj')
  4398. TargetAdd('libppython.dll', input='android_main.obj')
  4399. TargetAdd('libppython.dll', input='ppython_ppython.obj')
  4400. TargetAdd('libppython.dll', input='libp3framework.dll')
  4401. TargetAdd('libppython.dll', input='libp3android.dll')
  4402. TargetAdd('libppython.dll', input=COMMON_PANDA_LIBS)
  4403. TargetAdd('libppython.dll', opts=['MODULE', 'ANDROID'])
  4404. #
  4405. # DIRECTORY: panda/src/androiddisplay/
  4406. #
  4407. if (GetTarget() == 'android' and PkgSkip("EGL")==0 and PkgSkip("GLES")==0 and not RUNTIME):
  4408. DefSymbol('GLES', 'OPENGLES_1', '')
  4409. OPTS=['DIR:panda/src/androiddisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
  4410. TargetAdd('pandagles_androiddisplay_composite1.obj', opts=OPTS, input='p3androiddisplay_composite1.cxx')
  4411. OPTS=['DIR:panda/metalibs/pandagles', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
  4412. TargetAdd('pandagles_pandagles.obj', opts=OPTS, input='pandagles.cxx')
  4413. TargetAdd('libpandagles.dll', input='pandagles_pandagles.obj')
  4414. TargetAdd('libpandagles.dll', input='p3glesgsg_config_glesgsg.obj')
  4415. TargetAdd('libpandagles.dll', input='p3glesgsg_glesgsg.obj')
  4416. TargetAdd('libpandagles.dll', input='pandagles_androiddisplay_composite1.obj')
  4417. TargetAdd('libpandagles.dll', input='libp3android.dll')
  4418. TargetAdd('libpandagles.dll', input=COMMON_PANDA_LIBS)
  4419. TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL'])
  4420. #
  4421. # DIRECTORY: panda/src/tinydisplay/
  4422. #
  4423. if (not RUNTIME and (GetTarget() in ('windows', 'darwin') or PkgSkip("X11")==0) and PkgSkip("TINYDISPLAY")==0):
  4424. OPTS=['DIR:panda/src/tinydisplay', 'BUILDING:TINYDISPLAY']
  4425. TargetAdd('p3tinydisplay_composite1.obj', opts=OPTS, input='p3tinydisplay_composite1.cxx')
  4426. TargetAdd('p3tinydisplay_composite2.obj', opts=OPTS, input='p3tinydisplay_composite2.cxx')
  4427. TargetAdd('p3tinydisplay_ztriangle_1.obj', opts=OPTS, input='ztriangle_1.cxx')
  4428. TargetAdd('p3tinydisplay_ztriangle_2.obj', opts=OPTS, input='ztriangle_2.cxx')
  4429. TargetAdd('p3tinydisplay_ztriangle_3.obj', opts=OPTS, input='ztriangle_3.cxx')
  4430. TargetAdd('p3tinydisplay_ztriangle_4.obj', opts=OPTS, input='ztriangle_4.cxx')
  4431. TargetAdd('p3tinydisplay_ztriangle_table.obj', opts=OPTS, input='ztriangle_table.cxx')
  4432. if GetTarget() == 'darwin':
  4433. TargetAdd('p3tinydisplay_tinyOsxGraphicsWindow.obj', opts=OPTS, input='tinyOsxGraphicsWindow.mm')
  4434. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_tinyOsxGraphicsWindow.obj')
  4435. TargetAdd('libp3tinydisplay.dll', opts=['CARBON', 'AGL', 'COCOA'])
  4436. elif GetTarget() == 'windows':
  4437. TargetAdd('libp3tinydisplay.dll', input='libp3windisplay.dll')
  4438. TargetAdd('libp3tinydisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM'])
  4439. else:
  4440. TargetAdd('libp3tinydisplay.dll', input='p3x11display_composite1.obj')
  4441. TargetAdd('libp3tinydisplay.dll', opts=['X11'])
  4442. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_composite1.obj')
  4443. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_composite2.obj')
  4444. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_1.obj')
  4445. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_2.obj')
  4446. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_3.obj')
  4447. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_4.obj')
  4448. TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_table.obj')
  4449. TargetAdd('libp3tinydisplay.dll', input=COMMON_PANDA_LIBS)
  4450. #
  4451. # DIRECTORY: direct/src/directbase/
  4452. #
  4453. if (PkgSkip("DIRECT")==0):
  4454. OPTS=['DIR:direct/src/directbase']
  4455. TargetAdd('p3directbase_directbase.obj', opts=OPTS+['BUILDING:DIRECT'], input='directbase.cxx')
  4456. #
  4457. # DIRECTORY: direct/src/dcparser/
  4458. #
  4459. if (PkgSkip("DIRECT")==0):
  4460. OPTS=['DIR:direct/src/dcparser', 'BUILDING:DIRECT_DCPARSER', 'WITHINPANDA', 'BISONPREFIX_dcyy']
  4461. CreateFile(GetOutputDir()+"/include/dcParser.h")
  4462. PyTargetAdd('p3dcparser_dcParser.obj', opts=OPTS, input='dcParser.yxx')
  4463. #TargetAdd('dcParser.h', input='p3dcparser_dcParser.obj', opts=['DEPENDENCYONLY'])
  4464. PyTargetAdd('p3dcparser_dcLexer.obj', opts=OPTS, input='dcLexer.lxx')
  4465. PyTargetAdd('p3dcparser_composite1.obj', opts=OPTS, input='p3dcparser_composite1.cxx')
  4466. PyTargetAdd('p3dcparser_composite2.obj', opts=OPTS, input='p3dcparser_composite2.cxx')
  4467. OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA']
  4468. IGATEFILES=GetDirectoryContents('direct/src/dcparser', ["*.h", "*_composite*.cxx"])
  4469. if "dcParser.h" in IGATEFILES: IGATEFILES.remove("dcParser.h")
  4470. if "dcmsgtypes.h" in IGATEFILES: IGATEFILES.remove('dcmsgtypes.h')
  4471. TargetAdd('libp3dcparser.in', opts=OPTS, input=IGATEFILES)
  4472. TargetAdd('libp3dcparser.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3dcparser', 'SRCDIR:direct/src/dcparser'])
  4473. #
  4474. # DIRECTORY: direct/src/deadrec/
  4475. #
  4476. if (PkgSkip("DIRECT")==0):
  4477. OPTS=['DIR:direct/src/deadrec', 'BUILDING:DIRECT']
  4478. TargetAdd('p3deadrec_composite1.obj', opts=OPTS, input='p3deadrec_composite1.cxx')
  4479. OPTS=['DIR:direct/src/deadrec']
  4480. IGATEFILES=GetDirectoryContents('direct/src/deadrec', ["*.h", "*_composite*.cxx"])
  4481. TargetAdd('libp3deadrec.in', opts=OPTS, input=IGATEFILES)
  4482. TargetAdd('libp3deadrec.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3deadrec', 'SRCDIR:direct/src/deadrec'])
  4483. #
  4484. # DIRECTORY: direct/src/distributed/
  4485. #
  4486. if (PkgSkip("DIRECT")==0):
  4487. OPTS=['DIR:direct/src/distributed', 'DIR:direct/src/dcparser', 'WITHINPANDA', 'BUILDING:DIRECT', 'OPENSSL']
  4488. TargetAdd('p3distributed_config_distributed.obj', opts=OPTS, input='config_distributed.cxx')
  4489. PyTargetAdd('p3distributed_cConnectionRepository.obj', opts=OPTS, input='cConnectionRepository.cxx')
  4490. PyTargetAdd('p3distributed_cDistributedSmoothNodeBase.obj', opts=OPTS, input='cDistributedSmoothNodeBase.cxx')
  4491. OPTS=['DIR:direct/src/distributed', 'WITHINPANDA', 'OPENSSL']
  4492. IGATEFILES=GetDirectoryContents('direct/src/distributed', ["*.h", "*.cxx"])
  4493. TargetAdd('libp3distributed.in', opts=OPTS, input=IGATEFILES)
  4494. TargetAdd('libp3distributed.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3distributed', 'SRCDIR:direct/src/distributed'])
  4495. #
  4496. # DIRECTORY: direct/src/interval/
  4497. #
  4498. if (PkgSkip("DIRECT")==0):
  4499. OPTS=['DIR:direct/src/interval', 'BUILDING:DIRECT']
  4500. TargetAdd('p3interval_composite1.obj', opts=OPTS, input='p3interval_composite1.cxx')
  4501. OPTS=['DIR:direct/src/interval']
  4502. IGATEFILES=GetDirectoryContents('direct/src/interval', ["*.h", "*_composite*.cxx"])
  4503. TargetAdd('libp3interval.in', opts=OPTS, input=IGATEFILES)
  4504. TargetAdd('libp3interval.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3interval', 'SRCDIR:direct/src/interval'])
  4505. #
  4506. # DIRECTORY: direct/src/showbase/
  4507. #
  4508. if (PkgSkip("DIRECT")==0):
  4509. OPTS=['DIR:direct/src/showbase', 'BUILDING:DIRECT']
  4510. TargetAdd('p3showbase_showBase.obj', opts=OPTS, input='showBase.cxx')
  4511. if GetTarget() == 'darwin':
  4512. TargetAdd('p3showbase_showBase_assist.obj', opts=OPTS, input='showBase_assist.mm')
  4513. OPTS=['DIR:direct/src/showbase']
  4514. IGATEFILES=GetDirectoryContents('direct/src/showbase', ["*.h", "showBase.cxx"])
  4515. TargetAdd('libp3showbase.in', opts=OPTS, input=IGATEFILES)
  4516. TargetAdd('libp3showbase.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3showbase', 'SRCDIR:direct/src/showbase'])
  4517. #
  4518. # DIRECTORY: direct/src/motiontrail/
  4519. #
  4520. if (PkgSkip("DIRECT")==0):
  4521. OPTS=['DIR:direct/src/motiontrail', 'BUILDING:DIRECT']
  4522. TargetAdd('p3motiontrail_cMotionTrail.obj', opts=OPTS, input='cMotionTrail.cxx')
  4523. TargetAdd('p3motiontrail_config_motiontrail.obj', opts=OPTS, input='config_motiontrail.cxx')
  4524. OPTS=['DIR:direct/src/motiontrail']
  4525. IGATEFILES=GetDirectoryContents('direct/src/motiontrail', ["*.h", "cMotionTrail.cxx"])
  4526. TargetAdd('libp3motiontrail.in', opts=OPTS, input=IGATEFILES)
  4527. TargetAdd('libp3motiontrail.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3motiontrail', 'SRCDIR:direct/src/motiontrail'])
  4528. #
  4529. # DIRECTORY: direct/metalibs/direct/
  4530. #
  4531. if (PkgSkip("DIRECT")==0):
  4532. TargetAdd('libp3direct.dll', input='p3directbase_directbase.obj')
  4533. TargetAdd('libp3direct.dll', input='p3showbase_showBase.obj')
  4534. if GetTarget() == 'darwin':
  4535. TargetAdd('libp3direct.dll', input='p3showbase_showBase_assist.obj')
  4536. TargetAdd('libp3direct.dll', input='p3deadrec_composite1.obj')
  4537. TargetAdd('libp3direct.dll', input='p3interval_composite1.obj')
  4538. TargetAdd('libp3direct.dll', input='p3motiontrail_config_motiontrail.obj')
  4539. TargetAdd('libp3direct.dll', input='p3motiontrail_cMotionTrail.obj')
  4540. TargetAdd('libp3direct.dll', input=COMMON_PANDA_LIBS)
  4541. TargetAdd('libp3direct.dll', opts=['ADVAPI', 'OPENSSL', 'WINUSER', 'WINGDI'])
  4542. PyTargetAdd('direct_module.obj', input='libp3dcparser.in')
  4543. PyTargetAdd('direct_module.obj', input='libp3showbase.in')
  4544. PyTargetAdd('direct_module.obj', input='libp3deadrec.in')
  4545. PyTargetAdd('direct_module.obj', input='libp3interval.in')
  4546. PyTargetAdd('direct_module.obj', input='libp3distributed.in')
  4547. PyTargetAdd('direct_module.obj', input='libp3motiontrail.in')
  4548. PyTargetAdd('direct_module.obj', opts=['IMOD:panda3d.direct', 'ILIB:direct', 'IMPORT:panda3d.core'])
  4549. PyTargetAdd('direct.pyd', input='libp3dcparser_igate.obj')
  4550. PyTargetAdd('direct.pyd', input='libp3showbase_igate.obj')
  4551. PyTargetAdd('direct.pyd', input='libp3deadrec_igate.obj')
  4552. PyTargetAdd('direct.pyd', input='libp3interval_igate.obj')
  4553. PyTargetAdd('direct.pyd', input='libp3distributed_igate.obj')
  4554. PyTargetAdd('direct.pyd', input='libp3motiontrail_igate.obj')
  4555. # These are part of direct.pyd, not libp3direct.dll, because they rely on
  4556. # the Python libraries. If a C++ user needs these modules, we can move them
  4557. # back and filter out the Python-specific code.
  4558. PyTargetAdd('direct.pyd', input='p3dcparser_composite1.obj')
  4559. PyTargetAdd('direct.pyd', input='p3dcparser_composite2.obj')
  4560. PyTargetAdd('direct.pyd', input='p3dcparser_dcParser.obj')
  4561. PyTargetAdd('direct.pyd', input='p3dcparser_dcLexer.obj')
  4562. PyTargetAdd('direct.pyd', input='p3distributed_config_distributed.obj')
  4563. PyTargetAdd('direct.pyd', input='p3distributed_cConnectionRepository.obj')
  4564. PyTargetAdd('direct.pyd', input='p3distributed_cDistributedSmoothNodeBase.obj')
  4565. PyTargetAdd('direct.pyd', input='direct_module.obj')
  4566. PyTargetAdd('direct.pyd', input='libp3direct.dll')
  4567. PyTargetAdd('direct.pyd', input='libp3interrogatedb.dll')
  4568. PyTargetAdd('direct.pyd', input=COMMON_PANDA_LIBS)
  4569. PyTargetAdd('direct.pyd', opts=['OPENSSL', 'WINUSER', 'WINGDI', 'WINSOCK2'])
  4570. #
  4571. # DIRECTORY: direct/src/dcparse/
  4572. #
  4573. if (PkgSkip("PYTHON")==0 and PkgSkip("DIRECT")==0 and not RTDIST and not RUNTIME):
  4574. OPTS=['DIR:direct/src/dcparse', 'DIR:direct/src/dcparser', 'WITHINPANDA', 'ADVAPI']
  4575. PyTargetAdd('dcparse_dcparse.obj', opts=OPTS, input='dcparse.cxx')
  4576. PyTargetAdd('p3dcparse.exe', input='p3dcparser_composite1.obj')
  4577. PyTargetAdd('p3dcparse.exe', input='p3dcparser_composite2.obj')
  4578. PyTargetAdd('p3dcparse.exe', input='p3dcparser_dcParser.obj')
  4579. PyTargetAdd('p3dcparse.exe', input='p3dcparser_dcLexer.obj')
  4580. PyTargetAdd('p3dcparse.exe', input='dcparse_dcparse.obj')
  4581. PyTargetAdd('p3dcparse.exe', input='libp3direct.dll')
  4582. PyTargetAdd('p3dcparse.exe', input=COMMON_PANDA_LIBS)
  4583. PyTargetAdd('p3dcparse.exe', input='libp3pystub.lib')
  4584. PyTargetAdd('p3dcparse.exe', opts=['ADVAPI'])
  4585. #
  4586. # DIRECTORY: direct/src/plugin/
  4587. #
  4588. if (RTDIST or RUNTIME):
  4589. # Explicitly define this as we don't include dtool_config.h here.
  4590. if GetTarget() not in ('windows', 'darwin'):
  4591. DefSymbol("RUNTIME", "HAVE_X11", "1")
  4592. OPTS=['DIR:direct/src/plugin', 'BUILDING:P3D_PLUGIN', 'RUNTIME', 'OPENSSL']
  4593. TargetAdd('plugin_common.obj', opts=OPTS, input='plugin_common_composite1.cxx')
  4594. OPTS += ['ZLIB', 'MSIMG']
  4595. TargetAdd('plugin_plugin.obj', opts=OPTS, input='p3d_plugin_composite1.cxx')
  4596. TargetAdd('plugin_mkdir_complete.obj', opts=OPTS, input='mkdir_complete.cxx')
  4597. TargetAdd('plugin_wstring_encode.obj', opts=OPTS, input='wstring_encode.cxx')
  4598. TargetAdd('plugin_parse_color.obj', opts=OPTS, input='parse_color.cxx')
  4599. TargetAdd('plugin_get_twirl_data.obj', opts=OPTS, input='get_twirl_data.cxx')
  4600. TargetAdd('plugin_find_root_dir.obj', opts=OPTS, input='find_root_dir.cxx')
  4601. if GetTarget() == 'darwin':
  4602. TargetAdd('plugin_find_root_dir_assist.obj', opts=OPTS, input='find_root_dir_assist.mm')
  4603. TargetAdd('plugin_binaryXml.obj', opts=OPTS, input='binaryXml.cxx')
  4604. TargetAdd('plugin_fileSpec.obj', opts=OPTS, input='fileSpec.cxx')
  4605. TargetAdd('plugin_handleStream.obj', opts=OPTS, input='handleStream.cxx')
  4606. TargetAdd('plugin_handleStreamBuf.obj', opts=OPTS, input='handleStreamBuf.cxx')
  4607. if (RTDIST):
  4608. for fname in ("p3d_plugin.dll", "libp3d_plugin_static.ilb"):
  4609. TargetAdd(fname, input='plugin_plugin.obj')
  4610. TargetAdd(fname, input='plugin_mkdir_complete.obj')
  4611. TargetAdd(fname, input='plugin_wstring_encode.obj')
  4612. TargetAdd(fname, input='plugin_parse_color.obj')
  4613. TargetAdd(fname, input='plugin_find_root_dir.obj')
  4614. if GetTarget() == 'darwin':
  4615. TargetAdd(fname, input='plugin_find_root_dir_assist.obj')
  4616. TargetAdd(fname, input='plugin_fileSpec.obj')
  4617. TargetAdd(fname, input='plugin_binaryXml.obj')
  4618. TargetAdd(fname, input='plugin_handleStream.obj')
  4619. TargetAdd(fname, input='plugin_handleStreamBuf.obj')
  4620. TargetAdd(fname, input='libp3tinyxml.ilb')
  4621. if GetTarget() == 'darwin':
  4622. TargetAdd(fname, input='libp3subprocbuffer.ilb')
  4623. TargetAdd(fname, opts=['OPENSSL', 'ZLIB', 'X11', 'ADVAPI', 'WINUSER', 'WINGDI', 'WINSHELL', 'WINCOMCTL', 'WINOLE', 'MSIMG'])
  4624. TargetAdd("libp3d_plugin_static.ilb", input='plugin_get_twirl_data.obj')
  4625. if (PkgSkip("PYTHON")==0 and RTDIST):
  4626. # Freeze VFSImporter and its dependency modules into p3dpython.
  4627. # Mark panda3d.core as a dependency to make sure to build that first.
  4628. TargetAdd('p3dpython_frozen.obj', input='VFSImporter.py', opts=['DIR:direct/src/showbase', 'FREEZE_STARTUP'])
  4629. TargetAdd('p3dpython_frozen.obj', dep='core.pyd')
  4630. OPTS += ['PYTHON']
  4631. TargetAdd('p3dpython_p3dpython_composite1.obj', opts=OPTS, input='p3dpython_composite1.cxx')
  4632. TargetAdd('p3dpython_p3dPythonMain.obj', opts=OPTS, input='p3dPythonMain.cxx')
  4633. TargetAdd('p3dpython.exe', input='p3dpython_p3dpython_composite1.obj')
  4634. TargetAdd('p3dpython.exe', input='p3dpython_p3dPythonMain.obj')
  4635. TargetAdd('p3dpython.exe', input='p3dpython_frozen.obj')
  4636. TargetAdd('p3dpython.exe', input=COMMON_PANDA_LIBS)
  4637. TargetAdd('p3dpython.exe', input='libp3tinyxml.ilb')
  4638. TargetAdd('p3dpython.exe', input='libp3interrogatedb.dll')
  4639. TargetAdd('p3dpython.exe', opts=['PYTHON', 'WINUSER'])
  4640. TargetAdd('libp3dpython.dll', input='p3dpython_p3dpython_composite1.obj')
  4641. TargetAdd('libp3dpython.dll', input='p3dpython_frozen.obj')
  4642. TargetAdd('libp3dpython.dll', input=COMMON_PANDA_LIBS)
  4643. TargetAdd('libp3dpython.dll', input='libp3tinyxml.ilb')
  4644. TargetAdd('libp3dpython.dll', input='libp3interrogatedb.dll')
  4645. TargetAdd('libp3dpython.dll', opts=['PYTHON', 'WINUSER'])
  4646. if GetTarget() == 'windows':
  4647. DefSymbol("NON_CONSOLE", "NON_CONSOLE", "")
  4648. OPTS.append("NON_CONSOLE")
  4649. TargetAdd('p3dpythonw_p3dpython_composite1.obj', opts=OPTS, input='p3dpython_composite1.cxx')
  4650. TargetAdd('p3dpythonw_p3dPythonMain.obj', opts=OPTS, input='p3dPythonMain.cxx')
  4651. TargetAdd('p3dpythonw.exe', input='p3dpythonw_p3dpython_composite1.obj')
  4652. TargetAdd('p3dpythonw.exe', input='p3dpythonw_p3dPythonMain.obj')
  4653. TargetAdd('p3dpythonw.exe', input='p3dpython_frozen.obj')
  4654. TargetAdd('p3dpythonw.exe', input=COMMON_PANDA_LIBS)
  4655. TargetAdd('p3dpythonw.exe', input='libp3tinyxml.ilb')
  4656. TargetAdd('p3dpythonw.exe', input='libp3interrogatedb.dll')
  4657. TargetAdd('p3dpythonw.exe', opts=['SUBSYSTEM:WINDOWS', 'WINUSER'])
  4658. if (PkgSkip("OPENSSL")==0 and RTDIST and False):
  4659. OPTS=['DIR:direct/src/plugin', 'DIR:panda/src/express', 'OPENSSL']
  4660. if GetTarget() == 'darwin':
  4661. OPTS += ['OPT:2']
  4662. if (PkgSkip("FLTK")==0):
  4663. OPTS.append("FLTK")
  4664. TargetAdd('plugin_p3dCert.obj', opts=OPTS, input='p3dCert.cxx')
  4665. TargetAdd('plugin_p3dCert_strings.obj', opts=OPTS, input='p3dCert_strings.cxx')
  4666. TargetAdd('p3dcert.exe', input='plugin_mkdir_complete.obj')
  4667. TargetAdd('p3dcert.exe', input='plugin_wstring_encode.obj')
  4668. TargetAdd('p3dcert.exe', input='plugin_p3dCert.obj')
  4669. TargetAdd('p3dcert.exe', input='plugin_p3dCert_strings.obj')
  4670. OPTS=['SUBSYSTEM:WINDOWS', 'OPENSSL', 'FLTK', 'X11', 'WINCOMCTL', 'WINSOCK', 'WINGDI', 'WINUSER', 'ADVAPI', 'WINOLE', 'WINSHELL', 'SUBSYSTEM:WINDOWS']
  4671. if GetTarget() == 'darwin':
  4672. OPTS += ['OPT:2']
  4673. TargetAdd('p3dcert.exe', opts=OPTS)
  4674. elif (PkgSkip("WX")==0):
  4675. OPTS += ["WX", "RTTI"]
  4676. TargetAdd('plugin_p3dCert.obj', opts=OPTS, input='p3dCert_wx.cxx')
  4677. TargetAdd('p3dcert.exe', input='plugin_mkdir_complete.obj')
  4678. TargetAdd('p3dcert.exe', input='plugin_wstring_encode.obj')
  4679. TargetAdd('p3dcert.exe', input='plugin_p3dCert.obj')
  4680. OPTS=['SUBSYSTEM:WINDOWS', 'OPENSSL', 'WX', 'CARBON', 'WINOLE', 'WINOLEAUT', 'WINUSER', 'ADVAPI', 'WINSHELL', 'WINCOMCTL', 'WINGDI', 'WINCOMDLG']
  4681. if GetTarget() == "darwin":
  4682. OPTS += ['GL', 'OPT:2']
  4683. TargetAdd('p3dcert.exe', opts=OPTS)
  4684. #
  4685. # DIRECTORY: direct/src/plugin_npapi/
  4686. #
  4687. if RUNTIME:
  4688. OPTS=['DIR:direct/src/plugin_npapi', 'RUNTIME', 'GTK2']
  4689. if GetTarget() == 'windows':
  4690. nppanda3d_rc = {"name" : "Panda3D Game Engine Plug-in",
  4691. "version" : VERSION,
  4692. "description" : "Runs 3-D games and interactive applets",
  4693. "filename" : "nppanda3d.dll",
  4694. "mimetype" : "application/x-panda3d",
  4695. "extension" : "p3d",
  4696. "filedesc" : "Panda3D applet"}
  4697. TargetAdd('nppanda3d.res', opts=OPTS, winrc=nppanda3d_rc)
  4698. elif GetTarget() == 'darwin':
  4699. TargetAdd('nppanda3d.rsrc', opts=OPTS, input='nppanda3d.r')
  4700. OPTS += ['GTK2']
  4701. TargetAdd('plugin_npapi_nppanda3d_composite1.obj', opts=OPTS, input='nppanda3d_composite1.cxx')
  4702. TargetAdd('nppanda3d.plugin', input='plugin_common.obj')
  4703. TargetAdd('nppanda3d.plugin', input='plugin_parse_color.obj')
  4704. TargetAdd('nppanda3d.plugin', input='plugin_get_twirl_data.obj')
  4705. TargetAdd('nppanda3d.plugin', input='plugin_wstring_encode.obj')
  4706. TargetAdd('nppanda3d.plugin', input='plugin_npapi_nppanda3d_composite1.obj')
  4707. if GetTarget() == 'windows':
  4708. TargetAdd('nppanda3d.plugin', input='nppanda3d.res')
  4709. TargetAdd('nppanda3d.plugin', input='nppanda3d.def', ipath=OPTS)
  4710. elif GetTarget() == 'darwin':
  4711. TargetAdd('nppanda3d.plugin', input='nppanda3d.rsrc')
  4712. TargetAdd('nppanda3d.plugin', input='nppanda3d.plist', ipath=OPTS)
  4713. TargetAdd('nppanda3d.plugin', input='plugin_find_root_dir_assist.obj')
  4714. TargetAdd('nppanda3d.plugin', input='libp3tinyxml.ilb')
  4715. TargetAdd('nppanda3d.plugin', opts=['OPENSSL', 'WINGDI', 'WINUSER', 'WINSHELL', 'WINOLE', 'CARBON'])
  4716. #
  4717. # DIRECTORY: direct/src/plugin_activex/
  4718. #
  4719. if (RUNTIME and GetTarget() == 'windows' and PkgSkip("MFC")==0):
  4720. OPTS=['DIR:direct/src/plugin_activex', 'RUNTIME', 'ACTIVEX', 'MFC']
  4721. DefSymbol('ACTIVEX', '_USRDLL', '')
  4722. DefSymbol('ACTIVEX', '_WINDLL', '')
  4723. DefSymbol('ACTIVEX', '_AFXDLL', '')
  4724. DefSymbol('ACTIVEX', '_MBCS', '')
  4725. TargetAdd('P3DActiveX.tlb', opts=OPTS, input='P3DActiveX.idl')
  4726. TargetAdd('P3DActiveX.res', opts=OPTS, input='P3DActiveX.rc')
  4727. TargetAdd('plugin_activex_p3dactivex_composite1.obj', opts=OPTS, input='p3dactivex_composite1.cxx')
  4728. TargetAdd('p3dactivex.ocx', input='plugin_common.obj')
  4729. TargetAdd('p3dactivex.ocx', input='plugin_parse_color.obj')
  4730. TargetAdd('p3dactivex.ocx', input='plugin_get_twirl_data.obj')
  4731. TargetAdd('p3dactivex.ocx', input='plugin_wstring_encode.obj')
  4732. TargetAdd('p3dactivex.ocx', input='plugin_activex_p3dactivex_composite1.obj')
  4733. TargetAdd('p3dactivex.ocx', input='P3DActiveX.res')
  4734. TargetAdd('p3dactivex.ocx', input='P3DActiveX.def', ipath=OPTS)
  4735. TargetAdd('p3dactivex.ocx', input='libp3tinyxml.ilb')
  4736. TargetAdd('p3dactivex.ocx', opts=['MFC', 'WINSOCK2', 'OPENSSL', 'WINGDI', 'WINUSER'])
  4737. #
  4738. # DIRECTORY: direct/src/plugin_standalone/
  4739. #
  4740. if (RUNTIME):
  4741. OPTS=['DIR:direct/src/plugin_standalone', 'RUNTIME', 'OPENSSL']
  4742. TargetAdd('plugin_standalone_panda3d.obj', opts=OPTS, input='panda3d.cxx')
  4743. TargetAdd('plugin_standalone_panda3dBase.obj', opts=OPTS, input='panda3dBase.cxx')
  4744. if GetTarget() == 'windows':
  4745. panda3d_rc = {"name" : "Panda3D Game Engine Plug-in",
  4746. "version" : VERSION,
  4747. "description" : "Runs 3-D games and interactive applets",
  4748. "filename" : "panda3d.exe",
  4749. "mimetype" : "application/x-panda3d",
  4750. "extension" : "p3d",
  4751. "filedesc" : "Panda3D applet",
  4752. "icon" : "panda3d.ico"}
  4753. TargetAdd('panda3d.res', opts=OPTS, winrc=panda3d_rc)
  4754. TargetAdd('plugin_standalone_panda3dMain.obj', opts=OPTS, input='panda3dMain.cxx')
  4755. TargetAdd('panda3d.exe', input='plugin_standalone_panda3d.obj')
  4756. TargetAdd('panda3d.exe', input='plugin_standalone_panda3dMain.obj')
  4757. TargetAdd('panda3d.exe', input='plugin_standalone_panda3dBase.obj')
  4758. TargetAdd('panda3d.exe', input='plugin_common.obj')
  4759. TargetAdd('panda3d.exe', input='plugin_wstring_encode.obj')
  4760. if GetTarget() == 'darwin':
  4761. TargetAdd('panda3d.exe', input='plugin_find_root_dir_assist.obj')
  4762. elif GetTarget() == 'windows':
  4763. TargetAdd('panda3d.exe', input='panda3d.res')
  4764. TargetAdd('panda3d.exe', input='libpandaexpress.dll')
  4765. TargetAdd('panda3d.exe', input='libp3dtoolconfig.dll')
  4766. TargetAdd('panda3d.exe', input='libp3dtool.dll')
  4767. #TargetAdd('panda3d.exe', input='libp3pystub.lib')
  4768. TargetAdd('panda3d.exe', input='libp3tinyxml.ilb')
  4769. TargetAdd('panda3d.exe', opts=['NOICON', 'OPENSSL', 'ZLIB', 'WINGDI', 'WINUSER', 'WINSHELL', 'ADVAPI', 'WINSOCK2', 'WINOLE', 'CARBON'])
  4770. if (GetTarget() == 'darwin'):
  4771. TargetAdd('plugin_standalone_panda3dMac.obj', opts=OPTS, input='panda3dMac.cxx')
  4772. TargetAdd('Panda3D.app', input='plugin_standalone_panda3d.obj')
  4773. TargetAdd('Panda3D.app', input='plugin_standalone_panda3dMac.obj')
  4774. TargetAdd('Panda3D.app', input='plugin_standalone_panda3dBase.obj')
  4775. TargetAdd('Panda3D.app', input='plugin_common.obj')
  4776. TargetAdd('Panda3D.app', input='plugin_find_root_dir_assist.obj')
  4777. TargetAdd('Panda3D.app', input='libpandaexpress.dll')
  4778. TargetAdd('Panda3D.app', input='libp3dtoolconfig.dll')
  4779. TargetAdd('Panda3D.app', input='libp3dtool.dll')
  4780. #TargetAdd('Panda3D.app', input='libp3pystub.lib')
  4781. TargetAdd('Panda3D.app', input='libp3tinyxml.ilb')
  4782. TargetAdd('Panda3D.app', input='panda3d_mac.plist', ipath=OPTS)
  4783. TargetAdd('Panda3D.app', input='models/plugin_images/panda3d.icns')
  4784. TargetAdd('Panda3D.app', opts=['OPENSSL', 'ZLIB', 'WINGDI', 'WINUSER', 'WINSHELL', 'ADVAPI', 'WINSOCK2', 'WINOLE', 'CARBON'])
  4785. elif (GetTarget() == 'windows'):
  4786. TargetAdd('plugin_standalone_panda3dWinMain.obj', opts=OPTS, input='panda3dWinMain.cxx')
  4787. TargetAdd('panda3dw.exe', input='plugin_standalone_panda3d.obj')
  4788. TargetAdd('panda3dw.exe', input='plugin_standalone_panda3dWinMain.obj')
  4789. TargetAdd('panda3dw.exe', input='plugin_standalone_panda3dBase.obj')
  4790. TargetAdd('panda3dw.exe', input='plugin_wstring_encode.obj')
  4791. TargetAdd('panda3dw.exe', input='plugin_common.obj')
  4792. TargetAdd('panda3dw.exe', input='libpandaexpress.dll')
  4793. TargetAdd('panda3dw.exe', input='libp3dtoolconfig.dll')
  4794. TargetAdd('panda3dw.exe', input='libp3dtool.dll')
  4795. #TargetAdd('panda3dw.exe', input='libp3pystub.lib')
  4796. TargetAdd('panda3dw.exe', input='libp3tinyxml.ilb')
  4797. TargetAdd('panda3dw.exe', opts=['SUBSYSTEM:WINDOWS', 'OPENSSL', 'ZLIB', 'WINGDI', 'WINUSER', 'WINSHELL', 'ADVAPI', 'WINSOCK2', 'WINOLE', 'CARBON'])
  4798. if (RTDIST):
  4799. OPTS=['BUILDING:P3D_PLUGIN', 'DIR:direct/src/plugin_standalone', 'DIR:direct/src/plugin', 'DIR:dtool/src/dtoolbase', 'DIR:dtool/src/dtoolutil', 'DIR:dtool/src/pystub', 'DIR:dtool/src/prc', 'DIR:dtool/src/dconfig', 'DIR:panda/src/express', 'DIR:panda/src/downloader', 'RUNTIME', 'P3DEMBED', 'OPENSSL', 'ZLIB']
  4800. # This is arguably a big fat ugly hack, but doing it otherwise would complicate the build process considerably.
  4801. DefSymbol("P3DEMBED", "LINK_ALL_STATIC", "")
  4802. TargetAdd('plugin_standalone_panda3dBase.obj', opts=OPTS, input='panda3dBase.cxx')
  4803. TargetAdd('plugin_standalone_p3dEmbedMain.obj', opts=OPTS, input='p3dEmbedMain.cxx')
  4804. TargetAdd('plugin_standalone_p3dEmbed.obj', opts=OPTS, input='p3dEmbed.cxx')
  4805. #TargetAdd('plugin_standalone_pystub.obj', opts=OPTS, input='pystub.cxx')
  4806. TargetAdd('plugin_standalone_dtoolbase_composite1.obj', opts=OPTS, input='p3dtoolbase_composite1.cxx')
  4807. TargetAdd('plugin_standalone_dtoolbase_composite2.obj', opts=OPTS, input='p3dtoolbase_composite2.cxx')
  4808. TargetAdd('plugin_standalone_lookup3.obj', opts=OPTS, input='lookup3.c')
  4809. TargetAdd('plugin_standalone_indent.obj', opts=OPTS, input='indent.cxx')
  4810. TargetAdd('plugin_standalone_dtoolutil_composite1.obj', opts=OPTS, input='p3dtoolutil_composite1.cxx')
  4811. TargetAdd('plugin_standalone_dtoolutil_composite2.obj', opts=OPTS, input='p3dtoolutil_composite2.cxx')
  4812. if (GetTarget() == 'darwin'):
  4813. TargetAdd('plugin_standalone_dtoolutil_filename_assist.obj', opts=OPTS, input='filename_assist.mm')
  4814. TargetAdd('plugin_standalone_prc_composite1.obj', opts=OPTS, input='p3prc_composite1.cxx')
  4815. TargetAdd('plugin_standalone_prc_composite2.obj', opts=OPTS, input='p3prc_composite2.cxx')
  4816. TargetAdd('plugin_standalone_express_composite1.obj', opts=OPTS, input='p3express_composite1.cxx')
  4817. TargetAdd('plugin_standalone_express_composite2.obj', opts=OPTS, input='p3express_composite2.cxx')
  4818. TargetAdd('plugin_standalone_downloader_composite1.obj', opts=OPTS, input='p3downloader_composite1.cxx')
  4819. TargetAdd('plugin_standalone_downloader_composite2.obj', opts=OPTS, input='p3downloader_composite2.cxx')
  4820. TargetAdd('p3dembed.exe', input='plugin_standalone_panda3dBase.obj')
  4821. TargetAdd('p3dembed.exe', input='plugin_standalone_p3dEmbedMain.obj')
  4822. TargetAdd('p3dembed.exe', input='plugin_standalone_p3dEmbed.obj')
  4823. #TargetAdd('p3dembed.exe', input='plugin_standalone_pystub.obj')
  4824. TargetAdd('p3dembed.exe', input='plugin_standalone_dtoolbase_composite1.obj')
  4825. TargetAdd('p3dembed.exe', input='plugin_standalone_dtoolbase_composite2.obj')
  4826. TargetAdd('p3dembed.exe', input='plugin_standalone_lookup3.obj')
  4827. TargetAdd('p3dembed.exe', input='plugin_standalone_indent.obj')
  4828. TargetAdd('p3dembed.exe', input='plugin_standalone_dtoolutil_composite1.obj')
  4829. TargetAdd('p3dembed.exe', input='plugin_standalone_dtoolutil_composite2.obj')
  4830. if GetTarget() == 'darwin':
  4831. TargetAdd('p3dembed.exe', input='plugin_standalone_dtoolutil_filename_assist.obj')
  4832. TargetAdd('p3dembed.exe', input='plugin_standalone_prc_composite1.obj')
  4833. TargetAdd('p3dembed.exe', input='plugin_standalone_prc_composite2.obj')
  4834. TargetAdd('p3dembed.exe', input='plugin_standalone_express_composite1.obj')
  4835. TargetAdd('p3dembed.exe', input='plugin_standalone_express_composite2.obj')
  4836. TargetAdd('p3dembed.exe', input='plugin_standalone_downloader_composite1.obj')
  4837. TargetAdd('p3dembed.exe', input='plugin_standalone_downloader_composite2.obj')
  4838. TargetAdd('p3dembed.exe', input='plugin_common.obj')
  4839. if GetTarget() == 'darwin':
  4840. TargetAdd('p3dembed.exe', input='plugin_find_root_dir_assist.obj')
  4841. TargetAdd('p3dembed.exe', input='libp3subprocbuffer.ilb')
  4842. TargetAdd('p3dembed.exe', input='libp3tinyxml.ilb')
  4843. TargetAdd('p3dembed.exe', input='libp3d_plugin_static.ilb')
  4844. TargetAdd('p3dembed.exe', opts=['NOICON', 'WINGDI', 'WINSOCK2', 'ZLIB', 'WINUSER', 'OPENSSL', 'WINOLE', 'CARBON', 'MSIMG', 'WINCOMCTL', 'ADVAPI', 'WINSHELL', 'X11'])
  4845. if GetTarget() == 'windows':
  4846. OPTS.append("P3DEMBEDW")
  4847. DefSymbol("P3DEMBEDW", "P3DEMBEDW", "")
  4848. TargetAdd('plugin_standalone_p3dEmbedWinMain.obj', opts=OPTS, input='p3dEmbedMain.cxx')
  4849. TargetAdd('p3dembedw.exe', input='plugin_standalone_panda3dBase.obj')
  4850. TargetAdd('p3dembedw.exe', input='plugin_standalone_p3dEmbedWinMain.obj')
  4851. TargetAdd('p3dembedw.exe', input='plugin_standalone_p3dEmbed.obj')
  4852. #TargetAdd('p3dembedw.exe', input='plugin_standalone_pystub.obj')
  4853. TargetAdd('p3dembedw.exe', input='plugin_standalone_dtoolbase_composite1.obj')
  4854. TargetAdd('p3dembedw.exe', input='plugin_standalone_dtoolbase_composite2.obj')
  4855. TargetAdd('p3dembedw.exe', input='plugin_standalone_lookup3.obj')
  4856. TargetAdd('p3dembedw.exe', input='plugin_standalone_indent.obj')
  4857. TargetAdd('p3dembedw.exe', input='plugin_standalone_dtoolutil_composite1.obj')
  4858. TargetAdd('p3dembedw.exe', input='plugin_standalone_dtoolutil_composite2.obj')
  4859. TargetAdd('p3dembedw.exe', input='plugin_standalone_prc_composite1.obj')
  4860. TargetAdd('p3dembedw.exe', input='plugin_standalone_prc_composite2.obj')
  4861. TargetAdd('p3dembedw.exe', input='plugin_standalone_express_composite1.obj')
  4862. TargetAdd('p3dembedw.exe', input='plugin_standalone_express_composite2.obj')
  4863. TargetAdd('p3dembedw.exe', input='plugin_standalone_downloader_composite1.obj')
  4864. TargetAdd('p3dembedw.exe', input='plugin_standalone_downloader_composite2.obj')
  4865. TargetAdd('p3dembedw.exe', input='plugin_common.obj')
  4866. TargetAdd('p3dembedw.exe', input='libp3tinyxml.ilb')
  4867. TargetAdd('p3dembedw.exe', input='libp3d_plugin_static.ilb')
  4868. TargetAdd('p3dembedw.exe', opts=['SUBSYSTEM:WINDOWS', 'NOICON', 'WINGDI', 'WINSOCK2', 'ZLIB', 'WINUSER', 'OPENSSL', 'WINOLE', 'MSIMG', 'WINCOMCTL', 'ADVAPI', 'WINSHELL'])
  4869. #
  4870. # DIRECTORY: pandatool/src/pandatoolbase/
  4871. #
  4872. if (PkgSkip("PANDATOOL")==0):
  4873. OPTS=['DIR:pandatool/src/pandatoolbase']
  4874. TargetAdd('p3pandatoolbase_composite1.obj', opts=OPTS, input='p3pandatoolbase_composite1.cxx')
  4875. TargetAdd('libp3pandatoolbase.lib', input='p3pandatoolbase_composite1.obj')
  4876. #
  4877. # DIRECTORY: pandatool/src/converter/
  4878. #
  4879. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4880. OPTS=['DIR:pandatool/src/converter']
  4881. TargetAdd('p3converter_somethingToEggConverter.obj', opts=OPTS, input='somethingToEggConverter.cxx')
  4882. TargetAdd('p3converter_eggToSomethingConverter.obj', opts=OPTS, input='eggToSomethingConverter.cxx')
  4883. TargetAdd('libp3converter.lib', input='p3converter_somethingToEggConverter.obj')
  4884. TargetAdd('libp3converter.lib', input='p3converter_eggToSomethingConverter.obj')
  4885. #
  4886. # DIRECTORY: pandatool/src/progbase/
  4887. #
  4888. if not PkgSkip("PANDATOOL"):
  4889. OPTS=['DIR:pandatool/src/progbase', 'ZLIB']
  4890. TargetAdd('p3progbase_composite1.obj', opts=OPTS, input='p3progbase_composite1.cxx')
  4891. TargetAdd('libp3progbase.lib', input='p3progbase_composite1.obj')
  4892. #
  4893. # DIRECTORY: pandatool/src/eggbase/
  4894. #
  4895. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4896. OPTS=['DIR:pandatool/src/eggbase']
  4897. TargetAdd('p3eggbase_composite1.obj', opts=OPTS, input='p3eggbase_composite1.cxx')
  4898. TargetAdd('libp3eggbase.lib', input='p3eggbase_composite1.obj')
  4899. #
  4900. # DIRECTORY: pandatool/src/bam/
  4901. #
  4902. if not PkgSkip("PANDATOOL"):
  4903. OPTS=['DIR:pandatool/src/bam']
  4904. TargetAdd('bam-info_bamInfo.obj', opts=OPTS, input='bamInfo.cxx')
  4905. TargetAdd('bam-info.exe', input='bam-info_bamInfo.obj')
  4906. TargetAdd('bam-info.exe', input='libp3progbase.lib')
  4907. TargetAdd('bam-info.exe', input='libp3pandatoolbase.lib')
  4908. TargetAdd('bam-info.exe', input=COMMON_PANDA_LIBS)
  4909. TargetAdd('bam-info.exe', opts=['ADVAPI', 'FFTW'])
  4910. if not PkgSkip("EGG"):
  4911. TargetAdd('bam2egg_bamToEgg.obj', opts=OPTS, input='bamToEgg.cxx')
  4912. TargetAdd('bam2egg.exe', input='bam2egg_bamToEgg.obj')
  4913. TargetAdd('bam2egg.exe', input=COMMON_EGG2X_LIBS)
  4914. TargetAdd('bam2egg.exe', opts=['ADVAPI', 'FFTW'])
  4915. TargetAdd('egg2bam_eggToBam.obj', opts=OPTS, input='eggToBam.cxx')
  4916. TargetAdd('egg2bam.exe', input='egg2bam_eggToBam.obj')
  4917. TargetAdd('egg2bam.exe', input=COMMON_EGG2X_LIBS)
  4918. TargetAdd('egg2bam.exe', opts=['ADVAPI', 'FFTW'])
  4919. #
  4920. # DIRECTORY: pandatool/src/cvscopy/
  4921. #
  4922. if not PkgSkip("PANDATOOL"):
  4923. OPTS=['DIR:pandatool/src/cvscopy']
  4924. TargetAdd('p3cvscopy_composite1.obj', opts=OPTS, input='p3cvscopy_composite1.cxx')
  4925. TargetAdd('libp3cvscopy.lib', input='p3cvscopy_composite1.obj')
  4926. #
  4927. # DIRECTORY: pandatool/src/daeegg/
  4928. #
  4929. if not PkgSkip("PANDATOOL") and not PkgSkip("FCOLLADA") and not PkgSkip("EGG"):
  4930. OPTS=['DIR:pandatool/src/daeegg', 'FCOLLADA']
  4931. TargetAdd('p3daeegg_composite1.obj', opts=OPTS, input='p3daeegg_composite1.cxx')
  4932. TargetAdd('libp3daeegg.lib', input='p3daeegg_composite1.obj')
  4933. TargetAdd('libp3daeegg.lib', opts=['FCOLLADA', 'CARBON'])
  4934. #
  4935. # DIRECTORY: pandatool/src/assimp
  4936. #
  4937. if not PkgSkip("PANDATOOL") and not PkgSkip("ASSIMP"):
  4938. OPTS=['DIR:pandatool/src/assimp', 'BUILDING:ASSIMP', 'ASSIMP', 'MODULE']
  4939. TargetAdd('p3assimp_composite1.obj', opts=OPTS, input='p3assimp_composite1.cxx')
  4940. TargetAdd('libp3assimp.dll', input='p3assimp_composite1.obj')
  4941. TargetAdd('libp3assimp.dll', input=COMMON_PANDA_LIBS)
  4942. TargetAdd('libp3assimp.dll', opts=OPTS+['ZLIB'])
  4943. #
  4944. # DIRECTORY: pandatool/src/daeprogs/
  4945. #
  4946. if not PkgSkip("PANDATOOL") and not PkgSkip("FCOLLADA") and not PkgSkip("EGG"):
  4947. OPTS=['DIR:pandatool/src/daeprogs', 'FCOLLADA']
  4948. TargetAdd('dae2egg_daeToEgg.obj', opts=OPTS, input='daeToEgg.cxx')
  4949. TargetAdd('dae2egg.exe', input='dae2egg_daeToEgg.obj')
  4950. TargetAdd('dae2egg.exe', input='libp3daeegg.lib')
  4951. TargetAdd('dae2egg.exe', input=COMMON_EGG2X_LIBS)
  4952. TargetAdd('dae2egg.exe', opts=['WINUSER', 'FCOLLADA', 'CARBON'])
  4953. #
  4954. # DIRECTORY: pandatool/src/dxf/
  4955. #
  4956. if not PkgSkip("PANDATOOL"):
  4957. OPTS=['DIR:pandatool/src/dxf']
  4958. TargetAdd('p3dxf_composite1.obj', opts=OPTS, input='p3dxf_composite1.cxx')
  4959. TargetAdd('libp3dxf.lib', input='p3dxf_composite1.obj')
  4960. #
  4961. # DIRECTORY: pandatool/src/dxfegg/
  4962. #
  4963. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4964. OPTS=['DIR:pandatool/src/dxfegg']
  4965. TargetAdd('p3dxfegg_dxfToEggConverter.obj', opts=OPTS, input='dxfToEggConverter.cxx')
  4966. TargetAdd('p3dxfegg_dxfToEggLayer.obj', opts=OPTS, input='dxfToEggLayer.cxx')
  4967. TargetAdd('libp3dxfegg.lib', input='p3dxfegg_dxfToEggConverter.obj')
  4968. TargetAdd('libp3dxfegg.lib', input='p3dxfegg_dxfToEggLayer.obj')
  4969. #
  4970. # DIRECTORY: pandatool/src/dxfprogs/
  4971. #
  4972. if not PkgSkip("PANDATOOL"):
  4973. OPTS=['DIR:pandatool/src/dxfprogs']
  4974. TargetAdd('dxf-points_dxfPoints.obj', opts=OPTS, input='dxfPoints.cxx')
  4975. TargetAdd('dxf-points.exe', input='dxf-points_dxfPoints.obj')
  4976. TargetAdd('dxf-points.exe', input='libp3progbase.lib')
  4977. TargetAdd('dxf-points.exe', input='libp3dxf.lib')
  4978. TargetAdd('dxf-points.exe', input='libp3pandatoolbase.lib')
  4979. TargetAdd('dxf-points.exe', input=COMMON_PANDA_LIBS)
  4980. TargetAdd('dxf-points.exe', opts=['ADVAPI', 'FFTW'])
  4981. if not PkgSkip("EGG"):
  4982. TargetAdd('dxf2egg_dxfToEgg.obj', opts=OPTS, input='dxfToEgg.cxx')
  4983. TargetAdd('dxf2egg.exe', input='dxf2egg_dxfToEgg.obj')
  4984. TargetAdd('dxf2egg.exe', input='libp3dxfegg.lib')
  4985. TargetAdd('dxf2egg.exe', input='libp3dxf.lib')
  4986. TargetAdd('dxf2egg.exe', input=COMMON_EGG2X_LIBS)
  4987. TargetAdd('dxf2egg.exe', opts=['ADVAPI', 'FFTW'])
  4988. TargetAdd('egg2dxf_eggToDXF.obj', opts=OPTS, input='eggToDXF.cxx')
  4989. TargetAdd('egg2dxf_eggToDXFLayer.obj', opts=OPTS, input='eggToDXFLayer.cxx')
  4990. TargetAdd('egg2dxf.exe', input='egg2dxf_eggToDXF.obj')
  4991. TargetAdd('egg2dxf.exe', input='egg2dxf_eggToDXFLayer.obj')
  4992. TargetAdd('egg2dxf.exe', input='libp3dxf.lib')
  4993. TargetAdd('egg2dxf.exe', input=COMMON_EGG2X_LIBS)
  4994. TargetAdd('egg2dxf.exe', opts=['ADVAPI', 'FFTW'])
  4995. #
  4996. # DIRECTORY: pandatool/src/objegg/
  4997. #
  4998. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  4999. OPTS=['DIR:pandatool/src/objegg']
  5000. TargetAdd('p3objegg_objToEggConverter.obj', opts=OPTS, input='objToEggConverter.cxx')
  5001. TargetAdd('p3objegg_eggToObjConverter.obj', opts=OPTS, input='eggToObjConverter.cxx')
  5002. TargetAdd('p3objegg_config_objegg.obj', opts=OPTS, input='config_objegg.cxx')
  5003. TargetAdd('libp3objegg.lib', input='p3objegg_objToEggConverter.obj')
  5004. TargetAdd('libp3objegg.lib', input='p3objegg_eggToObjConverter.obj')
  5005. TargetAdd('libp3objegg.lib', input='p3objegg_config_objegg.obj')
  5006. #
  5007. # DIRECTORY: pandatool/src/objprogs/
  5008. #
  5009. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5010. OPTS=['DIR:pandatool/src/objprogs']
  5011. TargetAdd('obj2egg_objToEgg.obj', opts=OPTS, input='objToEgg.cxx')
  5012. TargetAdd('obj2egg.exe', input='obj2egg_objToEgg.obj')
  5013. TargetAdd('obj2egg.exe', input='libp3objegg.lib')
  5014. TargetAdd('obj2egg.exe', input=COMMON_EGG2X_LIBS)
  5015. TargetAdd('egg2obj_eggToObj.obj', opts=OPTS, input='eggToObj.cxx')
  5016. TargetAdd('egg2obj.exe', input='egg2obj_eggToObj.obj')
  5017. TargetAdd('egg2obj.exe', input='libp3objegg.lib')
  5018. TargetAdd('egg2obj.exe', input=COMMON_EGG2X_LIBS)
  5019. #
  5020. # DIRECTORY: pandatool/src/palettizer/
  5021. #
  5022. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5023. OPTS=['DIR:pandatool/src/palettizer']
  5024. TargetAdd('p3palettizer_composite1.obj', opts=OPTS, input='p3palettizer_composite1.cxx')
  5025. TargetAdd('libp3palettizer.lib', input='p3palettizer_composite1.obj')
  5026. #
  5027. # DIRECTORY: pandatool/src/egg-mkfont/
  5028. #
  5029. if not PkgSkip("FREETYPE") and not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5030. OPTS=['DIR:pandatool/src/egg-mkfont', 'DIR:pandatool/src/palettizer', 'FREETYPE']
  5031. TargetAdd('egg-mkfont_eggMakeFont.obj', opts=OPTS, input='eggMakeFont.cxx')
  5032. TargetAdd('egg-mkfont_rangeDescription.obj', opts=OPTS, input='rangeDescription.cxx')
  5033. TargetAdd('egg-mkfont_rangeIterator.obj', opts=OPTS, input='rangeIterator.cxx')
  5034. TargetAdd('egg-mkfont.exe', input='egg-mkfont_eggMakeFont.obj')
  5035. TargetAdd('egg-mkfont.exe', input='egg-mkfont_rangeDescription.obj')
  5036. TargetAdd('egg-mkfont.exe', input='egg-mkfont_rangeIterator.obj')
  5037. TargetAdd('egg-mkfont.exe', input='libp3palettizer.lib')
  5038. TargetAdd('egg-mkfont.exe', input=COMMON_EGG2X_LIBS)
  5039. TargetAdd('egg-mkfont.exe', opts=['ADVAPI', 'FREETYPE'])
  5040. #
  5041. # DIRECTORY: pandatool/src/eggcharbase/
  5042. #
  5043. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5044. OPTS=['DIR:pandatool/src/eggcharbase', 'ZLIB']
  5045. TargetAdd('p3eggcharbase_composite1.obj', opts=OPTS, input='p3eggcharbase_composite1.cxx')
  5046. TargetAdd('libp3eggcharbase.lib', input='p3eggcharbase_composite1.obj')
  5047. #
  5048. # DIRECTORY: pandatool/src/egg-optchar/
  5049. #
  5050. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5051. OPTS=['DIR:pandatool/src/egg-optchar']
  5052. TargetAdd('egg-optchar_config_egg_optchar.obj', opts=OPTS, input='config_egg_optchar.cxx')
  5053. TargetAdd('egg-optchar_eggOptchar.obj', opts=OPTS, input='eggOptchar.cxx')
  5054. TargetAdd('egg-optchar_eggOptcharUserData.obj', opts=OPTS, input='eggOptcharUserData.cxx')
  5055. TargetAdd('egg-optchar_vertexMembership.obj', opts=OPTS, input='vertexMembership.cxx')
  5056. TargetAdd('egg-optchar.exe', input='egg-optchar_config_egg_optchar.obj')
  5057. TargetAdd('egg-optchar.exe', input='egg-optchar_eggOptchar.obj')
  5058. TargetAdd('egg-optchar.exe', input='egg-optchar_eggOptcharUserData.obj')
  5059. TargetAdd('egg-optchar.exe', input='egg-optchar_vertexMembership.obj')
  5060. TargetAdd('egg-optchar.exe', input='libp3eggcharbase.lib')
  5061. TargetAdd('egg-optchar.exe', input=COMMON_EGG2X_LIBS)
  5062. TargetAdd('egg-optchar.exe', opts=['ADVAPI', 'FREETYPE'])
  5063. #
  5064. # DIRECTORY: pandatool/src/egg-palettize/
  5065. #
  5066. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5067. OPTS=['DIR:pandatool/src/egg-palettize', 'DIR:pandatool/src/palettizer']
  5068. TargetAdd('egg-palettize_eggPalettize.obj', opts=OPTS, input='eggPalettize.cxx')
  5069. TargetAdd('egg-palettize.exe', input='egg-palettize_eggPalettize.obj')
  5070. TargetAdd('egg-palettize.exe', input='libp3palettizer.lib')
  5071. TargetAdd('egg-palettize.exe', input=COMMON_EGG2X_LIBS)
  5072. TargetAdd('egg-palettize.exe', opts=['ADVAPI'])
  5073. #
  5074. # DIRECTORY: pandatool/src/egg-qtess/
  5075. #
  5076. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5077. OPTS=['DIR:pandatool/src/egg-qtess']
  5078. TargetAdd('egg-qtess_composite1.obj', opts=OPTS, input='egg-qtess_composite1.cxx')
  5079. TargetAdd('egg-qtess.exe', input='egg-qtess_composite1.obj')
  5080. TargetAdd('egg-qtess.exe', input='libp3eggbase.lib')
  5081. TargetAdd('egg-qtess.exe', input='libp3progbase.lib')
  5082. TargetAdd('egg-qtess.exe', input='libp3converter.lib')
  5083. TargetAdd('egg-qtess.exe', input=COMMON_EGG2X_LIBS)
  5084. TargetAdd('egg-qtess.exe', opts=['ADVAPI'])
  5085. #
  5086. # DIRECTORY: pandatool/src/eggprogs/
  5087. #
  5088. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5089. OPTS=['DIR:pandatool/src/eggprogs']
  5090. TargetAdd('egg-crop_eggCrop.obj', opts=OPTS, input='eggCrop.cxx')
  5091. TargetAdd('egg-crop.exe', input='egg-crop_eggCrop.obj')
  5092. TargetAdd('egg-crop.exe', input=COMMON_EGG2X_LIBS)
  5093. TargetAdd('egg-crop.exe', opts=['ADVAPI'])
  5094. TargetAdd('egg-make-tube_eggMakeTube.obj', opts=OPTS, input='eggMakeTube.cxx')
  5095. TargetAdd('egg-make-tube.exe', input='egg-make-tube_eggMakeTube.obj')
  5096. TargetAdd('egg-make-tube.exe', input=COMMON_EGG2X_LIBS)
  5097. TargetAdd('egg-make-tube.exe', opts=['ADVAPI'])
  5098. TargetAdd('egg-texture-cards_eggTextureCards.obj', opts=OPTS, input='eggTextureCards.cxx')
  5099. TargetAdd('egg-texture-cards.exe', input='egg-texture-cards_eggTextureCards.obj')
  5100. TargetAdd('egg-texture-cards.exe', input=COMMON_EGG2X_LIBS)
  5101. TargetAdd('egg-texture-cards.exe', opts=['ADVAPI'])
  5102. TargetAdd('egg-topstrip_eggTopstrip.obj', opts=OPTS, input='eggTopstrip.cxx')
  5103. TargetAdd('egg-topstrip.exe', input='egg-topstrip_eggTopstrip.obj')
  5104. TargetAdd('egg-topstrip.exe', input='libp3eggcharbase.lib')
  5105. TargetAdd('egg-topstrip.exe', input=COMMON_EGG2X_LIBS)
  5106. TargetAdd('egg-topstrip.exe', opts=['ADVAPI'])
  5107. TargetAdd('egg-trans_eggTrans.obj', opts=OPTS, input='eggTrans.cxx')
  5108. TargetAdd('egg-trans.exe', input='egg-trans_eggTrans.obj')
  5109. TargetAdd('egg-trans.exe', input=COMMON_EGG2X_LIBS)
  5110. TargetAdd('egg-trans.exe', opts=['ADVAPI'])
  5111. TargetAdd('egg2c_eggToC.obj', opts=OPTS, input='eggToC.cxx')
  5112. TargetAdd('egg2c.exe', input='egg2c_eggToC.obj')
  5113. TargetAdd('egg2c.exe', input=COMMON_EGG2X_LIBS)
  5114. TargetAdd('egg2c.exe', opts=['ADVAPI'])
  5115. TargetAdd('egg-rename_eggRename.obj', opts=OPTS, input='eggRename.cxx')
  5116. TargetAdd('egg-rename.exe', input='egg-rename_eggRename.obj')
  5117. TargetAdd('egg-rename.exe', input=COMMON_EGG2X_LIBS)
  5118. TargetAdd('egg-rename.exe', opts=['ADVAPI'])
  5119. TargetAdd('egg-retarget-anim_eggRetargetAnim.obj', opts=OPTS, input='eggRetargetAnim.cxx')
  5120. TargetAdd('egg-retarget-anim.exe', input='egg-retarget-anim_eggRetargetAnim.obj')
  5121. TargetAdd('egg-retarget-anim.exe', input='libp3eggcharbase.lib')
  5122. TargetAdd('egg-retarget-anim.exe', input=COMMON_EGG2X_LIBS)
  5123. TargetAdd('egg-retarget-anim.exe', opts=['ADVAPI'])
  5124. TargetAdd('egg-list-textures_eggListTextures.obj', opts=OPTS, input='eggListTextures.cxx')
  5125. TargetAdd('egg-list-textures.exe', input='egg-list-textures_eggListTextures.obj')
  5126. TargetAdd('egg-list-textures.exe', input=COMMON_EGG2X_LIBS)
  5127. TargetAdd('egg-list-textures.exe', opts=['ADVAPI'])
  5128. #
  5129. # DIRECTORY: pandatool/src/flt/
  5130. #
  5131. if not PkgSkip("PANDATOOL"):
  5132. OPTS=['DIR:pandatool/src/flt', 'ZLIB']
  5133. TargetAdd('p3flt_composite1.obj', opts=OPTS, input='p3flt_composite1.cxx')
  5134. TargetAdd('libp3flt.lib', input=['p3flt_composite1.obj'])
  5135. #
  5136. # DIRECTORY: pandatool/src/fltegg/
  5137. #
  5138. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5139. OPTS=['DIR:pandatool/src/fltegg']
  5140. TargetAdd('p3fltegg_fltToEggConverter.obj', opts=OPTS, input='fltToEggConverter.cxx')
  5141. TargetAdd('p3fltegg_fltToEggLevelState.obj', opts=OPTS, input='fltToEggLevelState.cxx')
  5142. TargetAdd('libp3fltegg.lib', input=['p3fltegg_fltToEggConverter.obj', 'p3fltegg_fltToEggLevelState.obj'])
  5143. #
  5144. # DIRECTORY: pandatool/src/fltprogs/
  5145. #
  5146. if not PkgSkip("PANDATOOL"):
  5147. OPTS=['DIR:pandatool/src/fltprogs', 'DIR:pandatool/src/flt', 'DIR:pandatool/src/cvscopy']
  5148. TargetAdd('flt-info_fltInfo.obj', opts=OPTS, input='fltInfo.cxx')
  5149. TargetAdd('flt-info.exe', input='flt-info_fltInfo.obj')
  5150. TargetAdd('flt-info.exe', input='libp3flt.lib')
  5151. TargetAdd('flt-info.exe', input='libp3progbase.lib')
  5152. TargetAdd('flt-info.exe', input='libp3pandatoolbase.lib')
  5153. TargetAdd('flt-info.exe', input=COMMON_PANDA_LIBS)
  5154. TargetAdd('flt-info.exe', opts=['ADVAPI'])
  5155. TargetAdd('flt-trans_fltTrans.obj', opts=OPTS, input='fltTrans.cxx')
  5156. TargetAdd('flt-trans.exe', input='flt-trans_fltTrans.obj')
  5157. TargetAdd('flt-trans.exe', input='libp3flt.lib')
  5158. TargetAdd('flt-trans.exe', input='libp3progbase.lib')
  5159. TargetAdd('flt-trans.exe', input='libp3pandatoolbase.lib')
  5160. TargetAdd('flt-trans.exe', input=COMMON_PANDA_LIBS)
  5161. TargetAdd('flt-trans.exe', opts=['ADVAPI'])
  5162. TargetAdd('fltcopy_fltCopy.obj', opts=OPTS, input='fltCopy.cxx')
  5163. TargetAdd('fltcopy.exe', input='fltcopy_fltCopy.obj')
  5164. TargetAdd('fltcopy.exe', input='libp3cvscopy.lib')
  5165. TargetAdd('fltcopy.exe', input='libp3flt.lib')
  5166. TargetAdd('fltcopy.exe', input='libp3progbase.lib')
  5167. TargetAdd('fltcopy.exe', input='libp3pandatoolbase.lib')
  5168. TargetAdd('fltcopy.exe', input=COMMON_PANDA_LIBS)
  5169. TargetAdd('fltcopy.exe', opts=['ADVAPI'])
  5170. if not PkgSkip("EGG"):
  5171. TargetAdd('egg2flt_eggToFlt.obj', opts=OPTS, input='eggToFlt.cxx')
  5172. TargetAdd('egg2flt.exe', input='egg2flt_eggToFlt.obj')
  5173. TargetAdd('egg2flt.exe', input='libp3flt.lib')
  5174. TargetAdd('egg2flt.exe', input=COMMON_EGG2X_LIBS)
  5175. TargetAdd('egg2flt.exe', opts=['ADVAPI'])
  5176. TargetAdd('flt2egg_fltToEgg.obj', opts=OPTS, input='fltToEgg.cxx')
  5177. TargetAdd('flt2egg.exe', input='flt2egg_fltToEgg.obj')
  5178. TargetAdd('flt2egg.exe', input='libp3flt.lib')
  5179. TargetAdd('flt2egg.exe', input='libp3fltegg.lib')
  5180. TargetAdd('flt2egg.exe', input=COMMON_EGG2X_LIBS)
  5181. TargetAdd('flt2egg.exe', opts=['ADVAPI'])
  5182. #
  5183. # DIRECTORY: pandatool/src/imagebase/
  5184. #
  5185. if not PkgSkip("PANDATOOL"):
  5186. OPTS=['DIR:pandatool/src/imagebase']
  5187. TargetAdd('p3imagebase_composite1.obj', opts=OPTS, input='p3imagebase_composite1.cxx')
  5188. TargetAdd('libp3imagebase.lib', input='p3imagebase_composite1.obj')
  5189. #
  5190. # DIRECTORY: pandatool/src/imageprogs/
  5191. #
  5192. if not PkgSkip("PANDATOOL"):
  5193. OPTS=['DIR:pandatool/src/imageprogs']
  5194. TargetAdd('image-info_imageInfo.obj', opts=OPTS, input='imageInfo.cxx')
  5195. TargetAdd('image-info.exe', input='image-info_imageInfo.obj')
  5196. TargetAdd('image-info.exe', input='libp3imagebase.lib')
  5197. TargetAdd('image-info.exe', input='libp3progbase.lib')
  5198. TargetAdd('image-info.exe', input='libp3pandatoolbase.lib')
  5199. TargetAdd('image-info.exe', input=COMMON_PANDA_LIBS)
  5200. TargetAdd('image-info.exe', opts=['ADVAPI'])
  5201. TargetAdd('image-resize_imageResize.obj', opts=OPTS, input='imageResize.cxx')
  5202. TargetAdd('image-resize.exe', input='image-resize_imageResize.obj')
  5203. TargetAdd('image-resize.exe', input='libp3imagebase.lib')
  5204. TargetAdd('image-resize.exe', input='libp3progbase.lib')
  5205. TargetAdd('image-resize.exe', input='libp3pandatoolbase.lib')
  5206. TargetAdd('image-resize.exe', input=COMMON_PANDA_LIBS)
  5207. TargetAdd('image-resize.exe', opts=['ADVAPI'])
  5208. TargetAdd('image-trans_imageTrans.obj', opts=OPTS, input='imageTrans.cxx')
  5209. TargetAdd('image-trans.exe', input='image-trans_imageTrans.obj')
  5210. TargetAdd('image-trans.exe', input='libp3imagebase.lib')
  5211. TargetAdd('image-trans.exe', input='libp3progbase.lib')
  5212. TargetAdd('image-trans.exe', input='libp3pandatoolbase.lib')
  5213. TargetAdd('image-trans.exe', input=COMMON_PANDA_LIBS)
  5214. TargetAdd('image-trans.exe', opts=['ADVAPI'])
  5215. #
  5216. # DIRECTORY: pandatool/src/pfmprogs/
  5217. #
  5218. if not PkgSkip("PANDATOOL"):
  5219. OPTS=['DIR:pandatool/src/pfmprogs']
  5220. TargetAdd('pfm-trans_pfmTrans.obj', opts=OPTS, input='pfmTrans.cxx')
  5221. TargetAdd('pfm-trans.exe', input='pfm-trans_pfmTrans.obj')
  5222. TargetAdd('pfm-trans.exe', input='libp3progbase.lib')
  5223. TargetAdd('pfm-trans.exe', input='libp3pandatoolbase.lib')
  5224. TargetAdd('pfm-trans.exe', input=COMMON_PANDA_LIBS)
  5225. TargetAdd('pfm-trans.exe', opts=['ADVAPI'])
  5226. TargetAdd('pfm-bba_pfmBba.obj', opts=OPTS, input='pfmBba.cxx')
  5227. TargetAdd('pfm-bba_config_pfmprogs.obj', opts=OPTS, input='config_pfmprogs.cxx')
  5228. TargetAdd('pfm-bba.exe', input='pfm-bba_pfmBba.obj')
  5229. TargetAdd('pfm-bba.exe', input='pfm-bba_config_pfmprogs.obj')
  5230. TargetAdd('pfm-bba.exe', input='libp3progbase.lib')
  5231. TargetAdd('pfm-bba.exe', input='libp3pandatoolbase.lib')
  5232. TargetAdd('pfm-bba.exe', input=COMMON_PANDA_LIBS)
  5233. TargetAdd('pfm-bba.exe', opts=['ADVAPI'])
  5234. #
  5235. # DIRECTORY: pandatool/src/lwo/
  5236. #
  5237. if not PkgSkip("PANDATOOL"):
  5238. OPTS=['DIR:pandatool/src/lwo']
  5239. TargetAdd('p3lwo_composite1.obj', opts=OPTS, input='p3lwo_composite1.cxx')
  5240. TargetAdd('libp3lwo.lib', input='p3lwo_composite1.obj')
  5241. #
  5242. # DIRECTORY: pandatool/src/lwoegg/
  5243. #
  5244. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5245. OPTS=['DIR:pandatool/src/lwoegg']
  5246. TargetAdd('p3lwoegg_composite1.obj', opts=OPTS, input='p3lwoegg_composite1.cxx')
  5247. TargetAdd('libp3lwoegg.lib', input='p3lwoegg_composite1.obj')
  5248. #
  5249. # DIRECTORY: pandatool/src/lwoprogs/
  5250. #
  5251. if not PkgSkip("PANDATOOL"):
  5252. OPTS=['DIR:pandatool/src/lwoprogs', 'DIR:pandatool/src/lwo']
  5253. TargetAdd('lwo-scan_lwoScan.obj', opts=OPTS, input='lwoScan.cxx')
  5254. TargetAdd('lwo-scan.exe', input='lwo-scan_lwoScan.obj')
  5255. TargetAdd('lwo-scan.exe', input='libp3lwo.lib')
  5256. TargetAdd('lwo-scan.exe', input='libp3progbase.lib')
  5257. TargetAdd('lwo-scan.exe', input='libp3pandatoolbase.lib')
  5258. TargetAdd('lwo-scan.exe', input=COMMON_PANDA_LIBS)
  5259. TargetAdd('lwo-scan.exe', opts=['ADVAPI'])
  5260. if not PkgSkip("EGG"):
  5261. TargetAdd('lwo2egg_lwoToEgg.obj', opts=OPTS, input='lwoToEgg.cxx')
  5262. TargetAdd('lwo2egg.exe', input='lwo2egg_lwoToEgg.obj')
  5263. TargetAdd('lwo2egg.exe', input='libp3lwo.lib')
  5264. TargetAdd('lwo2egg.exe', input='libp3lwoegg.lib')
  5265. TargetAdd('lwo2egg.exe', input=COMMON_EGG2X_LIBS)
  5266. TargetAdd('lwo2egg.exe', opts=['ADVAPI'])
  5267. #
  5268. # DIRECTORY: pandatool/src/maya/
  5269. #
  5270. for VER in MAYAVERSIONS:
  5271. VNUM=VER[4:]
  5272. if not PkgSkip(VER) and not PkgSkip("PANDATOOL"):
  5273. OPTS=['DIR:pandatool/src/maya', VER]
  5274. TargetAdd('maya'+VNUM+'_composite1.obj', opts=OPTS, input='p3maya_composite1.cxx')
  5275. TargetAdd('libmaya'+VNUM+'.lib', input='maya'+VNUM+'_composite1.obj')
  5276. #
  5277. # DIRECTORY: pandatool/src/mayaegg/
  5278. #
  5279. for VER in MAYAVERSIONS:
  5280. VNUM=VER[4:]
  5281. if not PkgSkip(VER) and not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5282. OPTS=['DIR:pandatool/src/mayaegg', 'DIR:pandatool/src/maya', VER]
  5283. TargetAdd('mayaegg'+VNUM+'_loader.obj', opts=OPTS, input='mayaEggLoader.cxx')
  5284. TargetAdd('mayaegg'+VNUM+'_composite1.obj', opts=OPTS, input='p3mayaegg_composite1.cxx')
  5285. TargetAdd('libmayaegg'+VNUM+'.lib', input='mayaegg'+VNUM+'_loader.obj')
  5286. TargetAdd('libmayaegg'+VNUM+'.lib', input='mayaegg'+VNUM+'_composite1.obj')
  5287. #
  5288. # DIRECTORY: pandatool/src/maxegg/
  5289. #
  5290. for VER in MAXVERSIONS:
  5291. VNUM=VER[3:]
  5292. if not PkgSkip(VER) and not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5293. OPTS=['DIR:pandatool/src/maxegg', VER, "WINCOMCTL", "WINCOMDLG", "WINUSER", "MSFORSCOPE", "RTTI"]
  5294. TargetAdd('maxEgg'+VNUM+'.res', opts=OPTS, input='maxEgg.rc')
  5295. TargetAdd('maxegg'+VNUM+'_loader.obj', opts=OPTS, input='maxEggLoader.cxx')
  5296. TargetAdd('maxegg'+VNUM+'_composite1.obj', opts=OPTS, input='p3maxegg_composite1.cxx')
  5297. TargetAdd('maxegg'+VNUM+'.dlo', input='maxegg'+VNUM+'_composite1.obj')
  5298. TargetAdd('maxegg'+VNUM+'.dlo', input='maxEgg'+VNUM+'.res')
  5299. TargetAdd('maxegg'+VNUM+'.dlo', input='maxEgg.def', ipath=OPTS)
  5300. TargetAdd('maxegg'+VNUM+'.dlo', input=COMMON_EGG2X_LIBS)
  5301. TargetAdd('maxegg'+VNUM+'.dlo', opts=OPTS)
  5302. #
  5303. # DIRECTORY: pandatool/src/maxprogs/
  5304. #
  5305. for VER in MAXVERSIONS:
  5306. VNUM=VER[3:]
  5307. if not PkgSkip(VER) and not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5308. OPTS=['DIR:pandatool/src/maxprogs', VER, "WINCOMCTL", "WINCOMDLG", "WINUSER", "MSFORSCOPE", "RTTI"]
  5309. TargetAdd('maxImportRes.res', opts=OPTS, input='maxImportRes.rc')
  5310. TargetAdd('maxprogs'+VNUM+'_maxeggimport.obj', opts=OPTS, input='maxEggImport.cxx')
  5311. TargetAdd('maxeggimport'+VNUM+'.dle', input='maxegg'+VNUM+'_loader.obj')
  5312. TargetAdd('maxeggimport'+VNUM+'.dle', input='maxprogs'+VNUM+'_maxeggimport.obj')
  5313. TargetAdd('maxeggimport'+VNUM+'.dle', input='libpandaegg.dll')
  5314. TargetAdd('maxeggimport'+VNUM+'.dle', input='libpanda.dll')
  5315. TargetAdd('maxeggimport'+VNUM+'.dle', input='libpandaexpress.dll')
  5316. TargetAdd('maxeggimport'+VNUM+'.dle', input='maxImportRes.res')
  5317. TargetAdd('maxeggimport'+VNUM+'.dle', input='maxEggImport.def', ipath=OPTS)
  5318. TargetAdd('maxeggimport'+VNUM+'.dle', input=COMMON_DTOOL_LIBS)
  5319. TargetAdd('maxeggimport'+VNUM+'.dle', opts=OPTS)
  5320. #
  5321. # DIRECTORY: pandatool/src/vrml/
  5322. #
  5323. if not PkgSkip("PANDATOOL"):
  5324. OPTS=['DIR:pandatool/src/vrml', 'ZLIB', 'BISONPREFIX_vrmlyy']
  5325. CreateFile(GetOutputDir()+"/include/vrmlParser.h")
  5326. TargetAdd('p3vrml_vrmlParser.obj', opts=OPTS, input='vrmlParser.yxx')
  5327. TargetAdd('vrmlParser.h', input='p3vrml_vrmlParser.obj', opts=['DEPENDENCYONLY'])
  5328. TargetAdd('p3vrml_vrmlLexer.obj', opts=OPTS, input='vrmlLexer.lxx')
  5329. TargetAdd('p3vrml_parse_vrml.obj', opts=OPTS, input='parse_vrml.cxx')
  5330. TargetAdd('p3vrml_standard_nodes.obj', opts=OPTS, input='standard_nodes.cxx')
  5331. TargetAdd('p3vrml_vrmlNode.obj', opts=OPTS, input='vrmlNode.cxx')
  5332. TargetAdd('p3vrml_vrmlNodeType.obj', opts=OPTS, input='vrmlNodeType.cxx')
  5333. TargetAdd('libp3vrml.lib', input='p3vrml_parse_vrml.obj')
  5334. TargetAdd('libp3vrml.lib', input='p3vrml_standard_nodes.obj')
  5335. TargetAdd('libp3vrml.lib', input='p3vrml_vrmlNode.obj')
  5336. TargetAdd('libp3vrml.lib', input='p3vrml_vrmlNodeType.obj')
  5337. TargetAdd('libp3vrml.lib', input='p3vrml_vrmlParser.obj')
  5338. TargetAdd('libp3vrml.lib', input='p3vrml_vrmlLexer.obj')
  5339. #
  5340. # DIRECTORY: pandatool/src/vrmlegg/
  5341. #
  5342. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5343. OPTS=['DIR:pandatool/src/vrmlegg', 'DIR:pandatool/src/vrml']
  5344. TargetAdd('p3vrmlegg_indexedFaceSet.obj', opts=OPTS, input='indexedFaceSet.cxx')
  5345. TargetAdd('p3vrmlegg_vrmlAppearance.obj', opts=OPTS, input='vrmlAppearance.cxx')
  5346. TargetAdd('p3vrmlegg_vrmlToEggConverter.obj', opts=OPTS, input='vrmlToEggConverter.cxx')
  5347. TargetAdd('libp3vrmlegg.lib', input='p3vrmlegg_indexedFaceSet.obj')
  5348. TargetAdd('libp3vrmlegg.lib', input='p3vrmlegg_vrmlAppearance.obj')
  5349. TargetAdd('libp3vrmlegg.lib', input='p3vrmlegg_vrmlToEggConverter.obj')
  5350. #
  5351. # DIRECTORY: pandatool/src/xfile/
  5352. #
  5353. if not PkgSkip("PANDATOOL"):
  5354. OPTS=['DIR:pandatool/src/xfile', 'ZLIB', 'BISONPREFIX_xyy', 'FLEXDASHI']
  5355. CreateFile(GetOutputDir()+"/include/xParser.h")
  5356. TargetAdd('p3xfile_xParser.obj', opts=OPTS, input='xParser.yxx')
  5357. TargetAdd('xParser.h', input='p3xfile_xParser.obj', opts=['DEPENDENCYONLY'])
  5358. TargetAdd('p3xfile_xLexer.obj', opts=OPTS, input='xLexer.lxx')
  5359. TargetAdd('p3xfile_composite1.obj', opts=OPTS, input='p3xfile_composite1.cxx')
  5360. TargetAdd('libp3xfile.lib', input='p3xfile_composite1.obj')
  5361. TargetAdd('libp3xfile.lib', input='p3xfile_xParser.obj')
  5362. TargetAdd('libp3xfile.lib', input='p3xfile_xLexer.obj')
  5363. #
  5364. # DIRECTORY: pandatool/src/xfileegg/
  5365. #
  5366. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5367. OPTS=['DIR:pandatool/src/xfileegg', 'DIR:pandatool/src/xfile']
  5368. TargetAdd('p3xfileegg_composite1.obj', opts=OPTS, input='p3xfileegg_composite1.cxx')
  5369. TargetAdd('libp3xfileegg.lib', input='p3xfileegg_composite1.obj')
  5370. #
  5371. # DIRECTORY: pandatool/src/ptloader/
  5372. #
  5373. if not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5374. if not PkgSkip("FCOLLADA"):
  5375. DefSymbol("FCOLLADA", "HAVE_FCOLLADA")
  5376. 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']
  5377. TargetAdd('p3ptloader_config_ptloader.obj', opts=OPTS, input='config_ptloader.cxx', dep='dtool_have_fcollada.dat')
  5378. TargetAdd('p3ptloader_loaderFileTypePandatool.obj', opts=OPTS, input='loaderFileTypePandatool.cxx')
  5379. TargetAdd('libp3ptloader.dll', input='p3ptloader_config_ptloader.obj')
  5380. TargetAdd('libp3ptloader.dll', input='p3ptloader_loaderFileTypePandatool.obj')
  5381. TargetAdd('libp3ptloader.dll', input='libp3fltegg.lib')
  5382. TargetAdd('libp3ptloader.dll', input='libp3flt.lib')
  5383. TargetAdd('libp3ptloader.dll', input='libp3lwoegg.lib')
  5384. TargetAdd('libp3ptloader.dll', input='libp3lwo.lib')
  5385. TargetAdd('libp3ptloader.dll', input='libp3dxfegg.lib')
  5386. TargetAdd('libp3ptloader.dll', input='libp3dxf.lib')
  5387. TargetAdd('libp3ptloader.dll', input='libp3objegg.lib')
  5388. TargetAdd('libp3ptloader.dll', input='libp3vrmlegg.lib')
  5389. TargetAdd('libp3ptloader.dll', input='libp3vrml.lib')
  5390. TargetAdd('libp3ptloader.dll', input='libp3xfileegg.lib')
  5391. TargetAdd('libp3ptloader.dll', input='libp3xfile.lib')
  5392. if (PkgSkip("FCOLLADA")==0): TargetAdd('libp3ptloader.dll', input='libp3daeegg.lib')
  5393. TargetAdd('libp3ptloader.dll', input='libp3eggbase.lib')
  5394. TargetAdd('libp3ptloader.dll', input='libp3progbase.lib')
  5395. TargetAdd('libp3ptloader.dll', input='libp3converter.lib')
  5396. TargetAdd('libp3ptloader.dll', input='libp3pandatoolbase.lib')
  5397. TargetAdd('libp3ptloader.dll', input='libpandaegg.dll')
  5398. TargetAdd('libp3ptloader.dll', input=COMMON_PANDA_LIBS)
  5399. TargetAdd('libp3ptloader.dll', opts=['MODULE', 'ADVAPI', 'FCOLLADA', 'WINUSER'])
  5400. #
  5401. # DIRECTORY: pandatool/src/miscprogs/
  5402. #
  5403. # This is a bit of an esoteric tool, and it causes issues because
  5404. # it conflicts with tools of the same name in different packages.
  5405. #if (PkgSkip("PANDATOOL")==0):
  5406. # OPTS=['DIR:pandatool/src/miscprogs']
  5407. # TargetAdd('bin2c_binToC.obj', opts=OPTS, input='binToC.cxx')
  5408. # TargetAdd('bin2c.exe', input='bin2c_binToC.obj')
  5409. # TargetAdd('bin2c.exe', input='libp3progbase.lib')
  5410. # TargetAdd('bin2c.exe', input='libp3pandatoolbase.lib')
  5411. # TargetAdd('bin2c.exe', input=COMMON_PANDA_LIBS)
  5412. # TargetAdd('bin2c.exe', opts=['ADVAPI'])
  5413. #
  5414. # DIRECTORY: pandatool/src/pstatserver/
  5415. #
  5416. if (PkgSkip("PANDATOOL")==0):
  5417. OPTS=['DIR:pandatool/src/pstatserver']
  5418. TargetAdd('p3pstatserver_composite1.obj', opts=OPTS, input='p3pstatserver_composite1.cxx')
  5419. TargetAdd('libp3pstatserver.lib', input='p3pstatserver_composite1.obj')
  5420. #
  5421. # DIRECTORY: pandatool/src/text-stats/
  5422. #
  5423. if (PkgSkip("PANDATOOL")==0):
  5424. OPTS=['DIR:pandatool/src/text-stats']
  5425. TargetAdd('text-stats_textMonitor.obj', opts=OPTS, input='textMonitor.cxx')
  5426. TargetAdd('text-stats_textStats.obj', opts=OPTS, input='textStats.cxx')
  5427. TargetAdd('text-stats.exe', input='text-stats_textMonitor.obj')
  5428. TargetAdd('text-stats.exe', input='text-stats_textStats.obj')
  5429. TargetAdd('text-stats.exe', input='libp3progbase.lib')
  5430. TargetAdd('text-stats.exe', input='libp3pstatserver.lib')
  5431. TargetAdd('text-stats.exe', input='libp3pandatoolbase.lib')
  5432. TargetAdd('text-stats.exe', input=COMMON_PANDA_LIBS)
  5433. TargetAdd('text-stats.exe', opts=['ADVAPI'])
  5434. #
  5435. # DIRECTORY: pandatool/src/vrmlprogs/
  5436. #
  5437. if not PkgSkip("PANDATOOL"):
  5438. OPTS=['DIR:pandatool/src/vrmlprogs', 'DIR:pandatool/src/vrml', 'DIR:pandatool/src/vrmlegg']
  5439. TargetAdd('vrml-trans_vrmlTrans.obj', opts=OPTS, input='vrmlTrans.cxx')
  5440. TargetAdd('vrml-trans.exe', input='vrml-trans_vrmlTrans.obj')
  5441. TargetAdd('vrml-trans.exe', input='libp3vrml.lib')
  5442. TargetAdd('vrml-trans.exe', input='libp3progbase.lib')
  5443. TargetAdd('vrml-trans.exe', input='libp3pandatoolbase.lib')
  5444. TargetAdd('vrml-trans.exe', input=COMMON_PANDA_LIBS)
  5445. TargetAdd('vrml-trans.exe', opts=['ADVAPI'])
  5446. if not PkgSkip("EGG"):
  5447. TargetAdd('vrml2egg_vrmlToEgg.obj', opts=OPTS, input='vrmlToEgg.cxx')
  5448. TargetAdd('vrml2egg.exe', input='vrml2egg_vrmlToEgg.obj')
  5449. TargetAdd('vrml2egg.exe', input='libp3vrmlegg.lib')
  5450. TargetAdd('vrml2egg.exe', input='libp3vrml.lib')
  5451. TargetAdd('vrml2egg.exe', input=COMMON_EGG2X_LIBS)
  5452. TargetAdd('vrml2egg.exe', opts=['ADVAPI'])
  5453. #
  5454. # DIRECTORY: pandatool/src/win-stats/
  5455. # DIRECTORY: pandatool/src/gtk-stats/
  5456. #
  5457. if (PkgSkip("PANDATOOL")==0 and (GetTarget() == 'windows' or PkgSkip("GTK2")==0)):
  5458. if GetTarget() == 'windows':
  5459. OPTS=['DIR:pandatool/src/win-stats']
  5460. TargetAdd('pstats_composite1.obj', opts=OPTS, input='winstats_composite1.cxx')
  5461. else:
  5462. OPTS=['DIR:pandatool/src/gtk-stats', 'GTK2']
  5463. TargetAdd('pstats_composite1.obj', opts=OPTS, input='gtkstats_composite1.cxx')
  5464. TargetAdd('pstats.exe', input='pstats_composite1.obj')
  5465. TargetAdd('pstats.exe', input='libp3pstatserver.lib')
  5466. TargetAdd('pstats.exe', input='libp3progbase.lib')
  5467. TargetAdd('pstats.exe', input='libp3pandatoolbase.lib')
  5468. TargetAdd('pstats.exe', input=COMMON_PANDA_LIBS)
  5469. TargetAdd('pstats.exe', opts=['SUBSYSTEM:WINDOWS', 'WINSOCK', 'WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM', 'GTK2'])
  5470. #
  5471. # DIRECTORY: pandatool/src/xfileprogs/
  5472. #
  5473. if not PkgSkip("PANDATOOL"):
  5474. OPTS=['DIR:pandatool/src/xfileprogs', 'DIR:pandatool/src/xfile', 'DIR:pandatool/src/xfileegg']
  5475. TargetAdd('x-trans_xFileTrans.obj', opts=OPTS, input='xFileTrans.cxx')
  5476. TargetAdd('x-trans.exe', input='x-trans_xFileTrans.obj')
  5477. TargetAdd('x-trans.exe', input='libp3progbase.lib')
  5478. TargetAdd('x-trans.exe', input='libp3xfile.lib')
  5479. TargetAdd('x-trans.exe', input='libp3pandatoolbase.lib')
  5480. TargetAdd('x-trans.exe', input=COMMON_PANDA_LIBS)
  5481. TargetAdd('x-trans.exe', opts=['ADVAPI'])
  5482. if not PkgSkip("EGG"):
  5483. TargetAdd('egg2x_eggToX.obj', opts=OPTS, input='eggToX.cxx')
  5484. TargetAdd('egg2x.exe', input='egg2x_eggToX.obj')
  5485. TargetAdd('egg2x.exe', input='libp3xfileegg.lib')
  5486. TargetAdd('egg2x.exe', input='libp3xfile.lib')
  5487. TargetAdd('egg2x.exe', input=COMMON_EGG2X_LIBS)
  5488. TargetAdd('egg2x.exe', opts=['ADVAPI'])
  5489. TargetAdd('x2egg_xFileToEgg.obj', opts=OPTS, input='xFileToEgg.cxx')
  5490. TargetAdd('x2egg.exe', input='x2egg_xFileToEgg.obj')
  5491. TargetAdd('x2egg.exe', input='libp3xfileegg.lib')
  5492. TargetAdd('x2egg.exe', input='libp3xfile.lib')
  5493. TargetAdd('x2egg.exe', input=COMMON_EGG2X_LIBS)
  5494. TargetAdd('x2egg.exe', opts=['ADVAPI'])
  5495. #
  5496. # DIRECTORY: pandatool/src/mayaprogs/
  5497. #
  5498. for VER in MAYAVERSIONS:
  5499. VNUM = VER[4:]
  5500. if not PkgSkip(VER) and not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
  5501. if GetTarget() == 'darwin' and int(VNUM) >= 2012:
  5502. ARCH_OPTS = ['NOARCH:PPC', 'NOARCH:I386']
  5503. if len(OSX_ARCHS) != 0 and 'x86_64' not in OSX_ARCHS:
  5504. continue
  5505. elif GetTarget() == 'darwin' and int(VNUM) >= 2009:
  5506. ARCH_OPTS = ['NOARCH:PPC']
  5507. elif GetTarget() == 'darwin':
  5508. ARCH_OPTS = ['NOARCH:X86_64']
  5509. else:
  5510. ARCH_OPTS = []
  5511. OPTS=['DIR:pandatool/src/mayaprogs', 'DIR:pandatool/src/maya', 'DIR:pandatool/src/mayaegg', 'DIR:pandatool/src/cvscopy', 'BUILDING:MISC', VER] + ARCH_OPTS
  5512. TargetAdd('mayaeggimport'+VNUM+'_mayaeggimport.obj', opts=OPTS, input='mayaEggImport.cxx')
  5513. TargetAdd('mayaeggimport'+VNUM+'.mll', input='mayaegg'+VNUM+'_loader.obj')
  5514. TargetAdd('mayaeggimport'+VNUM+'.mll', input='mayaeggimport'+VNUM+'_mayaeggimport.obj')
  5515. TargetAdd('mayaeggimport'+VNUM+'.mll', input='libpandaegg.dll')
  5516. TargetAdd('mayaeggimport'+VNUM+'.mll', input=COMMON_PANDA_LIBS)
  5517. #if GetTarget() == 'windows':
  5518. # TargetAdd('mayaeggimport'+VNUM+'.mll', input='libp3pystub.lib')
  5519. TargetAdd('mayaeggimport'+VNUM+'.mll', opts=['ADVAPI', VER]+ARCH_OPTS)
  5520. TargetAdd('mayaloader'+VNUM+'_config_mayaloader.obj', opts=OPTS, input='config_mayaloader.cxx')
  5521. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='mayaloader'+VNUM+'_config_mayaloader.obj')
  5522. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libmayaegg'+VNUM+'.lib')
  5523. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3ptloader.dll')
  5524. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libmaya'+VNUM+'.lib')
  5525. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3fltegg.lib')
  5526. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3flt.lib')
  5527. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3lwoegg.lib')
  5528. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3lwo.lib')
  5529. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3dxfegg.lib')
  5530. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3dxf.lib')
  5531. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3objegg.lib')
  5532. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3vrmlegg.lib')
  5533. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3vrml.lib')
  5534. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3xfileegg.lib')
  5535. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3xfile.lib')
  5536. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3eggbase.lib')
  5537. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3progbase.lib')
  5538. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3converter.lib')
  5539. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3pandatoolbase.lib')
  5540. TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libpandaegg.dll')
  5541. TargetAdd('libp3mayaloader'+VNUM+'.dll', input=COMMON_PANDA_LIBS)
  5542. TargetAdd('libp3mayaloader'+VNUM+'.dll', opts=['ADVAPI', VER]+ARCH_OPTS)
  5543. TargetAdd('mayapview'+VNUM+'_mayaPview.obj', opts=OPTS, input='mayaPview.cxx')
  5544. TargetAdd('libmayapview'+VNUM+'.mll', input='mayapview'+VNUM+'_mayaPview.obj')
  5545. TargetAdd('libmayapview'+VNUM+'.mll', input='libmayaegg'+VNUM+'.lib')
  5546. TargetAdd('libmayapview'+VNUM+'.mll', input='libmaya'+VNUM+'.lib')
  5547. TargetAdd('libmayapview'+VNUM+'.mll', input='libp3framework.dll')
  5548. if GetTarget() == 'windows':
  5549. TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS)
  5550. else:
  5551. TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS)
  5552. TargetAdd('libmayapview'+VNUM+'.mll', opts=['ADVAPI', VER]+ARCH_OPTS)
  5553. TargetAdd('maya2egg'+VNUM+'_mayaToEgg.obj', opts=OPTS, input='mayaToEgg.cxx')
  5554. TargetAdd('maya2egg'+VNUM+'_bin.exe', input='maya2egg'+VNUM+'_mayaToEgg.obj')
  5555. TargetAdd('maya2egg'+VNUM+'_bin.exe', input='libmayaegg'+VNUM+'.lib')
  5556. TargetAdd('maya2egg'+VNUM+'_bin.exe', input='libmaya'+VNUM+'.lib')
  5557. if GetTarget() == 'windows':
  5558. TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS)
  5559. else:
  5560. TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS)
  5561. TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS)
  5562. TargetAdd('egg2maya'+VNUM+'_eggToMaya.obj', opts=OPTS, input='eggToMaya.cxx')
  5563. TargetAdd('egg2maya'+VNUM+'_bin.exe', input='egg2maya'+VNUM+'_eggToMaya.obj')
  5564. TargetAdd('egg2maya'+VNUM+'_bin.exe', input='libmayaegg'+VNUM+'.lib')
  5565. TargetAdd('egg2maya'+VNUM+'_bin.exe', input='libmaya'+VNUM+'.lib')
  5566. if GetTarget() == 'windows':
  5567. TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS)
  5568. else:
  5569. TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS)
  5570. TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS)
  5571. TargetAdd('mayacopy'+VNUM+'_mayaCopy.obj', opts=OPTS, input='mayaCopy.cxx')
  5572. TargetAdd('mayacopy'+VNUM+'_bin.exe', input='mayacopy'+VNUM+'_mayaCopy.obj')
  5573. TargetAdd('mayacopy'+VNUM+'_bin.exe', input='libp3cvscopy.lib')
  5574. TargetAdd('mayacopy'+VNUM+'_bin.exe', input='libmaya'+VNUM+'.lib')
  5575. if GetTarget() == 'windows':
  5576. TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS)
  5577. else:
  5578. TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS)
  5579. TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS)
  5580. TargetAdd('mayasavepview'+VNUM+'_mayaSavePview.obj', opts=OPTS, input='mayaSavePview.cxx')
  5581. TargetAdd('libmayasavepview'+VNUM+'.mll', input='mayasavepview'+VNUM+'_mayaSavePview.obj')
  5582. TargetAdd('libmayasavepview'+VNUM+'.mll', opts=['ADVAPI', VER]+ARCH_OPTS)
  5583. TargetAdd('mayapath'+VNUM+'.obj', opts=OPTS, input='mayapath.cxx')
  5584. TargetAdd('maya2egg'+VNUM+'.exe', input='mayapath'+VNUM+'.obj')
  5585. TargetAdd('maya2egg'+VNUM+'.exe', input='libpandaexpress.dll')
  5586. TargetAdd('maya2egg'+VNUM+'.exe', input=COMMON_DTOOL_LIBS)
  5587. TargetAdd('maya2egg'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS)
  5588. TargetAdd('egg2maya'+VNUM+'.exe', input='mayapath'+VNUM+'.obj')
  5589. TargetAdd('egg2maya'+VNUM+'.exe', input='libpandaexpress.dll')
  5590. TargetAdd('egg2maya'+VNUM+'.exe', input=COMMON_DTOOL_LIBS)
  5591. TargetAdd('egg2maya'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS)
  5592. TargetAdd('mayacopy'+VNUM+'.exe', input='mayapath'+VNUM+'.obj')
  5593. TargetAdd('mayacopy'+VNUM+'.exe', input='libpandaexpress.dll')
  5594. TargetAdd('mayacopy'+VNUM+'.exe', input=COMMON_DTOOL_LIBS)
  5595. TargetAdd('mayacopy'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS)
  5596. #
  5597. # DIRECTORY: contrib/src/ai/
  5598. #
  5599. if (PkgSkip("CONTRIB")==0 and not RUNTIME):
  5600. OPTS=['DIR:contrib/src/ai', 'BUILDING:PANDAAI']
  5601. TargetAdd('p3ai_composite1.obj', opts=OPTS, input='p3ai_composite1.cxx')
  5602. TargetAdd('libpandaai.dll', input='p3ai_composite1.obj')
  5603. TargetAdd('libpandaai.dll', input=COMMON_PANDA_LIBS)
  5604. OPTS=['DIR:contrib/src/ai']
  5605. IGATEFILES=GetDirectoryContents('contrib/src/ai', ["*.h", "*_composite*.cxx"])
  5606. TargetAdd('libpandaai.in', opts=OPTS, input=IGATEFILES)
  5607. TargetAdd('libpandaai.in', opts=['IMOD:panda3d.ai', 'ILIB:libpandaai', 'SRCDIR:contrib/src/ai'])
  5608. PyTargetAdd('ai_module.obj', input='libpandaai.in')
  5609. PyTargetAdd('ai_module.obj', opts=OPTS)
  5610. PyTargetAdd('ai_module.obj', opts=['IMOD:panda3d.ai', 'ILIB:ai', 'IMPORT:panda3d.core'])
  5611. PyTargetAdd('ai.pyd', input='ai_module.obj')
  5612. PyTargetAdd('ai.pyd', input='libpandaai_igate.obj')
  5613. PyTargetAdd('ai.pyd', input='libpandaai.dll')
  5614. PyTargetAdd('ai.pyd', input='libp3interrogatedb.dll')
  5615. PyTargetAdd('ai.pyd', input=COMMON_PANDA_LIBS)
  5616. #
  5617. # DIRECTORY: contrib/src/rplight/
  5618. #
  5619. if not PkgSkip("CONTRIB") and not PkgSkip("PYTHON") and not RUNTIME:
  5620. OPTS=['DIR:contrib/src/rplight', 'BUILDING:RPLIGHT']
  5621. TargetAdd('p3rplight_composite1.obj', opts=OPTS, input='p3rplight_composite1.cxx')
  5622. IGATEFILES=GetDirectoryContents('contrib/src/rplight', ["*.h", "*_composite*.cxx"])
  5623. TargetAdd('libp3rplight.in', opts=OPTS, input=IGATEFILES)
  5624. TargetAdd('libp3rplight.in', opts=['IMOD:panda3d._rplight', 'ILIB:libp3rplight', 'SRCDIR:contrib/src/rplight'])
  5625. PyTargetAdd('rplight_module.obj', input='libp3rplight.in')
  5626. PyTargetAdd('rplight_module.obj', opts=OPTS)
  5627. PyTargetAdd('rplight_module.obj', opts=['IMOD:panda3d._rplight', 'ILIB:_rplight', 'IMPORT:panda3d.core'])
  5628. PyTargetAdd('_rplight.pyd', input='rplight_module.obj')
  5629. PyTargetAdd('_rplight.pyd', input='libp3rplight_igate.obj')
  5630. PyTargetAdd('_rplight.pyd', input='p3rplight_composite1.obj')
  5631. PyTargetAdd('_rplight.pyd', input='libp3interrogatedb.dll')
  5632. PyTargetAdd('_rplight.pyd', input=COMMON_PANDA_LIBS)
  5633. #
  5634. # Generate the models directory and samples directory
  5635. #
  5636. if not PkgSkip("DIRECT") and not RUNTIME and not PkgSkip("EGG"):
  5637. model_extensions = ["*.egg"]
  5638. # Check if we have access to an flt2egg utility, either self-compiled or on the system.
  5639. if ((PkgSkip("PANDATOOL")==0 and GetHost()==GetTarget()) or LocateBinary('flt2egg')):
  5640. model_extensions.append("*.flt")
  5641. for model in GetDirectoryContents("dmodels/src/misc", model_extensions):
  5642. if (PkgSkip("ZLIB")==0 and PkgSkip("DEPLOYTOOLS")==0 and not RTDIST):
  5643. newname = model[:-4] + ".egg.pz"
  5644. else:
  5645. newname = model[:-4] + ".egg"
  5646. TargetAdd(GetOutputDir()+"/models/misc/"+newname, input="dmodels/src/misc/"+model)
  5647. for model in GetDirectoryContents("dmodels/src/gui", model_extensions):
  5648. if (PkgSkip("ZLIB")==0 and PkgSkip("DEPLOYTOOLS")==0 and not RTDIST):
  5649. newname = model[:-4] + ".egg.pz"
  5650. else:
  5651. newname = model[:-4] + ".egg"
  5652. TargetAdd(GetOutputDir()+"/models/gui/"+newname, input="dmodels/src/gui/"+model)
  5653. for model in GetDirectoryContents("models", model_extensions):
  5654. if (PkgSkip("ZLIB")==0 and PkgSkip("DEPLOYTOOLS")==0 and not RTDIST):
  5655. newname = model[:-4] + ".egg.pz"
  5656. else:
  5657. newname = model[:-4] + ".egg"
  5658. TargetAdd(GetOutputDir()+"/models/"+newname, input="models/"+model)
  5659. if not PkgSkip("DIRECT") and not RUNTIME:
  5660. CopyAllFiles(GetOutputDir()+"/models/audio/sfx/", "dmodels/src/audio/sfx/", ".wav")
  5661. CopyAllFiles(GetOutputDir()+"/models/icons/", "dmodels/src/icons/", ".gif")
  5662. CopyAllFiles(GetOutputDir()+"/models/maps/", "models/maps/", ".jpg")
  5663. CopyAllFiles(GetOutputDir()+"/models/maps/", "models/maps/", ".png")
  5664. CopyAllFiles(GetOutputDir()+"/models/maps/", "models/maps/", ".rgb")
  5665. CopyAllFiles(GetOutputDir()+"/models/maps/", "models/maps/", ".rgba")
  5666. CopyAllFiles(GetOutputDir()+"/models/maps/", "dmodels/src/maps/", ".jpg")
  5667. CopyAllFiles(GetOutputDir()+"/models/maps/", "dmodels/src/maps/", ".png")
  5668. CopyAllFiles(GetOutputDir()+"/models/maps/", "dmodels/src/maps/", ".rgb")
  5669. CopyAllFiles(GetOutputDir()+"/models/maps/", "dmodels/src/maps/", ".rgba")
  5670. #
  5671. # Build the rtdist.
  5672. #
  5673. if (RTDIST):
  5674. OPTS=['DIR:direct/src/p3d']
  5675. TargetAdd('_panda3d', opts=OPTS, input='panda3d.pdef')
  5676. TargetAdd('_coreapi', opts=OPTS, input='coreapi.pdef')
  5677. TargetAdd('_thirdparty', opts=OPTS, input='thirdparty.pdef')
  5678. #
  5679. # If we have a host URL and distributor, we can make .p3d deployment tools.
  5680. #
  5681. if not PkgSkip("DIRECT") and not PkgSkip("DEPLOYTOOLS") and not RUNTIME and not RTDIST and HOST_URL and DISTRIBUTOR:
  5682. OPTS=['DIR:direct/src/p3d']
  5683. TargetAdd('packp3d.p3d', opts=OPTS, input='panda3d.pdef')
  5684. TargetAdd('pdeploy.p3d', opts=OPTS, input='panda3d.pdef')
  5685. TargetAdd('pmerge.p3d', opts=OPTS, input='panda3d.pdef')
  5686. TargetAdd('ppackage.p3d', opts=OPTS, input='panda3d.pdef')
  5687. TargetAdd('ppatcher.p3d', opts=OPTS, input='panda3d.pdef')
  5688. ##########################################################################################
  5689. #
  5690. # Dependency-Based Distributed Build System.
  5691. #
  5692. ##########################################################################################
  5693. DEPENDENCYQUEUE=[]
  5694. for target in TARGET_LIST:
  5695. name = target.name
  5696. inputs = target.inputs
  5697. opts = target.opts
  5698. deps = target.deps
  5699. DEPENDENCYQUEUE.append([CompileAnything, [name, inputs, opts], [name], deps, []])
  5700. def BuildWorker(taskqueue, donequeue):
  5701. while True:
  5702. try:
  5703. task = taskqueue.get(timeout=1)
  5704. except:
  5705. ProgressOutput(None, "Waiting for tasks...")
  5706. task = taskqueue.get()
  5707. sys.stdout.flush()
  5708. if (task == 0): return
  5709. try:
  5710. task[0](*task[1])
  5711. donequeue.put(task)
  5712. except:
  5713. donequeue.put(0)
  5714. def AllSourcesReady(task, pending):
  5715. sources = task[3]
  5716. for x in sources:
  5717. if (x in pending):
  5718. return 0
  5719. sources = task[1][1]
  5720. for x in sources:
  5721. if (x in pending):
  5722. return 0
  5723. altsources = task[4]
  5724. for x in altsources:
  5725. if (x in pending):
  5726. return 0
  5727. return 1
  5728. def ParallelMake(tasklist):
  5729. # Create the communication queues.
  5730. donequeue = queue.Queue()
  5731. taskqueue = queue.Queue()
  5732. # Build up a table listing all the pending targets
  5733. #task = [CompileAnything, [name, inputs, opts], [name], deps, []]
  5734. # task[2] = [name]
  5735. # task[3] = deps
  5736. # The python tool package, in particular fltegg seems to throw parallelmake off
  5737. # A hack for now is to divide the tasklist into two parts, one to be built in parallel
  5738. # and another subpart to be built sequentially. The most time consuming part of the process
  5739. # is the c++ code generation anyways.
  5740. tasklist_seq = []
  5741. i = 0
  5742. while i < len(tasklist):
  5743. if tasklist[i][2][0].endswith('.egg') | tasklist[i][2][0].endswith('.egg.pz'):
  5744. break
  5745. i += 1
  5746. if i < len(tasklist):
  5747. tasklist_seq = tasklist[i:]
  5748. tasklist = tasklist[:i]
  5749. iNumStartingTasks = len(tasklist)
  5750. pending = {}
  5751. for task in tasklist:
  5752. for target in task[2]:
  5753. pending[target] = 1
  5754. # Create the workers
  5755. for slave in range(THREADCOUNT):
  5756. th = threading.Thread(target=BuildWorker, args=[taskqueue, donequeue])
  5757. th.setDaemon(1)
  5758. th.start()
  5759. # Feed tasks to the workers.
  5760. tasksqueued = 0
  5761. while True:
  5762. if (tasksqueued < THREADCOUNT):
  5763. extras = []
  5764. for task in tasklist:
  5765. if (tasksqueued < THREADCOUNT) and (AllSourcesReady(task, pending)):
  5766. if (NeedsBuild(task[2], task[3])):
  5767. tasksqueued += 1
  5768. taskqueue.put(task)
  5769. else:
  5770. for target in task[2]:
  5771. del pending[target]
  5772. else:
  5773. extras.append(task)
  5774. tasklist = extras
  5775. sys.stdout.flush()
  5776. if (tasksqueued == 0): break
  5777. donetask = donequeue.get()
  5778. if (donetask == 0):
  5779. exit("Build process aborting.")
  5780. sys.stdout.flush()
  5781. tasksqueued -= 1
  5782. JustBuilt(donetask[2], donetask[3])
  5783. for target in donetask[2]:
  5784. del pending[target]
  5785. # Kill the workers.
  5786. for slave in range(THREADCOUNT):
  5787. taskqueue.put(0)
  5788. # Make sure there aren't any unsatisfied tasks
  5789. if len(tasklist) > 0:
  5790. exit("Dependency problems: " + str(len(tasklist)) + " tasks not finished. First task unsatisfied: "+str(tasklist[0][2]))
  5791. SequentialMake(tasklist_seq)
  5792. def SequentialMake(tasklist):
  5793. i = 0
  5794. for task in tasklist:
  5795. if (NeedsBuild(task[2], task[3])):
  5796. task[0](*task[1] + [(i * 100.0) / len(tasklist)])
  5797. JustBuilt(task[2], task[3])
  5798. i += 1
  5799. def RunDependencyQueue(tasklist):
  5800. if (THREADCOUNT!=0):
  5801. ParallelMake(tasklist)
  5802. else:
  5803. SequentialMake(tasklist)
  5804. try:
  5805. RunDependencyQueue(DEPENDENCYQUEUE)
  5806. except:
  5807. SaveDependencyCache()
  5808. raise
  5809. # Run the test suite.
  5810. if RUNTESTS:
  5811. cmdstr = BracketNameWithQuotes(SDK["PYTHONEXEC"].replace('\\', '/'))
  5812. if sys.version_info >= (2, 6):
  5813. cmdstr += " -B"
  5814. cmdstr += " -m pytest tests"
  5815. if GetVerbose():
  5816. cmdstr += " --verbose"
  5817. oscmd(cmdstr)
  5818. ##########################################################################################
  5819. #
  5820. # The Installers
  5821. #
  5822. # Under windows, we can build an 'exe' package using NSIS
  5823. # Under linux, we can build a 'deb' package or an 'rpm' package.
  5824. # Under OSX, we can make a 'dmg' package.
  5825. #
  5826. ##########################################################################################
  5827. def MakeInstallerNSIS(file, title, installdir):
  5828. if (os.path.isfile(file)):
  5829. os.remove(file)
  5830. elif (os.path.isdir(file)):
  5831. shutil.rmtree(file)
  5832. pyver = SDK["PYTHONVERSION"][6:9]
  5833. if GetTargetArch() == 'x64':
  5834. regview = '64'
  5835. else:
  5836. regview = '32'
  5837. if int(pyver[0]) == 3 and int(pyver[2]) >= 5:
  5838. pyver += '-32'
  5839. if (RUNTIME):
  5840. # Invoke the make_installer script.
  5841. AddToPathEnv("PATH", GetOutputDir() + "\\bin")
  5842. AddToPathEnv("PATH", GetOutputDir() + "\\plugins")
  5843. cmd = sys.executable + " -B -u " + os.path.join("direct", "src", "plugin_installer", "make_installer.py")
  5844. cmd += " --version %s --regview %s" % (VERSION, regview)
  5845. if GetTargetArch() == 'x64':
  5846. cmd += " --install \"$PROGRAMFILES64\\Panda3D\" "
  5847. else:
  5848. cmd += " --install \"$PROGRAMFILES32\\Panda3D\" "
  5849. oscmd(cmd)
  5850. shutil.move(os.path.join("direct", "src", "plugin_installer", "p3d-setup.exe"), file)
  5851. return
  5852. print("Building "+title+" installer at %s" % (file))
  5853. if (COMPRESSOR != "lzma"):
  5854. print("Note: you are using zlib, which is faster, but lzma gives better compression.")
  5855. if (os.path.exists("nsis-output.exe")):
  5856. os.remove("nsis-output.exe")
  5857. WriteFile(GetOutputDir()+"/tmp/__init__.py", "")
  5858. nsis_defs = {
  5859. 'COMPRESSOR' : COMPRESSOR,
  5860. 'TITLE' : title,
  5861. 'INSTALLDIR' : installdir,
  5862. 'OUTFILE' : '..\\' + file,
  5863. 'BUILT' : '..\\' + GetOutputDir(),
  5864. 'SOURCE' : '..',
  5865. 'PYVER' : pyver,
  5866. 'REGVIEW' : regview,
  5867. 'EXT_SUFFIX' : GetExtensionSuffix(),
  5868. }
  5869. if GetHost() == 'windows':
  5870. cmd = os.path.join(GetThirdpartyBase(), 'win-nsis', 'makensis') + ' /V2'
  5871. for item in nsis_defs.items():
  5872. cmd += ' /D%s="%s"' % item
  5873. else:
  5874. cmd = 'makensis -V2'
  5875. for item in nsis_defs.items():
  5876. cmd += ' -D%s="%s"' % item
  5877. cmd += ' "makepanda\\installer.nsi"'
  5878. oscmd(cmd)
  5879. def MakeDebugSymbolArchive(zipname, dirname):
  5880. import zipfile
  5881. zip = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
  5882. for fn in glob.glob(os.path.join(GetOutputDir(), 'bin', '*.pdb')):
  5883. zip.write(fn, dirname + '/bin/' + os.path.basename(fn))
  5884. for fn in glob.glob(os.path.join(GetOutputDir(), 'panda3d', '*.pdb')):
  5885. zip.write(fn, dirname + '/panda3d/' + os.path.basename(fn))
  5886. for fn in glob.glob(os.path.join(GetOutputDir(), 'plugins', '*.pdb')):
  5887. zip.write(fn, dirname + '/plugins/' + os.path.basename(fn))
  5888. for fn in glob.glob(os.path.join(GetOutputDir(), 'python', '*.pdb')):
  5889. zip.write(fn, dirname + '/python/' + os.path.basename(fn))
  5890. for fn in glob.glob(os.path.join(GetOutputDir(), 'python', 'DLLs', '*.pdb')):
  5891. zip.write(fn, dirname + '/python/DLLs/' + os.path.basename(fn))
  5892. zip.close()
  5893. INSTALLER_DEB_FILE="""
  5894. Package: panda3dMAJOR
  5895. Version: VERSION
  5896. Section: libdevel
  5897. Priority: optional
  5898. Architecture: ARCH
  5899. Essential: no
  5900. Depends: DEPENDS
  5901. Recommends: RECOMMENDS
  5902. Provides: panda3d, pythonPV-panda3d
  5903. Conflicts: panda3d, pythonPV-panda3d
  5904. Replaces: panda3d, pythonPV-panda3d
  5905. Maintainer: rdb <[email protected]>
  5906. Installed-Size: INSTSIZE
  5907. Description: Panda3D free 3D engine SDK
  5908. Panda3D is a game engine which includes graphics, audio, I/O, collision detection, and other abilities relevant to the creation of 3D games. Panda3D is open source and free software under the revised BSD license, and can be used for both free and commercial game development at no financial cost.
  5909. Panda3D's intended game-development language is Python. The engine itself is written in C++, and utilizes an automatic wrapper-generator to expose the complete functionality of the engine in a Python interface.
  5910. .
  5911. This package contains the SDK for development with Panda3D.
  5912. """
  5913. RUNTIME_INSTALLER_DEB_FILE="""
  5914. Package: panda3d-runtime
  5915. Version: VERSION
  5916. Section: web
  5917. Priority: optional
  5918. Architecture: ARCH
  5919. Essential: no
  5920. Depends: DEPENDS
  5921. Provides: panda3d-runtime
  5922. Maintainer: rdb <[email protected]>
  5923. Installed-Size: INSTSIZE
  5924. Description: Runtime binary and browser plugin for the Panda3D Game Engine
  5925. This package contains the runtime distribution and browser plugin of the Panda3D engine. It allows you view webpages that contain Panda3D content and to run games created with Panda3D that are packaged as .p3d file.
  5926. """
  5927. # We're not putting "python" in the "Requires" field,
  5928. # since the rpm-based distros don't have a common
  5929. # naming for the Python package.
  5930. INSTALLER_SPEC_FILE="""
  5931. Summary: The Panda3D free 3D engine SDK
  5932. Name: panda3d
  5933. Version: VERSION
  5934. Release: RPMRELEASE
  5935. License: BSD License
  5936. Group: Development/Libraries
  5937. BuildRoot: PANDASOURCE/targetroot
  5938. %description
  5939. Panda3D is a game engine which includes graphics, audio, I/O, collision detection, and other abilities relevant to the creation of 3D games. Panda3D is open source and free software under the revised BSD license, and can be used for both free and commercial game development at no financial cost.
  5940. Panda3D's intended game-development language is Python. The engine itself is written in C++, and utilizes an automatic wrapper-generator to expose the complete functionality of the engine in a Python interface.
  5941. This package contains the SDK for development with Panda3D, install panda3d-runtime for the runtime files.
  5942. %post
  5943. /sbin/ldconfig
  5944. %postun
  5945. /sbin/ldconfig
  5946. %files
  5947. %defattr(-,root,root)
  5948. /etc/Confauto.prc
  5949. /etc/Config.prc
  5950. /usr/share/panda3d
  5951. /etc/ld.so.conf.d/panda3d.conf
  5952. /usr/%_lib/panda3d
  5953. """ + PYTHON_SITEPACKAGES + """
  5954. /usr/include/panda3d
  5955. """
  5956. if not PkgSkip("PVIEW"):
  5957. INSTALLER_SPEC_FILE += \
  5958. """/usr/share/applications/pview.desktop
  5959. /usr/share/mime-info/panda3d.mime
  5960. /usr/share/mime-info/panda3d.keys
  5961. /usr/share/mime/packages/panda3d.xml
  5962. /usr/share/application-registry/panda3d.applications
  5963. """
  5964. RUNTIME_INSTALLER_SPEC_FILE="""
  5965. Summary: Runtime binary and browser plugin for the Panda3D Game Engine
  5966. Name: panda3d-runtime
  5967. Version: VERSION
  5968. Release: RPMRELEASE
  5969. License: BSD License
  5970. Group: Productivity/Graphics/Other
  5971. BuildRoot: PANDASOURCE/targetroot
  5972. %description
  5973. This package contains the runtime distribution and browser plugin of the Panda3D engine. It allows you view webpages that contain Panda3D content and to run games created with Panda3D that are packaged as .p3d file.
  5974. %files
  5975. %defattr(-,root,root)
  5976. /usr/bin/panda3d
  5977. /usr/%_lib/nppanda3d.so
  5978. /usr/%_lib/mozilla/plugins/nppanda3d.so
  5979. /usr/%_lib/mozilla-firefox/plugins/nppanda3d.so
  5980. /usr/%_lib/xulrunner-addons/plugins/nppanda3d.so
  5981. /usr/share/mime-info/panda3d-runtime.mime
  5982. /usr/share/mime-info/panda3d-runtime.keys
  5983. /usr/share/mime/packages/panda3d-runtime.xml
  5984. /usr/share/application-registry/panda3d-runtime.applications
  5985. /usr/share/applications/*.desktop
  5986. """
  5987. # plist file for Mac OSX
  5988. Info_plist = """<?xml version="1.0" encoding="UTF-8"?>
  5989. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  5990. <plist version="1.0">
  5991. <dict>
  5992. <key>CFBundleIdentifier</key>
  5993. <string>%(package_id)s</string>
  5994. <key>CFBundleShortVersionString</key>
  5995. <string>%(version)s</string>
  5996. <key>IFPkgFlagRelocatable</key>
  5997. <false/>
  5998. <key>IFPkgFlagAuthorizationAction</key>
  5999. <string>RootAuthorization</string>
  6000. <key>IFPkgFlagAllowBackRev</key>
  6001. <true/>
  6002. </dict>
  6003. </plist>
  6004. """
  6005. # FreeBSD pkg-descr
  6006. INSTALLER_PKG_DESCR_FILE = """
  6007. Panda3D is a game engine which includes graphics, audio, I/O, collision detection, and other abilities relevant to the creation of 3D games. Panda3D is open source and free software under the revised BSD license, and can be used for both free and commercial game development at no financial cost.
  6008. Panda3D's intended game-development language is Python. The engine itself is written in C++, and utilizes an automatic wrapper-generator to expose the complete functionality of the engine in a Python interface.
  6009. This package contains the SDK for development with Panda3D, install panda3d-runtime for the runtime files.
  6010. WWW: https://www.panda3d.org/
  6011. """
  6012. # FreeBSD pkg-descr
  6013. RUNTIME_INSTALLER_PKG_DESCR_FILE = """
  6014. Runtime binary and browser plugin for the Panda3D Game Engine
  6015. This package contains the runtime distribution and browser plugin of the Panda3D engine. It allows you view webpages that contain Panda3D content and to run games created with Panda3D that are packaged as .p3d file.
  6016. WWW: https://www.panda3d.org/
  6017. """
  6018. # FreeBSD PKG Manifest template file
  6019. INSTALLER_PKG_MANIFEST_FILE = """
  6020. name: NAME
  6021. version: VERSION
  6022. arch: ARCH
  6023. origin: ORIGIN
  6024. comment: "Panda3D free 3D engine SDK"
  6025. www: https://www.panda3d.org
  6026. maintainer: rdb <[email protected]>
  6027. prefix: /usr/local
  6028. flatsize: INSTSIZEMB
  6029. deps: {DEPENDS}
  6030. """
  6031. def MakeInstallerLinux():
  6032. if not RUNTIME and not PkgSkip("PYTHON"):
  6033. PYTHONV = SDK["PYTHONVERSION"].rstrip('dmu')
  6034. else:
  6035. PYTHONV = "python"
  6036. PV = PYTHONV.replace("python", "")
  6037. # Clean and set up a directory to install Panda3D into
  6038. oscmd("rm -rf targetroot data.tar.gz control.tar.gz panda3d.spec")
  6039. oscmd("mkdir --mode=0755 targetroot")
  6040. dpkg_present = False
  6041. if os.path.exists("/usr/bin/dpkg-architecture") and os.path.exists("/usr/bin/dpkg-deb"):
  6042. dpkg_present = True
  6043. rpmbuild_present = False
  6044. if os.path.exists("/usr/bin/rpmbuild"):
  6045. rpmbuild_present = True
  6046. if dpkg_present and rpmbuild_present:
  6047. Warn("both dpkg and rpmbuild present.")
  6048. if dpkg_present:
  6049. # Invoke installpanda.py to install it into a temporary dir
  6050. lib_dir = GetDebLibDir()
  6051. if RUNTIME:
  6052. InstallRuntime(destdir="targetroot", prefix="/usr", outputdir=GetOutputDir(), libdir=lib_dir)
  6053. else:
  6054. InstallPanda(destdir="targetroot", prefix="/usr", outputdir=GetOutputDir(), libdir=lib_dir)
  6055. oscmd("chmod -R 755 targetroot/usr/share/panda3d")
  6056. oscmd("mkdir -m 0755 -p targetroot/usr/share/man/man1")
  6057. oscmd("install -m 0644 doc/man/*.1 targetroot/usr/share/man/man1/")
  6058. oscmd("dpkg --print-architecture > "+GetOutputDir()+"/tmp/architecture.txt")
  6059. pkg_arch = ReadFile(GetOutputDir()+"/tmp/architecture.txt").strip()
  6060. if (RUNTIME):
  6061. txt = RUNTIME_INSTALLER_DEB_FILE[1:]
  6062. else:
  6063. txt = INSTALLER_DEB_FILE[1:]
  6064. txt = txt.replace("VERSION", DEBVERSION).replace("ARCH", pkg_arch).replace("PV", PV).replace("MAJOR", MAJOR_VERSION)
  6065. txt = txt.replace("INSTSIZE", str(GetDirectorySize("targetroot") / 1024))
  6066. oscmd("mkdir --mode=0755 -p targetroot/DEBIAN")
  6067. oscmd("cd targetroot && (find usr -type f -exec md5sum {} ;) > DEBIAN/md5sums")
  6068. if (not RUNTIME):
  6069. oscmd("cd targetroot && (find etc -type f -exec md5sum {} ;) >> DEBIAN/md5sums")
  6070. WriteFile("targetroot/DEBIAN/conffiles","/etc/Config.prc\n")
  6071. WriteFile("targetroot/DEBIAN/postinst","#!/bin/sh\necho running ldconfig\nldconfig\n")
  6072. oscmd("cp targetroot/DEBIAN/postinst targetroot/DEBIAN/postrm")
  6073. # Determine the package name and the locations that
  6074. # dpkg-shlibdeps should look in for executables.
  6075. pkg_version = DEBVERSION
  6076. if RUNTIME:
  6077. pkg_name = "panda3d-runtime"
  6078. lib_pattern = "debian/%s/usr/%s/*.so" % (pkg_name, lib_dir)
  6079. else:
  6080. pkg_name = "panda3d" + MAJOR_VERSION
  6081. lib_pattern = "debian/%s/usr/%s/panda3d/*.so*" % (pkg_name, lib_dir)
  6082. bin_pattern = "debian/%s/usr/bin/*" % (pkg_name)
  6083. # dpkg-shlibdeps looks in the debian/{pkg_name}/DEBIAN/shlibs directory
  6084. # and also expects a debian/control file, so we create this dummy set-up.
  6085. oscmd("mkdir targetroot/debian")
  6086. oscmd("ln -s .. targetroot/debian/" + pkg_name)
  6087. WriteFile("targetroot/debian/control", "")
  6088. dpkg_shlibdeps = "dpkg-shlibdeps"
  6089. if GetVerbose():
  6090. dpkg_shlibdeps += " -v"
  6091. if RUNTIME:
  6092. # The runtime doesn't export any useful symbols, so just query the dependencies.
  6093. oscmd("cd targetroot && %(dpkg_shlibdeps)s -x%(pkg_name)s %(lib_pattern)s %(bin_pattern)s*" % locals())
  6094. depends = ReadFile("targetroot/debian/substvars").replace("shlibs:Depends=", "").strip()
  6095. recommends = ""
  6096. else:
  6097. pkg_name = "panda3d" + MAJOR_VERSION
  6098. pkg_dir = "debian/panda3d" + MAJOR_VERSION
  6099. # Generate a symbols file so that other packages can know which symbols we export.
  6100. oscmd("cd targetroot && dpkg-gensymbols -q -ODEBIAN/symbols -v%(pkg_version)s -p%(pkg_name)s -e%(lib_pattern)s" % locals())
  6101. # Library dependencies are required, binary dependencies are recommended.
  6102. # We explicitly exclude libphysx-extras since we don't want to depend on PhysX.
  6103. oscmd("cd targetroot && LD_LIBRARY_PATH=usr/%(lib_dir)s/panda3d %(dpkg_shlibdeps)s -Tdebian/substvars_dep --ignore-missing-info -x%(pkg_name)s -xlibphysx-extras %(lib_pattern)s" % locals())
  6104. oscmd("cd targetroot && LD_LIBRARY_PATH=usr/%(lib_dir)s/panda3d %(dpkg_shlibdeps)s -Tdebian/substvars_rec --ignore-missing-info -x%(pkg_name)s %(bin_pattern)s" % locals())
  6105. # Parse the substvars files generated by dpkg-shlibdeps.
  6106. depends = ReadFile("targetroot/debian/substvars_dep").replace("shlibs:Depends=", "").strip()
  6107. recommends = ReadFile("targetroot/debian/substvars_rec").replace("shlibs:Depends=", "").strip()
  6108. if PkgSkip("PYTHON")==0:
  6109. depends += ", " + PYTHONV
  6110. recommends += ", python-wxversion, python-profiler (>= " + PV + "), python-pmw, python-tk (>= " + PV + ")"
  6111. if PkgSkip("NVIDIACG")==0:
  6112. depends += ", nvidia-cg-toolkit"
  6113. # Write back the dependencies, and delete the dummy set-up.
  6114. txt = txt.replace("DEPENDS", depends.strip(', '))
  6115. txt = txt.replace("RECOMMENDS", recommends.strip(', '))
  6116. WriteFile("targetroot/DEBIAN/control", txt)
  6117. oscmd("rm -rf targetroot/debian")
  6118. # Package it all up into a .deb file.
  6119. oscmd("chmod -R 755 targetroot/DEBIAN")
  6120. oscmd("chmod 644 targetroot/DEBIAN/control targetroot/DEBIAN/md5sums")
  6121. if not RUNTIME:
  6122. oscmd("chmod 644 targetroot/DEBIAN/conffiles targetroot/DEBIAN/symbols")
  6123. oscmd("fakeroot dpkg-deb -b targetroot %s_%s_%s.deb" % (pkg_name, pkg_version, pkg_arch))
  6124. elif rpmbuild_present:
  6125. # Invoke installpanda.py to install it into a temporary dir
  6126. if RUNTIME:
  6127. InstallRuntime(destdir="targetroot", prefix="/usr", outputdir=GetOutputDir(), libdir=GetRPMLibDir())
  6128. else:
  6129. InstallPanda(destdir="targetroot", prefix="/usr", outputdir=GetOutputDir(), libdir=GetRPMLibDir())
  6130. oscmd("chmod -R 755 targetroot/usr/share/panda3d")
  6131. oscmd("rpm -E '%_target_cpu' > "+GetOutputDir()+"/tmp/architecture.txt")
  6132. ARCH = ReadFile(GetOutputDir()+"/tmp/architecture.txt").strip()
  6133. pandasource = os.path.abspath(os.getcwd())
  6134. if RUNTIME:
  6135. txt = RUNTIME_INSTALLER_SPEC_FILE[1:]
  6136. else:
  6137. txt = INSTALLER_SPEC_FILE[1:]
  6138. # Add the binaries in /usr/bin explicitly to the spec file
  6139. for base in os.listdir(GetOutputDir() + "/bin"):
  6140. txt += "/usr/bin/%s\n" % (base)
  6141. # Write out the spec file.
  6142. txt = txt.replace("VERSION", VERSION)
  6143. txt = txt.replace("RPMRELEASE", RPMRELEASE)
  6144. txt = txt.replace("PANDASOURCE", pandasource)
  6145. txt = txt.replace("PV", PV)
  6146. WriteFile("panda3d.spec", txt)
  6147. oscmd("fakeroot rpmbuild --define '_rpmdir "+pandasource+"' --buildroot '"+os.path.abspath("targetroot")+"' -bb panda3d.spec")
  6148. if (RUNTIME):
  6149. oscmd("mv "+ARCH+"/panda3d-runtime-"+VERSION+"-"+RPMRELEASE+"."+ARCH+".rpm .")
  6150. else:
  6151. oscmd("mv "+ARCH+"/panda3d-"+VERSION+"-"+RPMRELEASE+"."+ARCH+".rpm .")
  6152. oscmd("rm -rf "+ARCH, True)
  6153. else:
  6154. exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!")
  6155. def MakeInstallerOSX():
  6156. if (RUNTIME):
  6157. # Invoke the make_installer script.
  6158. AddToPathEnv("DYLD_LIBRARY_PATH", GetOutputDir() + "/plugins")
  6159. cmdstr = sys.executable + " "
  6160. if sys.version_info >= (2, 6):
  6161. cmdstr += "-B "
  6162. cmdstr += "direct/src/plugin_installer/make_installer.py --version %s" % VERSION
  6163. oscmd(cmdstr)
  6164. return
  6165. dmg_name = "Panda3D-" + VERSION
  6166. if not SDK["PYTHONVERSION"].startswith("python2."):
  6167. dmg_name += '-py' + SDK["PYTHONVERSION"][6:9]
  6168. dmg_name += ".dmg"
  6169. import compileall
  6170. if (os.path.isfile(dmg_name)): oscmd("rm -f %s" % dmg_name)
  6171. if (os.path.exists("dstroot")): oscmd("rm -rf dstroot")
  6172. if (os.path.exists("Panda3D-rw.dmg")): oscmd('rm -f Panda3D-rw.dmg')
  6173. oscmd("mkdir -p dstroot/base/Developer/Panda3D/lib")
  6174. oscmd("mkdir -p dstroot/base/Developer/Panda3D/etc")
  6175. oscmd("cp %s/etc/Config.prc dstroot/base/Developer/Panda3D/etc/Config.prc" % GetOutputDir())
  6176. oscmd("cp %s/etc/Confauto.prc dstroot/base/Developer/Panda3D/etc/Confauto.prc" % GetOutputDir())
  6177. oscmd("cp -R %s/models dstroot/base/Developer/Panda3D/models" % GetOutputDir())
  6178. oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE")
  6179. oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes")
  6180. oscmd("cp -R %s/Frameworks dstroot/base/Developer/Panda3D/Frameworks" % GetOutputDir())
  6181. if os.path.isdir(GetOutputDir()+"/plugins"):
  6182. oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir())
  6183. # Libraries that shouldn't be in base, but are instead in other modules.
  6184. no_base_libs = ['libp3ffmpeg', 'libp3fmod_audio', 'libfmodex', 'libfmodexL']
  6185. for base in os.listdir(GetOutputDir()+"/lib"):
  6186. if not base.endswith(".a") and base.split('.')[0] not in no_base_libs:
  6187. libname = "dstroot/base/Developer/Panda3D/lib/" + base
  6188. # We really need to specify -R in order not to follow symlinks
  6189. # On OSX, just specifying -P is not enough to do that.
  6190. oscmd("cp -R -P " + GetOutputDir() + "/lib/" + base + " " + libname)
  6191. oscmd("mkdir -p dstroot/tools/Developer/Panda3D/bin")
  6192. oscmd("mkdir -p dstroot/tools/Developer/Tools")
  6193. oscmd("ln -s ../Panda3D/bin dstroot/tools/Developer/Tools/Panda3D")
  6194. oscmd("mkdir -p dstroot/tools/etc/paths.d")
  6195. # Trailing newline is important, works around a bug in OSX
  6196. WriteFile("dstroot/tools/etc/paths.d/Panda3D", "/Developer/Panda3D/bin\n")
  6197. oscmd("mkdir -m 0755 -p dstroot/tools/usr/local/share/man/man1")
  6198. oscmd("install -m 0644 doc/man/*.1 dstroot/tools/usr/local/share/man/man1/")
  6199. for base in os.listdir(GetOutputDir()+"/bin"):
  6200. binname = "dstroot/tools/Developer/Panda3D/bin/" + base
  6201. # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird.
  6202. oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname)
  6203. if PkgSkip("PYTHON")==0:
  6204. PV = SDK["PYTHONVERSION"][6:9]
  6205. oscmd("mkdir -p dstroot/pythoncode/usr/local/bin")
  6206. oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/panda3d")
  6207. oscmd("mkdir -p dstroot/pythoncode/Library/Python/%s/site-packages" % PV)
  6208. WriteFile("dstroot/pythoncode/Library/Python/%s/site-packages/Panda3D.pth" % PV, "/Developer/Panda3D")
  6209. oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/pandac" % GetOutputDir())
  6210. oscmd("cp -R %s/direct dstroot/pythoncode/Developer/Panda3D/direct" % GetOutputDir())
  6211. oscmd("ln -s %s dstroot/pythoncode/usr/local/bin/ppython" % SDK["PYTHONEXEC"])
  6212. oscmd("cp -R %s/*.so dstroot/pythoncode/Developer/Panda3D/" % GetOutputDir(), True)
  6213. oscmd("cp -R %s/*.py dstroot/pythoncode/Developer/Panda3D/" % GetOutputDir(), True)
  6214. if os.path.isdir(GetOutputDir()+"/Pmw"):
  6215. oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/Pmw" % GetOutputDir())
  6216. compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/Pmw")
  6217. WriteFile("dstroot/pythoncode/Developer/Panda3D/direct/__init__.py", "")
  6218. for base in os.listdir("dstroot/pythoncode/Developer/Panda3D/direct"):
  6219. if ((base != "extensions") and (base != "extensions_native")):
  6220. compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/direct/"+base)
  6221. suffix = GetExtensionSuffix()
  6222. for base in os.listdir(GetOutputDir()+"/panda3d"):
  6223. if base.endswith('.py') or (base.endswith(suffix) and '.' not in base[:-len(suffix)]):
  6224. libname = "dstroot/pythoncode/Developer/Panda3D/panda3d/" + base
  6225. # We really need to specify -R in order not to follow symlinks
  6226. # On OSX, just specifying -P is not enough to do that.
  6227. oscmd("cp -R -P " + GetOutputDir() + "/panda3d/" + base + " " + libname)
  6228. if not PkgSkip("FFMPEG"):
  6229. oscmd("mkdir -p dstroot/ffmpeg/Developer/Panda3D/lib")
  6230. oscmd("cp -R %s/lib/libp3ffmpeg.* dstroot/ffmpeg/Developer/Panda3D/lib/" % GetOutputDir())
  6231. #if not PkgSkip("OPENAL"):
  6232. # oscmd("mkdir -p dstroot/openal/Developer/Panda3D/lib")
  6233. # oscmd("cp -R %s/lib/libp3openal_audio.* dstroot/openal/Developer/Panda3D/lib/" % GetOutputDir())
  6234. if not PkgSkip("FMODEX"):
  6235. oscmd("mkdir -p dstroot/fmodex/Developer/Panda3D/lib")
  6236. oscmd("cp -R %s/lib/libp3fmod_audio.* dstroot/fmodex/Developer/Panda3D/lib/" % GetOutputDir())
  6237. oscmd("cp -R %s/lib/libfmodex* dstroot/fmodex/Developer/Panda3D/lib/" % GetOutputDir())
  6238. oscmd("mkdir -p dstroot/headers/Developer/Panda3D/lib")
  6239. oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % GetOutputDir())
  6240. if os.path.isfile(GetOutputDir() + "/lib/libp3pystub.a"):
  6241. oscmd("cp -R -P %s/lib/libp3pystub.a dstroot/headers/Developer/Panda3D/lib/" % GetOutputDir())
  6242. if os.path.isdir("samples"):
  6243. oscmd("mkdir -p dstroot/samples/Developer/Examples/Panda3D")
  6244. oscmd("cp -R samples/* dstroot/samples/Developer/Examples/Panda3D/")
  6245. oscmd("chmod -R 0775 dstroot/*")
  6246. DeleteVCS("dstroot")
  6247. DeleteBuildFiles("dstroot")
  6248. # We need to be root to perform a chown. Bleh.
  6249. # Fortunately PackageMaker does it for us, on 10.5 and above.
  6250. #oscmd("chown -R root:admin dstroot/*", True)
  6251. oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/")
  6252. oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Resources/en.lproj/")
  6253. pkgs = ["base", "tools", "headers"]
  6254. if not PkgSkip("PYTHON"): pkgs.append("pythoncode")
  6255. if not PkgSkip("FFMPEG"): pkgs.append("ffmpeg")
  6256. #if not PkgSkip("OPENAL"): pkgs.append("openal")
  6257. if not PkgSkip("FMODEX"): pkgs.append("fmodex")
  6258. if os.path.isdir("samples"): pkgs.append("samples")
  6259. for pkg in pkgs:
  6260. identifier = "org.panda3d.panda3d.%s.pkg" % pkg
  6261. plist = open("/tmp/Info_plist", "w")
  6262. plist.write(Info_plist % { "package_id" : identifier, "version" : VERSION })
  6263. plist.close()
  6264. if not os.path.isdir("dstroot/" + pkg):
  6265. os.makedirs("dstroot/" + pkg)
  6266. if OSXTARGET and OSXTARGET <= (10, 5):
  6267. target = '--target %d.%d' % (OSXTARGET)
  6268. else:
  6269. target = ''
  6270. if os.path.exists("/usr/bin/pkgbuild"):
  6271. # This new package builder is used in Lion and above.
  6272. cmd = '/usr/bin/pkgbuild --identifier ' + identifier + ' --version ' + VERSION + ' --root dstroot/' + pkg + '/ dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg'
  6273. # In older versions, we use PackageMaker. Apple keeps changing its location.
  6274. elif os.path.exists("/Developer/usr/bin/packagemaker"):
  6275. cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate'
  6276. elif os.path.exists("/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"):
  6277. cmd = '/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate'
  6278. elif os.path.exists("/Developer/Tools/PackageMaker.app/Contents/MacOS/PackageMaker"):
  6279. cmd = '/Developer/Tools/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate'
  6280. elif os.path.exists("/Developer/Tools/packagemaker"):
  6281. cmd = '/Developer/Tools/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist'
  6282. elif os.path.exists("/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"):
  6283. cmd = '/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate'
  6284. else:
  6285. exit("Neither pkgbuild nor PackageMaker could be found!")
  6286. oscmd(cmd)
  6287. if os.path.isfile("/tmp/Info_plist"):
  6288. oscmd("rm -f /tmp/Info_plist")
  6289. # Now that we've built all of the individual packages, build the metapackage.
  6290. dist = open("dstroot/Panda3D/Panda3D.mpkg/Contents/distribution.dist", "w")
  6291. dist.write('<?xml version="1.0" encoding="utf-8"?>\n')
  6292. dist.write('<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">\n')
  6293. dist.write(' <title>Panda3D SDK %s</title>\n' % (VERSION))
  6294. dist.write(' <options customize="always" allow-external-scripts="no" rootVolumeOnly="false"/>\n')
  6295. dist.write(' <license language="en" mime-type="text/plain">%s</license>\n' % ReadFile("doc/LICENSE"))
  6296. dist.write(' <choices-outline>\n')
  6297. for pkg in pkgs:
  6298. dist.write(' <line choice="%s"/>\n' % (pkg))
  6299. dist.write(' </choices-outline>\n')
  6300. dist.write(' <choice id="base" title="Panda3D Base Installation" description="This package contains the Panda3D libraries, configuration files and models/textures that are needed to use Panda3D. Location: /Developer/Panda3D/" start_enabled="false">\n')
  6301. dist.write(' <pkg-ref id="org.panda3d.panda3d.base.pkg"/>\n')
  6302. dist.write(' </choice>\n')
  6303. dist.write(' <choice id="tools" title="Tools" tooltip="Useful tools and model converters to help with Panda3D development" description="This package contains the various utilities that ship with Panda3D, including packaging tools, model converters, and many more. Location: /Developer/Panda3D/bin/">\n')
  6304. dist.write(' <pkg-ref id="org.panda3d.panda3d.tools.pkg"/>\n')
  6305. dist.write(' </choice>\n')
  6306. if not PkgSkip("PYTHON"):
  6307. dist.write(' <choice id="pythoncode" title="Python Support" tooltip="Python bindings for the Panda3D libraries" description="This package contains the \'direct\', \'pandac\' and \'panda3d\' python packages that are needed to do Python development with Panda3D. Location: /Developer/Panda3D/">\n')
  6308. dist.write(' <pkg-ref id="org.panda3d.panda3d.pythoncode.pkg"/>\n')
  6309. dist.write(' </choice>\n')
  6310. if not PkgSkip("FFMPEG"):
  6311. dist.write(' <choice id="ffmpeg" title="FFMpeg Plug-In" tooltip="FFMpeg video and audio decoding plug-in" description="This package contains the FFMpeg plug-in, which is used for decoding video and audio files with OpenAL.')
  6312. if PkgSkip("VORBIS") and PkgSkip("OPUS"):
  6313. dist.write(' It is not required for loading .wav files, which Panda3D can read out of the box.">\n')
  6314. elif PkgSkip("VORBIS"):
  6315. dist.write(' It is not required for loading .wav or .opus files, which Panda3D can read out of the box.">\n')
  6316. elif PkgSkip("OPUS"):
  6317. dist.write(' It is not required for loading .wav or .ogg files, which Panda3D can read out of the box.">\n')
  6318. else:
  6319. dist.write(' It is not required for loading .wav, .ogg or .opus files, which Panda3D can read out of the box.">\n')
  6320. dist.write(' <pkg-ref id="org.panda3d.panda3d.ffmpeg.pkg"/>\n')
  6321. dist.write(' </choice>\n')
  6322. #if not PkgSkip("OPENAL"):
  6323. # dist.write(' <choice id="openal" title="OpenAL Audio Plug-In" tooltip="OpenAL audio output plug-in" description="This package contains the OpenAL audio plug-in, which is an open-source library for playing sounds.">\n')
  6324. # dist.write(' <pkg-ref id="org.panda3d.panda3d.openal.pkg"/>\n')
  6325. # dist.write(' </choice>\n')
  6326. if not PkgSkip("FMODEX"):
  6327. dist.write(' <choice id="fmodex" title="FMOD Ex Plug-In" tooltip="FMOD Ex audio output plug-in" description="This package contains the FMOD Ex audio plug-in, which is a commercial library for playing sounds. It is an optional component as Panda3D can use the open-source alternative OpenAL instead.">\n')
  6328. dist.write(' <pkg-ref id="org.panda3d.panda3d.fmodex.pkg"/>\n')
  6329. dist.write(' </choice>\n')
  6330. if os.path.isdir("samples"):
  6331. dist.write(' <choice id="samples" title="Sample Programs" tooltip="Python sample programs that use Panda3D" description="This package contains the Python sample programs that can help you with learning how to use Panda3D. Location: /Developer/Examples/Panda3D/">\n')
  6332. dist.write(' <pkg-ref id="org.panda3d.panda3d.samples.pkg"/>\n')
  6333. dist.write(' </choice>\n')
  6334. dist.write(' <choice id="headers" title="C++ Header Files" tooltip="Header files for C++ development with Panda3D" description="This package contains the C++ header files that are needed in order to do C++ development with Panda3D. You don\'t need this if you want to develop in Python. Location: /Developer/Panda3D/include/" start_selected="false">\n')
  6335. dist.write(' <pkg-ref id="org.panda3d.panda3d.headers.pkg"/>\n')
  6336. dist.write(' </choice>\n')
  6337. for pkg in pkgs:
  6338. size = GetDirectorySize("dstroot/" + pkg) // 1024
  6339. dist.write(' <pkg-ref id="org.panda3d.panda3d.%s.pkg" installKBytes="%d" version="1" auth="Root">file:./Contents/Packages/%s.pkg</pkg-ref>\n' % (pkg, size, pkg))
  6340. dist.write('</installer-script>\n')
  6341. dist.close()
  6342. oscmd('hdiutil create Panda3D-rw.dmg -volname "Panda3D SDK %s" -srcfolder dstroot/Panda3D' % (VERSION))
  6343. oscmd('hdiutil convert Panda3D-rw.dmg -format UDBZ -o %s' % (dmg_name))
  6344. oscmd('rm -f Panda3D-rw.dmg')
  6345. def MakeInstallerFreeBSD():
  6346. oscmd("rm -rf targetroot +DESC pkg-plist +MANIFEST")
  6347. oscmd("mkdir targetroot")
  6348. # Invoke installpanda.py to install it into a temporary dir
  6349. if RUNTIME:
  6350. InstallRuntime(destdir = "targetroot", prefix = "/usr/local", outputdir = GetOutputDir())
  6351. else:
  6352. InstallPanda(destdir = "targetroot", prefix = "/usr/local", outputdir = GetOutputDir())
  6353. if not os.path.exists("/usr/sbin/pkg"):
  6354. exit("Cannot create an installer without pkg")
  6355. plist_txt = ''
  6356. for root, dirs, files in os.walk("targetroot/usr/local/", True):
  6357. for f in files:
  6358. plist_txt += os.path.join(root, f)[21:] + "\n"
  6359. if not RUNTIME:
  6360. plist_txt += "@postexec /sbin/ldconfig -m /usr/local/lib/panda3d\n"
  6361. plist_txt += "@postunexec /sbin/ldconfig -R\n"
  6362. for remdir in ("lib/panda3d", "share/panda3d", "include/panda3d"):
  6363. for root, dirs, files in os.walk("targetroot/usr/local/" + remdir, False):
  6364. for d in dirs:
  6365. plist_txt += "@dir %s\n" % os.path.join(root, d)[21:]
  6366. plist_txt += "@dir %s\n" % remdir
  6367. oscmd("echo \"`pkg config abi | tr '[:upper:]' '[:lower:]' | cut -d: -f1,2`:*\" > " + GetOutputDir() + "/tmp/architecture.txt")
  6368. pkg_arch = ReadFile(GetOutputDir()+"/tmp/architecture.txt").strip()
  6369. dependencies = ''
  6370. if PkgSkip("PYTHON") == 0:
  6371. # If this version of Python was installed from a package or ports, let's mark it as dependency.
  6372. oscmd("rm -f %s/tmp/python_dep" % GetOutputDir())
  6373. oscmd("pkg query \"\n\t%%n : {\n\t\torigin : %%o,\n\t\tversion : %%v\n\t},\n\" python%s > %s/tmp/python_dep" % (SDK["PYTHONVERSION"][6:9:2], GetOutputDir()), True)
  6374. if os.path.isfile(GetOutputDir() + "/tmp/python_dep"):
  6375. python_pkg = ReadFile(GetOutputDir() + "/tmp/python_dep")
  6376. if python_pkg:
  6377. dependencies += python_pkg
  6378. manifest_txt = INSTALLER_PKG_MANIFEST_FILE[1:].replace("NAME", 'panda3d' if not RUNTIME else 'panda3d-runtime')
  6379. manifest_txt = manifest_txt.replace("VERSION", VERSION)
  6380. manifest_txt = manifest_txt.replace("ARCH", pkg_arch)
  6381. manifest_txt = manifest_txt.replace("ORIGIN", 'devel/panda3d' if not RUNTIME else 'graphics/panda3d-runtime')
  6382. manifest_txt = manifest_txt.replace("DEPENDS", dependencies)
  6383. manifest_txt = manifest_txt.replace("INSTSIZE", str(GetDirectorySize("targetroot") / 1024 / 1024))
  6384. WriteFile("pkg-plist", plist_txt)
  6385. WriteFile("+DESC", INSTALLER_PKG_DESCR_FILE[1:] if not RUNTIME else RUNTIME_INSTALLER_PKG_DESCR_FILE[1:])
  6386. WriteFile("+MANIFEST", manifest_txt)
  6387. oscmd("pkg create -p pkg-plist -r %s -m . -o . %s" % (os.path.abspath("targetroot"), "--verbose" if GetVerbose() else "--quiet"))
  6388. def MakeInstallerAndroid():
  6389. oscmd("rm -rf apkroot")
  6390. oscmd("mkdir apkroot")
  6391. # Also remove the temporary apks.
  6392. apk_unaligned = os.path.join(GetOutputDir(), "tmp", "panda3d-unaligned.apk")
  6393. apk_unsigned = os.path.join(GetOutputDir(), "tmp", "panda3d-unsigned.apk")
  6394. if os.path.exists(apk_unaligned):
  6395. os.unlink(apk_unaligned)
  6396. if os.path.exists(apk_unsigned):
  6397. os.unlink(apk_unsigned)
  6398. # Compile the Java classes into a Dalvik executable.
  6399. dx_cmd = "dx --dex --output=apkroot/classes.dex "
  6400. if GetOptimize() <= 2:
  6401. dx_cmd += "--debug "
  6402. if GetVerbose():
  6403. dx_cmd += "--verbose "
  6404. if "ANDROID_API" in SDK:
  6405. dx_cmd += "--min-sdk-version=%d " % (SDK["ANDROID_API"])
  6406. dx_cmd += os.path.join(GetOutputDir(), "classes")
  6407. oscmd(dx_cmd)
  6408. # Copy the libraries one by one. In case of library dependencies, strip
  6409. # off any suffix (eg. libfile.so.1.0), as Android does not support them.
  6410. source_dir = os.path.join(GetOutputDir(), "lib")
  6411. target_dir = os.path.join("apkroot", "lib", SDK["ANDROID_ABI"])
  6412. oscmd("mkdir -p %s" % (target_dir))
  6413. # Determine the library directories we should look in.
  6414. libpath = [source_dir]
  6415. for dir in os.environ.get("LD_LIBRARY_PATH", "").split(':'):
  6416. dir = os.path.expandvars(dir)
  6417. dir = os.path.expanduser(dir)
  6418. if os.path.isdir(dir):
  6419. dir = os.path.realpath(dir)
  6420. if not dir.startswith("/system") and not dir.startswith("/vendor"):
  6421. libpath.append(dir)
  6422. def copy_library(source, base):
  6423. # Copy file to destination, stripping version suffix.
  6424. target = os.path.join(target_dir, base)
  6425. if not target.endswith('.so'):
  6426. target = target.rpartition('.so.')[0] + '.so'
  6427. if os.path.isfile(target):
  6428. # Already processed.
  6429. return
  6430. oscmd("cp %s %s" % (source, target))
  6431. # Walk through the library dependencies.
  6432. oscmd("ldd %s | grep .so > %s/tmp/otool-libs.txt" % (target, GetOutputDir()), True)
  6433. for line in open(GetOutputDir() + "/tmp/otool-libs.txt", "r"):
  6434. line = line.strip()
  6435. if not line:
  6436. continue
  6437. if '.so.' in line:
  6438. dep = line.rpartition('.so.')[0] + '.so'
  6439. oscmd("patchelf --replace-needed %s %s %s" % (line, dep, target), True)
  6440. else:
  6441. dep = line
  6442. # Find it on the LD_LIBRARY_PATH.
  6443. for dir in libpath:
  6444. fulldep = os.path.join(dir, dep)
  6445. if os.path.isfile(fulldep):
  6446. copy_library(os.path.realpath(fulldep), dep)
  6447. break
  6448. # Now copy every lib in the lib dir, and its dependencies.
  6449. for base in os.listdir(source_dir):
  6450. if not base.startswith('lib'):
  6451. continue
  6452. if not base.endswith('.so') and '.so.' not in base:
  6453. continue
  6454. source = os.path.join(source_dir, base)
  6455. if os.path.islink(source):
  6456. continue
  6457. copy_library(source, base)
  6458. # Same for Python extension modules. However, Android is strict about
  6459. # library naming, so we have a special naming scheme for these, in
  6460. # conjunction with a custom import hook to find these modules.
  6461. if not PkgSkip("PYTHON"):
  6462. suffix = GetExtensionSuffix()
  6463. source_dir = os.path.join(GetOutputDir(), "panda3d")
  6464. for base in os.listdir(source_dir):
  6465. if not base.endswith(suffix):
  6466. continue
  6467. modname = base[:-len(suffix)]
  6468. if '.' not in modname:
  6469. source = os.path.join(source_dir, base)
  6470. copy_library(source, "libpy.panda3d.{}.so".format(modname))
  6471. # Same for standard Python modules.
  6472. import _ctypes
  6473. source_dir = os.path.dirname(_ctypes.__file__)
  6474. for base in os.listdir(source_dir):
  6475. if not base.endswith('.so'):
  6476. continue
  6477. modname = base.partition('.')[0]
  6478. source = os.path.join(source_dir, base)
  6479. copy_library(source, "libpy.{}.so".format(modname))
  6480. def copy_python_tree(source_root, target_root):
  6481. for source_dir, dirs, files in os.walk(source_root):
  6482. if 'site-packages' in dirs:
  6483. dirs.remove('site-packages')
  6484. if not any(base.endswith('.py') for base in files):
  6485. continue
  6486. target_dir = os.path.join(target_root, os.path.relpath(source_dir, source_root))
  6487. target_dir = os.path.normpath(target_dir)
  6488. os.makedirs(target_dir, 0o755)
  6489. for base in files:
  6490. if base.endswith('.py'):
  6491. target = os.path.join(target_dir, base)
  6492. shutil.copy(os.path.join(source_dir, base), target)
  6493. # Copy the Python standard library to the .apk as well.
  6494. from distutils.sysconfig import get_python_lib
  6495. stdlib_source = get_python_lib(False, True)
  6496. stdlib_target = os.path.join("apkroot", "lib", "python{0}.{1}".format(*sys.version_info))
  6497. copy_python_tree(stdlib_source, stdlib_target)
  6498. # But also copy over our custom site.py.
  6499. shutil.copy("panda/src/android/site.py", os.path.join(stdlib_target, "site.py"))
  6500. # And now make a site-packages directory containing our direct/panda3d/pandac modules.
  6501. for tree in "panda3d", "direct", "pandac":
  6502. copy_python_tree(os.path.join(GetOutputDir(), tree), os.path.join(stdlib_target, "site-packages", tree))
  6503. # Copy the models and config files to the virtual assets filesystem.
  6504. oscmd("mkdir apkroot/assets")
  6505. oscmd("cp -R %s apkroot/assets/models" % (os.path.join(GetOutputDir(), "models")))
  6506. oscmd("cp -R %s apkroot/assets/etc" % (os.path.join(GetOutputDir(), "etc")))
  6507. # Make an empty res folder. It's needed for the apk to be installable, apparently.
  6508. oscmd("mkdir apkroot/res")
  6509. # Now package up the application
  6510. oscmd("cp panda/src/android/pview_manifest.xml apkroot/AndroidManifest.xml")
  6511. aapt_cmd = "aapt package"
  6512. aapt_cmd += " -F %s" % (apk_unaligned)
  6513. aapt_cmd += " -M apkroot/AndroidManifest.xml"
  6514. aapt_cmd += " -A apkroot/assets -S apkroot/res"
  6515. aapt_cmd += " -I $PREFIX/share/aapt/android.jar"
  6516. oscmd(aapt_cmd)
  6517. # And add all the libraries to it.
  6518. oscmd("cd apkroot && aapt add ../%s classes.dex" % (apk_unaligned))
  6519. for path, dirs, files in os.walk('apkroot/lib'):
  6520. if files:
  6521. rel = os.path.relpath(path, 'apkroot')
  6522. oscmd("cd apkroot && aapt add ../%s %s/*" % (apk_unaligned, rel))
  6523. # Now align the .apk, which is necessary for Android to load it.
  6524. oscmd("zipalign -v -p 4 %s %s" % (apk_unaligned, apk_unsigned))
  6525. # Finally, sign it using a debug key. This is generated if it doesn't exist.
  6526. oscmd("apksigner debug.ks %s panda3d.apk" % (apk_unsigned))
  6527. # Clean up.
  6528. oscmd("rm -rf apkroot")
  6529. os.unlink(apk_unaligned)
  6530. os.unlink(apk_unsigned)
  6531. try:
  6532. if INSTALLER:
  6533. ProgressOutput(100.0, "Building installer")
  6534. target = GetTarget()
  6535. if target == 'windows':
  6536. fn = "Panda3D-"
  6537. dir = "Panda3D-" + VERSION
  6538. if RUNTIME:
  6539. fn += "Runtime-"
  6540. title = "Panda3D " + VERSION
  6541. else:
  6542. title = "Panda3D SDK " + VERSION
  6543. fn += VERSION
  6544. if not RUNTIME and SDK["PYTHONVERSION"] != "python2.7":
  6545. fn += '-py' + SDK["PYTHONVERSION"][6:]
  6546. if GetOptimize() <= 2:
  6547. fn += "-dbg"
  6548. if GetTargetArch() == 'x64':
  6549. fn += '-x64'
  6550. dir += '-x64'
  6551. MakeInstallerNSIS(fn + '.exe', title, 'C:\\' + dir)
  6552. if not RUNTIME:
  6553. MakeDebugSymbolArchive(fn + '-pdb.zip', dir)
  6554. elif (target == 'linux'):
  6555. MakeInstallerLinux()
  6556. elif (target == 'darwin'):
  6557. MakeInstallerOSX()
  6558. elif (target == 'freebsd'):
  6559. MakeInstallerFreeBSD()
  6560. elif (target == 'android'):
  6561. MakeInstallerAndroid()
  6562. else:
  6563. exit("Do not know how to make an installer for this platform")
  6564. if WHEEL:
  6565. ProgressOutput(100.0, "Building wheel")
  6566. from makewheel import makewheel
  6567. makewheel(WHLVERSION, GetOutputDir())
  6568. finally:
  6569. SaveDependencyCache()
  6570. ##########################################################################################
  6571. #
  6572. # Print final status report.
  6573. #
  6574. ##########################################################################################
  6575. WARNINGS.append("Elapsed Time: "+PrettyTime(time.time() - STARTTIME))
  6576. printStatus("Makepanda Final Status Report", WARNINGS)
  6577. print(GetColor("green") + "Build successfully finished, elapsed time: " + PrettyTime(time.time() - STARTTIME) + GetColor())