makepanda.py 273 KB

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