makepanda.py 274 KB

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