makepanda.py 272 KB

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