makepanda.py 277 KB

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