makepanda.py 272 KB

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