makepanda.py 268 KB

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